From 471edfe303e1822e29a974ceaaa4cc442ebd36d4 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期一, 20 七月 2026 17:49:50 +0800
Subject: [PATCH] feat: 优化领料项过滤逻辑,排除与订单成品同规格物料

---
 src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
index 0ec5ca8..8c710cf 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
+++ b/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());
 
         // 閬嶅巻澶勭悊鏁版嵁骞剁粍瑁呯粨鏋�

--
Gitblit v1.9.3