Commit 613abe9a3968724ee028e4c6ddd480d6e66a1271
1 parent
b49798aa
✨ feat(mes): 添加工序存在性校验功能,优化物料表单
Showing
2 changed files
with
24 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdProductSipServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sip.MesMdProductS |
| 6 | 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sip.MesMdProductSipSaveReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSipDO; |
| 8 | 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSipMapper; |
| 9 | +import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; | |
| 9 | 10 | import jakarta.annotation.Resource; |
| 10 | 11 | import org.springframework.stereotype.Service; |
| 11 | 12 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -27,10 +28,17 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { |
| 27 | 28 | @Resource |
| 28 | 29 | private MesMdProductSipMapper productSipMapper; |
| 29 | 30 | |
| 31 | + @Resource | |
| 32 | + private MesProProcessService processService; | |
| 33 | + | |
| 30 | 34 | @Override |
| 31 | 35 | public Long createProductSip(MesMdProductSipSaveReqVO createReqVO) { |
| 32 | 36 | // 校验排列顺序的唯一性 |
| 33 | 37 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); |
| 38 | + // 校验工序存在 | |
| 39 | + if (createReqVO.getProcessId() != null) { | |
| 40 | + processService.validateProcessExists(createReqVO.getProcessId()); | |
| 41 | + } | |
| 34 | 42 | |
| 35 | 43 | // 插入 |
| 36 | 44 | MesMdProductSipDO sip = BeanUtils.toBean(createReqVO, MesMdProductSipDO.class); |
| ... | ... | @@ -44,6 +52,10 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { |
| 44 | 52 | validateProductSipExists(updateReqVO.getId()); |
| 45 | 53 | // 校验排列顺序的唯一性 |
| 46 | 54 | validateSortUnique(updateReqVO.getItemId(), updateReqVO.getSort(), updateReqVO.getId()); |
| 55 | + // 校验工序存在 | |
| 56 | + if (updateReqVO.getProcessId() != null) { | |
| 57 | + processService.validateProcessExists(updateReqVO.getProcessId()); | |
| 58 | + } | |
| 47 | 59 | |
| 48 | 60 | // 更新 |
| 49 | 61 | MesMdProductSipDO updateObj = BeanUtils.toBean(updateReqVO, MesMdProductSipDO.class); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdProductSopServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sop.MesMdProductS |
| 6 | 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sop.MesMdProductSopSaveReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSopDO; |
| 8 | 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSopMapper; |
| 9 | +import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; | |
| 9 | 10 | import jakarta.annotation.Resource; |
| 10 | 11 | import org.springframework.stereotype.Service; |
| 11 | 12 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -27,10 +28,17 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { |
| 27 | 28 | @Resource |
| 28 | 29 | private MesMdProductSopMapper productSopMapper; |
| 29 | 30 | |
| 31 | + @Resource | |
| 32 | + private MesProProcessService processService; | |
| 33 | + | |
| 30 | 34 | @Override |
| 31 | 35 | public Long createProductSop(MesMdProductSopSaveReqVO createReqVO) { |
| 32 | 36 | // 校验排列顺序的唯一性 |
| 33 | 37 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); |
| 38 | + // 校验工序存在 | |
| 39 | + if (createReqVO.getProcessId() != null) { | |
| 40 | + processService.validateProcessExists(createReqVO.getProcessId()); | |
| 41 | + } | |
| 34 | 42 | |
| 35 | 43 | // 插入 |
| 36 | 44 | MesMdProductSopDO sop = BeanUtils.toBean(createReqVO, MesMdProductSopDO.class); |
| ... | ... | @@ -44,6 +52,10 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { |
| 44 | 52 | validateProductSopExists(updateReqVO.getId()); |
| 45 | 53 | // 校验排列顺序的唯一性 |
| 46 | 54 | validateSortUnique(updateReqVO.getItemId(), updateReqVO.getSort(), updateReqVO.getId()); |
| 55 | + // 校验工序存在 | |
| 56 | + if (updateReqVO.getProcessId() != null) { | |
| 57 | + processService.validateProcessExists(updateReqVO.getProcessId()); | |
| 58 | + } | |
| 47 | 59 | |
| 48 | 60 | // 更新 |
| 49 | 61 | MesMdProductSopDO updateObj = BeanUtils.toBean(updateReqVO, MesMdProductSopDO.class); | ... | ... |