| | |
| | | "apsClient/pkg/convertx" |
| | | "apsClient/pkg/ecode" |
| | | "apsClient/pkg/logx" |
| | | "apsClient/pkg/safe" |
| | | "apsClient/service" |
| | | "apsClient/service/plc_address" |
| | | "errors" |
| | |
| | | Value: v, |
| | | }) |
| | | } |
| | | |
| | | 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, |
| | |
| | | // @Produce application/json |
| | | // @Param object body request.SendProcessParams true "查询参数" |
| | | // @Success 200 {object} contextx.Response{service.GetProcessModel} "成功" |
| | | // @Router /v1/task/sendProcessParams/{id} [post] |
| | | // @Router /v1/task/sendProcessParams [post] |
| | | func (slf *TaskApi) TaskStart(c *gin.Context) { |
| | | var params request.SendProcessParams |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return service.NewProgressService().AddProgress(db, procedure, order) |
| | | return service.NewProgressService().Upsert(db, procedure, order) |
| | | }) |
| | | if err != nil { |
| | | logx.Errorf("SendProcessParams update order and procedure status error:%v", err.Error()) |
| | |
| | | err = SendParams(processModel.ParamsMap, plcConfig) |
| | | if err != nil { |
| | | logx.Errorf("SendProcessParams: %v", err.Error()) |
| | | err = model.WithTransaction(func(db *gorm.DB) error { |
| | | err = taskService.UpdateProcedureStatusAndPosition(db, params.ProcedureId, model.ProcedureStatusWaitProcess, params.Position) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | procedure.Position = params.Position |
| | | err = taskService.UpdateOrderStatus(db, order.ID, model.OrderStatusWaitProcess) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return nil |
| | | }) |
| | | ctx.FailWithMsg(ecode.NeedConfirmedErr, "糟糕,工艺下发失败。") |
| | | return |
| | | } |