From 8a03cb579ada9d598188816d4741efbd2b73f16b Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 12 五月 2026 09:18:16 +0800
Subject: [PATCH] feat(stock): 添加盘点入库类型枚举并修复库存检查出库记录类型

---
 src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
index ff25350..dc15843 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -6,7 +6,6 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.enums.ReviewStatusEnum;
 import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
-import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
 import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.EnumUtil;
@@ -30,6 +29,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
 import java.util.List;
 
@@ -125,7 +125,7 @@
             if (stockInRecordExportData.getType().equals("0")) {
                 stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
             }else {
-                stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
+                stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
             }
         }
         ExcelUtil<StockInRecordExportData> util = new ExcelUtil<>(StockInRecordExportData.class);
@@ -193,8 +193,10 @@
                 if ("0".equals(stockInRecord.getType())) {
                     // 鍚堟牸鍏ュ簱 -> 鍏堟煡搴撳瓨锛屽瓨鍦ㄥ垯鏇存柊锛屼笉瀛樺湪鍒欐柊澧�
                     StockInventory stockInventory = getStockInventory(stockInRecord.getProductModelId(), stockInRecord.getBatchNo());
-                    if (stockInventory.getLocked().equals( true)&&!stockInRecord.getRecordType().equals(StockInQualifiedRecordTypeEnum.INVENTORY_CHECK_STOCK_IN.getCode())) {
-                        throw new BaseException("姝e湪搴撳瓨鐩樼偣,鏃犳硶鍏ュ簱,鍏ュ簱鎵规:" + stockInRecord.getInboundBatches());
+                    if (!ObjectUtils.isEmpty(stockInventory)) {
+                        if (stockInventory.getLocked().equals( true)&&!stockInRecord.getRecordType().equals(StockInQualifiedRecordTypeEnum.INVENTORY_CHECK_STOCK_IN.getCode())) {
+                            throw new BaseException("姝e湪搴撳瓨鐩樼偣,鏃犳硶鍏ュ簱,鍏ュ簱鎵规:" + stockInRecord.getInboundBatches());
+                        }
                     }
                     StockInventoryDto stockInventoryDto = new StockInventoryDto();
                     stockInventoryDto.setProductModelId(stockInRecord.getProductModelId());

--
Gitblit v1.9.3