From 4d03835d9ab44054e489636ad71d8be8ca266ac9 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 14 五月 2026 16:35:30 +0800
Subject: [PATCH] 修改销售台账后根据批次回滚库存,多个批次会有多个库存记录
---
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 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 4ffb6c5..4d3ca12 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -4,8 +4,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+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;
import com.ruoyi.common.utils.OrderUtils;
@@ -60,7 +60,7 @@
int insertRows = stockInRecordMapper.insert(stockInRecord);
- Long insertId = stockInRecord.getId(); // 鏇挎崲涓轰綘鐨勫疄闄呬富閿瓧娈碉細getRecordId()/getInboundId() 绛�
+ Long insertId = stockInRecord.getId();
return insertRows > 0 ? insertId : null;
}
@@ -85,7 +85,11 @@
for (Long id : ids) {
StockInRecord stockInRecord = stockInRecordMapper.selectById(id);
if (stockInRecord.getType().equals("0")) {
- StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, stockInRecord.getProductModelId()));
+ StockInventory stockInventory = stockInventoryMapper.selectOne(
+ new LambdaQueryWrapper<StockInventory>()
+ .eq(StockInventory::getProductModelId, stockInRecord.getProductModelId())
+ .eq(StockInventory::getBatchNo, stockInRecord.getBatchNo())
+ );
if (stockInventory == null) {
throw new BaseException("搴撳瓨璁板綍涓病鏈夊搴旂殑浜у搧,鏃犳硶鍒犻櫎!!!");
} else {
@@ -95,7 +99,10 @@
stockInventoryMapper.updateSubtractStockInventory(stockInRecordDto);
}
} else if (stockInRecord.getType().equals("1")) {
- StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>().eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId()));
+ StockUninventory stockUninventory = stockUninventoryMapper.selectOne(
+ new LambdaQueryWrapper<StockUninventory>()
+ .eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId())
+ .eq(StockUninventory::getBatchNo, stockInRecord.getBatchNo()));
if (stockUninventory == null) {
throw new BaseException("搴撳瓨璁板綍涓病鏈夊搴旂殑浜у搧,鏃犳硶鍒犻櫎!!!");
} else {
@@ -114,7 +121,7 @@
List<StockInRecordExportData> list = stockInRecordMapper.listStockInRecordExportData(stockInRecordDto);
for (StockInRecordExportData stockInRecordExportData : list) {
if (stockInRecordExportData.getType().equals("0")) {
- stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
+ stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
} else {
stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue());
}
--
Gitblit v1.9.3