|  |  | @ -19,6 +19,7 @@ import com.glxp.api.entity.basic.UdiEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrder; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrder; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBiz; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrderBiz; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.collect.IoCollectOrderCodeAuto; |  |  |  | import com.glxp.api.entity.collect.IoCollectOrderCodeAuto; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.inout.IoSplitCodeEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; |  |  |  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.thrsys.ThrSystemEntity; |  |  |  | import com.glxp.api.entity.thrsys.ThrSystemEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.exception.JsonException; |  |  |  | import com.glxp.api.exception.JsonException; | 
			
		
	
	
		
		
			
				
					|  |  | @ -33,6 +34,7 @@ import com.glxp.api.service.auth.SysWorkplaceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.BasicCollectBustypeService; |  |  |  | import com.glxp.api.service.basic.BasicCollectBustypeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.SysWorkplaceDocumentService; |  |  |  | import com.glxp.api.service.basic.SysWorkplaceDocumentService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; |  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.inout.IoSplitCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; |  |  |  | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.ThrSystemService; |  |  |  | import com.glxp.api.service.thrsys.ThrSystemService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.GennerOrderUtils; |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
	
		
		
			
				
					|  |  | @ -207,6 +209,13 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |                         actCount = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); |  |  |  |                         actCount = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (actCount > IntUtil.value(collectOrderBiz.getCount())) { |  |  |  |                     if (actCount > IntUtil.value(collectOrderBiz.getCount())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (needCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (vailInSplit(collectOrderBiz, collectOrder.getWorkPlaceCode(), needCount)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 throw new JsonException(502, "当前拆零数量还有剩余,是否继续扫码?"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         throw new JsonException(500, "扫码数量超出!"); |  |  |  |                         throw new JsonException(500, "扫码数量超出!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     collectOrderBiz.setScanCount(count); |  |  |  |                     collectOrderBiz.setScanCount(count); | 
			
		
	
	
		
		
			
				
					|  |  | @ -224,6 +233,12 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |                             actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); |  |  |  |                             actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (actCount1 > collectOrderBiz.getCount()) { |  |  |  |                         if (actCount1 > collectOrderBiz.getCount()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (needCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 if (vailInSplit(collectOrderBiz, collectOrder.getWorkPlaceCode(), needCount)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     throw new JsonException(502, "当前拆零数量还有剩余,是否继续扫码?"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             throw new JsonException(502, "扫码数量超出!"); |  |  |  |                             throw new JsonException(502, "扫码数量超出!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         collectOrderBiz.setScanCount(count1); |  |  |  |                         collectOrderBiz.setScanCount(count1); | 
			
		
	
	
		
		
			
				
					|  |  | @ -252,12 +267,6 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectOrder = collectOrderService.getByBillNo(addTagCodeReqeust.getBillNo()); |  |  |  |             collectOrder = collectOrderService.getByBillNo(addTagCodeReqeust.getBillNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (collectOrder == null) |  |  |  |             if (collectOrder == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 throw new JsonException(500, "单据不存在!"); |  |  |  |                 throw new JsonException(500, "单据不存在!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |             //3.校验该UDI码是否已经出库(是否在预出库队列)
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            Boolean b1 = splitFifoCodeService.isExitCode(code, collectOrder.getWorkPlaceCode());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            if (!b1) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //                return ResultVOUtils.error(500, "该追溯码未上货,无法使用!");
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             //按单不校验三期
 |  |  |  |             //按单不校验三期
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectOrderBiz = vailNoBatchNo(udiRelevanceResponses, collectOrderBizs, udiEntity); |  |  |  |             collectOrderBiz = vailNoBatchNo(udiRelevanceResponses, collectOrderBizs, udiEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |             switch (sysWorkplaceDocumentEntity.getCheckInsert()) { |  |  |  |             switch (sysWorkplaceDocumentEntity.getCheckInsert()) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -285,6 +294,12 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |                         actCount = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); |  |  |  |                         actCount = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (actCount > IntUtil.value(collectOrderBiz.getCount())) { |  |  |  |                     if (actCount > IntUtil.value(collectOrderBiz.getCount())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (needCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (vailInSplit(collectOrderBiz, collectOrder.getWorkPlaceCode(), needCount)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 throw new JsonException(502, "当前拆零数量还有剩余,是否继续扫码?"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         throw new JsonException(500, "扫码数量超出!"); |  |  |  |                         throw new JsonException(500, "扫码数量超出!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     collectOrderBiz.setScanCount(count); |  |  |  |                     collectOrderBiz.setScanCount(count); | 
			
		
	
	
		
		
			
				
					|  |  | @ -304,6 +319,12 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |                             actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); |  |  |  |                             actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + calCountUtil.getUseActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (actCount1 > collectOrderBiz.getCount()) { |  |  |  |                         if (actCount1 > collectOrderBiz.getCount()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (needCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 if (vailInSplit(collectOrderBiz, collectOrder.getWorkPlaceCode(), needCount)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     throw new JsonException(502, "当前拆零数量还有剩余,是否继续扫码?"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             throw new JsonException(502, "扫码数量超出!"); |  |  |  |                             throw new JsonException(502, "扫码数量超出!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         collectOrderBiz.setScanCount(count1); |  |  |  |                         collectOrderBiz.setScanCount(count1); | 
			
		
	
	
		
		
			
				
					|  |  | @ -359,6 +380,21 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |         return collectOrder; |  |  |  |         return collectOrder; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     IoSplitCodeService splitCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 校验当前产品是否拆零表库存 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public Boolean vailInSplit(IoCollectOrderBiz collectOrderBiz, Long workPlaceCode, Integer needCount) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoSplitCodeEntity> ioSplitCodeEntities = splitCodeService.findSplitCodes(collectOrderBiz.getRelId(), collectOrderBiz.getBatchNo(), workPlaceCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (IntUtil.value(ioSplitCodeEntity.getRemainCount()) > needCount) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public IoCollectOrderBiz scanGenOrder(List<UdiRelevanceResponse> udiRelevanceResponses, List<IoCollectOrderBiz> collectOrderBizs, UdiEntity udiEntity, IoCollectOrder collectOrder) { |  |  |  |     public IoCollectOrderBiz scanGenOrder(List<UdiRelevanceResponse> udiRelevanceResponses, List<IoCollectOrderBiz> collectOrderBizs, UdiEntity udiEntity, IoCollectOrder collectOrder) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) { |  |  |  |         for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |