|
|
@ -1,6 +1,7 @@ |
|
|
|
package digital.laboratory.platform.reagent.service.impl; |
|
|
|
package digital.laboratory.platform.reagent.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
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; |
|
|
@ -8,10 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.Constants; |
|
|
|
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.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.deepoove.poi.XWPFTemplate; |
|
|
|
|
|
|
|
import com.deepoove.poi.config.Configure; |
|
|
|
|
|
|
|
import com.deepoove.poi.config.ConfigureBuilder; |
|
|
|
|
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy; |
|
|
|
|
|
|
|
import digital.laboratory.platform.common.feign.RemoteWord2PDFService; |
|
|
|
import digital.laboratory.platform.common.feign.RemoteWord2PDFService; |
|
|
|
import digital.laboratory.platform.common.oss.service.OssFile; |
|
|
|
import digital.laboratory.platform.common.oss.service.OssFile; |
|
|
|
import digital.laboratory.platform.reagent.dto.PurchaseListDTO; |
|
|
|
import digital.laboratory.platform.reagent.dto.PurchaseListDTO; |
|
|
@ -19,22 +16,14 @@ import digital.laboratory.platform.reagent.entity.*; |
|
|
|
import digital.laboratory.platform.reagent.mapper.PurchaseListMapper; |
|
|
|
import digital.laboratory.platform.reagent.mapper.PurchaseListMapper; |
|
|
|
import digital.laboratory.platform.reagent.service.*; |
|
|
|
import digital.laboratory.platform.reagent.service.*; |
|
|
|
import digital.laboratory.platform.reagent.vo.*; |
|
|
|
import digital.laboratory.platform.reagent.vo.*; |
|
|
|
import feign.Response; |
|
|
|
|
|
|
|
import org.apache.commons.io.output.ByteArrayOutputStream; |
|
|
|
|
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.mock.web.MockMultipartFile; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -180,7 +169,7 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur |
|
|
|
warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());//关联入库表
|
|
|
|
warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());//关联入库表
|
|
|
|
warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());//供应商ID
|
|
|
|
warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());//供应商ID
|
|
|
|
warehousingContent.setWarehousingQuantity(0);//初始状态
|
|
|
|
warehousingContent.setWarehousingQuantity(0);//初始状态
|
|
|
|
if (reagentConsumables.getCode()!=null){ |
|
|
|
if (reagentConsumables.getCode() != null) { |
|
|
|
warehousingContent.setCode(reagentConsumables.getCode());//物品编码
|
|
|
|
warehousingContent.setCode(reagentConsumables.getCode());//物品编码
|
|
|
|
} |
|
|
|
} |
|
|
|
warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());//关联采购清单明细
|
|
|
|
warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());//关联采购清单明细
|
|
|
@ -220,10 +209,72 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur |
|
|
|
|
|
|
|
|
|
|
|
@Override//分页查询采购清单列表
|
|
|
|
@Override//分页查询采购清单列表
|
|
|
|
public IPage<PurchaseListPageVO> getPurchaseListVOPage(IPage<PurchaseList> page, @Param(Constants.WRAPPER) QueryWrapper<PurchaseList> qw) { |
|
|
|
public IPage<PurchaseListPageVO> getPurchaseListVOPage(IPage<PurchaseList> page, @Param(Constants.WRAPPER) QueryWrapper<PurchaseList> qw) { |
|
|
|
|
|
|
|
|
|
|
|
IPage<PurchaseListPageVO> purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw); |
|
|
|
IPage<PurchaseListPageVO> purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw); |
|
|
|
|
|
|
|
|
|
|
|
return purchaseListVOPage; |
|
|
|
return purchaseListVOPage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<PurchaseListDetails> addList(String id, Integer type) { |
|
|
|
|
|
|
|
if (type == 0) { |
|
|
|
|
|
|
|
List<DecentralizeDetails> decentralizeDetailsList = decentralizeDetailsService.list(new LambdaQueryWrapper<DecentralizeDetails>().eq(DecentralizeDetails::getDecentralizedRequestId, id)); |
|
|
|
|
|
|
|
DecentralizedRequest decentralizedRequest = decentralizedRequestService.getById(id); |
|
|
|
|
|
|
|
PurchaseList purchaseList = new PurchaseList(); |
|
|
|
|
|
|
|
purchaseList.setName(DateTime.now() + "采购清单"); |
|
|
|
|
|
|
|
purchaseList.setStatus(0); |
|
|
|
|
|
|
|
purchaseList.setCreateBy(decentralizedRequest.getCreateBy()); |
|
|
|
|
|
|
|
purchaseList.setType("分散采购申请"); |
|
|
|
|
|
|
|
purchaseList.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
|
|
|
decentralizedRequest.setPurchaseListId(purchaseList.getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<PurchaseListDetails> purchaseListDetailsArrayList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (DecentralizeDetails decentralizeDetails : decentralizeDetailsList) { |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(decentralizeDetails.getReagentConsumableId())) { |
|
|
|
|
|
|
|
ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(decentralizeDetails); |
|
|
|
|
|
|
|
decentralizeDetails.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
PurchaseListDetails purchaseListDetails = new PurchaseListDetails(); |
|
|
|
|
|
|
|
purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
|
|
|
purchaseListDetails.setReagentConsumableId(decentralizeDetails.getReagentConsumableId()); |
|
|
|
|
|
|
|
purchaseListDetails.setPurchaseListId(purchaseList.getId()); |
|
|
|
|
|
|
|
purchaseListDetails.setPurchaseQuantity(decentralizeDetails.getQuantity()); |
|
|
|
|
|
|
|
decentralizeDetails.setPurchaseListDetailsId(purchaseListDetails.getId()); |
|
|
|
|
|
|
|
purchaseListDetailsArrayList.add(purchaseListDetails); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.save(purchaseList) && |
|
|
|
|
|
|
|
decentralizedRequestService.updateById(decentralizedRequest) && |
|
|
|
|
|
|
|
decentralizeDetailsService.updateBatchById(decentralizeDetailsList) && |
|
|
|
|
|
|
|
purchaseListDetailsService.saveBatch(purchaseListDetailsArrayList)) { |
|
|
|
|
|
|
|
return purchaseListDetailsArrayList; |
|
|
|
|
|
|
|
} else return null; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PurchasingPlan purchasingPlan = purchasingPlanService.getById(id); |
|
|
|
|
|
|
|
List<ProcurementContent> procurementContentList = procurementContentService.list(new LambdaQueryWrapper<ProcurementContent>().eq(ProcurementContent::getPurchasingPlanId, id)); |
|
|
|
|
|
|
|
PurchaseList purchaseList = new PurchaseList();//创建采购清单
|
|
|
|
|
|
|
|
purchaseList.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
|
|
|
purchaseList.setName(DateTime.now() + "采购清单");//清单名称
|
|
|
|
|
|
|
|
purchaseList.setStatus(0);//状态
|
|
|
|
|
|
|
|
purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划
|
|
|
|
|
|
|
|
purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单
|
|
|
|
|
|
|
|
ArrayList<PurchaseListDetails> purchaseListDetailsArrayList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ProcurementContent procurementContent : procurementContentList) { |
|
|
|
|
|
|
|
PurchaseListDetails purchaseListDetails = new PurchaseListDetails();//采购清单明细
|
|
|
|
|
|
|
|
purchaseListDetails.setPurchaseListId(purchaseList.getId());//关联采购清单
|
|
|
|
|
|
|
|
purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());//采购数量
|
|
|
|
|
|
|
|
purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());//采购试剂耗材ID
|
|
|
|
|
|
|
|
purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
|
|
|
purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());//关联采购计划明细
|
|
|
|
|
|
|
|
purchaseListDetailsArrayList.add(purchaseListDetails); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.save(purchaseList) && |
|
|
|
|
|
|
|
purchasingPlanService.updateById(purchasingPlan) && |
|
|
|
|
|
|
|
procurementContentService.updateBatchById(procurementContentList) && |
|
|
|
|
|
|
|
purchaseListDetailsService.saveBatch(purchaseListDetailsArrayList)) { |
|
|
|
|
|
|
|
return purchaseListDetailsArrayList; |
|
|
|
|
|
|
|
} else return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|