From 530b456eded06e0692e1d8bd5891069439c8f8f8 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 17 四月 2026 15:10:56 +0800
Subject: [PATCH] fix: 1.已发货的销售台账对应的出入库记录做限制不能删除;2.销售台账入库操作后,点击删除,对应的销售入库记录未一并删除;3.销售台账入库状态新增部分入库

---
 src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 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..b1bb2cf 100644
--- a/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
+++ b/src/main/java/com/ruoyi/procurementrecord/utils/StockUtils.java
@@ -35,12 +35,13 @@
 
     /**
      * 涓嶅悎鏍煎叆搴�
+     *
      * @param productModelId
      * @param quantity
      * @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) {
         StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
         stockUninventoryDto.setRecordId(recordId);
         stockUninventoryDto.setRecordType(String.valueOf(recordType));
@@ -51,12 +52,13 @@
 
     /**
      * 涓嶅悎鏍煎嚭搴�
+     *
      * @param productModelId
      * @param quantity
      * @param recordType
      * @param recordId
      */
-    public void subtractUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) {
+    public void subtractUnStock(Long productModelId, BigDecimal quantity, Integer recordType, Long recordId) {
         StockUninventoryDto stockUninventoryDto = new StockUninventoryDto();
         stockUninventoryDto.setRecordId(recordId);
         stockUninventoryDto.setRecordType(String.valueOf(recordType));
@@ -67,33 +69,69 @@
 
     /**
      * 鍚堟牸鍏ュ簱
+     *
      * @param productModelId
      * @param quantity
      * @param recordType
      * @param recordId
      */
-    public void addStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+    public void addStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
+        addStock(null, null, productModelId, quantity, recordType, recordId);
+    }
+
+    /**
+     * 鍚堟牸鍏ュ簱
+     *
+     * @param productModelId
+     * @param quantity
+     * @param recordType
+     * @param recordId
+     */
+    public void addStock(Long salesLedgerId, Long salesLedgerProductId, Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
         StockInventoryDto stockInventoryDto = new StockInventoryDto();
         stockInventoryDto.setRecordId(recordId);
         stockInventoryDto.setRecordType(String.valueOf(recordType));
         stockInventoryDto.setQualitity(quantity);
         stockInventoryDto.setProductModelId(productModelId);
+        stockInventoryDto.setSalesLedgerId(salesLedgerId);
+        stockInventoryDto.setSalesLedgerProductId(salesLedgerProductId);
         stockInventoryService.addstockInventory(stockInventoryDto);
+    }
+
+
+    /**
+     * 鍚堟牸鍑哄簱
+     *
+     * @param productModelId
+     * @param quantity
+     * @param recordType
+     * @param recordId
+     */
+    public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
+        StockInventoryDto stockInventoryDto = new StockInventoryDto();
+        stockInventoryDto.setRecordId(recordId);
+        stockInventoryDto.setRecordType(String.valueOf(recordType));
+        stockInventoryDto.setQualitity(quantity);
+        stockInventoryDto.setProductModelId(productModelId);
+        stockInventoryService.subtractStockInventory(stockInventoryDto);
     }
 
     /**
      * 鍚堟牸鍑哄簱
+     *
      * @param productModelId
      * @param quantity
      * @param recordType
      * @param recordId
      */
-    public void substractStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) {
+    public void substractStock(Long salesId, Long salseProductId, Long productModelId, BigDecimal quantity, String recordType, Long recordId) {
         StockInventoryDto stockInventoryDto = new StockInventoryDto();
         stockInventoryDto.setRecordId(recordId);
         stockInventoryDto.setRecordType(String.valueOf(recordType));
         stockInventoryDto.setQualitity(quantity);
         stockInventoryDto.setProductModelId(productModelId);
+        stockInventoryDto.setSalesLedgerId(salesId);
+        stockInventoryDto.setSalesLedgerProductId(salseProductId);
         stockInventoryService.subtractStockInventory(stockInventoryDto);
     }
 
@@ -106,6 +144,7 @@
             stockInRecordService.batchDelete(Collections.singletonList(one.getId()));
         }
     }
+
     public void deleteStockOutRecord(Long recordId, String recordType) {
         StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>()
                 .lambda().eq(StockOutRecord::getRecordId, recordId)

--
Gitblit v1.9.3