Commit 8431b44378b9d5e1805a7a582529fd953955f64a

Authored by YunaiV
1 parent 65a97a69

✨ feat(mes): 添加报工人和审核人字段,优化审批逻辑

yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java
@@ -155,7 +155,7 @@ public class MesProFeedbackController { @@ -155,7 +155,7 @@ public class MesProFeedbackController {
155 @Operation(summary = "审批报工") 155 @Operation(summary = "审批报工")
156 @Parameter(name = "id", description = "编号", required = true) 156 @Parameter(name = "id", description = "编号", required = true)
157 @PreAuthorize("@ss.hasPermission('mes:pro-feedback:approve')") 157 @PreAuthorize("@ss.hasPermission('mes:pro-feedback:approve')")
158 - public CommonResult<Integer> approveFeedback(@RequestParam("id") Long id) { 158 + public CommonResult<Boolean> approveFeedback(@RequestParam("id") Long id) {
159 return success(feedbackService.approveFeedback(id)); 159 return success(feedbackService.approveFeedback(id));
160 } 160 }
161 161
@@ -220,8 +220,7 @@ public class MesProFeedbackController { @@ -220,8 +220,7 @@ public class MesProFeedbackController {
220 vo.setTaskCode(task.getCode())); 220 vo.setTaskCode(task.getCode()));
221 // 物料 → 单位 221 // 物料 → 单位
222 findAndThen(itemMap, vo.getItemId(), item -> { 222 findAndThen(itemMap, vo.getItemId(), item -> {
223 - // TODO @AI:specification 全称  
224 - vo.setItemCode(item.getCode()).setItemName(item.getName()).setItemSpec(item.getSpecification()) 223 + vo.setItemCode(item.getCode()).setItemName(item.getName()).setItemSpecification(item.getSpecification())
225 .setUnitMeasureId(item.getUnitMeasureId()); 224 .setUnitMeasureId(item.getUnitMeasureId());
226 findAndThen(unitMeasureMap, item.getUnitMeasureId(), unit -> 225 findAndThen(unitMeasureMap, item.getUnitMeasureId(), unit ->
227 vo.setUnitMeasureName(unit.getName())); 226 vo.setUnitMeasureName(unit.getName()));
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/vo/MesProFeedbackRespVO.java
@@ -98,7 +98,7 @@ public class MesProFeedbackRespVO { @@ -98,7 +98,7 @@ public class MesProFeedbackRespVO {
98 98
99 @Schema(description = "规格型号", example = "一字型") 99 @Schema(description = "规格型号", example = "一字型")
100 @ExcelProperty("规格型号") 100 @ExcelProperty("规格型号")
101 - private String itemSpec; 101 + private String itemSpecification;
102 102
103 @Schema(description = "单位编号", example = "202") 103 @Schema(description = "单位编号", example = "202")
104 private Long unitMeasureId; 104 private Long unitMeasureId;
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/vo/MesProFeedbackSaveReqVO.java
@@ -42,6 +42,10 @@ public class MesProFeedbackSaveReqVO { @@ -42,6 +42,10 @@ public class MesProFeedbackSaveReqVO {
42 @NotNull(message = "生产任务不能为空") 42 @NotNull(message = "生产任务不能为空")
43 private Long taskId; 43 private Long taskId;
44 44
  45 + @Schema(description = "产品物料编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  46 + @NotNull(message = "产品物料不能为空")
  47 + private Long itemId;
  48 +
45 @Schema(description = "过期日期") 49 @Schema(description = "过期日期")
46 private LocalDateTime expireDate; 50 private LocalDateTime expireDate;
47 51
@@ -70,6 +74,18 @@ public class MesProFeedbackSaveReqVO { @@ -70,6 +74,18 @@ public class MesProFeedbackSaveReqVO {
70 @Schema(description = "其他废品数量", example = "0") 74 @Schema(description = "其他废品数量", example = "0")
71 private BigDecimal otherScrapQuantity; 75 private BigDecimal otherScrapQuantity;
72 76
  77 + @Schema(description = "报工人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  78 + @NotNull(message = "报工人不能为空")
  79 + private Long feedbackUserId;
  80 +
  81 + @Schema(description = "报工时间", requiredMode = Schema.RequiredMode.REQUIRED)
  82 + @NotNull(message = "报工时间不能为空")
  83 + private LocalDateTime feedbackTime;
  84 +
  85 + @Schema(description = "审核人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  86 + @NotNull(message = "审核人不能为空")
  87 + private Long approveUserId;
  88 +
73 @Schema(description = "备注", example = "备注") 89 @Schema(description = "备注", example = "备注")
74 private String remark; 90 private String remark;
75 91
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/route/MesProRouteProcessController.java
@@ -93,6 +93,18 @@ public class MesProRouteProcessController { @@ -93,6 +93,18 @@ public class MesProRouteProcessController {
93 return success(buildRouteProcessRespVOList(list)); 93 return success(buildRouteProcessRespVOList(list));
94 } 94 }
95 95
  96 + @GetMapping("/get-by-route-and-process")
  97 + @Operation(summary = "按工艺路线+工序获得工序配置")
  98 + @Parameter(name = "routeId", description = "工艺路线编号", required = true, example = "1")
  99 + @Parameter(name = "processId", description = "工序编号", required = true, example = "1")
  100 + @PreAuthorize("@ss.hasPermission('mes:pro-route:query')")
  101 + public CommonResult<MesProRouteProcessRespVO> getRouteProcessByRouteAndProcess(
  102 + @RequestParam("routeId") Long routeId,
  103 + @RequestParam("processId") Long processId) {
  104 + MesProRouteProcessDO routeProcess = routeProcessService.getRouteProcessByRouteIdAndProcessId(routeId, processId);
  105 + return success(buildRouteProcessRespVO(routeProcess));
  106 + }
  107 +
96 // ==================== 拼接 VO ==================== 108 // ==================== 拼接 VO ====================
97 109
98 private List<MesProRouteProcessRespVO> buildRouteProcessRespVOList(List<MesProRouteProcessDO> list) { 110 private List<MesProRouteProcessRespVO> buildRouteProcessRespVOList(List<MesProRouteProcessDO> list) {
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/task/MesProTaskController.java
@@ -128,8 +128,9 @@ public class MesProTaskController { @@ -128,8 +128,9 @@ public class MesProTaskController {
128 List<MesProTaskDO> list = taskService.getTaskListByWorkOrderId(workOrderId); 128 List<MesProTaskDO> list = taskService.getTaskListByWorkOrderId(workOrderId);
129 return success(convertList(list, task -> new MesProTaskRespVO() 129 return success(convertList(list, task -> new MesProTaskRespVO()
130 .setId(task.getId()).setCode(task.getCode()).setName(task.getName()) 130 .setId(task.getId()).setCode(task.getCode()).setName(task.getName())
131 - .setWorkOrderId(task.getWorkOrderId()).setProcessId(task.getProcessId())  
132 - .setStatus(task.getStatus()))); 131 + .setWorkOrderId(task.getWorkOrderId()).setWorkstationId(task.getWorkstationId())
  132 + .setRouteId(task.getRouteId()).setProcessId(task.getProcessId())
  133 + .setItemId(task.getItemId()).setStatus(task.getStatus())));
133 } 134 }
134 135
135 @GetMapping("/gantt-list") 136 @GetMapping("/gantt-list")
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/feedback/MesProFeedbackService.java
@@ -69,9 +69,9 @@ public interface MesProFeedbackService { @@ -69,9 +69,9 @@ public interface MesProFeedbackService {
69 * 审批报工(审批中 -> 已完成 或 待检验) 69 * 审批报工(审批中 -> 已完成 或 待检验)
70 * 70 *
71 * @param id 编号 71 * @param id 编号
72 - * @return 审批后的状态 72 + * @return true=已完成, false=待检验
73 */ 73 */
74 - Integer approveFeedback(Long id); 74 + boolean approveFeedback(Long id);
75 75
76 } 76 }
77 77
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/feedback/MesProFeedbackServiceImpl.java
@@ -121,10 +121,10 @@ public class MesProFeedbackServiceImpl implements MesProFeedbackService { @@ -121,10 +121,10 @@ public class MesProFeedbackServiceImpl implements MesProFeedbackService {
121 .setStatus(MesProFeedbackStatusEnum.PREPARE.getStatus())); 121 .setStatus(MesProFeedbackStatusEnum.PREPARE.getStatus()));
122 } 122 }
123 123
124 - // TODO @AI:要不改成 boolean:看是不是 finish;如果非 finish 说明要前端提示“报工成功,请等待质量检验完成!” 124 + // DONE @AI:改成 boolean:true 表示已完成;false 表示待检验,前端需提示"报工成功,请等待质量检验完成!"
125 @Override 125 @Override
126 @Transactional(rollbackFor = Exception.class) 126 @Transactional(rollbackFor = Exception.class)
127 - public Integer approveFeedback(Long id) { 127 + public boolean approveFeedback(Long id) {
128 // TODO @AI: 逻辑需要继续跟进; 128 // TODO @AI: 逻辑需要继续跟进;
129 // 1.1 校验存在 + 审批中状态 129 // 1.1 校验存在 + 审批中状态
130 MesProFeedbackDO feedback = validateFeedbackStatusApproving(id); 130 MesProFeedbackDO feedback = validateFeedbackStatusApproving(id);
@@ -157,7 +157,7 @@ public class MesProFeedbackServiceImpl implements MesProFeedbackService { @@ -157,7 +157,7 @@ public class MesProFeedbackServiceImpl implements MesProFeedbackService {
157 // TODO @芋艿:WM 产品产出(WmProductProduceService)未迁移,此处需补充产品产出逻辑 157 // TODO @芋艿:WM 产品产出(WmProductProduceService)未迁移,此处需补充产品产出逻辑
158 // TODO @芋艿:updateProTaskAndWorkorder 待 pro_task 服务迁移后补充级联更新任务/工单的已生产数量 158 // TODO @芋艿:updateProTaskAndWorkorder 待 pro_task 服务迁移后补充级联更新任务/工单的已生产数量
159 } 159 }
160 - return targetStatus; 160 + return BooleanUtil.isFalse(checkFlag); // true=已完成, false=待检验
161 } 161 }
162 162
163 // ==================== 校验方法 ==================== 163 // ==================== 校验方法 ====================