yuan
2 天以前 471edfe303e1822e29a974ceaaa4cc442ebd36d4
feat: 优化领料项过滤逻辑,排除与订单成品同规格物料
已修改1个文件
14 ■■■■■ 文件已修改
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
@@ -1107,9 +1107,21 @@
            }
        }
        // 过滤出非根节点(实际领料项)
        // 收集订单成品规格ID:包含生产订单成品规格与BOM根节点规格,用于排除“自己”这一物料
        Set<Long> finishedProductModelIds = new HashSet<>();
        if (productionOrder != null && productionOrder.getProductModelId() != null) {
            finishedProductModelIds.add(productionOrder.getProductModelId());
        }
        bomStructureList.stream()
                .filter(s -> s != null && (s.getParentId() == null || s.getParentId() == 0))
                .map(ProductionBomStructureVo::getProductModelId)
                .filter(Objects::nonNull)
                .forEach(finishedProductModelIds::add);
        // 过滤出非根节点(实际领料项),并排除与订单成品同规格的物料(自制成品无需领料)
        List<ProductionBomStructureVo> childStructureList = bomStructureList.stream()
                .filter(s -> s != null && s.getParentId() != null && s.getParentId() != 0)
                .filter(s -> s.getProductModelId() == null || !finishedProductModelIds.contains(s.getProductModelId()))
                .collect(Collectors.toList());
        // 遍历处理数据并组装结果