|  |  |  | @ -38,6 +38,7 @@ import com.glxp.api.util.StringUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.scheduling.annotation.Async; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.dao.collect.RelCodeBatchMapper; | 
			
		
	
	
		
			
				
					|  |  |  | @ -101,7 +102,6 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 手动添加 | 
			
		
	
		
			
				
					|  |  |  |  |      * | 
			
		
	
	
		
			
				
					|  |  |  | @ -280,6 +280,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     SpsDirectClient spsDirectClient; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private SpGetHttpClient spGetHttpClient; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 层级编码查询spms同步库 | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
	
		
			
				
					|  |  |  | @ -299,11 +300,14 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     UdiProductService udiProductService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void threadUpdateIoCodeTempEntity(String parentCode) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         ThreadUtil.execAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |  |             List<IoCodeTempEntity> ioCodeTempEntities = ioCodeTempDao.selectList(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollUtil.isNotEmpty(ioCodeTempEntities)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 IoCodeTempEntity codeTempEntity = ioCodeTempEntities.get(0); | 
			
		
	
		
			
				
					|  |  |  |  |                 //1、排除掉层级是1的
 | 
			
		
	
		
			
				
					|  |  |  |  |                 UdiEntity udi = FilterUdiUtils.getUdi(parentCode); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if (udi == null) | 
			
		
	
		
			
				
					|  |  |  |  |                     return; | 
			
		
	
		
			
				
					|  |  |  |  |                 String udi1 = udi.getUdi(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -314,7 +318,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                         .eq(RelCodeBatch::getParentCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //
 | 
			
		
	
		
			
				
					|  |  |  |  |             if(navList == null || navList.size() == 0 ){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if (navList == null || navList.size() == 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                     CompanyEntity companyEntity = companyService.findCompany(); | 
			
		
	
		
			
				
					|  |  |  |  |                     BasicCorpEntity basicCorpEntity = basicCorpService.selectByErpId(codeTempEntity.getSupId()); | 
			
		
	
		
			
				
					|  |  |  |  |                     AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust = new AlihealthRelCodeInsertReqeust(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -326,31 +330,31 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                     alihealthRelCodeInsertReqeust.setRefEntId(companyEntity.getRefEntId()); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     BaseResponse baseResponse = spGetHttpClient.relCodeInsert(alihealthRelCodeInsertReqeust); | 
			
		
	
		
			
				
					|  |  |  |  |                 if(baseResponse.getCode() == 20000){ | 
			
		
	
		
			
				
					|  |  |  |  |                     System.out.println("sda"+baseResponse.getData().toString()); | 
			
		
	
		
			
				
					|  |  |  |  |                     AlihealthKytSinglerelationResponse alihealthKytSinglerelationResponse = JSONUtil.toBean(baseResponse.getData().toString(),AlihealthKytSinglerelationResponse.class); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (baseResponse.getCode() == 20000) { | 
			
		
	
		
			
				
					|  |  |  |  |                         System.out.println("sda" + baseResponse.getData().toString()); | 
			
		
	
		
			
				
					|  |  |  |  |                         AlihealthKytSinglerelationResponse alihealthKytSinglerelationResponse = JSONUtil.toBean(baseResponse.getData().toString(), AlihealthKytSinglerelationResponse.class); | 
			
		
	
		
			
				
					|  |  |  |  |                         // 返回的码关联关系进行插入
 | 
			
		
	
		
			
				
					|  |  |  |  |                     RelCodeBatch relCodeBatch =  alihealthKytSinglerelationResponse.disposeRelCodeBatch( alihealthRelCodeInsertReqeust.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |                     RelCodeBatch relCodeBatchOne  = relCodeBatchService.getOne(new QueryWrapper<RelCodeBatch>().eq("productCode",relCodeBatch.getProductCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                         RelCodeBatch relCodeBatch = alihealthKytSinglerelationResponse.disposeRelCodeBatch(alihealthRelCodeInsertReqeust.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |                         RelCodeBatch relCodeBatchOne = relCodeBatchService.getOne(new QueryWrapper<RelCodeBatch>().eq("productCode", relCodeBatch.getProductCode()) | 
			
		
	
		
			
				
					|  |  |  |  |                                 .last("limit 1") | 
			
		
	
		
			
				
					|  |  |  |  |                         ); | 
			
		
	
		
			
				
					|  |  |  |  |                     if(Objects.isNull(relCodeBatchOne)){ | 
			
		
	
		
			
				
					|  |  |  |  |                         if (Objects.isNull(relCodeBatchOne)) { | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeBatch.setCreateUser(alihealthRelCodeInsertReqeust.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeBatch.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeBatchService.save(relCodeBatch); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     }else { | 
			
		
	
		
			
				
					|  |  |  |  |                         relCodeBatchService.update(relCodeBatch,new QueryWrapper<RelCodeBatch>().eq("productCode",relCodeBatch.getProductCode())); | 
			
		
	
		
			
				
					|  |  |  |  |                         } else { | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeBatchService.update(relCodeBatch, new QueryWrapper<RelCodeBatch>().eq("productCode", relCodeBatch.getProductCode())); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     Integer  id = Objects.isNull(relCodeBatch.getId()) ? relCodeBatchOne.getId() :relCodeBatch.getId(); | 
			
		
	
		
			
				
					|  |  |  |  |                         Integer id = Objects.isNull(relCodeBatch.getId()) ? relCodeBatchOne.getId() : relCodeBatch.getId(); | 
			
		
	
		
			
				
					|  |  |  |  |                         // 进行查询
 | 
			
		
	
		
			
				
					|  |  |  |  |                         List<RelCodeDetail> list = alihealthKytSinglerelationResponse.disposeRelRodeDetailList(id); | 
			
		
	
		
			
				
					|  |  |  |  |                     if(list!=null && list.size()>0){ | 
			
		
	
		
			
				
					|  |  |  |  |                         if (list != null && list.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                             List curCodeList = new ArrayList(); | 
			
		
	
		
			
				
					|  |  |  |  |                             for (RelCodeDetail relCodeDetail : list) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 curCodeList.add(relCodeDetail.getCurCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         relCodeDetailService.remove(new QueryWrapper<RelCodeDetail>().in("curCode",curCodeList)); | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeDetailService.remove(new QueryWrapper<RelCodeDetail>().in("curCode", curCodeList)); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeDetailService.saveBatch(list); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -359,12 +363,12 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                         navList = this.list(new LambdaQueryWrapper<RelCodeBatch>() | 
			
		
	
		
			
				
					|  |  |  |  |                                 .eq(RelCodeBatch::getCurCode, parentCode)); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if(StringUtils.isEmpty(companyEntity.getRefEntId())){ | 
			
		
	
		
			
				
					|  |  |  |  |                         if (StringUtils.isEmpty(companyEntity.getRefEntId())) { | 
			
		
	
		
			
				
					|  |  |  |  |                             companyEntity.setRefEntId(alihealthKytSinglerelationResponse.getRefEntId()); | 
			
		
	
		
			
				
					|  |  |  |  |                             companyService.modifyCompany(companyEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                 }else { | 
			
		
	
		
			
				
					|  |  |  |  |                     if(StringUtils.isNotEmpty(companyEntity.getRefEntId())){ | 
			
		
	
		
			
				
					|  |  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |  |                         if (StringUtils.isNotEmpty(companyEntity.getRefEntId())) { | 
			
		
	
		
			
				
					|  |  |  |  |                             companyEntity.setRefEntId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                             companyService.modifyCompany(companyEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -381,11 +385,11 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                         ioCodeTempDao.updateById(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |  |                 ThreadUtil.execAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |  |                     asynThreadUpdateIoCodeTempEntity(parentCode, ioCodeTempEntities); | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -411,7 +415,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
			
				
					|  |  |  |  |     void ProcessData(Element rootElement){ | 
			
		
	
		
			
				
					|  |  |  |  |     void ProcessData(Element rootElement) { | 
			
		
	
		
			
				
					|  |  |  |  |         //截取Relation
 | 
			
		
	
		
			
				
					|  |  |  |  |         NodeList relation = rootElement.getElementsByTagName("Relation"); | 
			
		
	
		
			
				
					|  |  |  |  |         if (relation == null) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -484,19 +488,19 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                         relCodeDetail.setFlag(Integer.valueOf(flag)); | 
			
		
	
		
			
				
					|  |  |  |  |                         //判断是否已存在
 | 
			
		
	
		
			
				
					|  |  |  |  |                         List<RelCodeDetail> relCodeDetails = codeMap.get(StrUtil.isNotBlank(parentCode) ? parentCode : "0"); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (relCodeDetails == null){ | 
			
		
	
		
			
				
					|  |  |  |  |                         if (relCodeDetails == null) { | 
			
		
	
		
			
				
					|  |  |  |  |                             List<RelCodeDetail> newRelCodeDetails = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                             newRelCodeDetails.add(relCodeDetail); | 
			
		
	
		
			
				
					|  |  |  |  |                             codeMap.put(StrUtil.isNotBlank(parentCode) ? parentCode : "0",newRelCodeDetails); | 
			
		
	
		
			
				
					|  |  |  |  |                         }else { | 
			
		
	
		
			
				
					|  |  |  |  |                             codeMap.put(StrUtil.isNotBlank(parentCode) ? parentCode : "0", newRelCodeDetails); | 
			
		
	
		
			
				
					|  |  |  |  |                         } else { | 
			
		
	
		
			
				
					|  |  |  |  |                             relCodeDetails.add(relCodeDetail); | 
			
		
	
		
			
				
					|  |  |  |  |                             codeMap.put(StrUtil.isNotBlank(parentCode) ? parentCode : "0",relCodeDetails); | 
			
		
	
		
			
				
					|  |  |  |  |                             codeMap.put(StrUtil.isNotBlank(parentCode) ? parentCode : "0", relCodeDetails); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //开始处理codeMap
 | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!codeMap.isEmpty()){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!codeMap.isEmpty()) { | 
			
		
	
		
			
				
					|  |  |  |  |                     Map<String, Integer> batchIdFkMap = new HashMap<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                     List<RelCodeDetail> addRelCodeDetail = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                     RelCodeBatch updateDrugLevelRelCodeBatch = null; | 
			
		
	
	
		
			
				
					|  |  |  | @ -506,9 +510,9 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                         List<RelCodeDetail> list = entry.getValue(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         RelCodeBatch addRelCodeBatch = new RelCodeBatch(); | 
			
		
	
		
			
				
					|  |  |  |  |                         BeanUtils.copyProperties(relCodeBatch,addRelCodeBatch); | 
			
		
	
		
			
				
					|  |  |  |  |                         BeanUtils.copyProperties(relCodeBatch, addRelCodeBatch); | 
			
		
	
		
			
				
					|  |  |  |  |                         addRelCodeBatch.setParentCode(key); | 
			
		
	
		
			
				
					|  |  |  |  |                         if ("0".equals(key)){ | 
			
		
	
		
			
				
					|  |  |  |  |                         if ("0".equals(key)) { | 
			
		
	
		
			
				
					|  |  |  |  |                             RelCodeDetail relCodeDetail = list.get(0); | 
			
		
	
		
			
				
					|  |  |  |  |                             String curCode = relCodeDetail.getCurCode(); | 
			
		
	
		
			
				
					|  |  |  |  |                             String diStr = FilterUdiUtils.getUdi(curCode).getUdi(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -517,14 +521,14 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                             addRelCodeBatch.setThreeLevelCount(1); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             this.save(addRelCodeBatch); | 
			
		
	
		
			
				
					|  |  |  |  |                             batchIdFkMap.put(curCode,addRelCodeBatch.getId()); | 
			
		
	
		
			
				
					|  |  |  |  |                             batchIdFkMap.put(curCode, addRelCodeBatch.getId()); | 
			
		
	
		
			
				
					|  |  |  |  |                             updateDrugLevelRelCodeBatch = addRelCodeBatch; | 
			
		
	
		
			
				
					|  |  |  |  |                         }else { | 
			
		
	
		
			
				
					|  |  |  |  |                         } else { | 
			
		
	
		
			
				
					|  |  |  |  |                             for (RelCodeDetail detail : list) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 Integer packLayer = detail.getPackLayer(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (packLayer == 2){ | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (packLayer == 2) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     RelCodeBatch addRelCodeBatch2 = new RelCodeBatch(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     BeanUtils.copyProperties(relCodeBatch,addRelCodeBatch2); | 
			
		
	
		
			
				
					|  |  |  |  |                                     BeanUtils.copyProperties(relCodeBatch, addRelCodeBatch2); | 
			
		
	
		
			
				
					|  |  |  |  |                                     addRelCodeBatch2.setParentCode(key); | 
			
		
	
		
			
				
					|  |  |  |  |                                     String curCode = detail.getCurCode(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     String diStr = FilterUdiUtils.getUdi(curCode).getUdi(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -534,12 +538,12 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                                     addRelCodeBatch2.setTwoLevelCount(1); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     this.save(addRelCodeBatch2); | 
			
		
	
		
			
				
					|  |  |  |  |                                     batchIdFkMap.put(curCode,addRelCodeBatch2.getId()); | 
			
		
	
		
			
				
					|  |  |  |  |                                     batchIdFkMap.put(curCode, addRelCodeBatch2.getId()); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     //同时也是上面的明细
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     detail.setBatchIdFk(batchIdFkMap.get(key)); | 
			
		
	
		
			
				
					|  |  |  |  |                                     addRelCodeDetail.add(detail); | 
			
		
	
		
			
				
					|  |  |  |  |                                 }else if (packLayer == 1){ | 
			
		
	
		
			
				
					|  |  |  |  |                                 } else if (packLayer == 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     //直接明细
 | 
			
		
	
		
			
				
					|  |  |  |  |                                     detail.setBatchIdFk(batchIdFkMap.get(key)); | 
			
		
	
		
			
				
					|  |  |  |  |                                     addRelCodeDetail.add(detail); | 
			
		
	
	
		
			
				
					|  |  |  | @ -547,7 +551,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     if (CollUtil.isNotEmpty(addRelCodeDetail)){ | 
			
		
	
		
			
				
					|  |  |  |  |                     if (CollUtil.isNotEmpty(addRelCodeDetail)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         relCodeDetailService.saveBatch(addRelCodeDetail); | 
			
		
	
		
			
				
					|  |  |  |  |                         //更新层级关系的数量
 | 
			
		
	
		
			
				
					|  |  |  |  |                         this.updateDrugLevelCount(updateDrugLevelRelCodeBatch); | 
			
		
	
	
		
			
				
					|  |  |  | @ -561,15 +565,16 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 通过curCode 获取明细的数量 如果是 三级 需要先去计算二级单下的一级数量 在算出二级数量 | 
			
		
	
		
			
				
					|  |  |  |  |      * 如果是 二级 直接计算出 一级 | 
			
		
	
		
			
				
					|  |  |  |  |      * | 
			
		
	
		
			
				
					|  |  |  |  |      * @param item | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |  |     private void updateDrugLevelCount(RelCodeBatch item) { | 
			
		
	
		
			
				
					|  |  |  |  |         String curCode = item.getCurCode(); | 
			
		
	
		
			
				
					|  |  |  |  |         List<RelCodeDetail> list = relCodeDetailService.list(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getParentCode, curCode)); | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(list)){ | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(list)) { | 
			
		
	
		
			
				
					|  |  |  |  |             RelCodeDetail relCodeDetail = list.get(0); | 
			
		
	
		
			
				
					|  |  |  |  |             Integer packLayer = relCodeDetail.getPackLayer(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (packLayer == 2){ | 
			
		
	
		
			
				
					|  |  |  |  |             if (packLayer == 2) { | 
			
		
	
		
			
				
					|  |  |  |  |                 item.setThreeLevelCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                 item.setTwoLevelCount(list.size()); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -580,12 +585,12 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 //更新下 二级单
 | 
			
		
	
		
			
				
					|  |  |  |  |                 List<RelCodeBatch> twoRelCodeBatchs = this.list(new LambdaQueryWrapper<RelCodeBatch>().in(RelCodeBatch::getCurCode, twoCurCodes)); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (CollUtil.isNotEmpty(twoRelCodeBatchs)){ | 
			
		
	
		
			
				
					|  |  |  |  |                     twoRelCodeBatchs.forEach( t -> { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (CollUtil.isNotEmpty(twoRelCodeBatchs)) { | 
			
		
	
		
			
				
					|  |  |  |  |                     twoRelCodeBatchs.forEach(t -> { | 
			
		
	
		
			
				
					|  |  |  |  |                         this.updateDrugLevelCount(t); | 
			
		
	
		
			
				
					|  |  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }else if (packLayer == 1){ | 
			
		
	
		
			
				
					|  |  |  |  |             } else if (packLayer == 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                 item.setThreeLevelCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                 item.setTwoLevelCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                 item.setOneLevelCount(list.size()); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |