From 41ab7abd0b0ec0fefb03b60bbaf42c02fbda666b Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 23 四月 2026 15:53:16 +0800
Subject: [PATCH] feat(production): 添加生产订单与销售台账关联功能

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

diff --git a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
index 819ce65..5c4f384 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -7,6 +7,7 @@
 import com.ruoyi.stock.dto.StockInRecordDto;
 import com.ruoyi.stock.dto.StockInventoryDto;
 import com.ruoyi.stock.dto.StockUninventoryDto;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
 import com.ruoyi.stock.pojo.StockInRecord;
 import com.ruoyi.stock.pojo.StockOutRecord;
 import com.ruoyi.stock.service.StockInRecordService;
@@ -32,6 +33,7 @@
     private final StockInventoryService stockInventoryService;
     private final StockInRecordService stockInRecordService;
     private final StockOutRecordService stockOutRecordService;
+    private final StockInventoryMapper stockInventoryMapper;
 
     /**
      * 涓嶅悎鏍煎叆搴�
@@ -104,7 +106,14 @@
                 .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));
         }
+
     }
     public void deleteStockOutRecord(Long recordId, String recordType) {
         StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>()
@@ -112,6 +121,13 @@
                 .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));
         }
+
     }
 }

--
Gitblit v1.9.3