From 0a42649505613583809823998218ba76584905d6 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 8 Sep 2025 15:03:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(wms):=20=E4=BF=AE=E5=A4=8D=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E6=95=B0=E9=87=8F=E8=AE=A1=E7=AE=97=E6=BD=9C=E5=9C=A8?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在计算新的库存数量时,增加了对 changeQty 的空值检查- 避免了在 changeQty 为 null 时可能发生的空指针异常 -确保了库存数量的正确计算和程序的稳定性 --- .../org/dromara/wms/service/impl/WmsInventoryServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java index 5c5c162b..01458c4b 100644 --- a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/WmsInventoryServiceImpl.java @@ -422,7 +422,8 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService { for (WmsInventoryLedgerVo record : ledgerList) { String key = record.getMaterialId() + "_" + record.getBatchCode() + "_" + record.getLocationCode(); BigDecimal currentBalance = balanceMap.getOrDefault(key, BigDecimal.ZERO); - BigDecimal newBalance = currentBalance.add(record.getChangeQty()); + BigDecimal changeQty = record.getChangeQty() != null ? record.getChangeQty() : BigDecimal.ZERO; + BigDecimal newBalance = currentBalance.add(changeQty); balanceMap.put(key, newBalance); record.setBalanceQty(newBalance); }