| 
					
				 | 
			
			
				@@ -19,6 +19,7 @@ import com.ruoyi.common.core.domain.entity.SysDictData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.entity.SysUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.entity.TWarehouse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.core.domain.model.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ruoyi.common.exception.BaseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.exception.WarehouseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.utils.DictUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3075,9 +3076,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tWarehousebillsitems.setfChargedate(time);//仓储费计算日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (warehousebillsitems.getfBillstatus() != 30L) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("entry.printing"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNull(sysConfig)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BaseException("系统参数异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String configValue = sysConfig.getConfigValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ("0".equals(configValue) && warehousebillsitems.getfBillstatus() != 30L) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return AjaxResult.error("请确认是该明细数据是否存在,或该明细数据状态异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         TGoods goods = tGoodsMapper.selectTGoodsById(warehousebillsitems.getfGoodsid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ("1".equals(goods.getIfCntrno()) && StringUtils.isNull(warehousebillsitems.getfCntrno())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return AjaxResult.error("仓库明细第未找到箱号"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6141,11 +6149,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tWarehousebillsCntrMapper.deleteTWarehousebillsCntrfPid(tWarehousebills.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         JSONArray warehouseJSON = JSONArray.parseArray(warehousebillsitems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         * 流水号回收 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         *  1、 获取所有流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> serialNumberList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isNotEmpty(warehousebillsitemsList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int i = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (TWarehousebillsitems wb : warehousebillsitemsList) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6153,9 +6157,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if ("1".equals(goods.getIfCntrno()) && StringUtils.isNull(wb.getfCntrno())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return AjaxResult.error("仓库明细第" + i + "行未找到箱号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (StringUtils.isNotNull(wb.getfSerialNumber())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    serialNumberList.add(wb.getfSerialNumber()); // 流水号回收 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (WarehouseTypeEnum.SJRK_REVOKE.getType().equals(billsType)) { // 撤销 入库 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // 查询库存总账 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     TWhgenleg tWhgenle = queryWhgenlegService.stockWhgenleg(tWarehousebills, wb, goods.getIfCntrno(), WarehouseTypeEnum.UNDO_OPERATION.getType()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6163,10 +6164,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (StringUtils.isNotNull(tWhgenle) && (wb.getfQty() <= tWhgenle.getfQtyblc())) { // 非空 且 撤销数 <= 结余数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             updateTWhgenlegData(wb, tWhgenle.getfId(), billsType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             TWhgenleg whgenleg = tWhgenlegMapper.selectTWhgenlegById(tWhgenle.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            Long qtyblc = whgenleg.getfQtyblc(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal grossweightblc = whgenleg.getfGrossweightblc(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            BigDecimal netweightblc = whgenleg.getfNetweightblc(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (qtyblc == 0 && grossweightblc.compareTo(BigDecimal.ZERO) == 0 && netweightblc.compareTo(BigDecimal.ZERO) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Long qtyd = whgenleg.getfQtyd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal grossweightd = whgenleg.getfGrossweightd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal netweightd = whgenleg.getfNetweightd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (qtyd == 0 && grossweightd.compareTo(BigDecimal.ZERO) == 0 && netweightd.compareTo(BigDecimal.ZERO) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                 tWhgenlegMapper.deleteTWhgenlegById(whgenleg.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } else { // 撤销数>结余数 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6196,6 +6197,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         TWhgenleg tWhgenle = queryWhgenlegService.secondStockWhgenleg(tWarehousebills, wb, goods.getIfCntrno(), WarehouseTypeEnum.CONFIRM_OPERATION.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (StringUtils.isNotNull(tWhgenle) && (wb.getfQty() <= tWhgenle.getfQtyblc())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             updateTWhgenlegData(wb, tWhgenle.getfId(), WarehouseTypeEnum.SJRK_REVOKE.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            TWhgenleg whgenleg = tWhgenlegMapper.selectTWhgenlegById(tWhgenle.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Long qtyd = whgenleg.getfQtyd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal grossweightd = whgenleg.getfGrossweightd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            BigDecimal netweightd = whgenleg.getfNetweightd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (qtyd == 0 && grossweightd.compareTo(BigDecimal.ZERO) == 0 && netweightd.compareTo(BigDecimal.ZERO) == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                tWhgenlegMapper.deleteTWhgenlegById(whgenleg.getfId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             throw new WarehouseException("第" + i + "行撤销数大于库存结余数"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6255,20 +6263,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!WarehouseTypeEnum.HQZY_REVOKE.getType().equals(billsType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             * 流水号回收 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             *  2、 流水号去重 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             *  3、 添加到 billno_del 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<String> serialNumberNewList = delRepeat(serialNumberList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            serialNumberNewList.forEach(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                BillnoDel billnoDel = new BillnoDel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                billnoDel.setBillType(item.substring(0, 2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                billnoDel.setBillNo(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                billnoDelMapper.insertBillnoDel(billnoDel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //  箱型数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isNotNull(tCntr) && !"[]".equals(tCntr)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             JSONArray jsonDrArray = JSONArray.parseArray(tCntr); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6309,7 +6303,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbDr.setfDc("D"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbDr.setCreateBy(loginUser.getUser().getUserName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbDr.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (tWarehousebills.getfBsdate() != null && !tWarehousebills.getfBsdate().equals("")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tWarehousebills.getfBsdate() != null && !"".equals(tWarehousebills.getfBsdate())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     wbDr.setfBsdate(tWarehousebills.getfBsdate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbDr); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6324,7 +6318,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbCr.setfDc("C"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbCr.setCreateBy(loginUser.getUser().getUserName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 wbCr.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (tWarehousebills.getfBsdate() != null && !tWarehousebills.getfBsdate().equals("")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tWarehousebills.getfBsdate() != null && !"".equals(tWarehousebills.getfBsdate())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     wbCr.setfBsdate(tWarehousebills.getfBsdate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbCr); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -6341,8 +6335,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static List<String> delRepeat(List<String> list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> myList = list.stream().distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return myList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return list.stream().distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -7948,7 +7941,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (StringUtils.isNotEmpty(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             endDate += " 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null, null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return String.valueOf(statistics.get("quantity")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |