Jelajahi Sumber

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun

zhangyuewww 2 tahun lalu
induk
melakukan
ecc4c93a23

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ExpenseInfo.java

@@ -136,7 +136,7 @@ public class ExpenseInfo extends BaseModel<ExpenseInfo> {
      */
     private String expensesPurpose;
     /**
-     * 是否自动分配(1不自动分配3仓储费自动分配5燃料自动分配)
+     * 是否自动分配(1不自动分配3仓储费自动分配5燃料自动分配)
      */
     private String autoAssign;
     /**

+ 10 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -1082,9 +1082,17 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
                 coalPaymentInfo1.setCompId(expenseInfo1.getCompId());
                 coalPaymentInfo1.setWarehouseId(expenseInfo1.getWarehouseId());
                 coalPaymentInfo1.setWarehouseName(expenseInfo1.getWarehouseName());
-                coalPaymentInfo1.setDistributableAmount(expenseInfo1.getAmountMoney());
-                coalPaymentInfo1.setCurrentAverageAllocatedCost(expenseInfo1.getCoalPrice());
+                coalPaymentInfo1.setDistributableAmount(0d);
+                coalPaymentInfo1.setCurrentAverageAllocatedCost(0d);
                 coalPaymentInfoService.insert(coalPaymentInfo1);
+                //当前合计可分配金额
+                Double nowDisAmount = coalPaymentInfo1.getDistributableAmount();
+                //当前平均分配单价
+                Double nowCurCost = coalPaymentInfo1.getCurrentAverageAllocatedCost();
+                coalPaymentInfo1.setDistributableAmount(nowDisAmount + expenseInfo1.getAmountMoney());
+                coalPaymentInfo1.setCurrentAverageAllocatedCost((nowCurCost*13/550*nowDisAmount +
+                        expenseInfo1.getCoalPrice()*13/550*expenseInfo1.getAmountMoney()) / (nowDisAmount + expenseInfo1.getAmountMoney()));
+                coalPaymentInfoService.updateById(coalPaymentInfo1);
             }else {
                 //不为空, 编辑
                 //当前合计可分配金额