Kaynağa Gözat

仓储费计算新增参数(曹志刚指导)

shanxin 4 yıl önce
ebeveyn
işleme
5c00bd8108

+ 15 - 8
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -250,22 +250,25 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
      * @author shanxin
      * @param fCorpid   出库客户Id
      * @param fGoodsid  物资类型Id
-     * @param days 时长天数
+     * @param days 时长天数(需要计算仓储费的时长)
      * @param feeUnitid 计价单位
      * @param itemNums 数量
+     * @param earlySumDays 已经计算过仓储费的天数(假设传参80,则阶梯计价时按照80往后的计算)  21.01.14 曹志刚要求新增
      * @return
      */
     public Map<String, Object> getCarryingCost(Long fCorpid,
-                                      Long fGoodsid,
-                                      Long days,
-                                      Long feeUnitid,
-                                      Long itemNums) {
+                                               Long fGoodsid,
+                                               Long days,
+                                               Long feeUnitid,
+                                               Long itemNums,
+                                               Long earlySumDays) {
         Map<String, Object> map = new HashMap<>();
         if (null == fCorpid ||
                 null == fGoodsid ||
                 null == days ||
                 null == feeUnitid ||
-                null == itemNums) {
+                null == itemNums ||
+                null == earlySumDays) {
             return null;
         }
         List<TWarehouseAgreementitems> itemList =
@@ -277,13 +280,17 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
         BigDecimal money = new BigDecimal(0);
         Long dayLength = 0L;
         Long feeId = 0L;
+
         for (TWarehouseAgreementitems tWarehouseAgreementitems : itemList) {
             if (days < 1) break;
-            dayLength = tWarehouseAgreementitems.getfEndays() - tWarehouseAgreementitems.getfFromdays() + 1L;
+            if (earlySumDays >= tWarehouseAgreementitems.getfEndays()) break; //将已算账的天数 与 计费规则的 最后一天作比较如果 已算10天 > 规则结束  不算帐
+
+            dayLength = tWarehouseAgreementitems.getfEndays() - tWarehouseAgreementitems.getfFromdays() + 1L; //阶梯中的结束-开始日期
+
             if (days >= dayLength) {
                 feeId = tWarehouseAgreementitems.getfFeeid();
                 money = money.add(this.getCalculate(itemNums,tWarehouseAgreementitems.getfPrice(),dayLength));
-                days -=  dayLength;
+                days = days - dayLength;
             } else {
                 feeId = tWarehouseAgreementitems.getfFeeid();
                 money = money.add(this.getCalculate(itemNums,feeUnitid,days));