| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -5,10 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.toolkit.IdWorker; | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.toolkit.IdWorker; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.common.mybatis.security.service.DLPUser; | 
					 | 
					 | 
					 | 
					import digital.laboratory.platform.common.mybatis.security.service.DLPUser; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.dto.AuditAndApproveDTO; | 
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.dto.AuditAndApproveDTO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.dto.PurchaseListDTO; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.dto.PurchasingPlanDTO; | 
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.dto.PurchasingPlanDTO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.entity.*; | 
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.entity.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.mapper.PurchasingPlanMapper; | 
					 | 
					 | 
					 | 
					import digital.laboratory.platform.reagent.mapper.PurchasingPlanMapper; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -20,7 +20,6 @@ import org.springframework.beans.BeanUtils; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
					 | 
					 | 
					 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
					 | 
					 | 
					 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.time.LocalDateTime; | 
					 | 
					 | 
					 | 
					import java.time.LocalDateTime; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.ArrayList; | 
					 | 
					 | 
					 | 
					import java.util.ArrayList; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.List; | 
					 | 
					 | 
					 | 
					import java.util.List; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -32,6 +31,7 @@ import java.util.List; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @describe (采购计划) 服务实现类 | 
					 | 
					 | 
					 | 
					 * @describe (采购计划) 服务实现类 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					@Service | 
					 | 
					 | 
					 | 
					@Service | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					@SuppressWarnings("all") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, PurchasingPlan> implements PurchasingPlanService { | 
					 | 
					 | 
					 | 
					public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, PurchasingPlan> implements PurchasingPlanService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ProcurementContentService procurementContentService; | 
					 | 
					 | 
					 | 
					    private ProcurementContentService procurementContentService; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -57,13 +57,13 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Autowired | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private SupplierInformationService supplierInformationService; | 
					 | 
					 | 
					 | 
					    private SupplierInformationService supplierInformationService; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override//分页
 | 
					 | 
					 | 
					 | 
					    @Override//分页查询
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public IPage<PurchasingPlanVO> getPurchasingPlanVOPage(IPage<PurchasingPlan> page, QueryWrapper<PurchasingPlan> qw) { | 
					 | 
					 | 
					 | 
					    public IPage<PurchasingPlanVO> getPurchasingPlanVOPage(IPage<PurchasingPlan> page, QueryWrapper<PurchasingPlan> qw) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        IPage<PurchasingPlanVO> purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw); | 
					 | 
					 | 
					 | 
					        IPage<PurchasingPlanVO> purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return purchasingPlanVOPage; | 
					 | 
					 | 
					 | 
					        return purchasingPlanVOPage; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override//列表
 | 
					 | 
					 | 
					 | 
					    @Override//采购计划集合
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public List<PurchasingPlanVO> getPurchasingPlanVOList(QueryWrapper<PurchasingPlan> qw) { | 
					 | 
					 | 
					 | 
					    public List<PurchasingPlanVO> getPurchasingPlanVOList(QueryWrapper<PurchasingPlan> qw) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return baseMapper.getPurchasingPlanVOList(qw); | 
					 | 
					 | 
					 | 
					        return baseMapper.getPurchasingPlanVOList(qw); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -72,16 +72,11 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlanVO getPurchasingPlanVO(String purchasingPlanId) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlanVO getPurchasingPlanVO(String purchasingPlanId) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlanVO purchasingPlanVO = baseMapper.getPurchasingPlanVO(purchasingPlanId); | 
					 | 
					 | 
					 | 
					        PurchasingPlanVO purchasingPlanVO = baseMapper.getPurchasingPlanVO(purchasingPlanId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (purchasingPlanVO == null) { | 
					 | 
					 | 
					 | 
					        if (purchasingPlanVO == null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("信息不存在")); | 
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("信息不存在")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);//将采购计划明细Set至采购计划VO
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlanVO.setProcurementContentVOList(procurementContentVOList); | 
					 | 
					 | 
					 | 
					        purchasingPlanVO.setProcurementContentVOList(procurementContentVOList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return purchasingPlanVO; | 
					 | 
					 | 
					 | 
					        return purchasingPlanVO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -89,144 +84,102 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override//创建计划
 | 
					 | 
					 | 
					 | 
					    @Override//创建计划
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = new PurchasingPlan(); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = new PurchasingPlan();//创建采购计划
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setCreateId(user.getId());//创建人ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setCreateId(user.getId()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setStatus(0);//状态
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setCreateName(user.getName());//创建人名称
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setStatus(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setCreateName(user.getName()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<ProcurementContent> list = new ArrayList<>();//需要整合的集合
 | 
					 | 
					 | 
					 | 
					        List<ProcurementContent> list = new ArrayList<>();//需要整合的集合
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        boolean flag = true; | 
					 | 
					 | 
					 | 
					        boolean flag = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) { | 
					 | 
					 | 
					 | 
					        for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //将列入计划的集中采购申请状态变为3
 | 
					 | 
					 | 
					 | 
					            //将列入计划的集中采购申请状态变为3
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            String detailsOfCentralizedId = purchasingPlanDTO.getDetailsOfCentralizedId(); | 
					 | 
					 | 
					 | 
					            CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            centralizedRequest.setStatus(3); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            DetailsOfCentralized byId2 = detailsOfCentralizedService.getById(detailsOfCentralizedId); | 
					 | 
					 | 
					 | 
					            centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            requestService.updateById(centralizedRequest); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            CentralizedRequest byId3 = requestService.getById(byId2.getCentralizedRequestId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId3.setStatus(3); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId3.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            requestService.updateById(byId3); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            flag = true; | 
					 | 
					 | 
					 | 
					            flag = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//
 | 
					 | 
					 | 
					 | 
					            //合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //合并相同的采购内容
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (list.size() != 0) { | 
					 | 
					 | 
					 | 
					            if (list.size() != 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for (int i = 0; i < list.size(); i++) { | 
					 | 
					 | 
					 | 
					                for (int i = 0; i < list.size(); i++) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) { | 
					 | 
					 | 
					 | 
					                    if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        ReagentConsumables byId1 = reagentConsumablesService.getById(list.get(i).getReagentConsumableId()); | 
					 | 
					 | 
					 | 
					                        list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        list.get(i).setUnitPrice(byId1.getUnitPrice()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        //Set采购数量
 | 
					 | 
					 | 
					 | 
					                        //Set采购数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					                        list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());//合并之前的数量加上被合并对象的数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                        list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());//计算小计
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); | 
					 | 
					 | 
					 | 
					                        //添加采购申请明细的采购数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        byId.setQuantityPurchased(byId.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        byId.setProcurementContentId(list.get(i).getProcurementContentId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        detailsOfCentralizedService.updateById(byId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        detailsOfCentralized.setProcurementContentId(list.get(i).getProcurementContentId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        detailsOfCentralizedService.updateById(detailsOfCentralized); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        //被合并后,改变flag,进入下一个循环
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        flag = false; | 
					 | 
					 | 
					 | 
					                        flag = false; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    } | 
					 | 
					 | 
					 | 
					                    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                //无需合并的采购计划明细
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (flag) { | 
					 | 
					 | 
					 | 
					                if (flag) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ProcurementContent procurementContent = new ProcurementContent(); | 
					 | 
					 | 
					 | 
					                    ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                    BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); | 
					 | 
					 | 
					 | 
					                    procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications());//赋值采购数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());//赋值采购数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());//单价
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());//小计
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());//采购申请明细关联采购计划明细
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					                    detailsOfCentralizedService.updateById(detailsOfCentralized); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                    list.add(procurementContent);//将计划明细添加至集合
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    byId.setQuantityPurchased(byId.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    procurementContent.setUnitPrice(reagentConsumables.getUnitPrice()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    byId.setProcurementContentId(procurementContent.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    detailsOfCentralizedService.updateById(byId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    list.add(procurementContent); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					 | 
					            } else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ProcurementContent procurementContent = new ProcurementContent(); | 
					 | 
					 | 
					 | 
					                ProcurementContent procurementContent = new ProcurementContent(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); | 
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); | 
					 | 
					 | 
					 | 
					                DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                byId.setQuantityPurchased(byId.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					                byId.setQuantityPurchased(byId.getNumberOfApplications()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); | 
					 | 
					 | 
					 | 
					                procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					                procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications()); | 
					 | 
					 | 
					 | 
					                procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                procurementContent.setUnitPrice(reagentConsumables.getUnitPrice()); | 
					 | 
					 | 
					 | 
					                procurementContent.setUnitPrice(reagentConsumables.getUnitPrice()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice()); | 
					 | 
					 | 
					 | 
					                procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                byId.setProcurementContentId(procurementContent.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					                byId.setProcurementContentId(procurementContent.getProcurementContentId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                detailsOfCentralizedService.updateById(byId); | 
					 | 
					 | 
					 | 
					                detailsOfCentralizedService.updateById(byId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                list.add(procurementContent); | 
					 | 
					 | 
					 | 
					                list.add(procurementContent); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) { | 
					 | 
					 | 
					 | 
					        if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            calculatedAmount(purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            calculatedAmount(purchasingPlan.getPurchasingPlanId());//计算经费预算
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());//获取VO
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return purchasingPlanVO; | 
					 | 
					 | 
					 | 
					            return purchasingPlanVO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("保存失败")); | 
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("保存失败")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					//    @Override//新增明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) { | 
					 | 
					 | 
					 | 
					//    public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent procurementContent = new ProcurementContent(); | 
					 | 
					 | 
					 | 
					//        ProcurementContent procurementContent = new ProcurementContent();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); | 
					 | 
					 | 
					 | 
					//        BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					//
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (procurementContentService.save(procurementContent)) { | 
					 | 
					 | 
					 | 
					//        if (procurementContentService.save(procurementContent)) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return procurementContent; | 
					 | 
					 | 
					 | 
					//            return procurementContent;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					//        } else {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return null; | 
					 | 
					 | 
					 | 
					//            return null;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					//        }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					//    }
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Transactional | 
					 | 
					 | 
					 | 
					    @Transactional//修改采购计划明细(已废弃)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) { | 
					 | 
					 | 
					 | 
					    public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -254,80 +207,58 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override//修改整合的采购计划明细中的申请明细
 | 
					 | 
					 | 
					 | 
					    @Override//修改整合的采购计划明细中的采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ProcurementContent editDetails(PurchasingPlanDTO purchasingPlanDTO) { | 
					 | 
					 | 
					 | 
					    public ProcurementContent editDetails(PurchasingPlanDTO purchasingPlanDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					        ProcurementContent procurementContent = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());//得到计划明细
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setUnitPrice(purchasingPlanDTO.getUnitPrice()); | 
					 | 
					 | 
					 | 
					        procurementContent.setUnitPrice(purchasingPlanDTO.getUnitPrice());//得到修改的明细单价
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(procurementContent.getPurchasingPlanId());//查询出采购计划
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); | 
					 | 
					 | 
					 | 
					        DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//获取修改的对应的采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (detailsOfCentralized.getQuantityPurchased() == null) { | 
					 | 
					 | 
					 | 
					        if (detailsOfCentralized.getQuantityPurchased() == null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //原本合并总数量-采购申请明细数量+采购申请明细修改后的数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					        } else {//原本合并总数量-采购申请修改后的采购数量+修改数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() - detailsOfCentralized.getQuantityPurchased() + purchasingPlanDTO.getQuantityPurchased()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getQuantityPurchased() + purchasingPlanDTO.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());//计算小计
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        detailsOfCentralized.setQuantityPurchased(purchasingPlanDTO.getQuantityPurchased());//赋值采购实际数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        detailsOfCentralized.setDetailsRemark(purchasingPlanDTO.getPlanRemark());//修改备注
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setSubtotal(byId.getUnitPrice() * byId.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					        if (procurementContentService.updateById(procurementContent) && detailsOfCentralizedService.updateById(detailsOfCentralized)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        detailsOfCentralized.setQuantityPurchased(purchasingPlanDTO.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					            return procurementContent; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        detailsOfCentralized.setDetailsRemark(purchasingPlanDTO.getPlanRemark()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        calculatedAmount(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (procurementContentService.updateById(byId) && detailsOfCentralizedService.updateById(detailsOfCentralized)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            calculatedAmount(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return byId; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("修改失败")); | 
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("修改失败")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Transactional | 
					 | 
					 | 
					 | 
					    @Transactional//删除一条计划明细
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public Boolean delContentById(String procurementContentId) { | 
					 | 
					 | 
					 | 
					    public Boolean delContentById(String procurementContentId) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(procurementContentId); | 
					 | 
					 | 
					 | 
					        ProcurementContent procurementContent = procurementContentService.getById(procurementContentId);//采购计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        //该采购计划明细关联的集中采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					        List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContentId)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, procurementContentId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (DetailsOfCentralized detailsOfCentralized : list) { | 
					 | 
					 | 
					 | 
					        for (DetailsOfCentralized detailsOfCentralized : list) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            detailsOfCentralized.setQuantityPurchased(0);//采购申请明细的采购数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            detailsOfCentralized.setQuantityPurchased(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(procurementContent.getPurchasingPlanId());//采购计划
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.getById(byId.getPurchasingPlanId()).getStatus() == 0 | 
					 | 
					 | 
					 | 
					        if (this.getById(procurementContent.getPurchasingPlanId()).getStatus() == 0 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                && detailsOfCentralizedService.updateBatchById(list) && procurementContentService.removeById(procurementContentId)) { | 
					 | 
					 | 
					 | 
					                && detailsOfCentralizedService.updateBatchById(list) && procurementContentService.removeById(procurementContentId)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					            List<ProcurementContent> procurementContentList = procurementContentService.list(Wrappers.<ProcurementContent>query().eq("purchasing_plan_id", purchasingPlan.getPurchasingPlanId())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            //如果采购计划的明细全部被删除,则自动删除这个采购计划
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            if (procurementContentList.size() == 0) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<ProcurementContent> list1 = procurementContentService.list(procurementContentLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (list1.size() == 0) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.removeById(purchasingPlan); | 
					 | 
					 | 
					 | 
					                this.removeById(purchasingPlan); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return true; | 
					 | 
					 | 
					 | 
					                return true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            calculatedAmount(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return true; | 
					 | 
					 | 
					 | 
					            return true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return null; | 
					 | 
					 | 
					 | 
					            return null; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -337,114 +268,96 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override//换货
 | 
					 | 
					 | 
					 | 
					    @Override//换货
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ProcurementContent replacementById(PurchasingPlanDTO purchasingPlanDTO) { | 
					 | 
					 | 
					 | 
					    public ProcurementContent replacementById(PurchasingPlanDTO purchasingPlanDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId(); | 
					 | 
					 | 
					 | 
					        String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId();//换货试剂耗材ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        ProcurementContent procurementContent = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());//采购计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //将换货信息补充至采购计划明细
 | 
					 | 
					 | 
					 | 
					        //将换货信息补充至采购计划明细
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setReplacementReagentConsumableId(replacementReagentConsumableId); | 
					 | 
					 | 
					 | 
					        procurementContent.setReplacementReagentConsumableId(replacementReagentConsumableId);//换货试剂耗材ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity()); | 
					 | 
					 | 
					 | 
					        procurementContent.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());//换货数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setReplacementPrice(purchasingPlanDTO.getReplacementPrice()); | 
					 | 
					 | 
					 | 
					        procurementContent.setReplacementPrice(purchasingPlanDTO.getReplacementPrice());//换货单价
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setReplacementRemark(purchasingPlanDTO.getReplacementRemark()); | 
					 | 
					 | 
					 | 
					        procurementContent.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());//换货备注
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setSupplierId(purchasingPlanDTO.getSupplierId()); | 
					 | 
					 | 
					 | 
					        procurementContent.setSupplierId(purchasingPlanDTO.getSupplierId());//换货供应商ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        //关联这个采购计划明细的所有采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					        List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContent.getProcurementContentId())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, byId.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, procurementContent.getProcurementContentId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, byId.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					        PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);//查询是否有采购清单
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchaseListDetails one = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //如果存在采购清单,则需修改清单信息
 | 
					 | 
					 | 
					 | 
					        //如果存在采购清单,则需修改清单信息
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (one != null) { | 
					 | 
					 | 
					 | 
					        if (purchaseListDetails != null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, purchaseListDetails.getId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, one.getId()); | 
					 | 
					 | 
					 | 
					            purchaseListDetails.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            purchaseListDetails.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            one.setSupplierId(purchasingPlanDTO.getSupplierId()); | 
					 | 
					 | 
					 | 
					            purchaseListDetails.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            one.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            one.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseListDetailsService.updateById(one); | 
					 | 
					 | 
					 | 
					            purchaseListDetailsService.updateById(purchaseListDetails); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            WarehousingContent one1 = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					            WarehousingContent warehousingContent = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //若存在入库信息,则需修改入库记录
 | 
					 | 
					 | 
					 | 
					            //若存在入库信息,则需修改入库记录
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (one1 != null) { | 
					 | 
					 | 
					 | 
					            if (warehousingContent != null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (one1.getWarehousingQuantity() == 0) { | 
					 | 
					 | 
					 | 
					                if (warehousingContent.getWarehousingQuantity() == 0) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                    warehousingContent.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    one1.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId()); | 
					 | 
					 | 
					 | 
					                    warehousingContent.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    one1.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity()); | 
					 | 
					 | 
					 | 
					                    warehousingContent.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    one1.setSupplierId(purchasingPlanDTO.getSupplierId()); | 
					 | 
					 | 
					 | 
					                    ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ReagentConsumables byId1 = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId()); | 
					 | 
					 | 
					 | 
					                    warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//采购试剂耗材名称
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    one1.setReagentConsumableName(byId1.getReagentConsumableName()); | 
					 | 
					 | 
					 | 
					                    warehousingContentService.updateById(warehousingContent); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    warehousingContentService.updateById(one1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else { | 
					 | 
					 | 
					 | 
					                } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                    //如果已入库,则不能换货
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理")); | 
					 | 
					 | 
					 | 
					                    throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        //将换货信息补充至每一个集中采购申请明细
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (DetailsOfCentralized detailsOfCentralized : list) { | 
					 | 
					 | 
					 | 
					        for (DetailsOfCentralized detailsOfCentralized : list) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId); | 
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity()); | 
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark()); | 
					 | 
					 | 
					 | 
					            detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            detailsOfCentralizedService.updateById(detailsOfCentralized); | 
					 | 
					 | 
					 | 
					            detailsOfCentralizedService.updateById(detailsOfCentralized); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //将换货信息补充至集中采购申请明细
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (procurementContentService.updateById(byId)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return byId; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (procurementContentService.updateById(procurementContent)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return procurementContent; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("换货失败")); | 
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("换货失败")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlan commitById(String purchasingPlanId) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlan commitById(String purchasingPlanId) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(purchasingPlanId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan byId = this.getById(purchasingPlanId); | 
					 | 
					 | 
					 | 
					        //若是审核审批不通过时提交,则需清空原有的审核审批信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //若是审核审批不通过时的提交,则需清空原有的审核审批信息
 | 
					 | 
					 | 
					 | 
					        //审核不通过
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (byId.getStatus()==-4){ | 
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() == -4) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditOpinionOfPrimary(""); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditOpinionOfPrimary(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditResultOfPrimary(false); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditResultOfPrimary(false); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setPrimaryAuditorId(""); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setPrimaryAuditorId(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditTimeOfPrimary(null); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditTimeOfPrimary(null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (byId.getStatus()==-5){ | 
					 | 
					 | 
					 | 
					        //审批不通过
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditOpinionOfPrimary(""); | 
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() == -5) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditResultOfPrimary(false); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditOpinionOfPrimary(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setPrimaryAuditorId(""); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditResultOfPrimary(false); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setAuditTimeOfPrimary(null); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setPrimaryAuditorId(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setApproverId(""); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setAuditTimeOfPrimary(null); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setApprovalOpinion(""); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setApproverId(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setApprovalResult(false); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setApprovalOpinion(""); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            byId.setApprovalTime(null); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setApprovalResult(false); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            purchasingPlan.setApprovalTime(null); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setStatus(1); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setStatus(1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        byId.setCommitTime(LocalDateTime.now()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setCommitTime(LocalDateTime.now());//
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.updateById(byId)) { | 
					 | 
					 | 
					 | 
					            calculatedAmount(purchasingPlan.getPurchasingPlanId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            calculatedAmount(byId.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return byId; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("提交失败")); | 
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("提交失败")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					    @Override//审核采购计划
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -452,20 +365,16 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() != 1) { | 
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() != 1) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("当前状态不可审核")); | 
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("当前状态不可审核")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult());//审核结果
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion());//审核意见
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setPrimaryAuditorId(dlpUser.getId());//审核人ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setPrimaryAuditorId(dlpUser.getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (auditAndApproveDto.getAuditResult() == true) { | 
					 | 
					 | 
					 | 
					        if (auditAndApproveDto.getAuditResult() == true) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(4); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(4);//审核通过
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(-4); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(-4);//审核不通过
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -473,7 +382,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override//审批采购计划
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlan approveById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlan approveById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -481,56 +390,40 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() != 4) { | 
					 | 
					 | 
					 | 
					        if (purchasingPlan.getStatus() != 4) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("当前状态不可审批")); | 
					 | 
					 | 
					 | 
					            throw new RuntimeException(String.format("当前状态不可审批")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult());//审批结果
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion());//审批意见
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult()); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalTime(LocalDateTime.now());//审批时间
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        purchasingPlan.setApproverId(dlpUser.getId());//审批人ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setApprovalTime(LocalDateTime.now()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setApproverId(dlpUser.getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //审批通过则创建采购清单
 | 
					 | 
					 | 
					 | 
					        //审批通过则创建采购清单
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (auditAndApproveDto.getApproveResult() == true) { | 
					 | 
					 | 
					 | 
					        if (auditAndApproveDto.getApproveResult() == true) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(5); | 
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(5);//审批通过
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					            LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					            procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//采购计划明细
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					            PurchaseList purchaseList = new PurchaseList();//创建采购清单
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            PurchaseListDTO purchaseListDTO = new PurchaseListDTO(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            PurchaseList purchaseList = new PurchaseList(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseList.setId(IdWorker.get32UUID().toUpperCase()); | 
					 | 
					 | 
					 | 
					            purchaseList.setId(IdWorker.get32UUID().toUpperCase()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseList.setName(DateTime.now() + "采购清单"); | 
					 | 
					 | 
					 | 
					            purchaseList.setName(DateTime.now() + "采购清单");//清单名称
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseList.setStatus(0); | 
					 | 
					 | 
					 | 
					            purchaseList.setStatus(0);//状态
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseList.setType("采购计划"); | 
					 | 
					 | 
					 | 
					            purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseList.setCreateBy(purchasingPlan.getCreateBy()); | 
					 | 
					 | 
					 | 
					            purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchaseListService.save(purchaseList); | 
					 | 
					 | 
					 | 
					            purchaseListService.save(purchaseList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchasingPlan.setPurchaseListId(purchaseList.getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            for (ProcurementContent procurementContent : list) { | 
					 | 
					 | 
					 | 
					            for (ProcurementContent procurementContent : list) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                PurchaseListDetails purchaseListDetails = new PurchaseListDetails(); | 
					 | 
					 | 
					 | 
					                PurchaseListDetails purchaseListDetails = new PurchaseListDetails();//采购清单明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					                purchaseListDetails.setPurchaseListId(purchaseList.getId());//关联采购清单
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetails.setPurchaseListId(purchaseList.getId()); | 
					 | 
					 | 
					 | 
					                purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());//采购数量
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased()); | 
					 | 
					 | 
					 | 
					                purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());//采购试剂耗材ID
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); | 
					 | 
					 | 
					 | 
					                purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId()); | 
					 | 
					 | 
					 | 
					                purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());//关联采购计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                purchaseListDetailsService.save(purchaseListDetails); | 
					 | 
					 | 
					 | 
					                purchaseListDetailsService.save(purchaseListDetails); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(-5);//审核不通过
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            purchasingPlan.setStatus(-5); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -541,51 +434,45 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //计算经费预算方法
 | 
					 | 
					 | 
					 | 
					    //计算经费预算方法
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public PurchasingPlan calculatedAmount(String purchasingPlanId) { | 
					 | 
					 | 
					 | 
					    public PurchasingPlan calculatedAmount(String purchasingPlanId) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(purchasingPlanId); | 
					 | 
					 | 
					 | 
					        PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);//采购计划
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					 | 
					        LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); | 
					 | 
					 | 
					 | 
					        procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					        List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//这个采购计划内的所有采购计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double x = 0; | 
					 | 
					 | 
					 | 
					        double x = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //计算每个采购计划明细的小计(单价*采购数量)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for ( | 
					 | 
					 | 
					 | 
					        for ( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ProcurementContent procurementContent : list) { | 
					 | 
					 | 
					 | 
					                ProcurementContent procurementContent : list) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice(); | 
					 | 
					 | 
					 | 
					            x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        purchasingPlan.setAppropriationBudget(x); | 
					 | 
					 | 
					 | 
					        purchasingPlan.setAppropriationBudget(x);//经费预算
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
					 | 
					 | 
					 | 
					        if (this.updateById(purchasingPlan)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
					 | 
					 | 
					 | 
					            return purchasingPlan; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("计算失败")); | 
					 | 
					 | 
					 | 
					        } else throw new RuntimeException(String.format("计算失败")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override//查看换货信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ReplacementVO getReplacementVO(String id){ | 
					 | 
					 | 
					 | 
					    public ReplacementVO getReplacementVO(String id) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ProcurementContent byId = procurementContentService.getById(id); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ReplacementVO replacementVO = new ReplacementVO(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (byId.getReplacementQuantity()!=null&&byId.getReplacementPrice()!=null&&byId.getReplacementRemark()!=null | 
					 | 
					 | 
					 | 
					        ProcurementContent procurementContent = procurementContentService.getById(id);//采购计划明细
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        &&byId.getReplacementReagentConsumableId()!=null&&byId.getSupplierId()!=null){ | 
					 | 
					 | 
					 | 
					        ReplacementVO replacementVO = new ReplacementVO();//换货VO
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setReplacementQuantity(byId.getReplacementQuantity()); | 
					 | 
					 | 
					 | 
					        //判断换货信息是否充分
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setReplacementRemark(byId.getReplacementRemark()); | 
					 | 
					 | 
					 | 
					        if (procurementContent.getReplacementQuantity() != null && procurementContent.getReplacementPrice() != null && procurementContent.getReplacementRemark() != null | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setReplacementPrice(byId.getReplacementPrice()); | 
					 | 
					 | 
					 | 
					                && procurementContent.getReplacementReagentConsumableId() != null && procurementContent.getSupplierId() != null) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setReplacementReagentConsumableId(byId.getReplacementReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setSupplierId(byId.getSupplierId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        SupplierInformation byId1 = supplierInformationService.getById(byId.getSupplierId()); | 
					 | 
					 | 
					 | 
					            SupplierInformation supplierInformation = supplierInformationService.getById(procurementContent.getSupplierId());//供应商
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					            ReagentConsumables reagentConsumables = reagentConsumablesService.getById(procurementContent.getReplacementReagentConsumableId());//试剂耗材信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setSupplierName(byId1.getSupplierName()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        ReagentConsumables byId2 = reagentConsumablesService.getById(byId.getReplacementReagentConsumableId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        replacementVO.setReagentConsumables(byId2);} | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setReplacementQuantity(procurementContent.getReplacementQuantity());//换货数量
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setReplacementRemark(procurementContent.getReplacementRemark());//换货备注
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setReplacementPrice(procurementContent.getReplacementPrice());//换货单价
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setReplacementReagentConsumableId(procurementContent.getReplacementReagentConsumableId());//换货试剂耗材ID
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setSupplierId(procurementContent.getSupplierId());//换货供应商ID
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setSupplierName(supplierInformation.getSupplierName());//换货供应商名称
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            replacementVO.setReagentConsumables(reagentConsumables);//换货试剂耗材信息
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return replacementVO; | 
					 | 
					 | 
					 | 
					        return replacementVO; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |