Ver código fonte

退货入库时金额为零处理

liyuan 6 meses atrás
pai
commit
571472d8a9

+ 3 - 3
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -4516,9 +4516,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					stockDesc.setStoreInventory(stockDesc.getBalanceQuantity());
 					BigDecimal inventoryAmount = item.getSendNum().multiply(stockOne.getInventoryCostPrice());
 					BigDecimal rebateInventoryAmount = item.getSendNum().multiply(stockOne.getRebatePrice());
-					stockDesc.setInventoryAmount(stockOne.getInventoryAmount().add(inventoryAmount));
-					stockDesc.setRebateInventoryAmount(stockOne.getRebateInventoryAmount().add(rebateInventoryAmount));
-					stockDesc.setInventoryCostPrice(stockDesc.getInventoryAmount().divide(stockDesc.getBalanceQuantity(), RoundingMode.DOWN).setScale(2, RoundingMode.DOWN));
+					stockDesc.setInventoryAmount(inventoryAmount.compareTo(BigDecimal.ZERO) == 0 ? item.getSendNum().multiply(item.getCostpriePrice()) : stockOne.getInventoryAmount().add(inventoryAmount));
+					stockDesc.setRebateInventoryAmount(inventoryAmount.compareTo(BigDecimal.ZERO) == 0 ? item.getSendNum().multiply(item.getRebatePrice()) : stockOne.getRebateInventoryAmount().add(rebateInventoryAmount));
+					stockDesc.setInventoryCostPrice(inventoryAmount.compareTo(BigDecimal.ZERO) == 0 ? item.getCostpriePrice() : stockDesc.getInventoryAmount().divide(stockDesc.getBalanceQuantity(), RoundingMode.DOWN).setScale(2, RoundingMode.DOWN));
 					stockDesc.setVersion(stockOne.getVersion());
 					pjStockDescArrayListUpdate.add(stockDesc);
 				}