库存操作判空处理;

This commit is contained in:
王奎兴
2026-02-09 18:14:29 +08:00
parent ee4cd312ab
commit 8c21c6bfa8
2 changed files with 9 additions and 2 deletions
@@ -196,10 +196,13 @@ public class HandoverTaskOrderDomainService {
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventoryPO != null) {
//更新库存数量
//库存数量
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
//冻结数量
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
//分配后库存数量
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(checkQuantity);
//分配后冻结数量
@@ -541,10 +541,14 @@ public class StockShelfOrderDomainService {
BigDecimal shelvesQuantity = shelfMaterialDetail.getShelvesQuantity();
shelvesQuantity = shelvesQuantity != null ? shelvesQuantity : BigDecimal.ZERO;
MaterialInventoryPO materialInventoryPO = materialInventoryPOS.get(0);
BigDecimal newInventoryQuantity = materialInventoryPO.getInventoryQuantity().add(shelvesQuantity);
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
BigDecimal newAllocationQuantity = materialInventoryPO.getAllocationQuantity().add(shelvesQuantity);
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
BigDecimal newInventoryQuantity = oldInventoryQuantity.add(shelvesQuantity);
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(shelvesQuantity);
BigDecimal oldArea = materialInventoryPO.getArea();
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;