|  |  |  | @ -126,22 +126,29 @@ public class ForThirdSysApiController { | 
			
		
	
		
			
				
					|  |  |  |  |             if (codeEntity == null) | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error("库存未找到该UDI码,请检查该UDI是否存在错误!"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         //1.获取预验收库存
 | 
			
		
	
		
			
				
					|  |  |  |  |         InvWarehouseEntity preInInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN); | 
			
		
	
		
			
				
					|  |  |  |  |         if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |             count = invPreinProductDetailService.vailStockCountByCode(null, preInInv.getCode(), null, filterInvProductRequest.getUdiCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         } else | 
			
		
	
		
			
				
					|  |  |  |  |             count = invPreinProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, preInInv.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (count == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             //2.获取寄售库存
 | 
			
		
	
		
			
				
					|  |  |  |  |             InvWarehouseEntity preInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_ADVANCE); | 
			
		
	
		
			
				
					|  |  |  |  |             count = invPreProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, preInv.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         if (count == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             //3.获取入账库库存
 | 
			
		
	
		
			
				
					|  |  |  |  |             count = invProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, filterInvProductRequest.getInvCode(), null, true); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         Integer purType = checkUdi.getPurType(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (purType != null && purType == 2) { | 
			
		
	
		
			
				
					|  |  |  |  |             count = 1; | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             //1.获取预验收库存
 | 
			
		
	
		
			
				
					|  |  |  |  |             InvWarehouseEntity preInInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCountByCode(null, preInInv.getCode(), null, filterInvProductRequest.getUdiCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             } else | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, preInInv.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             if (count == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                 //2.获取寄售库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                 InvWarehouseEntity preInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_ADVANCE); | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, preInv.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             if (count == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                 //3.获取入账库库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invProductDetailService.vailStockCount(checkUdi.getRelId(), udiEntity.getBatchNo(), null, null, filterInvProductRequest.getInvCode(), null, true); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         InvProductResponse invProductResponse = new InvProductResponse(); | 
			
		
	
		
			
				
					|  |  |  |  |         BeanUtil.copyProperties(checkUdi, invProductResponse); | 
			
		
	
		
			
				
					|  |  |  |  |         invProductResponse.setThrCode(checkUdi.getThirdId()); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |