| | |
| | | // @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 |
| | | } |