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/pojo/StockInventory.java | 3 +++
src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java | 2 ++
src/main/java/com/ruoyi/stock/pojo/StockInRecord.java | 3 +++
src/main/resources/mapper/stock/StockInventoryMapper.xml | 23 +++++++++++++++++++----
docs/大罗素.sql | 7 +++++++
src/main/resources/mapper/stock/StockUninventoryMapper.xml | 3 +++
src/main/java/com/ruoyi/stock/pojo/StockUninventory.java | 3 +++
src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java | 2 ++
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | 13 +++++++++++++
9 files changed, 55 insertions(+), 4 deletions(-)
diff --git "a/docs/\345\244\247\347\275\227\347\264\240.sql" "b/docs/\345\244\247\347\275\227\347\264\240.sql"
new file mode 100644
index 0000000..12af2f4
--- /dev/null
+++ "b/docs/\345\244\247\347\275\227\347\264\240.sql"
@@ -0,0 +1,7 @@
+
+alter table stock_inventory
+ add warehouse varchar(255) null comment '浠撳簱';
+alter table stock_uninventory
+ add warehouse varchar(255) null comment '浠撳簱';
+alter table stock_in_record
+ add warehouse varchar(255) null comment '浠撳簱';
diff --git a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
index a608401..db550dd 100644
--- a/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
+++ b/src/main/java/com/ruoyi/stock/execl/StockInventoryExportData.java
@@ -22,6 +22,8 @@
@Excel(name = "鎵瑰彿")
private String batchNo;
+ @Excel(name = "浠撳簱")
+ private String warehouse;
@Excel(name = "鍚堟牸搴撳瓨鏁伴噺")
private BigDecimal qualifiedQuantity;
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java b/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
index d020761..73cd6f1 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockInRecord.java
@@ -73,4 +73,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+
+ @Schema(description = "浠撳簱")
+ private String warehouse;
}
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockInventory.java b/src/main/java/com/ruoyi/stock/pojo/StockInventory.java
index 5652ec7..8c9411b 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockInventory.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockInventory.java
@@ -72,4 +72,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ @Schema(description = "浠撳簱")
+ private String warehouse;
+
}
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockUninventory.java b/src/main/java/com/ruoyi/stock/pojo/StockUninventory.java
index 6272c2a..1d8b6d5 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockUninventory.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockUninventory.java
@@ -68,4 +68,7 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ @Schema(description = "浠撳簱")
+ private String warehouse;
+
}
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 61aac8b..5f02cca 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInRecordServiceImpl.java
@@ -247,6 +247,7 @@
setBatchNo(stockInRecord.getBatchNo());
setRemark(stockInRecord.getRemark());
setWarnNum(stockInRecord.getWarnNum());
+ setWarehouse(stockInRecord.getWarehouse());
setVersion(1);
}});
} else {
@@ -266,6 +267,7 @@
setQualitity(stockInRecord.getStockInNum());
setBatchNo(stockInRecord.getBatchNo());
setRemark(stockInRecord.getRemark());
+ setWarehouse(stockInRecord.getWarehouse());
setVersion(1);
}});
} else {
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 a45359f..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) {
@@ -171,6 +173,7 @@
stockInRecordDto.setRemark(stockInventoryDto.getRemark());
stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum());
stockInRecordDto.setCreateTime(stockInventoryDto.getCreateTime());
+ stockInRecordDto.setWarehouse(stockInventoryDto.getWarehouse());
stockInRecordService.add(stockInRecordDto);
return true;
}
@@ -315,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);
@@ -328,6 +339,7 @@
stockInventoryDto.setQualitity(dto.getQualifiedQuantity());
stockInventoryDto.setRemark(dto.getRemark());
stockInventoryDto.setWarnNum(dto.getWarnNum());
+ stockInventoryDto.setWarehouse(dto.getWarehouse());
// 楠岃瘉鍚堟牸鍐荤粨鏁伴噺
if (ObjectUtils.isNotEmpty(dto.getQualifiedLockedQuantity())) {
@@ -351,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())) {
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index ed780a7..aad917a 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -31,6 +31,9 @@
<if test="ew.lockedQuantity != null and ew.lockedQuantity !=''">
locked_quantity = locked_quantity + #{ew.lockedQuantity},
</if>
+ <if test="ew.warehouse != null and ew.warehouse !=''">
+ warehouse = #{ew.warehouse},
+ </if>
update_time = now()
</set>
where product_model_id = #{ew.productModelId}
@@ -65,6 +68,7 @@
</update>
<select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto">
select si.id,
+ si.warehouse,
si.qualitity,
COALESCE(si.locked_quantity, 0) as locked_quantity,
si.product_model_id,
@@ -120,6 +124,7 @@
unit,
product_name,
product_id,
+ MAX(warehouse) as warehouse,
'combined' as stockType
from (
select
@@ -142,6 +147,7 @@
pm.unit,
p.product_name,
p.id as product_id,
+ si.warehouse,
(
select IFNULL(SUM(sor.stock_out_num), 0)
from stock_out_record sor
@@ -180,6 +186,7 @@
pm.unit,
p.product_name,
p.id as product_id,
+ su.warehouse,
0 as qualifiedPendingOut,
(
select IFNULL(SUM(sor.stock_out_num), 0)
@@ -221,8 +228,9 @@
model,
unit,
product_name,
- product_id
- order by combined.create_time desc
+ product_id,
+ warehouse
+ order by create_time desc
</select>
<select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
@@ -259,6 +267,7 @@
unit,
product_name,
product_id,
+ MAX(warehouse) as warehouse,
'combined' as stockType
from (
select
@@ -281,6 +290,7 @@
pm.unit,
p.product_name,
p.id as product_id,
+ si.warehouse,
(
select IFNULL(SUM(sor.stock_out_num), 0)
from stock_out_record sor
@@ -316,6 +326,7 @@
pm.unit,
p.product_name,
p.id as product_id,
+ su.warehouse,
0 as qualifiedPendingOut,
(
select IFNULL(SUM(sor.stock_out_num), 0)
@@ -342,7 +353,7 @@
and combined.product_id in (select id from product_tree)
</if>
</where>
- group by batch_no, product_model_id, model, unit, product_name, product_id
+ group by batch_no, product_model_id, model, unit, product_name, product_id, warehouse
</select>
<select id="stockInventoryPage" resultType="com.ruoyi.stock.dto.StockInRecordDto">
select sir.*,si.qualitity as current_stock,
@@ -562,6 +573,7 @@
unit,
product_name,
product_id,
+ MAX(warehouse) as warehouse,
MAX(create_time) as create_time,
MAX(update_time) as update_time,
@@ -593,6 +605,7 @@
COALESCE(si.warn_num, 0) as warn_num,
si.version,
si.remark,
+ si.warehouse,
(
select IFNULL(SUM(sor.stock_out_num), 0)
@@ -635,6 +648,7 @@
0 as warn_num,
su.version,
su.remark,
+ su.warehouse,
0 as qualifiedPendingOut,
@@ -668,7 +682,8 @@
model,
unit,
product_name,
- product_id
+ product_id,
+ warehouse
order by
batch_no
</select>
diff --git a/src/main/resources/mapper/stock/StockUninventoryMapper.xml b/src/main/resources/mapper/stock/StockUninventoryMapper.xml
index 582542c..49acb4a 100644
--- a/src/main/resources/mapper/stock/StockUninventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockUninventoryMapper.xml
@@ -50,6 +50,9 @@
<if test="ew.remark != null and ew.remark !=''">
remark = #{ew.remark},
</if>
+ <if test="ew.warehouse != null and ew.warehouse !=''">
+ warehouse = #{ew.warehouse},
+ </if>
update_time = now()
</set>
where product_model_id = #{ew.productModelId}
--
Gitblit v1.9.3