Commit 94b808d759fb6aa1354d1932e4edd4db873b4799
1 parent
c2d93baf
feat(mes): 添加维修工单确认和不通过功能,更新相关服务和前端接口
Showing
3 changed files
with
55 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/MesDvRepairController.java
| ... | ... | @@ -111,6 +111,24 @@ public class MesDvRepairController { |
| 111 | 111 | buildRepairRespVOList(list)); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | + @PutMapping("/confirm") | |
| 115 | + @Operation(summary = "通过维修工单(草稿→已确认,结果=通过)") | |
| 116 | + @Parameter(name = "id", description = "编号", required = true) | |
| 117 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | |
| 118 | + public CommonResult<Boolean> confirmRepair(@RequestParam("id") Long id) { | |
| 119 | + repairService.confirmRepair(id); | |
| 120 | + return success(true); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @PutMapping("/reject") | |
| 124 | + @Operation(summary = "不通过维修工单(草稿→已确认,结果=不通过)") | |
| 125 | + @Parameter(name = "id", description = "编号", required = true) | |
| 126 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | |
| 127 | + public CommonResult<Boolean> rejectRepair(@RequestParam("id") Long id) { | |
| 128 | + repairService.rejectRepair(id); | |
| 129 | + return success(true); | |
| 130 | + } | |
| 131 | + | |
| 114 | 132 | // ==================== 拼接 VO ==================== |
| 115 | 133 | |
| 116 | 134 | private List<MesDvRepairRespVO> buildRepairRespVOList(List<MesDvRepairDO> list) { | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/repair/MesDvRepairService.java
| ... | ... | @@ -59,4 +59,18 @@ public interface MesDvRepairService { |
| 59 | 59 | */ |
| 60 | 60 | PageResult<MesDvRepairDO> getRepairPage(MesDvRepairPageReqVO pageReqVO); |
| 61 | 61 | |
| 62 | + /** | |
| 63 | + * 通过维修工单(草稿→已确认,结果=通过) | |
| 64 | + * | |
| 65 | + * @param id 编号 | |
| 66 | + */ | |
| 67 | + void confirmRepair(Long id); | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * 不通过维修工单(草稿→已确认,结果=不通过) | |
| 71 | + * | |
| 72 | + * @param id 编号 | |
| 73 | + */ | |
| 74 | + void rejectRepair(Long id); | |
| 75 | + | |
| 62 | 76 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/repair/MesDvRepairServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairSave |
| 8 | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairDO; |
| 9 | 9 | import cn.iocoder.yudao.module.mes.dal.mysql.dv.repair.MesDvRepairLineMapper; |
| 10 | 10 | import cn.iocoder.yudao.module.mes.dal.mysql.dv.repair.MesDvRepairMapper; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairResultEnum; | |
| 11 | 12 | import cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairStatusEnum; |
| 12 | 13 | import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; |
| 13 | 14 | import jakarta.annotation.Resource; |
| ... | ... | @@ -109,4 +110,26 @@ public class MesDvRepairServiceImpl implements MesDvRepairService { |
| 109 | 110 | return repairMapper.selectPage(pageReqVO); |
| 110 | 111 | } |
| 111 | 112 | |
| 113 | + @Override | |
| 114 | + public void confirmRepair(Long id) { | |
| 115 | + // 1. 校验存在,且状态为草稿 | |
| 116 | + validateRepairDraft(id); | |
| 117 | + | |
| 118 | + // 2. 更新状态为已确认,结果为通过 | |
| 119 | + repairMapper.updateById(new MesDvRepairDO().setId(id) | |
| 120 | + .setStatus(MesDvRepairStatusEnum.CONFIRMED.getStatus()) | |
| 121 | + .setResult(MesDvRepairResultEnum.PASS.getResult())); | |
| 122 | + } | |
| 123 | + | |
| 124 | + @Override | |
| 125 | + public void rejectRepair(Long id) { | |
| 126 | + // 1. 校验存在,且状态为草稿 | |
| 127 | + validateRepairDraft(id); | |
| 128 | + | |
| 129 | + // 2. 更新状态为已确认,结果为不通过 | |
| 130 | + repairMapper.updateById(new MesDvRepairDO().setId(id) | |
| 131 | + .setStatus(MesDvRepairStatusEnum.CONFIRMED.getStatus()) | |
| 132 | + .setResult(MesDvRepairResultEnum.FAIL.getResult())); | |
| 133 | + } | |
| 134 | + | |
| 112 | 135 | } | ... | ... |