From a97eb69a7233fc36a794832210fb1b0de037f2bb Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 15 四月 2026 16:39:53 +0800
Subject: [PATCH] fix:生产核算-对应工序

---
 src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 2ded4f0..2a47d02 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -38,12 +38,15 @@
      * @param recordType
      * @param recordId
      */
-    public void addUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+    public void addUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId, String batchNo, String customer, LocalDate productionDate) {
         StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
         stockUninventoryDto.setRecordId(recordId);
         stockUninventoryDto.setRecordType(String.valueOf(recordType));
         stockUninventoryDto.setQualitity(quantity);
         stockUninventoryDto.setProductModelId(productModelId);
+        stockUninventoryDto.setBatchNo(batchNo);
+        stockUninventoryDto.setCustomer(customer);
+        stockUninventoryDto.setProductionDate(productionDate);
         stockUninventoryService.addStockUninventory(stockUninventoryDto);
     }
 
@@ -115,13 +118,13 @@
                 .eq(StockInRecord::getRecordType, recordType));
         if (ObjectUtils.isNotEmpty(one)) {
             stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
+            //灏嗗簱瀛樺噺鍥炴潵
+            StockInventoryDto stockInventoryDto = new StockInventoryDto();
+            stockInventoryDto.setRecordId(recordId);
+            stockInventoryDto.setRecordType(recordType);
+            stockInventoryDto.setQualitity(one.getStockInNum());
+            stockInventoryMapper.updateSubtractStockInventory((stockInventoryDto));
         }
-        //灏嗗簱瀛樺噺鍥炴潵
-        StockInventoryDto stockInventoryDto = new StockInventoryDto();
-        stockInventoryDto.setRecordId(recordId);
-        stockInventoryDto.setRecordType(recordType);
-        stockInventoryDto.setQualitity(one.getStockInNum());
-        stockInventoryMapper.updateSubtractStockInventory((stockInventoryDto));
     }
     public void deleteStockOutRecord(Long recordId, String recordType) {
         StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>()
@@ -129,12 +132,12 @@
                 .eq(StockOutRecord::getRecordType, recordType));
         if (ObjectUtils.isNotEmpty(one)) {
             stockOutRecordService.batchDelete(Collections.singletonList(one.getId()));
+            //灏嗗簱瀛樺姞鍥炴潵
+            StockInventoryDto stockInventoryDto = new StockInventoryDto();
+            stockInventoryDto.setRecordId(recordId);
+            stockInventoryDto.setRecordType(recordType);
+            stockInventoryDto.setQualitity(one.getStockOutNum());
+            stockInventoryMapper.updateAddStockInventory((stockInventoryDto));
         }
-        //灏嗗簱瀛樺姞鍥炴潵
-        StockInventoryDto stockInventoryDto = new StockInventoryDto();
-        stockInventoryDto.setRecordId(recordId);
-        stockInventoryDto.setRecordType(recordType);
-        stockInventoryDto.setQualitity(one.getStockOutNum());
-        stockInventoryMapper.updateAddStockInventory((stockInventoryDto));
     }
 }

--
Gitblit v1.9.3