Commit b41bb318b431b793c824e1708b0aa7f448439f7c
1 parent
90a621a8
♻️ refactor(machinery): 移除设备存在性校验中的启用状态检查
简化设备存在性校验逻辑,移除对设备启用状态的检查,确保代码更清晰且易于维护。
Showing
7 changed files
with
5 additions
and
23 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanMachineryServiceImpl.java
| ... | ... | @@ -42,7 +42,7 @@ public class MesDvCheckPlanMachineryServiceImpl implements MesDvCheckPlanMachine |
| 42 | 42 | // 1.1 校验方案草稿状态 |
| 43 | 43 | MesDvCheckPlanDO currentPlan = checkPlanService.validateCheckPlanPrepare(createReqVO.getPlanId()); |
| 44 | 44 | // 1.2 校验设备存在 |
| 45 | - machineryService.validateMachineryExistsAndEnable(createReqVO.getMachineryId()); | |
| 45 | + machineryService.validateMachineryExists(createReqVO.getMachineryId()); | |
| 46 | 46 | // 1.3 校验同一方案下设备不重复 |
| 47 | 47 | if (checkPlanMachineryMapper.selectByPlanIdAndMachineryId(createReqVO.getPlanId(), createReqVO.getMachineryId()) != null) { |
| 48 | 48 | throw exception(DV_CHECK_PLAN_MACHINERY_DUPLICATE); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkrecord/MesDvCheckRecordServiceImpl.java
| ... | ... | @@ -170,7 +170,7 @@ public class MesDvCheckRecordServiceImpl implements MesDvCheckRecordService { |
| 170 | 170 | |
| 171 | 171 | private void validateCheckRecordSave(MesDvCheckRecordSaveReqVO reqVO) { |
| 172 | 172 | // 校验设备是否存在 |
| 173 | - machineryService.validateMachineryExistsAndEnable(reqVO.getMachineryId()); | |
| 173 | + machineryService.validateMachineryExists(reqVO.getMachineryId()); | |
| 174 | 174 | // 校验点检计划是否存在 |
| 175 | 175 | if (reqVO.getPlanId() != null) { |
| 176 | 176 | checkPlanService.validateCheckPlanExistsAndType(reqVO.getPlanId(), MesDvCheckPlanTypeEnum.CHECK.getType()); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/machinery/MesDvMachineryService.java
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/machinery/MesDvMachineryServiceImpl.java
| ... | ... | @@ -132,17 +132,6 @@ public class MesDvMachineryServiceImpl implements MesDvMachineryService { |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - @Override | |
| 136 | - public void validateMachineryExistsAndEnable(Long id) { | |
| 137 | - MesDvMachineryDO machinery = machineryMapper.selectById(id); | |
| 138 | - if (machinery == null) { | |
| 139 | - throw exception(DV_MACHINERY_NOT_EXISTS); | |
| 140 | - } | |
| 141 | - if (ObjUtil.notEqual(CommonStatusEnum.ENABLE.getStatus(), machinery.getStatus())) { | |
| 142 | - throw exception(DV_MACHINERY_IS_DISABLE); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - | |
| 146 | 135 | private void validateMachineryCodeUnique(Long id, String code) { |
| 147 | 136 | if (code == null) { |
| 148 | 137 | return; | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/maintenrecord/MesDvMaintenRecordServiceImpl.java
| ... | ... | @@ -106,7 +106,7 @@ public class MesDvMaintenRecordServiceImpl implements MesDvMaintenRecordService |
| 106 | 106 | |
| 107 | 107 | private void validateMaintenRecordRelation(MesDvMaintenRecordSaveReqVO reqVO) { |
| 108 | 108 | // 校验设备是否存在 |
| 109 | - machineryService.validateMachineryExistsAndEnable(reqVO.getMachineryId()); | |
| 109 | + machineryService.validateMachineryExists(reqVO.getMachineryId()); | |
| 110 | 110 | // 校验保养计划是否存在 |
| 111 | 111 | if (reqVO.getPlanId() != null) { |
| 112 | 112 | checkPlanService.validateCheckPlanExistsAndType(reqVO.getPlanId(), MesDvCheckPlanTypeEnum.MAINTENANCE.getType()); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/repair/MesDvRepairServiceImpl.java
| ... | ... | @@ -79,7 +79,7 @@ public class MesDvRepairServiceImpl implements MesDvRepairService { |
| 79 | 79 | // 校验编码唯一 |
| 80 | 80 | validateCodeUnique(reqVO.getId(), reqVO.getCode()); |
| 81 | 81 | // 校验设备存在 |
| 82 | - machineryService.validateMachineryExistsAndEnable(reqVO.getMachineryId()); | |
| 82 | + machineryService.validateMachineryExists(reqVO.getMachineryId()); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | private void validateCodeUnique(Long id, String code) { | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/workstation/MesMdWorkstationMachineServiceImpl.java
| ... | ... | @@ -47,7 +47,7 @@ public class MesMdWorkstationMachineServiceImpl implements MesMdWorkstationMachi |
| 47 | 47 | |
| 48 | 48 | private void validateWorkstationMachineSaveData(MesMdWorkstationMachineSaveReqVO reqVO) { |
| 49 | 49 | // 校验设备是否存在 |
| 50 | - machineryService.validateMachineryExistsAndEnable(reqVO.getMachineryId()); | |
| 50 | + machineryService.validateMachineryExists(reqVO.getMachineryId()); | |
| 51 | 51 | // 校验该设备是否已分配到其他工作站(一台设备只能分配到一个工作站) |
| 52 | 52 | MesMdWorkstationMachineDO existing = workstationMachineMapper.selectByMachineryId(reqVO.getMachineryId()); |
| 53 | 53 | if (existing != null) { | ... | ... |