Просмотр исходного кода

修改库存明细 先批次后库存

koushanshan 1 год назад
Родитель
Сommit
a55952dfd1
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

+ 4 - 5
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -673,10 +673,6 @@ public class InventoryService extends BaseService<Inventory> {
 
 
                     inOutRecordVO.setInvId(inventoryResponse.getInvId());
                     inOutRecordVO.setInvId(inventoryResponse.getInvId());
 
 
-                    //修改库存数量
-                    this.updateInventoryMessageAdd(inventoryResponse, inOutRecordVO);
-
-
                     //region  修改/新建   库存数量,可用量,金额等信息
                     //region  修改/新建   库存数量,可用量,金额等信息
                     //销售退货出库  新建库存批次
                     //销售退货出库  新建库存批次
                     if (Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
                     if (Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
@@ -688,6 +684,9 @@ public class InventoryService extends BaseService<Inventory> {
                     }
                     }
                     //endregion
                     //endregion
 
 
+                    //修改库存数量
+                    this.updateInventoryMessageAdd(inventoryResponse, inOutRecordVO);
+
                     //region 库存流水
                     //region 库存流水
                     this.insertInboundRecord(inOutRecordVO);
                     this.insertInboundRecord(inOutRecordVO);
                     //endregion
                     //endregion
@@ -828,7 +827,7 @@ public class InventoryService extends BaseService<Inventory> {
         inventory.setCostAmt(costAmt);
         inventory.setCostAmt(costAmt);
         //存货单价
         //存货单价
         inventory.setCostPrice(costAmt.compareTo(BigDecimal.ZERO) > 0 && inventory.getInvQty().compareTo(BigDecimal.ZERO) > 0 ?
         inventory.setCostPrice(costAmt.compareTo(BigDecimal.ZERO) > 0 && inventory.getInvQty().compareTo(BigDecimal.ZERO) > 0 ?
-                costAmt.divide(inventory.getInvQty(), BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
+                costAmt.divide(inventory.getInvQty(), 2,BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
         inventoryMapper.updateAmtAndQty(inventory);
         inventoryMapper.updateAmtAndQty(inventory);
         //endregion
         //endregion
     }
     }