Commit 8bfe74fe03417591ab9ebf970361ac2e1ec142de
1 parent
a6b7f4c7
✨ feat(mes): 添加按产品查询工序列表功能
Showing
3 changed files
with
38 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/route/MesProRouteProcessController.java
| ... | ... | @@ -74,6 +74,16 @@ public class MesProRouteProcessController { |
| 74 | 74 | return success(buildRouteProcessRespVO(routeProcess)); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | + // TODO @芋艿:到底叫 list-by-item 还是 list-by-product? | |
| 78 | + @GetMapping("/list-by-product") | |
| 79 | + @Operation(summary = "按产品获得工序列表", description = "根据产品查找关联的工艺路线,返回该路线的工序列表") | |
| 80 | + @Parameter(name = "productId", description = "产品编号", required = true, example = "1") | |
| 81 | + @PreAuthorize("@ss.hasPermission('mes:pro-route:query')") | |
| 82 | + public CommonResult<List<MesProRouteProcessRespVO>> getRouteProcessListByProduct(@RequestParam("productId") Long productId) { | |
| 83 | + List<MesProRouteProcessDO> list = routeProcessService.getRouteProcessListByProductId(productId); | |
| 84 | + return success(buildRouteProcessRespVOList(list)); | |
| 85 | + } | |
| 86 | + | |
| 77 | 87 | @GetMapping("/list-by-route") |
| 78 | 88 | @Operation(summary = "按工艺路线获得工序列表") |
| 79 | 89 | @Parameter(name = "routeId", description = "工艺路线编号", required = true, example = "1") | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProcessService.java
| ... | ... | @@ -57,6 +57,16 @@ public interface MesProRouteProcessService { |
| 57 | 57 | MesProRouteProcessDO getRouteProcessByRouteIdAndProcessId(Long routeId, Long processId); |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | + * 按产品获得工序列表 | |
| 61 | + * | |
| 62 | + * 根据产品查找关联的工艺路线,返回该路线的工序列表 | |
| 63 | + * | |
| 64 | + * @param productId 产品编号 | |
| 65 | + * @return 工序列表 | |
| 66 | + */ | |
| 67 | + List<MesProRouteProcessDO> getRouteProcessListByProductId(Long productId); | |
| 68 | + | |
| 69 | + /** | |
| 60 | 70 | * 按工艺路线删除工序(级联删除使用) |
| 61 | 71 | * |
| 62 | 72 | * @param routeId 工艺路线编号 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/route/MesProRouteProcessServiceImpl.java
| ... | ... | @@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | 5 | import cn.iocoder.yudao.module.mes.controller.admin.pro.route.vo.process.MesProRouteProcessSaveReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProcessDO; |
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProductDO; | |
| 7 | 8 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.route.MesProRouteProcessMapper; |
| 9 | +import cn.iocoder.yudao.module.mes.dal.mysql.pro.route.MesProRouteProductMapper; | |
| 8 | 10 | import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; |
| 9 | 11 | import jakarta.annotation.Resource; |
| 10 | 12 | import org.springframework.context.annotation.Lazy; |
| ... | ... | @@ -32,6 +34,10 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService |
| 32 | 34 | @Resource |
| 33 | 35 | private MesProRouteProcessMapper routeProcessMapper; |
| 34 | 36 | |
| 37 | + // TODO @AI:应该使用 MesProRouteProductService; | |
| 38 | + @Resource | |
| 39 | + private MesProRouteProductMapper routeProductMapper; | |
| 40 | + | |
| 35 | 41 | @Resource |
| 36 | 42 | @Lazy |
| 37 | 43 | private MesProProcessService processService; |
| ... | ... | @@ -184,6 +190,18 @@ public class MesProRouteProcessServiceImpl implements MesProRouteProcessService |
| 184 | 190 | } |
| 185 | 191 | |
| 186 | 192 | @Override |
| 193 | + public List<MesProRouteProcessDO> getRouteProcessListByProductId(Long productId) { | |
| 194 | + // 1. 根据产品查找关联的工艺路线产品记录 | |
| 195 | + MesProRouteProductDO routeProduct = routeProductMapper.selectByItemId(productId); | |
| 196 | + if (routeProduct == null) { | |
| 197 | + // TODO @芋艿:会不会存在配置了多个的情况??? | |
| 198 | + return Collections.emptyList(); | |
| 199 | + } | |
| 200 | + // 2. 返回该工艺路线的工序列表 | |
| 201 | + return routeProcessMapper.selectListByRouteId(routeProduct.getRouteId()); | |
| 202 | + } | |
| 203 | + | |
| 204 | + @Override | |
| 187 | 205 | public void deleteRouteProcessByRouteId(Long routeId) { |
| 188 | 206 | routeProcessMapper.deleteByRouteId(routeId); |
| 189 | 207 | } | ... | ... |