| | |
| | | params.PageSize = 1 |
| | | } |
| | | |
| | | taskDataList, count, code := service.NewTaskService().GetTask(params.Page, params.PageSize) |
| | | taskResponse, code := service.NewTaskService().GetTask(params.Page, params.PageSize) |
| | | if code != ecode.OK { |
| | | ctx.Fail(code) |
| | | return |
| | | } |
| | | taskResponse := &response.TaskResponse{ |
| | | Tasks: taskDataList, |
| | | TaskCount: count, |
| | | } |
| | | ctx.OkWithDetailed(taskResponse) |
| | | } |
| | |
| | | ctx.Fail(code) |
| | | return |
| | | } |
| | | err := service.NewTaskService().UpdateProcedureStatus(nil, id, model.ProcedureStatusFinished) |
| | | err := service.NewTaskService().UpdateProcedureStatus(nil, id, model.ProcedureStatusFinished, procedure.Position) |
| | | if err != nil { |
| | | logx.Errorf("UpdateProcedureStatus err: %v", err.Error()) |
| | | ctx.Fail(ecode.UnknownErr) |
| | |
| | | } |
| | | |
| | | err = model.WithTransaction(func(db *gorm.DB) error { |
| | | err = taskService.UpdateProcedureStatus(db, params.ProcedureId, model.ProcedureStatusProcessing) |
| | | err = taskService.UpdateProcedureStatusAndPosition(db, params.ProcedureId, model.ProcedureStatusProcessing, params.Position) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | procedure.Position = params.Position |
| | | err = taskService.UpdateOrderStatus(db, order.ID, model.OrderStatusProcessing) |
| | | if err != nil { |
| | | return err |
| | |
| | | return |
| | | } |
| | | plcConfig.CurrentTryTimes = 0 |
| | | err = service.PlcWrite(plcConfig, constvar.PlcStartAddressTypeTotalNumber, order.Amount.IntPart()) |
| | | err = service.PlcWrite(plcConfig, constvar.PlcStartAddressTypeTotalNumber, params.Position, order.Amount.IntPart()) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.NeedConfirmedErr, "糟糕,工艺下发失败。") |
| | | return |