|  | @@ -1265,19 +1265,20 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到库存总账的计费单位,请确认");
 | 
	
		
			
				|  |  |                  return map;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            long fInventoryDays = 0L;
 | 
	
		
			
				|  |  |              long fCorpid = warehouseBills.getfCorpid();
 | 
	
		
			
				|  |  |              String fBilltype = (String) item.get("fBilltype");
 | 
	
		
			
				|  |  |              long fGoodsid = Long.parseLong((String) item.get("fTypeid"));
 | 
	
		
			
				|  |  |              long fId = Long.valueOf(String.valueOf(item.get("fId"))).longValue();
 | 
	
		
			
				|  |  |              // 要计费天数
 | 
	
		
			
				|  |  | -            long dateDay = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fChargedate"));
 | 
	
		
			
				|  |  | +            long fBillingDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fChargedate"));
 | 
	
		
			
				|  |  |              // 累计计费天数
 | 
	
		
			
				|  |  | -            if ("KCZZ".equals(fBilltype)) {
 | 
	
		
			
				|  |  | -                fInventoryDays = DateUtils.getDateDay((Date) item.get("fChargedate"), (Date) item.get("fOriginalbilldate"));
 | 
	
		
			
				|  |  | +            long accumulatedDays = DateUtils.getDateDay((Date) item.get("fChargedate"), (Date) item.get("fOriginalbilldate"));
 | 
	
		
			
				|  |  | +            // 库存天数
 | 
	
		
			
				|  |  | +            long fInventoryDays = DateUtils.getDateDay(warehouseBills.getfBillingDeadline(), (Date) item.get("fOriginalbilldate"));
 | 
	
		
			
				|  |  | +            /*if ("KCZZ".equals(fBilltype)) {
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  fInventoryDays = Long.valueOf(String.valueOf(item.get("fBillingDays")));
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +            }*/
 | 
	
		
			
				|  |  |              Long dictLabel = Long.valueOf(String.valueOf(item.get("fBillingway")));
 | 
	
		
			
				|  |  |              BigDecimal fQty = acquiredQuantity(item, dictLabel);
 | 
	
		
			
				|  |  |              if (fQty.equals(BigDecimal.ZERO)) {
 | 
	
	
		
			
				|  | @@ -1285,7 +1286,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  return AjaxResult.error("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到计费单位,请确认");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // 计算仓储费明细
 | 
	
		
			
				|  |  | -            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, dateDay, dictLabel, fQty, fInventoryDays);
 | 
	
		
			
				|  |  | +            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays);
 | 
	
		
			
				|  |  |              if (StringUtils.isNull(objectMap)) {
 | 
	
		
			
				|  |  |                  map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到仓储费协议,请确认");
 | 
	
		
			
				|  |  |                  return map;
 | 
	
	
		
			
				|  | @@ -1309,7 +1310,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              fees.setfBillingQty(fQty);
 | 
	
		
			
				|  |  |              fees.setfUnitprice(sumAmt);
 | 
	
		
			
				|  |  |              fees.setfBilltype(fBilltype);
 | 
	
		
			
				|  |  | -            fees.setfBillingDays(dateDay);
 | 
	
		
			
				|  |  | +            fees.setfBillingDays(fBillingDays);
 | 
	
		
			
				|  |  |              fees.setCreateTime(new Date());
 | 
	
		
			
				|  |  |              fees.setfQty(new BigDecimal(1));
 | 
	
		
			
				|  |  |              fees.setfPid(warehouseBills.getfId());
 |