Commit 74005fc603047ad9288b85b23ddc5ffac2afcd80

Authored by YunaiV
1 parent 4080ca5e

fix(mes): 工艺路线模块 TODO 修复:启用限制、枚举规范、字典链接

- 工艺路线启用后禁止关闭/删除,前后端+关联表(工序/产品/BOM)均增加校验
- MesProLinkTypeEnum 枚举常量重命名为全称(START_START/FINISH_FINISH 等)
- 新增 MesTimeUnitTypeEnum 时间单位枚举(MINUTE/HOUR/DAY)
- DictTypeConstants 补充 MES_PRO_LINK_TYPE、MES_TIME_UNIT_TYPE
- MesProRouteProcessDO/MesProRouteProductDO 补充字典+枚举 Javadoc 链接
- MesProRouteProcessMapper 移除冗余的 findPreProcess/findNextProcess 方法
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/pro/route/MesProRouteProcessDO.java
@@ -51,6 +51,7 @@ public class MesProRouteProcessDO extends BaseDO { @@ -51,6 +51,7 @@ public class MesProRouteProcessDO extends BaseDO {
51 /** 51 /**
52 * 与下一道工序关系 52 * 与下一道工序关系
53 * 53 *
  54 + * 字典 {@link cn.iocoder.yudao.module.mes.enums.DictTypeConstants#MES_PRO_LINK_TYPE}
54 * 枚举 {@link cn.iocoder.yudao.module.mes.enums.pro.MesProLinkTypeEnum} 55 * 枚举 {@link cn.iocoder.yudao.module.mes.enums.pro.MesProLinkTypeEnum}
55 */ 56 */
56 private Integer linkType; 57 private Integer linkType;
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/pro/route/MesProRouteProductDO.java
@@ -51,9 +51,9 @@ public class MesProRouteProductDO extends BaseDO { @@ -51,9 +51,9 @@ public class MesProRouteProductDO extends BaseDO {
51 /** 51 /**
52 * 时间单位 52 * 时间单位
53 * 53 *
54 - * 字典类型 mes_time_unit_type 54 + * 字典 {@link cn.iocoder.yudao.module.mes.enums.DictTypeConstants#MES_TIME_UNIT_TYPE}
  55 + * 枚举 {@link cn.iocoder.yudao.module.mes.enums.pro.MesTimeUnitTypeEnum}
55 */ 56 */
56 - // TODO @AI:外链 @ 加下,字典 + 枚举类;(需要枚举出来。在 dictconstants 里)  
57 private String timeUnitType; 57 private String timeUnitType;
58 /** 58 /**
59 * 备注 59 * 备注
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/pro/MesProRouteProcessMapper.java
@@ -48,22 +48,4 @@ public interface MesProRouteProcessMapper extends BaseMapperX<MesProRouteProcess @@ -48,22 +48,4 @@ public interface MesProRouteProcessMapper extends BaseMapperX<MesProRouteProcess
48 return selectList(MesProRouteProcessDO::getProcessId, processId); 48 return selectList(MesProRouteProcessDO::getProcessId, processId);
49 } 49 }
50 50
51 - default MesProRouteProcessDO findPreProcess(Long routeId, Integer sort) {  
52 - return selectOne(new LambdaQueryWrapperX<MesProRouteProcessDO>()  
53 - .eq(MesProRouteProcessDO::getRouteId, routeId)  
54 - .lt(MesProRouteProcessDO::getSort, sort)  
55 - .orderByDesc(MesProRouteProcessDO::getSort)  
56 - // TODO @AI:limit 1,使用 mybatis utils  
57 - .last("LIMIT 1"));  
58 - }  
59 -  
60 - default MesProRouteProcessDO findNextProcess(Long routeId, Integer sort) {  
61 - return selectOne(new LambdaQueryWrapperX<MesProRouteProcessDO>()  
62 - .eq(MesProRouteProcessDO::getRouteId, routeId)  
63 - .gt(MesProRouteProcessDO::getSort, sort)  
64 - .orderByAsc(MesProRouteProcessDO::getSort)  
65 - // TODO @AI:limit 1,使用 mybatis utils  
66 - .last("LIMIT 1"));  
67 - }  
68 -  
69 } 51 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/DictTypeConstants.java
@@ -24,5 +24,7 @@ public interface DictTypeConstants { @@ -24,5 +24,7 @@ public interface DictTypeConstants {
24 String MES_PRO_WORK_ORDER_SOURCE_TYPE = "mes_pro_work_order_source_type"; // MES 工单来源类型 24 String MES_PRO_WORK_ORDER_SOURCE_TYPE = "mes_pro_work_order_source_type"; // MES 工单来源类型
25 String MES_PRO_WORK_ORDER_TYPE = "mes_pro_work_order_type"; // MES 工单类型 25 String MES_PRO_WORK_ORDER_TYPE = "mes_pro_work_order_type"; // MES 工单类型
26 String MES_QC_TYPE = "mes_qc_type"; // MES 检测种类(IQC/IPQC/OQC/RQC) 26 String MES_QC_TYPE = "mes_qc_type"; // MES 检测种类(IQC/IPQC/OQC/RQC)
  27 + String MES_PRO_LINK_TYPE = "mes_pro_link_type"; // MES 工序关系类型
  28 + String MES_TIME_UNIT_TYPE = "mes_time_unit_type"; // MES 时间单位
27 29
28 } 30 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
@@ -150,6 +150,7 @@ public interface ErrorCodeConstants { @@ -150,6 +150,7 @@ public interface ErrorCodeConstants {
150 ErrorCode PRO_ROUTE_ENABLE_NO_PROCESS = new ErrorCode(1_040_501_002, "请先添加组成工序"); 150 ErrorCode PRO_ROUTE_ENABLE_NO_PROCESS = new ErrorCode(1_040_501_002, "请先添加组成工序");
151 ErrorCode PRO_ROUTE_ENABLE_NO_KEY_PROCESS = new ErrorCode(1_040_501_003, "工艺路线必须要有关键工序"); 151 ErrorCode PRO_ROUTE_ENABLE_NO_KEY_PROCESS = new ErrorCode(1_040_501_003, "工艺路线必须要有关键工序");
152 ErrorCode PRO_ROUTE_ENABLE_PRODUCT_NO_BOM = new ErrorCode(1_040_501_004, "产品 {} 未配置工序的 BOM 消耗"); 152 ErrorCode PRO_ROUTE_ENABLE_PRODUCT_NO_BOM = new ErrorCode(1_040_501_004, "产品 {} 未配置工序的 BOM 消耗");
  153 + ErrorCode PRO_ROUTE_IS_ENABLE = new ErrorCode(1_040_501_005, "工艺路线已启用,不允许操作");
153 // ========== MES 生产管理-工艺路线工序(1-040-501-100) ========== 154 // ========== MES 生产管理-工艺路线工序(1-040-501-100) ==========
154 ErrorCode PRO_ROUTE_PROCESS_NOT_EXISTS = new ErrorCode(1_040_501_100, "工艺路线工序不存在"); 155 ErrorCode PRO_ROUTE_PROCESS_NOT_EXISTS = new ErrorCode(1_040_501_100, "工艺路线工序不存在");
155 ErrorCode PRO_ROUTE_PROCESS_SORT_DUPLICATE = new ErrorCode(1_040_501_101, "序号已存在"); 156 ErrorCode PRO_ROUTE_PROCESS_SORT_DUPLICATE = new ErrorCode(1_040_501_101, "序号已存在");
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/pro/MesProLinkTypeEnum.java
@@ -15,11 +15,10 @@ import java.util.Arrays; @@ -15,11 +15,10 @@ import java.util.Arrays;
15 @AllArgsConstructor 15 @AllArgsConstructor
16 public enum MesProLinkTypeEnum implements ArrayValuable<Integer> { 16 public enum MesProLinkTypeEnum implements ArrayValuable<Integer> {
17 17
18 - // TODO @AI:START_START,类似这样的缩写;  
19 - SS(0, "开始-开始"),  
20 - FF(1, "结束-结束"),  
21 - SF(2, "开始-结束"),  
22 - FS(3, "结束-开始"); 18 + START_START(0, "开始-开始"),
  19 + FINISH_FINISH(1, "结束-结束"),
  20 + START_FINISH(2, "开始-结束"),
  21 + FINISH_START(3, "结束-开始");
23 22
24 public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProLinkTypeEnum::getType).toArray(Integer[]::new); 23 public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProLinkTypeEnum::getType).toArray(Integer[]::new);
25 24
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProcessServiceImpl.java
@@ -41,6 +41,8 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService @@ -41,6 +41,8 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService
41 @Override 41 @Override
42 @Transactional(rollbackFor = Exception.class) 42 @Transactional(rollbackFor = Exception.class)
43 public Long createRouteProcess(MesProRouteProcessSaveReqVO createReqVO) { 43 public Long createRouteProcess(MesProRouteProcessSaveReqVO createReqVO) {
  44 + // 1.0 已启用的工艺路线,不允许操作
  45 + routeService.validateRouteNotEnable(createReqVO.getRouteId());
44 // 1.1 校验工艺路线、工序存在 46 // 1.1 校验工艺路线、工序存在
45 validateRouteAndProcessExists(createReqVO.getRouteId(), createReqVO.getProcessId()); 47 validateRouteAndProcessExists(createReqVO.getRouteId(), createReqVO.getProcessId());
46 // 1.2 校验唯一性 48 // 1.2 校验唯一性
@@ -60,6 +62,8 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService @@ -60,6 +62,8 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService
60 @Override 62 @Override
61 @Transactional(rollbackFor = Exception.class) 63 @Transactional(rollbackFor = Exception.class)
62 public void updateRouteProcess(MesProRouteProcessSaveReqVO updateReqVO) { 64 public void updateRouteProcess(MesProRouteProcessSaveReqVO updateReqVO) {
  65 + // 1.0 已启用的工艺路线,不允许操作
  66 + routeService.validateRouteNotEnable(updateReqVO.getRouteId());
63 // 1.1 校验存在 67 // 1.1 校验存在
64 validateRouteProcessExists(updateReqVO.getId()); 68 validateRouteProcessExists(updateReqVO.getId());
65 // 1.2 校验工艺路线、工序存在 69 // 1.2 校验工艺路线、工序存在
@@ -80,11 +84,10 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService @@ -80,11 +84,10 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService
80 @Override 84 @Override
81 @Transactional(rollbackFor = Exception.class) 85 @Transactional(rollbackFor = Exception.class)
82 public void deleteRouteProcess(Long id) { 86 public void deleteRouteProcess(Long id) {
83 - // 1. 校验存在  
84 - MesProRouteProcessDO routeProcess = routeProcessMapper.selectById(id);  
85 - if (routeProcess == null) {  
86 - throw exception(PRO_ROUTE_PROCESS_NOT_EXISTS);  
87 - } 87 + // 1.1 校验存在
  88 + MesProRouteProcessDO routeProcess = validateRouteProcessExists(id);
  89 + // 1.2 已启用的工艺路线,不允许操作
  90 + routeService.validateRouteNotEnable(routeProcess.getRouteId());
88 91
89 // 2. 删除 92 // 2. 删除
90 routeProcessMapper.deleteById(id); 93 routeProcessMapper.deleteById(id);
@@ -114,10 +117,12 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService @@ -114,10 +117,12 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService
114 } 117 }
115 } 118 }
116 119
117 - private void validateRouteProcessExists(Long id) {  
118 - if (routeProcessMapper.selectById(id) == null) { 120 + private MesProRouteProcessDO validateRouteProcessExists(Long id) {
  121 + MesProRouteProcessDO routeProcess = routeProcessMapper.selectById(id);
  122 + if (routeProcess == null) {
119 throw exception(PRO_ROUTE_PROCESS_NOT_EXISTS); 123 throw exception(PRO_ROUTE_PROCESS_NOT_EXISTS);
120 } 124 }
  125 + return routeProcess;
121 } 126 }
122 127
123 private void validateRouteAndProcessExists(Long routeId, Long processId) { 128 private void validateRouteAndProcessExists(Long routeId, Long processId) {
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProductBomServiceImpl.java
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.route.vo.productbom.MesP @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.route.vo.productbom.MesP
6 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProductBomDO; 6 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProductBomDO;
7 import cn.iocoder.yudao.module.mes.dal.mysql.pro.MesProRouteProductBomMapper; 7 import cn.iocoder.yudao.module.mes.dal.mysql.pro.MesProRouteProductBomMapper;
8 import jakarta.annotation.Resource; 8 import jakarta.annotation.Resource;
  9 +import org.springframework.context.annotation.Lazy;
9 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
10 import org.springframework.validation.annotation.Validated; 11 import org.springframework.validation.annotation.Validated;
11 12
@@ -26,9 +27,15 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe @@ -26,9 +27,15 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe
26 @Resource 27 @Resource
27 private MesProRouteProductBomMapper routeProductBomMapper; 28 private MesProRouteProductBomMapper routeProductBomMapper;
28 29
  30 + @Resource
  31 + @Lazy
  32 + private MesProRouteService routeService;
  33 +
29 @Override 34 @Override
30 public Long createRouteProductBom(MesProRouteProductBomSaveReqVO createReqVO) { 35 public Long createRouteProductBom(MesProRouteProductBomSaveReqVO createReqVO) {
31 - // 1. 校验唯一性 36 + // 1.0 已启用的工艺路线,不允许操作
  37 + routeService.validateRouteNotEnable(createReqVO.getRouteId());
  38 + // 1.1 校验唯一性
32 validateBomUnique(null, createReqVO.getItemId(), createReqVO.getProcessId(), createReqVO.getProductId()); 39 validateBomUnique(null, createReqVO.getItemId(), createReqVO.getProcessId(), createReqVO.getProductId());
33 // 2. 插入 40 // 2. 插入
34 MesProRouteProductBomDO routeProductBom = BeanUtils.toBean(createReqVO, MesProRouteProductBomDO.class); 41 MesProRouteProductBomDO routeProductBom = BeanUtils.toBean(createReqVO, MesProRouteProductBomDO.class);
@@ -38,9 +45,11 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe @@ -38,9 +45,11 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe
38 45
39 @Override 46 @Override
40 public void updateRouteProductBom(MesProRouteProductBomSaveReqVO updateReqVO) { 47 public void updateRouteProductBom(MesProRouteProductBomSaveReqVO updateReqVO) {
41 - // 1. 校验存在 48 + // 1.0 已启用的工艺路线,不允许操作
  49 + routeService.validateRouteNotEnable(updateReqVO.getRouteId());
  50 + // 1.1 校验存在
42 validateRouteProductBomExists(updateReqVO.getId()); 51 validateRouteProductBomExists(updateReqVO.getId());
43 - // 2. 校验唯一性 52 + // 1.2 校验唯一性
44 validateBomUnique(updateReqVO.getId(), updateReqVO.getItemId(), updateReqVO.getProcessId(), updateReqVO.getProductId()); 53 validateBomUnique(updateReqVO.getId(), updateReqVO.getItemId(), updateReqVO.getProcessId(), updateReqVO.getProductId());
45 // 3. 更新 54 // 3. 更新
46 MesProRouteProductBomDO updateObj = BeanUtils.toBean(updateReqVO, MesProRouteProductBomDO.class); 55 MesProRouteProductBomDO updateObj = BeanUtils.toBean(updateReqVO, MesProRouteProductBomDO.class);
@@ -49,8 +58,13 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe @@ -49,8 +58,13 @@ public class MesProRouteProductBomServiceImpl implements MesProRouteProductBomSe
49 58
50 @Override 59 @Override
51 public void deleteRouteProductBom(Long id) { 60 public void deleteRouteProductBom(Long id) {
52 - // 1. 校验存在  
53 - validateRouteProductBomExists(id); 61 + // 1.1 校验存在
  62 + MesProRouteProductBomDO bom = routeProductBomMapper.selectById(id);
  63 + if (bom == null) {
  64 + throw exception(PRO_ROUTE_PRODUCT_BOM_NOT_EXISTS);
  65 + }
  66 + // 1.2 已启用的工艺路线,不允许操作
  67 + routeService.validateRouteNotEnable(bom.getRouteId());
54 // 2. 删除 68 // 2. 删除
55 routeProductBomMapper.deleteById(id); 69 routeProductBomMapper.deleteById(id);
56 } 70 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProductServiceImpl.java
@@ -30,11 +30,16 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService @@ -30,11 +30,16 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService
30 30
31 @Resource 31 @Resource
32 @Lazy 32 @Lazy
  33 + private MesProRouteService routeService;
  34 + @Resource
  35 + @Lazy
33 private MesProRouteProductBomService routeProductBomService; 36 private MesProRouteProductBomService routeProductBomService;
34 37
35 @Override 38 @Override
36 public Long createRouteProduct(MesProRouteProductSaveReqVO createReqVO) { 39 public Long createRouteProduct(MesProRouteProductSaveReqVO createReqVO) {
37 - // 1. 校验产品唯一性(一个产品只能关联一条工艺路线) 40 + // 1.0 已启用的工艺路线,不允许操作
  41 + routeService.validateRouteNotEnable(createReqVO.getRouteId());
  42 + // 1.1 校验产品唯一性(一个产品只能关联一条工艺路线)
38 validateItemUnique(null, createReqVO.getItemId()); 43 validateItemUnique(null, createReqVO.getItemId());
39 44
40 // 2. 插入 45 // 2. 插入
@@ -45,6 +50,8 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService @@ -45,6 +50,8 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService
45 50
46 @Override 51 @Override
47 public void updateRouteProduct(MesProRouteProductSaveReqVO updateReqVO) { 52 public void updateRouteProduct(MesProRouteProductSaveReqVO updateReqVO) {
  53 + // 1.0 已启用的工艺路线,不允许操作
  54 + routeService.validateRouteNotEnable(updateReqVO.getRouteId());
48 // 1.1 校验存在 55 // 1.1 校验存在
49 validateRouteProductExists(updateReqVO.getId()); 56 validateRouteProductExists(updateReqVO.getId());
50 // 1.2 校验产品唯一性 57 // 1.2 校验产品唯一性
@@ -58,9 +65,11 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService @@ -58,9 +65,11 @@ public class MesProRouteProductServiceImpl implements MesProRouteProductService
58 @Override 65 @Override
59 @Transactional(rollbackFor = Exception.class) 66 @Transactional(rollbackFor = Exception.class)
60 public void deleteRouteProduct(Long id) { 67 public void deleteRouteProduct(Long id) {
61 - // 1. 校验存在 68 + // 1.1 校验存在
62 MesProRouteProductDO routeProduct = routeProductMapper.selectById(id); 69 MesProRouteProductDO routeProduct = routeProductMapper.selectById(id);
63 validateRouteProductExists(routeProduct); 70 validateRouteProductExists(routeProduct);
  71 + // 1.2 已启用的工艺路线,不允许操作
  72 + routeService.validateRouteNotEnable(routeProduct.getRouteId());
64 73
65 // 2.1 级联删除关联的 BOM 74 // 2.1 级联删除关联的 BOM
66 routeProductBomService.deleteRouteProductBomByRouteIdAndProductId(routeProduct.getRouteId(), routeProduct.getItemId()); 75 routeProductBomService.deleteRouteProductBomByRouteIdAndProductId(routeProduct.getRouteId(), routeProduct.getItemId());
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteService.java
@@ -53,4 +53,11 @@ public interface MesProRouteService { @@ -53,4 +53,11 @@ public interface MesProRouteService {
53 */ 53 */
54 List<MesProRouteDO> getRouteListByStatus(Integer status); 54 List<MesProRouteDO> getRouteListByStatus(Integer status);
55 55
  56 + /**
  57 + * 校验工艺路线未启用(已启用则抛异常)
  58 + *
  59 + * @param routeId 工艺路线编号
  60 + */
  61 + void validateRouteNotEnable(Long routeId);
  62 +
56 } 63 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteServiceImpl.java
@@ -71,7 +71,7 @@ public class MesProRouteServiceImpl implements MesProRouteService { @@ -71,7 +71,7 @@ public class MesProRouteServiceImpl implements MesProRouteService {
71 @Override 71 @Override
72 public void updateRouteStatus(Long id, Integer status) { 72 public void updateRouteStatus(Long id, Integer status) {
73 // 1.1 校验存在 73 // 1.1 校验存在
74 - validateRouteExists(id); 74 + MesProRouteDO route = validateRouteExists(id);
75 // 1.2 启用时的校验 75 // 1.2 启用时的校验
76 if (CommonStatusEnum.ENABLE.getStatus().equals(status)) { 76 if (CommonStatusEnum.ENABLE.getStatus().equals(status)) {
77 validateRouteEnable(id); 77 validateRouteEnable(id);
@@ -84,8 +84,10 @@ public class MesProRouteServiceImpl implements MesProRouteService { @@ -84,8 +84,10 @@ public class MesProRouteServiceImpl implements MesProRouteService {
84 @Override 84 @Override
85 @Transactional(rollbackFor = Exception.class) 85 @Transactional(rollbackFor = Exception.class)
86 public void deleteRoute(Long id) { 86 public void deleteRoute(Long id) {
87 - // 1. 校验存在 87 + // 1.1 校验存在
88 validateRouteExists(id); 88 validateRouteExists(id);
  89 + // 1.2 已启用的工艺路线,不允许删除
  90 + validateRouteNotEnable(id);
89 91
90 // 2.1 级联删除 92 // 2.1 级联删除
91 routeProcessService.deleteRouteProcessByRouteId(id); 93 routeProcessService.deleteRouteProcessByRouteId(id);
@@ -95,10 +97,12 @@ public class MesProRouteServiceImpl implements MesProRouteService { @@ -95,10 +97,12 @@ public class MesProRouteServiceImpl implements MesProRouteService {
95 routeMapper.deleteById(id); 97 routeMapper.deleteById(id);
96 } 98 }
97 99
98 - private void validateRouteExists(Long id) {  
99 - if (routeMapper.selectById(id) == null) { 100 + private MesProRouteDO validateRouteExists(Long id) {
  101 + MesProRouteDO route = routeMapper.selectById(id);
  102 + if (route == null) {
100 throw exception(PRO_ROUTE_NOT_EXISTS); 103 throw exception(PRO_ROUTE_NOT_EXISTS);
101 } 104 }
  105 + return route;
102 } 106 }
103 107
104 private void validateRouteCodeUnique(Long id, String code) { 108 private void validateRouteCodeUnique(Long id, String code) {
@@ -151,4 +155,12 @@ public class MesProRouteServiceImpl implements MesProRouteService { @@ -151,4 +155,12 @@ public class MesProRouteServiceImpl implements MesProRouteService {
151 return routeMapper.selectListByStatus(status); 155 return routeMapper.selectListByStatus(status);
152 } 156 }
153 157
  158 + @Override
  159 + public void validateRouteNotEnable(Long routeId) {
  160 + MesProRouteDO route = routeMapper.selectById(routeId);
  161 + if (route != null && CommonStatusEnum.ENABLE.getStatus().equals(route.getStatus())) {
  162 + throw exception(PRO_ROUTE_IS_ENABLE);
  163 + }
  164 + }
  165 +
154 } 166 }