From f57064d2fa563ee4cfeeccd715850ba8b8aa4f60 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期一, 18 五月 2026 09:44:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New_pro' into dev_宁夏_英泽防锈

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

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
index 6a30baf..31cdc79 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
@@ -216,19 +216,22 @@
             return;
         }
         List<ProductionBomStructure> updateList = new ArrayList<>();
+        BigDecimal lastProcessDemandedQuantity = orderQuantity;
         for (ProductionBomStructure structure : structureList) {
             if (structure == null || structure.getId() == null) {
                 continue;
             }
-            BigDecimal demandedQuantity = defaultDecimal(structure.getUnitQuantity()).multiply(orderQuantity);
-            if (compareDecimal(structure.getDemandedQuantity(), demandedQuantity) == 0) {
-                continue;
-            }
+
+            BigDecimal demandedQuantity = lastProcessDemandedQuantity.multiply(defaultDecimal(structure.getUnitQuantity()));
+//            if (compareDecimal(structure.getDemandedQuantity(), demandedQuantity) == 0) {
+//                continue;
+//            }
             ProductionBomStructure update = new ProductionBomStructure();
             update.setId(structure.getId());
             update.setDemandedQuantity(demandedQuantity);
             updateList.add(update);
             structure.setDemandedQuantity(demandedQuantity);
+            lastProcessDemandedQuantity = demandedQuantity;
         }
         if (!updateList.isEmpty()) {
             this.updateBatchById(updateList);
@@ -307,7 +310,7 @@
             if (matchedOperation == null) {
                 matchedOperation = insertRoutingOperationSnapshot(orderRouting.getId(), productionOrderId, desiredOperation);
             } else {
-                updateRoutingOperationSnapshotIfNecessary(matchedOperation, orderRouting.getId(), productionOrderId, desiredOperation);
+                updateRoutingOperationSnapshotIfNecessary(desiredOperation, orderRouting.getId(), productionOrderId, matchedOperation);
             }
             finalOperationList.add(matchedOperation);
         }

--
Gitblit v1.9.3