fix(wms): 修复库存数量计算潜在空指针异常

- 在计算新的库存数量时,增加了对 changeQty 的空值检查- 避免了在 changeQty 为 null 时可能发生的空指针异常
-确保了库存数量的正确计算和程序的稳定性
master
zangch@mesnac.com 3 months ago
parent 0ec5aa88a9
commit 0a42649505

@ -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);
}

Loading…
Cancel
Save