zhangyuewww 2 年之前
父节点
当前提交
f2019acf0f

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehouseBaseInfo.java

@@ -137,6 +137,10 @@ public class WarehouseBaseInfo extends BaseModel<WarehouseBaseInfo> {
      * 总储存量(吨)
      * 总储存量(吨)
      */
      */
     private Float totalStorage;
     private Float totalStorage;
+    /**
+     * 利率
+     */
+    private Double interestRate;
     /**
     /**
      * 附件地址
      * 附件地址
      */
      */

+ 36 - 31
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehousingOrderServiceImpl.java

@@ -815,41 +815,46 @@ public class WarehousingOrderServiceImpl extends ServiceImpl<WarehousingOrderMap
                 }
                 }
             }
             }
             //利率对成本的影响
             //利率对成本的影响
-            //查入库单利率
-            List<EnabledInfo> enabledInfoList = enabledInfoService.selectList(new EntityWrapper<EnabledInfo>()
-                    .eq("function_type", "2"));
-            if (!CollectionUtils.isEmpty(enabledInfoList)) {
-                for (EnabledInfo enabledInfo : enabledInfoList) {
-                    //查剩余重量>0的入库单
-                    List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
-                            .eq("comp_id", enabledInfo.getCompId())
-                            .ne("temporary_flag", "1")
-                            .ne("warehouse_name","榆树库")
-                            .gt("surplus_weight", 0));
-                    if (!CollectionUtils.isEmpty(warehousingOrderList)) {
-                        for (WarehousingOrder warehousingOrder : warehousingOrderList) {
-                            Double distributionMoney = 0d;
-                            List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
-                                    .eq("order_id", warehousingOrder.getId())
-                                    .ne("status", "已驳回"));
-                            if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
-                                distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
-                            }
-                            distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
-                            if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
-                                if (warehousingOrder.getSurplusWeight() > 1) {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30) * warehousingOrder.getSurplusWeight());
-                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() / 30);
-                                } else {
-                                    warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
-                                    warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * enabledInfo.getValue() * warehousingOrder.getSurplusWeight() / 30);
-                                }
-                            }
-                            this.updateById(warehousingOrder);
+//            //查入库单利率
+//            List<EnabledInfo> enabledInfoList = enabledInfoService.selectList(new EntityWrapper<EnabledInfo>()
+//                    .eq("function_type", "2"));
+//            if (!CollectionUtils.isEmpty(enabledInfoList)) {
+//                for (EnabledInfo enabledInfo : enabledInfoList) {
+            Double value=0d;
+            //查剩余重量>0的入库单
+            List<WarehousingOrder> warehousingOrderList = this.selectList(new EntityWrapper<WarehousingOrder>()
+//                            .eq("comp_id", enabledInfo.getCompId())
+                    .ne("temporary_flag", "1")
+                    .gt("surplus_weight", 0));
+            if (!CollectionUtils.isEmpty(warehousingOrderList)) {
+                for (WarehousingOrder warehousingOrder : warehousingOrderList) {
+                    Double distributionMoney = 0d;
+                    List<ExpenseAllocationInfo> expenseAllocationInfoList1 = expenseAllocationInfoService.selectList(new EntityWrapper<ExpenseAllocationInfo>()
+                            .eq("order_id", warehousingOrder.getId())
+                            .ne("status", "已驳回"));
+                    if (!CollectionUtils.isEmpty(expenseAllocationInfoList1)) {
+                        distributionMoney = expenseAllocationInfoList1.stream().mapToDouble(ExpenseAllocationInfo::getDistributionMoney).sum();
+                    }
+                    distributionMoney = distributionMoney + warehousingOrder.getInterest() + warehousingOrder.getStorageFee();
+                    if (distributionMoney / warehousingOrder.getInWarehouseWeight() < 100) {
+                        WarehouseBaseInfo warehouseBaseInfo=warehouseBaseInfoService.selectById(warehousingOrder.getBaseId());
+                        //取当前入库单仓库利率
+                        if (warehouseBaseInfo.getInterestRate()!=null){
+                            value=warehouseBaseInfo.getInterestRate();
+                        }
+                        if (warehousingOrder.getSurplusWeight() > 1) {
+                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value / 30) * warehousingOrder.getSurplusWeight());
+                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value / 30);
+                        } else {
+                            warehousingOrder.setInterest(warehousingOrder.getInterest() + (warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30) * warehousingOrder.getSurplusWeight());
+                            warehousingOrder.setAvgCost(warehousingOrder.getAvgCost() + warehousingOrder.getAvgCost() * value * warehousingOrder.getSurplusWeight() / 30);
                         }
                         }
                     }
                     }
+                    this.updateById(warehousingOrder);
                 }
                 }
             }
             }
+//                }
+//            }
             return "OK";
             return "OK";
         }
         }
         return "NG";
         return "NG";