From d8e9abd9f92538d6baa44415ec7e096db5fea9b9 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期一, 01 六月 2026 11:58:49 +0800
Subject: [PATCH] 库存增加仓库

---
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index 24605ba..fa76bc7 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -14,6 +14,7 @@
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.project.system.service.ISysDictDataService;
 import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
 import com.ruoyi.sales.pojo.SalesLedgerProduct;
 import com.ruoyi.stock.dto.StockInRecordDto;
@@ -60,6 +61,7 @@
     private final StockUninventoryService stockUninventoryService;
     private final SalesLedgerProductMapper salesLedgerProductMapper;
     private final ProductModelMapper productModelMapper;
+    private final ISysDictDataService sysDictDataService;
 
     @Override
     public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) {
@@ -92,6 +94,7 @@
         stockInRecordDto.setBatchNo(stockInventoryDto.getBatchNo());
         stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
         stockInRecordDto.setType("0");
+        stockInRecordDto.setCreateTime(stockInventoryDto.getCreateTime());
         stockInRecordService.add(stockInRecordDto);
         //鍐嶈繘琛屾柊澧炲簱瀛樻暟閲忓簱瀛�
         //鍏堟煡璇㈠簱瀛樿〃涓殑浜у搧鏄惁瀛樺湪锛屼笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
@@ -168,6 +171,9 @@
         stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
         stockInRecordDto.setType("0");
         stockInRecordDto.setRemark(stockInventoryDto.getRemark());
+        stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum());
+        stockInRecordDto.setCreateTime(stockInventoryDto.getCreateTime());
+        stockInRecordDto.setWarehouse(stockInventoryDto.getWarehouse());
         stockInRecordService.add(stockInRecordDto);
         return true;
     }
@@ -312,6 +318,14 @@
             int successCount = 0;
 
             for (StockInventoryExportData dto : list) {
+                // 楠岃瘉浠撳簱鏄惁瀛樺湪浜庡瓧鍏镐腑
+                if (StringUtils.isNotEmpty(dto.getWarehouse())) {
+                    String warehouseLabel = sysDictDataService.selectDictLabel("warehouse", dto.getWarehouse());
+                    if (StringUtils.isEmpty(warehouseLabel)) {
+                        throw new RuntimeException("浠撳簱鍊� " + dto.getWarehouse() + " 涓嶅瓨鍦ㄤ簬瀛楀吀涓�");
+                    }
+                }
+
                 // 鏋勫缓鏌ユ壘閿�
                 String key = dto.getProductName() + "|" + dto.getModel();
                 SalesLedgerProduct matchedProduct = productMap.get(key);
@@ -325,6 +339,7 @@
                         stockInventoryDto.setQualitity(dto.getQualifiedQuantity());
                         stockInventoryDto.setRemark(dto.getRemark());
                         stockInventoryDto.setWarnNum(dto.getWarnNum());
+                        stockInventoryDto.setWarehouse(dto.getWarehouse());
 
                         // 楠岃瘉鍚堟牸鍐荤粨鏁伴噺
                         if (ObjectUtils.isNotEmpty(dto.getQualifiedLockedQuantity())) {
@@ -348,6 +363,7 @@
                         stockUninventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode());
                         stockUninventoryDto.setQualitity(dto.getUnQualifiedQuantity());
                         stockUninventoryDto.setRemark(dto.getRemark());
+                        stockUninventoryDto.setWarehouse(dto.getWarehouse());
 
                         // 楠岃瘉涓嶅悎鏍煎喕缁撴暟閲�
                         if (ObjectUtils.isNotEmpty(dto.getUnQualifiedLockedQuantity())) {

--
Gitblit v1.9.3