From 3481d209ec847542b73fa16616ffe0e13c949e80 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期六, 18 四月 2026 18:11:03 +0800
Subject: [PATCH] fix: 入库与出库数量绑定
---
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | 14 ++++++++------
1 files changed, 8 insertions(+), 6 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 5208f92..c1743d4 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -58,13 +58,15 @@
@Transactional(rollbackFor = Exception.class)
public Boolean addstockInventory(StockInventoryDto stockInventoryDto) {
//鏂板鍏ュ簱璁板綍鍐嶆坊鍔犲簱瀛�
- // 鏇存柊浜у搧鍏ュ簱鐘舵��
- SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(stockInventoryDto.getSalesLedgerProductId());
- if (salesLedgerProduct == null) {
- throw new ServiceException("鍏ュ簱澶辫触,閿�鍞骇鍝佷笉瀛樺湪");
+ // 鏇存柊璁㈠崟浜у搧鍏ュ簱鐘舵�侊紙浠呭綋浼犲叆浜嗕骇鍝佽ID鏃讹級
+ if (stockInventoryDto.getSalesLedgerProductId() != null) {
+ SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(stockInventoryDto.getSalesLedgerProductId());
+ if (salesLedgerProduct == null) {
+ throw new ServiceException("鍏ュ簱澶辫触,閿�鍞骇鍝佷笉瀛樺湪");
+ }
+ salesLedgerProduct.setProductStockStatus(1);
+ salesLedgerProductMapper.updateById(salesLedgerProduct);
}
- salesLedgerProduct.setProductStockStatus(1);
- salesLedgerProductMapper.updateById(salesLedgerProduct);
StockInRecordDto stockInRecordDto = new StockInRecordDto();
stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());
--
Gitblit v1.9.3