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 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sip.MesMdProductS | ||
| 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sip.MesMdProductSipSaveReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sip.MesMdProductSipSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSipDO; | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSipDO; |
| 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSipMapper; | 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSipMapper; |
| 9 | +import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; | ||
| 9 | import jakarta.annotation.Resource; | 10 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 12 | import org.springframework.validation.annotation.Validated; |
| @@ -27,10 +28,17 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { | @@ -27,10 +28,17 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { | ||
| 27 | @Resource | 28 | @Resource |
| 28 | private MesMdProductSipMapper productSipMapper; | 29 | private MesMdProductSipMapper productSipMapper; |
| 29 | 30 | ||
| 31 | + @Resource | ||
| 32 | + private MesProProcessService processService; | ||
| 33 | + | ||
| 30 | @Override | 34 | @Override |
| 31 | public Long createProductSip(MesMdProductSipSaveReqVO createReqVO) { | 35 | public Long createProductSip(MesMdProductSipSaveReqVO createReqVO) { |
| 32 | // 校验排列顺序的唯一性 | 36 | // 校验排列顺序的唯一性 |
| 33 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); | 37 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); |
| 38 | + // 校验工序存在 | ||
| 39 | + if (createReqVO.getProcessId() != null) { | ||
| 40 | + processService.validateProcessExists(createReqVO.getProcessId()); | ||
| 41 | + } | ||
| 34 | 42 | ||
| 35 | // 插入 | 43 | // 插入 |
| 36 | MesMdProductSipDO sip = BeanUtils.toBean(createReqVO, MesMdProductSipDO.class); | 44 | MesMdProductSipDO sip = BeanUtils.toBean(createReqVO, MesMdProductSipDO.class); |
| @@ -44,6 +52,10 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { | @@ -44,6 +52,10 @@ public class MesMdProductSipServiceImpl implements MesMdProductSipService { | ||
| 44 | validateProductSipExists(updateReqVO.getId()); | 52 | validateProductSipExists(updateReqVO.getId()); |
| 45 | // 校验排列顺序的唯一性 | 53 | // 校验排列顺序的唯一性 |
| 46 | validateSortUnique(updateReqVO.getItemId(), updateReqVO.getSort(), updateReqVO.getId()); | 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 | MesMdProductSipDO updateObj = BeanUtils.toBean(updateReqVO, MesMdProductSipDO.class); | 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 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sop.MesMdProductS | ||
| 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sop.MesMdProductSopSaveReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.sop.MesMdProductSopSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSopDO; | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdProductSopDO; |
| 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSopMapper; | 8 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdProductSopMapper; |
| 9 | +import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; | ||
| 9 | import jakarta.annotation.Resource; | 10 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 12 | import org.springframework.validation.annotation.Validated; |
| @@ -27,10 +28,17 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { | @@ -27,10 +28,17 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { | ||
| 27 | @Resource | 28 | @Resource |
| 28 | private MesMdProductSopMapper productSopMapper; | 29 | private MesMdProductSopMapper productSopMapper; |
| 29 | 30 | ||
| 31 | + @Resource | ||
| 32 | + private MesProProcessService processService; | ||
| 33 | + | ||
| 30 | @Override | 34 | @Override |
| 31 | public Long createProductSop(MesMdProductSopSaveReqVO createReqVO) { | 35 | public Long createProductSop(MesMdProductSopSaveReqVO createReqVO) { |
| 32 | // 校验排列顺序的唯一性 | 36 | // 校验排列顺序的唯一性 |
| 33 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); | 37 | validateSortUnique(createReqVO.getItemId(), createReqVO.getSort(), null); |
| 38 | + // 校验工序存在 | ||
| 39 | + if (createReqVO.getProcessId() != null) { | ||
| 40 | + processService.validateProcessExists(createReqVO.getProcessId()); | ||
| 41 | + } | ||
| 34 | 42 | ||
| 35 | // 插入 | 43 | // 插入 |
| 36 | MesMdProductSopDO sop = BeanUtils.toBean(createReqVO, MesMdProductSopDO.class); | 44 | MesMdProductSopDO sop = BeanUtils.toBean(createReqVO, MesMdProductSopDO.class); |
| @@ -44,6 +52,10 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { | @@ -44,6 +52,10 @@ public class MesMdProductSopServiceImpl implements MesMdProductSopService { | ||
| 44 | validateProductSopExists(updateReqVO.getId()); | 52 | validateProductSopExists(updateReqVO.getId()); |
| 45 | // 校验排列顺序的唯一性 | 53 | // 校验排列顺序的唯一性 |
| 46 | validateSortUnique(updateReqVO.getItemId(), updateReqVO.getSort(), updateReqVO.getId()); | 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 | MesMdProductSopDO updateObj = BeanUtils.toBean(updateReqVO, MesMdProductSopDO.class); | 61 | MesMdProductSopDO updateObj = BeanUtils.toBean(updateReqVO, MesMdProductSopDO.class); |