|  |  |  | @ -267,30 +267,39 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo | 
			
		
	
		
			
				
					|  |  |  |  |                                 .filter(item -> | 
			
		
	
		
			
				
					|  |  |  |  |                                         IntUtil.value(item.getRemoveFlag()) && item.getBizIdFk().equals(collectOrderBiz.getId())) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .findFirst(); | 
			
		
	
		
			
				
					|  |  |  |  |                         IoCollectOrderCodeMan result = null; | 
			
		
	
		
			
				
					|  |  |  |  |                         if (firstMatch.isPresent()) { | 
			
		
	
		
			
				
					|  |  |  |  |                             IoCollectOrderCodeMan result = firstMatch.get(); | 
			
		
	
		
			
				
					|  |  |  |  |                             IoSplitCodeEntity ioSplitCodeEntity = IoSplitCodeEntity.builder().code(result.getUdiCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .errUdiCode(result.getUdiCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .orderId(result.getOrderIdFk()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .action(collectOrder.getBusType()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .relId(result.getRelId()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .nameCode(result.getNameCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .batchNo(result.getBatchNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .produceDate(result.getProductDate()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .expireDate(result.getExpireDate()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .serialNo(result.getSerialNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .scanCount(result.getScanCount()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .totalCount(result.getScanCount()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .workPlaceCode(putWorkPlaceCode) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .status(2) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .fifoSplit(1) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .createTime(new Date()).updateTime(new Date()) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .remainCount(-unTagCount).build(); | 
			
		
	
		
			
				
					|  |  |  |  |                             this.decorateUnpackExpireTime(ioSplitCodeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                             splitCodeService.save(ioSplitCodeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                             result = firstMatch.get(); | 
			
		
	
		
			
				
					|  |  |  |  |                         } else { | 
			
		
	
		
			
				
					|  |  |  |  |                             Optional<IoCollectOrderCodeMan> firstMatch1 = collectOrderCodeMEN.stream() | 
			
		
	
		
			
				
					|  |  |  |  |                                     .filter(item -> | 
			
		
	
		
			
				
					|  |  |  |  |                                             item.getBizIdFk().equals(collectOrderBiz.getId())) | 
			
		
	
		
			
				
					|  |  |  |  |                                     .findFirst(); | 
			
		
	
		
			
				
					|  |  |  |  |                             if (firstMatch1.isPresent()) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 result = firstMatch1.get(); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         IoSplitCodeEntity ioSplitCodeEntity = IoSplitCodeEntity.builder().code(result.getUdiCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .errUdiCode(result.getUdiCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .orderId(result.getOrderIdFk()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .action(collectOrder.getBusType()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .relId(result.getRelId()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .nameCode(result.getNameCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .batchNo(result.getBatchNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .produceDate(result.getProductDate()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .expireDate(result.getExpireDate()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .serialNo(result.getSerialNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .scanCount(result.getScanCount()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .totalCount(result.getScanCount()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .workPlaceCode(putWorkPlaceCode) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .status(2) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .fifoSplit(1) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .createTime(new Date()).updateTime(new Date()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .remainCount(-unTagCount).build(); | 
			
		
	
		
			
				
					|  |  |  |  |                         this.decorateUnpackExpireTime(ioSplitCodeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         splitCodeService.save(ioSplitCodeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 continue; | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
	
		
			
				
					|  |  |  | @ -502,7 +511,7 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //包装拆包失效时间
 | 
			
		
	
		
			
				
					|  |  |  |  |     void decorateUnpackExpireTime(IoSplitCodeEntity ioSplitCodeEntity){ | 
			
		
	
		
			
				
					|  |  |  |  |     void decorateUnpackExpireTime(IoSplitCodeEntity ioSplitCodeEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |         Long relId = ioSplitCodeEntity.getRelId(); | 
			
		
	
		
			
				
					|  |  |  |  |         UdiRelevanceEntity relevanceEntity = udiRelevanceService.getById(relId); | 
			
		
	
		
			
				
					|  |  |  |  |         int n = IntUtil.value(relevanceEntity.getUnpackUseTime()); | 
			
		
	
	
		
			
				
					|  |  |  | @ -523,11 +532,11 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo | 
			
		
	
		
			
				
					|  |  |  |  |     public void asyncUnpackExpireTask() { | 
			
		
	
		
			
				
					|  |  |  |  |         LambdaQueryWrapper<IoSplitCodeEntity> lqw = new LambdaQueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         Date now = new Date(); | 
			
		
	
		
			
				
					|  |  |  |  |         lqw.lt(IoSplitCodeEntity::getUnpackExpireTime,now); | 
			
		
	
		
			
				
					|  |  |  |  |         lqw.lt(IoSplitCodeEntity::getUnpackExpireTime, now); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoSplitCodeEntity> ioSplitCodeEntities = splitCodeMapper.selectList(lqw); | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(ioSplitCodeEntities)){ | 
			
		
	
		
			
				
					|  |  |  |  |          //进行损耗出库
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(ioSplitCodeEntities)) { | 
			
		
	
		
			
				
					|  |  |  |  |             //进行损耗出库
 | 
			
		
	
		
			
				
					|  |  |  |  |             IoSplitDesOrder collectOrder; | 
			
		
	
		
			
				
					|  |  |  |  |             List<IoSplitDesOrderDetail> splitDesOrderDetails = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |             List<Long> removeByIds = new ArrayList<>(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -546,7 +555,7 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo | 
			
		
	
		
			
				
					|  |  |  |  |                     .build(); | 
			
		
	
		
			
				
					|  |  |  |  |             splitDesOrderService.save(collectOrder); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             ioSplitCodeEntities.forEach( splitCodeEntity -> { | 
			
		
	
		
			
				
					|  |  |  |  |             ioSplitCodeEntities.forEach(splitCodeEntity -> { | 
			
		
	
		
			
				
					|  |  |  |  |                 //损耗详细表
 | 
			
		
	
		
			
				
					|  |  |  |  |                 IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder() | 
			
		
	
		
			
				
					|  |  |  |  |                         .id(IdUtil.getSnowflakeNextId()) | 
			
		
	
	
		
			
				
					|  |  |  | 
 |