From 98b9654b91a8b1205ce204a396db01e780bf0d2b Mon Sep 17 00:00:00 2001 From: guochaojie Date: Tue, 20 Aug 2024 17:16:18 +0800 Subject: [PATCH] =?UTF-8?q?MRP=20=E8=BF=90=E7=AE=97=20init2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jnpf/service/YysBillMaterialService.java | 3 ++- .../impl/YysBillMaterialServiceImpl.java | 14 ++++++++++++++ .../YysMonthlyProductionController.java | 19 ++++++++++++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysBillMaterialService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysBillMaterialService.java index ba78f5f..4e2d99a 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysBillMaterialService.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysBillMaterialService.java @@ -29,7 +29,8 @@ public interface YysBillMaterialService extends IService //子表方法 //副表数据方法 String checkForm(YysBillMaterialForm form,int i); - void saveOrUpdate(YysBillMaterialForm yysBillMaterialForm,String id, boolean isSave) throws Exception; + YysBillMaterialEntity getByProductId(String id); + List getListByProductIds(List id); } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java index 32f8683..28ff068 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysBillMaterialServiceImpl.java @@ -284,4 +284,18 @@ public class YysBillMaterialServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + wrapper.lambda().eq(YysBillMaterialEntity::getPieceId,id); + return this.getOne(wrapper); + } + + @Override + public List getListByProductIds(List id) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda().in(YysBillMaterialEntity::getPieceId,id); + return this.list(wrapper); + } } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java index cf656b0..1c8eaf1 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java @@ -81,6 +81,9 @@ public class YysMonthlyProductionController { @Autowired private YysMonthlyProductionService yysMonthlyProductionService; + @Autowired + private YysBillMaterialService bomService; + @Autowired private ConfigValueUtil configValueUtil; @@ -545,14 +548,20 @@ public class YysMonthlyProductionController { if(unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划"); // 获取没有生成MRP的月度生产计划 - Set> collect = unMPRList.stream().map(entity -> { - Map map = new HashMap<>(); - map.put("productId", entity.getProductId()); - return map; - }).collect(Collectors.toSet()); + Set productIds = unMPRList.stream().map(YysMonthlyProductionEntity::getProductId).collect(Collectors.toSet()); + + if(productIds.size()==0){ + return ActionResult.fail("没有需要生成MRP的月度生产计划"); + } // 根据计划生成的物料 获取BOM清单 + List bomList = bomService.getListByProductIds(new ArrayList<>(productIds)); + + // 获取bom 清单详情 + + // 获取 物料信息 + // 获取单位信息 // 计算一个计划的物料需求量