|  |  | @ -46,6 +46,7 @@ import com.glxp.api.service.inout.IoAddInoutService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.IoCheckInoutService; |  |  |  | import com.glxp.api.service.inout.IoCheckInoutService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.IoOrderDetailBizService; |  |  |  | import com.glxp.api.service.inout.IoOrderDetailBizService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.IoOrderService; |  |  |  | import com.glxp.api.service.inout.IoOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.inv.impl.InvProductService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.system.SystemParamConfigService; |  |  |  | import com.glxp.api.service.system.SystemParamConfigService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.ThrInvOrderService; |  |  |  | import com.glxp.api.service.thrsys.ThrInvOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.ThrSystemBusApiService; |  |  |  | import com.glxp.api.service.thrsys.ThrSystemBusApiService; | 
			
		
	
	
		
		
			
				
					|  |  | @ -61,6 +62,7 @@ import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.transaction.annotation.Transactional; |  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.math.BigDecimal; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.text.ParseException; |  |  |  | import java.text.ParseException; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.text.SimpleDateFormat; |  |  |  | import java.text.SimpleDateFormat; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.*; |  |  |  | import java.util.*; | 
			
		
	
	
		
		
			
				
					|  |  | @ -336,8 +338,13 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); |  |  |  |         filterInvProductRequest.setStartDate(stringToDate(days + " 00:00:00")); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); |  |  |  |         filterInvProductRequest.setEndDate(stringToDate(days + " 23:59:59")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (thrInvOrderMapper.countDownloadsInRange(filterInvProductRequest.getStartDate(), filterInvProductRequest.getEndDate()) <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             handleExternalThrInvSfOrder(filterInvProductRequest); |  |  |  |             handleExternalThrInvSfOrder(filterInvProductRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |             log.info("自动抓取第三方收费出入库明细生成单据定时任务结束"); |  |  |  |             log.info("自动抓取第三方收费出入库明细生成单据定时任务结束"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             log.info("已下载户略"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -703,9 +710,10 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                             //校验产品是否被供应商关联
 |  |  |  |                             //校验产品是否被供应商关联
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                             CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); |  |  |  |                             CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             if (udiRlSupEntity != null) |  |  |  |                             if (udiRlSupEntity != null) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 item.setPrice(udiRlSupEntity.getPrice()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 item.setSupId(udiRlSupEntity.getCustomerId()); |  |  |  |                                 item.setSupId(udiRlSupEntity.getCustomerId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             else |  |  |  |                             } else | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 exmsg.append(thrCode + "供应商未关联"); |  |  |  |                                 exmsg.append(thrCode + "供应商未关联"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } else { |  |  |  |                         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             exmsg.append(thrCode + ","); |  |  |  |                             exmsg.append(thrCode + ","); | 
			
		
	
	
		
		
			
				
					|  |  | @ -841,22 +849,12 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (CollUtil.isNotEmpty(thrInvOrders)) { |  |  |  |         if (CollUtil.isNotEmpty(thrInvOrders)) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (ThrInvOrder thrInvOrder : thrInvOrders) { |  |  |  |             for (ThrInvOrder thrInvOrder : thrInvOrders) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 /** |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                  * 1、根据 外检单号 进行 分组 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                  * 2、遍历不同分组 在分组的列表再次进行匹配 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                  * 3、匹配到的列表 不为空  进行 新增关联的单据  插入明细操作 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                  * 4、需要 回写三方的明细表 标记已处理 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                  */ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList( |  |  |  |                 List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList( | 
			
		
	
		
		
			
				
					
					|  |  |  |                         new LambdaQueryWrapper<ThrInvOrderDetail>() |  |  |  |                         new LambdaQueryWrapper<ThrInvOrderDetail>() | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .and(o -> o.isNull(ThrInvOrderDetail::getHandleStatus).or().ne(ThrInvOrderDetail::getHandleStatus, 1)). |  |  |  |                                 .and(o -> o.isNull(ThrInvOrderDetail::getHandleStatus).or().ne(ThrInvOrderDetail::getHandleStatus, 1)). | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 eq(ThrInvOrderDetail::getOrderIdFk, thrInvOrder.getBillNo()) |  |  |  |                                 eq(ThrInvOrderDetail::getOrderIdFk, thrInvOrder.getBillNo()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ); |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollectionUtil.isEmpty(thrInvOrderDetails)) continue; |  |  |  |                 if (CollectionUtil.isEmpty(thrInvOrderDetails)) continue; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 log.info("扫描处理第三方收费明细生成单据定时任务==orderIdFk==:[" + thrInvOrder.getBillNo() + "]"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //新单号
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //通过单号获取单据信息
 |  |  |  |                 //通过单号获取单据信息
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper<ThrInvOrder> qw = new QueryWrapper<>(); |  |  |  |                 QueryWrapper<ThrInvOrder> qw = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 qw.eq("billNo", thrInvOrder.getBillNo()); |  |  |  |                 qw.eq("billNo", thrInvOrder.getBillNo()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -895,6 +893,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 }); |  |  |  |                                 }); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 fullGen.getAndIncrement(); |  |  |  |                                 fullGen.getAndIncrement(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             updateThrInvOrderDetails.add(item); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     }); |  |  |  |                     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (thrInvOrderDetails.size() == fullGen.intValue()) { |  |  |  |                     if (thrInvOrderDetails.size() == fullGen.intValue()) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -944,23 +944,24 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //新增明细
 |  |  |  |                 //新增明细
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollectionUtil.isNotEmpty(addThrInvOrderDetails)) { |  |  |  |                 if (CollectionUtil.isNotEmpty(addThrInvOrderDetails)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     thrInvOrderDetailMapper.insertBatch(addThrInvOrderDetails); |  |  |  |                     thrInvOrderDetailMapper.insertBatch(addThrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genOrder(thrInvOrder, bussinessTypeEntity, addThrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //更新明细
 |  |  |  |                 //更新明细
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollectionUtil.isNotEmpty(updateThrInvOrderDetails)) { |  |  |  |                 if (CollectionUtil.isNotEmpty(updateThrInvOrderDetails)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails); |  |  |  |                     thrInvOrderDetailMapper.updateBatchById(updateThrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     genOrder(thrInvOrder, bussinessTypeEntity, updateThrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 genOrder(thrInvOrder, bussinessTypeEntity); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 log.info("扫描处理第三方收费明细生成单据定时任务结束"); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public boolean genOrder( |  |  |  |     public boolean genOrder( | 
			
		
	
		
		
			
				
					
					|  |  |  |             ThrInvOrder thrInvOrder, BasicBussinessTypeEntity bussinessTypeEntity) { |  |  |  |             ThrInvOrder thrInvOrder, BasicBussinessTypeEntity bussinessTypeEntity, List<ThrInvOrderDetail> thrInvOrderDetails) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         QueryWrapper<ThrInvOrderDetail> qwd = new QueryWrapper<>(); |  |  |  | //        QueryWrapper<ThrInvOrderDetail> qwd = new QueryWrapper<>();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         qwd.eq("orderIdFk", thrInvOrder.getBillNo()); |  |  |  | //        qwd.eq("orderIdFk", thrInvOrder.getBillNo());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(qwd); |  |  |  | //        List<ThrInvOrderDetail> thrInvOrderDetails = thrInvOrderDetailMapper.selectList(qwd);
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if (CollectionUtil.isEmpty(thrInvOrderDetails)) |  |  |  |         if (CollectionUtil.isEmpty(thrInvOrderDetails)) | 
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -995,7 +996,9 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setCorpOrderId(UUID.randomUUID() + "");//单据号
 |  |  |  |             ioOrderEntity.setCorpOrderId(UUID.randomUUID() + "");//单据号
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setThrOrderIdFk(thrInvOrder.getBillNo());//单据号
 |  |  |  |             ioOrderEntity.setThrOrderIdFk(thrInvOrder.getBillNo());//单据号
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setUpdateTime(new Date()); |  |  |  |             ioOrderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (thrInvOrder.getStartDate() != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioOrderEntity.setCreateTime(new Date()); |  |  |  |                 ioOrderEntity.setCreateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setCustomerId("110"); |  |  |  |             ioOrderEntity.setCustomerId("110"); | 
			
		
	
		
		
			
				
					
					|  |  |  |             Long userId = 1l; |  |  |  |             Long userId = 1l; | 
			
		
	
		
		
			
				
					
					|  |  |  | //            try {
 |  |  |  | //            try {
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -1003,8 +1006,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | //            } catch (Exception e) {
 |  |  |  | //            } catch (Exception e) {
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //                e.printStackTrace();
 |  |  |  | //                e.printStackTrace();
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //            }
 |  |  |  | //            }
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setCreateUser(userId + ""); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setUpdateUser(userId + ""); |  |  |  |             ioOrderEntity.setUpdateUser(userId + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ioOrderEntity.setCreateUser(userId + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理
 |  |  |  |             ioOrderEntity.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);//正常单据处理
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoOrderDetailBizEntity> newOrderDetailBiz = new ArrayList<>(); |  |  |  |             List<IoOrderDetailBizEntity> newOrderDetailBiz = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (entry.getValue().size() > 0) { |  |  |  |             if (entry.getValue().size() > 0) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -1018,6 +1021,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 使用substring()去掉第一个字符
 |  |  |  |                 // 使用substring()去掉第一个字符
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 toBillNo = toBillNo.substring(1); |  |  |  |                 toBillNo = toBillNo.substring(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             thrInvOrderDetailMapper.updateBatchById(thrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |             thrInvOrder.setToBillNo(toBillNo); |  |  |  |             thrInvOrder.setToBillNo(toBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |             thrInvOrderMapper.updateById(thrInvOrder); |  |  |  |             thrInvOrderMapper.updateById(thrInvOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioOrderService.insertOrder(ioOrderEntity); |  |  |  |             ioOrderService.insertOrder(ioOrderEntity); | 
			
		
	
	
		
		
			
				
					|  |  | @ -1110,11 +1114,13 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 item.setRelId(relId); |  |  |  |                                 item.setRelId(relId); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 item.setHandleStatus(1); |  |  |  |                                 item.setHandleStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 item.setToBillNo(newBillNo); |  |  |  |                                 item.setToBillNo(newBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 updateThrInvOrderDetails.add(item); |  |  |  |                                 updateThrInvOrderDetails.add(item); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 //校验产品是否被供应商关联
 |  |  |  |                                 //校验产品是否被供应商关联
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); |  |  |  |                                 CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 if (udiRlSupEntity != null) |  |  |  |                                 if (udiRlSupEntity != null) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                     item.setSupId(udiRlSupEntity.getCustomerId()); |  |  |  |                                     item.setSupId(udiRlSupEntity.getCustomerId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } else { |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
	
		
		
			
				
					|  |  | @ -1183,6 +1189,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrder.setToBillNo(toBillNo); |  |  |  |                 thrInvOrder.setToBillNo(toBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrderMapper.updateById(thrInvOrder); |  |  |  |                 thrInvOrderMapper.updateById(thrInvOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 thrInvOrderDetails.forEach(item -> { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             item.setToBillNo(newBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 thrInvOrderDetailMapper.updateBatchById(thrInvOrderDetails); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioOrderService.insertOrder(ioOrderEntity); |  |  |  |                 ioOrderService.insertOrder(ioOrderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz); |  |  |  |                 ioOrderDetailBizService.batchInsertBizs(newOrderDetailBiz); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //自动处理业务单据
 |  |  |  |                 //自动处理业务单据
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -1337,10 +1348,12 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity(); |  |  |  |                     IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     parameterPackag(basicProductsEntity, ioOrderDetailBizEntity, thrInvOrderDetail); |  |  |  |                     parameterPackag(basicProductsEntity, ioOrderDetailBizEntity, thrInvOrderDetail); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     ioOrderDetailBizEntity.setOrderIdFk(newBillNo); |  |  |  |                     ioOrderDetailBizEntity.setOrderIdFk(newBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     ioOrderDetailBizEntity.setBatchNo("/"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     thrInvOrderDetail.setToBillNo(newBillNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     thrInvOrderDetail.setHandleStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     newOrderDetailBiz.add(ioOrderDetailBizEntity); |  |  |  |                     newOrderDetailBiz.add(ioOrderDetailBizEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         return true; |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -1451,6 +1464,10 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     InvProductService invProductService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 将三方的出入库明细列表 转换为 系统的出入库单据明细 |  |  |  |      * 将三方的出入库明细列表 转换为 系统的出入库单据明细 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
	
		
		
			
				
					|  |  | @ -1487,15 +1504,31 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrderDetail.setRelId(relId); |  |  |  |                 thrInvOrderDetail.setRelId(relId); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrderDetail.setThrCode(thrCode); |  |  |  |                 thrInvOrderDetail.setThrCode(thrCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrderDetail.setReCount(String.valueOf(count)); |  |  |  |                 thrInvOrderDetail.setReCount(String.valueOf(count)); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 thrInvOrderDetails.add(thrInvOrderDetail); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (ObjectUtil.isNull(relId)) { |  |  |  |                 if (ObjectUtil.isNull(relId)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     exmsg.append(thrCode + ","); |  |  |  |                     exmsg.append(thrCode + ","); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //校验产品是否被供应商关联
 |  |  |  |                 //校验产品是否被供应商关联
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CompanyProductRelevanceEntity udiRlSupEntity = udiRlSupService.selOneByRlId(relId); |  |  |  |                 List<UdiRlSupEntity> udiRlSupEntitys = udiRlSupService.findByUdiRlId(relId); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if (udiRlSupEntity != null) |  |  |  |                 if (CollUtil.isNotEmpty(udiRlSupEntitys)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (UdiRlSupEntity udiRlSupEntity : udiRlSupEntitys) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         Integer count1 = invProductService.selectExitCount("1000000", Long.parseLong(udiRlSupEntity.getCustomerId()), Long.parseLong(udiRlSupEntity.getUdiRlIdFk())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (IntUtil.value(count1 > 0)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             thrInvOrderDetail.setSupId(udiRlSupEntity.getCustomerId()); |  |  |  |                             thrInvOrderDetail.setSupId(udiRlSupEntity.getCustomerId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (udiRlSupEntity.getPrice() == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 thrInvOrderDetail.setPrice(BigDecimal.ZERO); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             else |  |  |  |                             else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 thrInvOrderDetail.setPrice(udiRlSupEntity.getPrice()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (thrInvOrderDetail.getSupId() == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         thrInvOrderDetail.setSupId(udiRlSupEntitys.get(0).getCustomerId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (udiRlSupEntitys.get(0).getPrice() == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             thrInvOrderDetail.setPrice(BigDecimal.ZERO); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             thrInvOrderDetail.setPrice(udiRlSupEntitys.get(0).getPrice()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else | 
			
		
	
		
		
			
				
					
					|  |  |  |                     exmsg.append(thrCode + "供应商未关联"); |  |  |  |                     exmsg.append(thrCode + "供应商未关联"); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -1518,7 +1551,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else {//走项目组套
 |  |  |  |         } else {//走项目组套
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             thrInvOrder.setSkProject(1); |  |  |  |             thrInvOrder.setSkProject(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |             StringBuilder exmsg = new StringBuilder(""); |  |  |  |             StringBuilder exmsg = new StringBuilder(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |             list.forEach(item -> { |  |  |  |             list.forEach(item -> { | 
			
		
	
	
		
		
			
				
					|  |  | @ -1533,24 +1565,24 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //通过thrCode获取到项目组套
 |  |  |  |                 //通过thrCode获取到项目组套
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode); |  |  |  |                 List<BasicSkProjectDetailEntity> skProjectDetailEntityList = basicDestinyRelService.filterDestinyRelListByPId(thrCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollectionUtil.isNotEmpty(skProjectDetailEntityList) && count > 0) { |  |  |  |                 if (CollectionUtil.isNotEmpty(skProjectDetailEntityList) && count > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     Integer finalCount = count; |  |  |  |                     Integer finalCount = count; | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (IntUtil.value(cpMutiFilter) > 0 && IntUtil.value(finalCount) > 1) { |  |  |  |                     if (IntUtil.value(cpMutiFilter) > 0 && skProjectDetailEntityList.size() > 1) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         log.error(item.getCpmctymc() + "," + item.getThrCode() + "项目关联多个耗材对照,已杯过滤!"); |  |  |  |                         log.error(item.getCpmctymc() + "," + item.getThrCode() + "项目关联多个耗材对照,已被过滤!"); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } else { |  |  |  |                     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         skProjectDetailEntityList.forEach(sk -> { |  |  |  |                         skProjectDetailEntityList.forEach(sk -> { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail(); |  |  |  |                             ThrInvOrderDetail thrInvOrderDetail = new ThrInvOrderDetail(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             BeanUtils.copyProperties(item, thrInvOrderDetail); |  |  |  |                             BeanUtils.copyProperties(item, thrInvOrderDetail); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             thrInvOrderDetail.setOrderIdFk(billNo); |  |  |  |                             thrInvOrderDetail.setOrderIdFk(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             thrInvOrderDetail.setRelId(sk.getRelId()); |  |  |  |                             thrInvOrderDetail.setRelId(sk.getRelId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             thrInvOrderDetail.setSupId(sk.getSupId() + ""); |  |  |  |                             thrInvOrderDetail.setSupId(sk.getSupId() + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             UdiRlSupEntity udiRlSupEntity = udiRlSupService.findByUdiRlIdUnitFk(thrInvOrderDetail.getRelId() + "", thrInvOrderDetail.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (udiRlSupEntity != null && udiRlSupEntity.getPrice() != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 thrInvOrderDetail.setPrice(udiRlSupEntity.getPrice()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             Integer skCount = sk.getCount(); |  |  |  |                             Integer skCount = sk.getCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             if (skCount != null && skCount > 0) { |  |  |  |                             if (skCount != null && skCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount)); |  |  |  |                                 thrInvOrderDetail.setReCount(String.valueOf(skCount * finalCount)); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             //过滤是否高值
 |  |  |  |                             //过滤是否高值
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                             if (IntUtil.value(highFilter) > 0) { |  |  |  |                             if (IntUtil.value(highFilter) > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(sk.getRelId()); |  |  |  |                                 UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(sk.getRelId()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -1560,7 +1592,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } else { |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 thrInvOrderDetails.add(thrInvOrderDetail); |  |  |  |                                 thrInvOrderDetails.add(thrInvOrderDetail); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         }); |  |  |  |                         }); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |