|  |  | @ -1,7 +1,10 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.api.service.inout; |  |  |  | package com.glxp.api.service.inout; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.basic.UdiRelevanceEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inv.impl.InvProductDetailService; |  |  |  | import com.glxp.api.service.inv.impl.InvProductDetailService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.util.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.BeanUtils; |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.collection.CollUtil; |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.lang.UUID; |  |  |  | import cn.hutool.core.lang.UUID; | 
			
		
	
	
		
		
			
				
					|  |  | @ -20,10 +23,6 @@ import com.glxp.api.service.basic.IBasicBusTypePreService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.IBasicBussinessTypeService; |  |  |  | import com.glxp.api.service.basic.IBasicBussinessTypeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.impl.IoOrderInvoiceService; |  |  |  | import com.glxp.api.service.inout.impl.IoOrderInvoiceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.system.SystemParamConfigService; |  |  |  | import com.glxp.api.service.system.SystemParamConfigService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.CustomUtil; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.MsDateUtil; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.GennerOrderUtils; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.OrderNoTypeBean; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.context.annotation.Lazy; |  |  |  | import org.springframework.context.annotation.Lazy; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -146,6 +145,9 @@ public class IoChangeInoutService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return invCount; |  |  |  |         return invCount; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     UdiRelevanceService udiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //生成单据
 |  |  |  |     //生成单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity, boolean isGenInovice) { |  |  |  |     public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity, boolean isGenInovice) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -157,8 +159,38 @@ public class IoChangeInoutService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (useInList.size() <= 0) { |  |  |  |         if (useInList.size() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, List<IoCodeEntity>> filterSupMaps = new HashMap<>(); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         BasicBussinessTypeEntity targetBustypeEntity = basicBussinessTypeService.findByAction(bussinessChangeTypeEntity.getAction()); |  |  |  |         BasicBussinessTypeEntity targetBustypeEntity = basicBussinessTypeService.findByAction(bussinessChangeTypeEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, useInList, orderEntity, isGenInovice);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoCodeEntity> groupBuyList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoCodeEntity> unGroupBuyList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (IntUtil.value(targetBustypeEntity.getGroupBuySplit()) == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //过滤集采、非集采
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (IoCodeEntity codeEntity : useInList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(codeEntity.getRelId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (IntUtil.value(udiRelevanceEntity.getGroupBuy())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     groupBuyList.add(codeEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     unGroupBuyList.add(codeEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (CollUtil.isNotEmpty(groupBuyList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, groupBuyList, orderEntity, isGenInovice); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (CollUtil.isNotEmpty(unGroupBuyList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, unGroupBuyList, orderEntity, isGenInovice); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             buildGenOrder(targetBustypeEntity, bussinessChangeTypeEntity, useInList, orderEntity, isGenInovice); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void buildGenOrder(BasicBussinessTypeEntity targetBustypeEntity, BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity, boolean isGenInvoice) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, List<IoCodeEntity>> filterSupMaps = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         //过滤供应商
 |  |  |  |         //过滤供应商
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (targetBustypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT || bussinessChangeTypeEntity.getCreateType() == 3 || bussinessChangeTypeEntity.getCreateType() == 4) { |  |  |  |         if (targetBustypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT || bussinessChangeTypeEntity.getCreateType() == 3 || bussinessChangeTypeEntity.getCreateType() == 4) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (IoCodeEntity warehouseEntity : useInList) { |  |  |  |             for (IoCodeEntity warehouseEntity : useInList) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -293,7 +325,7 @@ public class IoChangeInoutService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (isGenInovice) { |  |  |  |             if (isGenInvoice) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 //生成发票信息
 |  |  |  |                 //生成发票信息
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<IoOrderInvoiceEntity> invoiceEntities = ioOrderInvoiceService.findByBillNo(orderEntity.getBillNo()); |  |  |  |                 List<IoOrderInvoiceEntity> invoiceEntities = ioOrderInvoiceService.findByBillNo(orderEntity.getBillNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollUtil.isNotEmpty(invoiceEntities)) { |  |  |  |                 if (CollUtil.isNotEmpty(invoiceEntities)) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |