|  |  | @ -15,6 +15,7 @@ import com.glxp.api.constant.WorkOperType; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.collect.IoCollectOrderCodeManMapper; |  |  |  | import com.glxp.api.dao.collect.IoCollectOrderCodeManMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.auth.InvWarehouseEntity; |  |  |  | import com.glxp.api.entity.auth.InvWarehouseEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.auth.SysWorkplace; |  |  |  | import com.glxp.api.entity.auth.SysWorkplace; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.basic.BasicBussinessTypeEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity; |  |  |  | import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.basic.SysWorkplacePutRel; |  |  |  | import com.glxp.api.entity.basic.SysWorkplacePutRel; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.basic.UdiEntity; |  |  |  | import com.glxp.api.entity.basic.UdiEntity; | 
			
		
	
	
		
		
			
				
					|  |  | @ -37,10 +38,13 @@ import com.glxp.api.service.auth.CustomerService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.InvWarehouseService; |  |  |  | import com.glxp.api.service.auth.InvWarehouseService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.SysWorkplaceService; |  |  |  | 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.IBasicBussinessTypeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 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.IoCodeLostService; |  |  |  | import com.glxp.api.service.inout.IoCodeLostService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.inout.IoCodeTempService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.IoSplitCodeService; |  |  |  | import com.glxp.api.service.inout.IoSplitCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inv.AnncmntProductService; |  |  |  | import com.glxp.api.service.inv.AnncmntProductService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; |  |  |  | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.SysWorkplacePutRelService; |  |  |  | import com.glxp.api.service.thrsys.SysWorkplacePutRelService; | 
			
		
	
	
		
		
			
				
					|  |  | @ -96,6 +100,13 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCollectCodeBackService ioCollectCodeBackService; |  |  |  |     IoCollectCodeBackService ioCollectCodeBackService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private IBasicBussinessTypeService basicBussinessTypeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     IoCodeService codeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private IoCodeTempService codeTempService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<CollectOrderCodeManResponse> filterList(CollectOrderCodeManRequest collectOrderCodeManRequest) { |  |  |  |     public List<CollectOrderCodeManResponse> filterList(CollectOrderCodeManRequest collectOrderCodeManRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (collectOrderCodeManRequest == null) { |  |  |  |         if (collectOrderCodeManRequest == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return Collections.emptyList(); |  |  |  |             return Collections.emptyList(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -203,6 +214,44 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  | //            }
 |  |  |  | //            }
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  | //        }
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //2-1.校验预验收库存是否已存在
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String preInBillNo = addTagCodeReqeust.getPreInBillNo(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String orderId = addTagCodeReqeust.getBillNo(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (StrUtil.isNotEmpty(preInBillNo)){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction("SC74047369831589"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 2)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (bussinessTypeEntity.getBackPreinType() == 1 && bussinessTypeEntity.isPreInBack()) {//按单出库&& bussinessTypeEntity.isPreInBack()
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     String orderIds = preInBillNo; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (StrUtil.isNotEmpty(orderIds)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         String[] orderIdArray = orderIds.split(","); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         List<String> orderList = CollUtil.toList(orderIdArray); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         int count = codeService.findByOrderIdsCount(orderList, code); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (count <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                            throw new JsonException(500, "非预验收单产品或预验收库存数量不足!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (StrUtil.isNotEmpty(orderId)) {//非首次添加
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 //无序列号,则可能存在多个预验收入库单
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 if (codeTempEntity != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     if (count < (codeTempEntity.getMyCount() + 1)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                         throw new JsonException(500, "超出预验收库存数量"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 if (count < 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     throw new JsonException(500, "预验收库存数量不足"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         throw new JsonException(500, "未选择预验收入库单,请先选择预验收入库单!"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //流通数量
 |  |  |  |         //流通数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Integer circleCount = calCountUtil.getCirActCount(udiRelevanceResponse); |  |  |  |         Integer circleCount = calCountUtil.getCirActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |         //使用数量
 |  |  |  |         //使用数量
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -772,4 +821,18 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode | 
			
		
	
		
		
			
				
					
					|  |  |  |     public Integer getScanCount(String billNo, Long relId) { |  |  |  |     public Integer getScanCount(String billNo, Long relId) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return collectOrderCodeManMapper.getScanCount(billNo,relId); |  |  |  |         return collectOrderCodeManMapper.getScanCount(billNo,relId); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param purType 1:入账库;2:预验收库;3:寄售库 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             udiRelevanceEntity, Integer purType) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (bussinessTypeEntity.getUseDyCount() == 2) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |