| | |
| | | package v1 |
| | | |
| | | import ( |
| | | "apsClient/conf" |
| | | "apsClient/constvar" |
| | | "apsClient/model" |
| | | "apsClient/model/common" |
| | | "apsClient/model/response" |
| | | "apsClient/nsq" |
| | | "apsClient/pkg/contextx" |
| | | "apsClient/pkg/convertx" |
| | | "apsClient/pkg/ecode" |
| | |
| | | return |
| | | } |
| | | id := convertx.Atoi(idx) |
| | | _, code := service.NewTaskService().GetProcedureById(id) |
| | | procedure, code := service.NewTaskService().GetProcedureById(id) |
| | | if code != ecode.OK { |
| | | ctx.Fail(code) |
| | | return |
| | |
| | | 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()) |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |
| | |
| | | ctx.FailWithMsg(ecode.NeedConfirmedErr, "糟糕,工艺下发失败。") |
| | | 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()) |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | | |