From ffdeee34afd3c28f603584e80039fc1dc30f1ff9 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 13 九月 2023 17:27:22 +0800 Subject: [PATCH] 下发工艺参数时记录该工序对应的设备位置 --- api/v1/plc.go | 29 ++++------------------------- 1 files changed, 4 insertions(+), 25 deletions(-) diff --git a/api/v1/plc.go b/api/v1/plc.go index 03a19ce..907e8d8 100644 --- a/api/v1/plc.go +++ b/api/v1/plc.go @@ -2,11 +2,10 @@ import ( "apsClient/constvar" + "apsClient/model/request" "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" @@ -18,10 +17,12 @@ // @Tags 鐢熶骇鏁伴噺 // @Summary 鑾峰彇鐢熶骇杩涘害 // @Produce application/json +// @Param object body request.SendProcessParams true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{data=response.ProductProgress} "鎴愬姛" // @Router /v1/plc/productProgress [get] func (slf *PlcApi) GetProductProgress(c *gin.Context) { - ctx, ok := contextx.NewContext(c, nil) + var params request.SendProcessParams + ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } @@ -44,27 +45,5 @@ 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() } -- Gitblit v1.8.0