| | |
| | | "apsClient/model/response" |
| | | _ "apsClient/model/response" |
| | | "apsClient/pkg/contextx" |
| | | "apsClient/pkg/ecode" |
| | | "apsClient/pkg/safe" |
| | | "apsClient/service" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/spf13/cast" |
| | |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | taskData, code := service.NewTaskService().GetTask() |
| | | if code != ecode.OK { |
| | | ctx.Fail(code) |
| | | return |
| | | } |
| | | |
| | | if taskData.Order == nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "当前没有待生产工单") |
| | | return |
| | | } |
| | | |
| | | plcConfig, code := service.NewDevicePlcService().GetDevicePlc() |
| | | if code != ecode.OK { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "请先配置PLC") |
| | | return |
| | | } |
| | | |
| | | safe.Go(func() { |
| | | _ = service.PlcWrite(plcConfig, constvar.PlcStartAddressTypeTotalNumber, taskData.Order.Amount.IntPart()) |
| | | }) |
| | | |
| | | ctx.Ok() |
| | | } |