| 
					
				 | 
			
			
				@@ -41,6 +41,8 @@ import com.ruoyi.shipping.mapper.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.domain.SysCheckCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.domain.SysConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.mapper.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ruoyi.system.service.ISysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ruoyi.system.service.impl.SysConfigServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.warehouseBusiness.domain.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.warehouseBusiness.excel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.warehouseBusiness.mapper.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,6 +131,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysDictDataMapper sysDictDataMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ISysConfigService sysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private SysConfigServiceImpl sysConfigServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private AuditItemsServiceImpl auditItemsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3963,9 +3971,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param warehouseBills 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param mapItem 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param loginUser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param cangKey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Map<String, Object> getWarehouseItems(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Map<String, Object> getWarehouseItems(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser, String cangKey) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long feeId = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal sumAmt = new BigDecimal(0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3979,6 +3988,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Date fBsdate = (Date) item.get("fBsdate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long fCorpid = warehouseBills.getfCorpid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String fBilltype = (String) item.get("fBilltype"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String warehouseId = item.get("warehouse").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String fGoodsid = (String) item.get("fTypeid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(fGoodsid)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 fGoodsid = "\"" + fGoodsid + "\""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4009,8 +4019,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return AjaxResult.error("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到计费单位,请确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 计算仓储费明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 仓储费协议计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays, cangKey, warehouseId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNull(objectMap)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到仓储费协议,请确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4076,7 +4086,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param loginUser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Map<String, Object> getWarehouseItemsList(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Map<String, Object> getWarehouseItemsList(TWarehouseBills warehouseBills, List<Map<String, Object>> mapItem, LoginUser loginUser, String warehouse) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long feeId = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal sumAmt = new BigDecimal(0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4091,6 +4101,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long fCorpid = warehouseBills.getfCorpid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String fBilltype = (String) item.get("fBilltype"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String fGoodsid = (String) item.get("fTypeid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String warehouseId = (String) item.get("warehouse"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNotEmpty(fGoodsid)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 fGoodsid = "\"" + fGoodsid + "\""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4121,7 +4132,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return AjaxResult.error("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到计费单位,请确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 计算仓储费明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> objectMap = tWarehouseAgreementService.getCarryingCost(fCorpid, fGoodsid, fBillingDays, dictLabel, fQty, accumulatedDays, warehouse, warehouseId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isNull(objectMap)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到仓储费协议,请确认"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4224,6 +4235,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<TWarehousebillsfees> itemsList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal bigDecimal = new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //调一次公共方法,获取字符类型的true或者false传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String cangKey = sysConfigServiceImpl.selectConfigByKey("agreement.warehouse"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 库存总账id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long whgenlegFeeId = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 计费单位 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4231,7 +4244,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 查询 出库 货转的库存明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Map<String, Object>> warehousebillsitemsList = tWarehousebillsitemsMapper.selectStorageFeeItemList(tWarehouseBills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (warehousebillsitemsList.size() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, warehousebillsitemsList, loginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, warehousebillsitemsList, loginUser, cangKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (mapItem.containsKey("error")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return AjaxResult.error((String) mapItem.get("error")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4240,7 +4253,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Map<String, Object>> tWhgenlegs = tWhgenlegMapper.selectStorageFeeItemList(tWarehouseBills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (tWhgenlegs.size() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, tWhgenlegs, loginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> mapItem = getWarehouseItems(tWarehouseBills, tWhgenlegs, loginUser, cangKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (mapItem.containsKey("error")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return AjaxResult.error((String) mapItem.get("error")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -4309,8 +4322,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long feeUnitid = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 查询 出库 货转的库存明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<Map<String, Object>> warehousebillsitemsList = tWarehousebillsitemsMapper.selectStorageFeeItemList(tWarehouseBills); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String cangKey = sysConfigServiceImpl.selectConfigByKey("agreement.warehouse"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (warehousebillsitemsList.size() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Map<String, Object> mapItem = getWarehouseItemsList(tWarehouseBills, warehousebillsitemsList, loginUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, Object> mapItem = getWarehouseItemsList(tWarehouseBills, warehousebillsitemsList, loginUser, cangKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (mapItem.containsKey("error")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return AjaxResult.error((String) mapItem.get("error")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6449,12 +6463,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         TWarehousebillsCntr warehousebillsCntr = tWarehousebillsCntrMapper.selectTWarehousebillsCntrByPId(selectOne.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         warehousebillsCntr.setUpdateBy(SecurityUtils.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         warehousebillsCntr.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        warehousebillsCntr.setfCntrcount(warehousebillsCntr.getfCntrcount()-number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        warehousebillsCntr.setfCntrcount(warehousebillsCntr.getfCntrcount() - number); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tWarehousebillsCntrMapper.updateTWarehousebillsCntr(warehousebillsCntr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //修改箱信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isNotEmpty(tWarehousebillsCntritemsList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (TWarehousebillsCntritems warehousebillsCntritems : tWarehousebillsCntritemsList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(),warehousebillsCntritems.getfCntrno()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tWarehousebillsCntritemsMapper.deleteTWarehousebillsCntritemOlder(selectOne.getfId(), warehousebillsCntritems.getfCntrno()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (isApprove) { 
			 |