| | |
| | | "apsClient/conf" |
| | | "apsClient/constvar" |
| | | "apsClient/model" |
| | | "apsClient/model/common" |
| | | "apsClient/model/request" |
| | | "apsClient/model/response" |
| | | "apsClient/nsq" |
| | | "apsClient/pkg/contextx" |
| | | "apsClient/pkg/ecode" |
| | | "apsClient/pkg/logx" |
| | | "apsClient/pkg/safe" |
| | | "apsClient/service" |
| | | "apsClient/service/plc_address" |
| | | "errors" |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/jinzhu/gorm" |
| | | "github.com/spf13/cast" |
| | |
| | | }) |
| | | } |
| | | |
| | | safe.Go(func() { |
| | | caller := nsq.NewCaller(fmt.Sprintf(constvar.NsqTopicGetPlcAddress, conf.Conf.NsqConf.NodeId), fmt.Sprintf(constvar.NsqTopicSendPlcAddress, conf.Conf.NsqConf.NodeId)) |
| | | var addressResult common.ResponsePlcAddress |
| | | err := caller.Call(common.RequestPlcAddress{DeviceId: conf.Conf.System.DeviceId}, &addressResult, time.Second*3) |
| | | if err != nil { |
| | | logx.Infof("get plc address err: %v", err.Error()) |
| | | } |
| | | }) |
| | | |
| | | resp := response.ProcessParamsResponse{ |
| | | Number: processModel.Number, |
| | | Params: processParamsArr, |
| | |
| | | logx.Errorf("UpdateProcedureStatus err: %v", err.Error()) |
| | | ctx.Fail(ecode.UnknownErr) |
| | | return |
| | | } |
| | | |
| | | msg := &common.MsgTaskStatusUpdate{ |
| | | WorkOrderId: procedure.WorkOrderID, |
| | | ProcedureID: procedure.ProceduresInfo.ProcedureID, |
| | | DeviceId: procedure.ProceduresInfo.DeviceID, |
| | | IsProcessing: false, |
| | | IsFinish: true, |
| | | } |
| | | |
| | | caller := nsq.NewCaller(fmt.Sprintf(constvar.NsqTopicTaskProcedureStatusUpdate, conf.Conf.NsqConf.NodeId), "") |
| | | err = caller.Send(msg) |
| | | if err != nil { |
| | | logx.Errorf("send task status update msg error:%v", err.Error()) |
| | | } |
| | | |
| | | service.TaskFlagUnset(procedure.Channel) |
| | |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.NeedConfirmedErr, "PLC请求失败,请检查PLC配置") |
| | | return |
| | | } |
| | | |
| | | msg := &common.MsgTaskStatusUpdate{ |
| | | WorkOrderId: procedure.WorkOrderID, |
| | | ProcedureID: procedure.ProceduresInfo.ProcedureID, |
| | | DeviceId: procedure.ProceduresInfo.DeviceID, |
| | | IsProcessing: true, |
| | | IsFinish: false, |
| | | } |
| | | |
| | | caller := nsq.NewCaller(fmt.Sprintf(constvar.NsqTopicTaskProcedureStatusUpdate, conf.Conf.NsqConf.NodeId), "") |
| | | err = caller.Send(msg) |
| | | if err != nil { |
| | | logx.Errorf("send task status update msg error:%v", err.Error()) |
| | | } |
| | | service.TaskFlagSet(procedure.Channel) |
| | | ctx.Ok() |