|  | @@ -108,7 +108,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |          tWarehouseAgreementitems.setfPid(fId);
 | 
	
		
			
				|  |  |          List<TWarehouseAgreementitems> tWarehouseAgreementitemss = tWarehouseAgreementitemsMapper.selectTWarehouseAgreementitemsList(tWarehouseAgreementitems);
 | 
	
		
			
				|  |  |          if (StringUtils.isNotEmpty(tWarehouseAgreementitemss)) {
 | 
	
		
			
				|  |  | -            for (TWarehouseAgreementitems  fees : tWarehouseAgreementitemss) {
 | 
	
		
			
				|  |  | +            for (TWarehouseAgreementitems fees : tWarehouseAgreementitemss) {
 | 
	
		
			
				|  |  |                  feesId.add(fees.getfFeeid());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -168,19 +168,19 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     *  新增
 | 
	
		
			
				|  |  | +     * 新增
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param agreement
 | 
	
		
			
				|  |  |       * @param agreementitems
 | 
	
		
			
				|  |  |       * @param loginUser
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public AjaxResult insertTWarehouseAgreement(String agreement, String agreementitems, LoginUser loginUser,int fFeetypeid) {
 | 
	
		
			
				|  |  | +    public AjaxResult insertTWarehouseAgreement(String agreement, String agreementitems, LoginUser loginUser, int fFeetypeid) {
 | 
	
		
			
				|  |  |          Long fPid = null;
 | 
	
		
			
				|  |  |          TWarehouseAgreement tWarehouseAgreement = JSONArray.parseObject(agreement, TWarehouseAgreement.class);
 | 
	
		
			
				|  |  | -        if(StringUtils.isNull(tWarehouseAgreement.getfId())){
 | 
	
		
			
				|  |  | +        if (StringUtils.isNull(tWarehouseAgreement.getfId())) {
 | 
	
		
			
				|  |  |              // 如果是新数据
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |              // 业务编码
 | 
	
	
		
			
				|  | @@ -193,7 +193,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setfBillstatus("2"); // 暂存
 | 
	
		
			
				|  |  |              tWarehouseAgreementMapper.insertTWarehouseAgreement(tWarehouseAgreement);
 | 
	
		
			
				|  |  |              fPid = tWarehouseAgreement.getfId();
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              fPid = tWarehouseAgreement.getfId();
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setUpdateTime(new Date());
 | 
	
	
		
			
				|  | @@ -215,7 +215,8 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     *   仓储费请核
 | 
	
		
			
				|  |  | +     * 仓储费请核
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param agreement
 | 
	
		
			
				|  |  |       * @param agreementitems
 | 
	
		
			
				|  |  |       * @param loginUser
 | 
	
	
		
			
				|  | @@ -227,7 +228,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      public AjaxResult tWarehouseAgreementSubmit(String agreement, String agreementitems, LoginUser loginUser, int fFeetypeid) {
 | 
	
		
			
				|  |  |          Long fPid = null;
 | 
	
		
			
				|  |  |          TWarehouseAgreement tWarehouseAgreement = JSONArray.parseObject(agreement, TWarehouseAgreement.class);
 | 
	
		
			
				|  |  | -        if(StringUtils.isNull(tWarehouseAgreement.getfId())){
 | 
	
		
			
				|  |  | +        if (StringUtils.isNull(tWarehouseAgreement.getfId())) {
 | 
	
		
			
				|  |  |              // 如果是新数据
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |              // 业务编码
 | 
	
	
		
			
				|  | @@ -240,7 +241,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setfBillstatus("4");
 | 
	
		
			
				|  |  |              tWarehouseAgreementMapper.insertTWarehouseAgreement(tWarehouseAgreement);
 | 
	
		
			
				|  |  |              fPid = tWarehouseAgreement.getfId();
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              fPid = tWarehouseAgreement.getfId();
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setfBillstatus("4");
 | 
	
		
			
				|  |  |              tWarehouseAgreement.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
	
		
			
				|  | @@ -263,10 +264,10 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |          String key = "";
 | 
	
		
			
				|  |  |          boolean isApprove = false;
 | 
	
		
			
				|  |  |          long actId = 0L;
 | 
	
		
			
				|  |  | -        if (fFeetypeid==0) {
 | 
	
		
			
				|  |  | +        if (fFeetypeid == 0) {
 | 
	
		
			
				|  |  |              actId = 310L;
 | 
	
		
			
				|  |  |              key = "warehouse.storage.ApprovalFlow";
 | 
	
		
			
				|  |  | -        } else if (fFeetypeid==1) {
 | 
	
		
			
				|  |  | +        } else if (fFeetypeid == 1) {
 | 
	
		
			
				|  |  |              actId = 320L;
 | 
	
		
			
				|  |  |              key = "warehouse.task.ApprovalFlow";
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -286,9 +287,9 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |              auditItems.setIffinalItem("F");
 | 
	
		
			
				|  |  |              auditItems.setBillNo(tWarehouseAgreement.getfBillno());
 | 
	
		
			
				|  |  |              auditItems.setRefno1(String.valueOf(tWarehouseAgreement.getfCorpid()));
 | 
	
		
			
				|  |  | -            if(tWarehouseAgreement.getfFeetypeid()==0){
 | 
	
		
			
				|  |  | +            if (tWarehouseAgreement.getfFeetypeid() == 0) {
 | 
	
		
			
				|  |  |                  auditItems.setRefno2("CCF");// 存储业务类型(业务类型)
 | 
	
		
			
				|  |  | -            }else{
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  |                  auditItems.setRefno2("ZYF");// 存储业务类型(业务类型)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              auditItems.setSendUserId(loginUser.getUser().getUserId());
 | 
	
	
		
			
				|  | @@ -304,7 +305,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |                  TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              return approvalFlow;
 | 
	
		
			
				|  |  | -        }else {
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              AjaxResult ajaxResult = agreementFollow(fPid, 6L);
 | 
	
		
			
				|  |  |              Long code = Long.valueOf(String.valueOf(ajaxResult.get("code"))).longValue();
 | 
	
		
			
				|  |  |              return ajaxResult;
 | 
	
	
		
			
				|  | @@ -379,11 +380,11 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public int deleteTWarehouseAgreementByIds(Long[] fIds) {
 | 
	
		
			
				|  |  |          // 取出业务编号、 放入 billno_del
 | 
	
		
			
				|  |  | -        for(Long id:fIds){
 | 
	
		
			
				|  |  | +        for (Long id : fIds) {
 | 
	
		
			
				|  |  |              // 1、查询主表信息
 | 
	
		
			
				|  |  | -            TWarehouseAgreement tWarehouseAgreement =  tWarehouseAgreementMapper.selectTWarehouseAgreementById(id);
 | 
	
		
			
				|  |  | +            TWarehouseAgreement tWarehouseAgreement = tWarehouseAgreementMapper.selectTWarehouseAgreementById(id);
 | 
	
		
			
				|  |  |              // 2、业务编号、客存编号 放入 billno_del
 | 
	
		
			
				|  |  | -            BillnoDel billnoDel =new BillnoDel();
 | 
	
		
			
				|  |  | +            BillnoDel billnoDel = new BillnoDel();
 | 
	
		
			
				|  |  |              billnoDel.setBillType("WA");
 | 
	
		
			
				|  |  |              billnoDel.setBillNo(tWarehouseAgreement.getfBillno());
 | 
	
		
			
				|  |  |              billnoDelMapper.insertBillnoDel(billnoDel);
 | 
	
	
		
			
				|  | @@ -409,9 +410,9 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |          TWarehouseAgreementitems tWarehouseAgreementitems = new TWarehouseAgreementitems();
 | 
	
		
			
				|  |  |          tWarehouseAgreementitems.setfPid(tWarehouseAgreement.getfId());
 | 
	
		
			
				|  |  |          List<TWarehouseAgreementitems> tWarehouseAgreementitemss = tWarehouseAgreementitemsMapper.selectTWarehouseAgreementitemsList(tWarehouseAgreementitems);
 | 
	
		
			
				|  |  | -        if( StringUtils.isNull(tWarehouseAgreement)){
 | 
	
		
			
				|  |  | +        if (StringUtils.isNull(tWarehouseAgreement)) {
 | 
	
		
			
				|  |  |              return AjaxResult.success("0");
 | 
	
		
			
				|  |  | -        } else if(StringUtils.isNotNull(tWarehouseAgreement) && StringUtils.isEmpty(tWarehouseAgreementitemss) ){
 | 
	
		
			
				|  |  | +        } else if (StringUtils.isNotNull(tWarehouseAgreement) && StringUtils.isEmpty(tWarehouseAgreementitemss)) {
 | 
	
		
			
				|  |  |              return AjaxResult.success("1");
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              return AjaxResult.success("2");
 | 
	
	
		
			
				|  | @@ -421,14 +422,15 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 计算存储费用
 | 
	
		
			
				|  |  | -     * @author shanxin
 | 
	
		
			
				|  |  | -     * @param fCorpid   出库客户Id
 | 
	
		
			
				|  |  | -     * @param fGoodsid  物资类型Id
 | 
	
		
			
				|  |  | -     * @param days 时长天数(需要计算仓储费的时长)
 | 
	
		
			
				|  |  | -     * @param feeUnitid 计价单位
 | 
	
		
			
				|  |  | -     * @param itemNums 数量
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param fCorpid      出库客户Id
 | 
	
		
			
				|  |  | +     * @param fGoodsid     物资类型Id
 | 
	
		
			
				|  |  | +     * @param days         时长天数(需要计算仓储费的时长)
 | 
	
		
			
				|  |  | +     * @param feeUnitid    计价单位
 | 
	
		
			
				|  |  | +     * @param itemNums     数量
 | 
	
		
			
				|  |  |       * @param earlySumDays 已经计算过仓储费的天数(假设传参80,则阶梯计价时按照80往后的计算)  21.01.14 曹志刚要求新增
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  | +     * @author shanxin
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public Map<String, Object> getCarryingCost(Long fCorpid,
 | 
	
		
			
				|  |  |                                                 Long fGoodsid,
 | 
	
	
		
			
				|  | @@ -446,7 +448,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |              return null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<TWarehouseAgreementitems> itemList =
 | 
	
		
			
				|  |  | -                this.tWarehouseAgreementitemsMapper.getItemsBytWarehouseAgreementMsg(fCorpid,fGoodsid,feeUnitid);
 | 
	
		
			
				|  |  | +                this.tWarehouseAgreementitemsMapper.getItemsBytWarehouseAgreementMsg(fCorpid, fGoodsid, feeUnitid);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (CollUtil.isEmpty(itemList)) {
 | 
	
		
			
				|  |  |              return null;
 | 
	
	
		
			
				|  | @@ -457,8 +459,9 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String remark = "";
 | 
	
		
			
				|  |  |          for (TWarehouseAgreementitems tWarehouseAgreementitems : itemList) {
 | 
	
		
			
				|  |  | -            if (days  < 1) break;
 | 
	
		
			
				|  |  | -            if (earlySumDays >= tWarehouseAgreementitems.getfEndays()) continue; //将已算账的天数 与 计费规则的 最后一天作比较如果 已算10天 > 规则结束  不算帐
 | 
	
		
			
				|  |  | +            if (days < 1) break;
 | 
	
		
			
				|  |  | +            if (earlySumDays >= tWarehouseAgreementitems.getfEndays())
 | 
	
		
			
				|  |  | +                continue; //将已算账的天数 与 计费规则的 最后一天作比较如果 已算10天 > 规则结束  不算帐
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              dayLength = tWarehouseAgreementitems.getfEndays() - tWarehouseAgreementitems.getfFromdays() + 1L; //阶梯中的结束-开始日期
 | 
	
		
			
				|  |  |              String information = "";
 | 
	
	
		
			
				|  | @@ -479,7 +482,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |                  BigDecimal calculate = this.getCalculate(itemNums, tWarehouseAgreementitems.getfPrice(), days);
 | 
	
		
			
				|  |  |                  money = money.add(calculate);
 | 
	
		
			
				|  |  |  //                long day = days - tWarehouseAgreementitems.getfFromdays();
 | 
	
		
			
				|  |  | -                information =  days + "天*" + tWarehouseAgreementitems.getfPrice() + "元*" + itemNums + "元 = " + calculate + "元";
 | 
	
		
			
				|  |  | +                information = days + "天*" + tWarehouseAgreementitems.getfPrice() + "元*" + itemNums + "元 = " + calculate + "元";
 | 
	
		
			
				|  |  |                  if (StringUtils.isEmpty(remark)) {
 | 
	
		
			
				|  |  |                      remark = information;
 | 
	
		
			
				|  |  |                  } else {
 | 
	
	
		
			
				|  | @@ -497,12 +500,13 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 数量 * 单价 * 天数
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param itemNumsBig 数量
 | 
	
		
			
				|  |  | -     * @param unitPrice 单价
 | 
	
		
			
				|  |  | +     * @param unitPrice   单价
 | 
	
		
			
				|  |  |       * @param dateLength  天数
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    public BigDecimal getCalculate (BigDecimal itemNumsBig,BigDecimal unitPrice,Long dateLength) {
 | 
	
		
			
				|  |  | +    public BigDecimal getCalculate(BigDecimal itemNumsBig, BigDecimal unitPrice, Long dateLength) {
 | 
	
		
			
				|  |  |          BigDecimal money = new BigDecimal(0);
 | 
	
		
			
				|  |  |          BigDecimal bigDaysBig = new BigDecimal(dateLength);
 | 
	
		
			
				|  |  |          money = itemNumsBig.multiply(unitPrice).multiply(bigDaysBig);
 | 
	
	
		
			
				|  | @@ -510,26 +514,4 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  }
 |