From 5eec9b5a9d8bf9e49663d5a51cab7490fef5b204 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 26 八月 2025 15:22:03 +0800
Subject: [PATCH] yys  生产管控(完成基本功能)

---
 main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
index eef4183..25dae27 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -173,7 +173,7 @@
         batchInsertInventories(masterId, dto.getProductionInventoryList());
 
         // 鎻掑叆寰呭叆搴撴暟鎹�
-        insertPendingInventory(dto.getProductionList());
+//        insertPendingInventory(dto.getProductionList());
 
         return 1;
     }
@@ -263,6 +263,7 @@
             BeanUtils.copyProperties(p, copy);
             copy.setId(null);
             copy.setProductionMasterId(masterId);
+            copy.setStatus(1);
             productionMapper.insert(copy);
         }
     }
@@ -283,7 +284,7 @@
     /**
      * 灏嗗姞宸ヤ骇鐢熺殑浜у搧璁板綍鍒板緟鍏ュ簱琛�
      */
-    private void insertPendingInventory(List<Production> list) {
+    public void insertPendingInventory(List<Production> list) {
         LocalDate currentDate = LocalDate.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         String formattedDate = currentDate.format(formatter);
@@ -295,7 +296,7 @@
             PendingInventory pending = new PendingInventory();
             pending.setCoalId(p.getCoalId());
             pending.setInventoryQuantity(p.getProductionQuantity());
-            pending.setUnit("t");
+            pending.setUnit("鍚�");
             pending.setSupplierName(formattedDate + " - " + "鐢熶骇鍔犲伐鍏ュ簱");
 
             // 闈炵┖澶勭悊
@@ -402,20 +403,20 @@
         }
 
         // 鎵归噺鏇存柊瀹樻柟搴撳瓨
-        for (Map.Entry<Long, BigDecimal> entry : inventoryAdjustMap.entrySet()) {
-            OfficialInventory official = officialInventoryMapper.selectById(entry.getKey());
-            if (official == null) {
-                throw new BaseException("瀹樻柟搴撳瓨涓嶅瓨鍦紝ID: " + entry.getKey());
-            }
-
-            // 浣跨敤绾跨▼瀹夊叏鐨凚igDecimal鎿嶄綔
-            official.setInventoryQuantity(
-                    Optional.ofNullable(official.getInventoryQuantity())
-                            .orElse(BigDecimal.ZERO)
-                            .add(entry.getValue())
-            );
-            officialInventoryMapper.updateById(official);
-        }
+//        for (Map.Entry<Long, BigDecimal> entry : inventoryAdjustMap.entrySet()) {
+//            OfficialInventory official = officialInventoryMapper.selectById(entry.getKey());
+//            if (official == null) {
+//                throw new BaseException("瀹樻柟搴撳瓨涓嶅瓨鍦紝ID: " + entry.getKey());
+//            }
+//
+//            // 浣跨敤绾跨▼瀹夊叏鐨凚igDecimal鎿嶄綔
+//            official.setInventoryQuantity(
+//                    Optional.ofNullable(official.getInventoryQuantity())
+//                            .orElse(BigDecimal.ZERO)
+//                            .add(entry.getValue())
+//            );
+//            officialInventoryMapper.updateById(official);
+//        }
 
         // 鎵归噺鍒犻櫎鐢熶骇搴撳瓨
         if (!productionIdsToDelete.isEmpty()) {

--
Gitblit v1.9.3