main
杨海航 3 months ago
parent 6c9a487682
commit 08d70bab0b
  1. 9
      src/main/java/digital/laboratory/platform/reagent/controller/PurchaseCatalogueController.java
  2. 3
      src/main/java/digital/laboratory/platform/reagent/entity/AcceptanceRecordForm.java
  3. 2
      src/main/java/digital/laboratory/platform/reagent/entity/AcceptanceSignFor.java
  4. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ApplicationForUse.java
  5. 2
      src/main/java/digital/laboratory/platform/reagent/entity/BatchDetails.java
  6. 5
      src/main/java/digital/laboratory/platform/reagent/entity/Blacklist.java
  7. 4
      src/main/java/digital/laboratory/platform/reagent/entity/CatalogueDetails.java
  8. 2
      src/main/java/digital/laboratory/platform/reagent/entity/CategoryTable.java
  9. 3
      src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java
  10. 4
      src/main/java/digital/laboratory/platform/reagent/entity/CheckSchedule.java
  11. 3
      src/main/java/digital/laboratory/platform/reagent/entity/ComplianceCheck.java
  12. 2
      src/main/java/digital/laboratory/platform/reagent/entity/DecentralizeDetails.java
  13. 2
      src/main/java/digital/laboratory/platform/reagent/entity/DecentralizedRequest.java
  14. 2
      src/main/java/digital/laboratory/platform/reagent/entity/DeliveryRegistrationForm.java
  15. 2
      src/main/java/digital/laboratory/platform/reagent/entity/DetailsOfCentralized.java
  16. 2
      src/main/java/digital/laboratory/platform/reagent/entity/EvaluationForm.java
  17. 2
      src/main/java/digital/laboratory/platform/reagent/entity/FixedValueReport.java
  18. 2
      src/main/java/digital/laboratory/platform/reagent/entity/InstructionBook.java
  19. 2
      src/main/java/digital/laboratory/platform/reagent/entity/LocationInfo.java
  20. 2
      src/main/java/digital/laboratory/platform/reagent/entity/OutgoingContents.java
  21. 2
      src/main/java/digital/laboratory/platform/reagent/entity/PeriodVerificationImplementation.java
  22. 2
      src/main/java/digital/laboratory/platform/reagent/entity/PeriodVerificationPlan.java
  23. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ProcurementContent.java
  24. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ProvideServicesOrSupplies.java
  25. 2
      src/main/java/digital/laboratory/platform/reagent/entity/PurchaseCatalogue.java
  26. 3
      src/main/java/digital/laboratory/platform/reagent/entity/PurchaseList.java
  27. 3
      src/main/java/digital/laboratory/platform/reagent/entity/PurchaseListDetails.java
  28. 3
      src/main/java/digital/laboratory/platform/reagent/entity/PurchasingPlan.java
  29. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ReagentConsumableInventory.java
  30. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ReagentConsumableStash.java
  31. 4
      src/main/java/digital/laboratory/platform/reagent/entity/ReagentConsumables.java
  32. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ReagentConsumablesSet.java
  33. 2
      src/main/java/digital/laboratory/platform/reagent/entity/ReferenceMaterial.java
  34. 3
      src/main/java/digital/laboratory/platform/reagent/entity/RequisitionRecord.java
  35. 2
      src/main/java/digital/laboratory/platform/reagent/entity/SolutionUseForm.java
  36. 5
      src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java
  37. 5
      src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApprovalForm.java
  38. 5
      src/main/java/digital/laboratory/platform/reagent/entity/StandardReserveSolution.java
  39. 6
      src/main/java/digital/laboratory/platform/reagent/entity/StandardSolutionCurve.java
  40. 5
      src/main/java/digital/laboratory/platform/reagent/entity/SupplierInformation.java
  41. 6
      src/main/java/digital/laboratory/platform/reagent/entity/WarehousingContent.java
  42. 5
      src/main/java/digital/laboratory/platform/reagent/entity/WarehousingRecordForm.java
  43. 206
      src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java

@ -14,8 +14,6 @@ import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhuozhengsoft.pageoffice.FileSaver;
import com.zhuozhengsoft.pageoffice.PageOfficeCtrl;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.log.annotation.SysLog;
@ -463,7 +461,7 @@ public class PurchaseCatalogueController {
//MockMultipartFile mockMultipartFile = new MockMultipartFile("file", entrustmentLetterFileName + ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fisWord);
MockMultipartFile mockMultipartFile = new MockMultipartFile("file", applyFileName + ".docx", "image/jpg", fisWord);
PageOfficeCtrl pageOfficeCtrl = new PageOfficeCtrl(theHttpServletRequest);
Response response = remoteWord2PDFService.word2pdf(mockMultipartFile);
@ -473,10 +471,7 @@ public class PurchaseCatalogueController {
IoUtil.copy(response.body().asInputStream(), outPDF, IoUtil.DEFAULT_MIDDLE_BUFFER_SIZE);
ByteArrayInputStream isPDF = new ByteArrayInputStream(outPDF.toByteArray());
outPDF.close();
FileSaver fs = new FileSaver(theHttpServletRequest, httpServletResponse);
FileInputStream fileStream = fs.getFileStream();
ossFile.fileSave("document" + "/" + "purchaseCatalogue" + "/" + id + "/" + applyFileName + ".pdf", fileStream);
ossFile.fileSave("document" + "/" + "purchaseCatalogue" + "/" + id + "/" + applyFileName + ".pdf", isPDF);
isPDF.close();
System.out.println(String.format("转换为 PDF 结束"));

@ -130,7 +130,6 @@ public class AcceptanceRecordForm extends BaseEntity {
@ApiModelProperty(value = "(验收中间表ID)")
private String acceptanceSignForId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -28,6 +28,4 @@ public class AcceptanceSignFor extends BaseEntity {
@ApiModelProperty(value = "状态 0 未开始签收 1 进行中 2 已完成 ")
private Integer status;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -52,6 +52,4 @@ public class ApplicationForUse extends BaseEntity {
@ApiModelProperty(value="检验鉴定实验ID")
private String experimentId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -103,7 +103,5 @@ public class BatchDetails extends BaseEntity {
@TableField(exist = false)
private String supplierName;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -56,10 +56,5 @@ public class Blacklist extends BaseEntity {
@ApiModelProperty(value="complianceCheckId")
private String complianceCheckId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -148,8 +148,4 @@ public class CatalogueDetails extends BaseEntity {
@TableId(value = "catalogue_details_id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "catalogueDetailsId")
private String catalogueDetailsId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -43,7 +43,5 @@ public class CategoryTable extends BaseEntity {
@ApiModelProperty(value="种类")
private String species;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -81,7 +81,4 @@ public class CentralizedRequest extends BaseEntity {
@ApiModelProperty(value = "集中采购申请ID")
private String id;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -76,8 +76,4 @@ public class CheckSchedule extends BaseEntity {
@ApiModelProperty(value="(提交时间)")
private LocalDateTime commitTime;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -157,7 +157,4 @@ public class ComplianceCheck extends BaseEntity {
@ApiModelProperty(value="(标准物质Id,若选择的物质为标准物质,则需传输Id)")
private String referenceMaterialId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -170,8 +170,6 @@ public class DecentralizeDetails extends BaseEntity {
@ApiModelProperty(value = "物品编码")
private String code;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -154,8 +154,6 @@ public class DecentralizedRequest extends BaseEntity {
@ApiModelProperty(value="(状态(0:未提交,1:已提交,2:一级审核通过,3:二级审核通过,4:三级审核通过,5:审批通过,6:已被制定为采购清单))")
private Integer status;
@ApiModelProperty(value = "系统ID")
private String sId;

@ -57,8 +57,6 @@ public class DeliveryRegistrationForm extends BaseEntity {
@ApiModelProperty(value="id")
private String id;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -99,7 +99,5 @@ public class DetailsOfCentralized extends BaseEntity {
@ApiModelProperty(value="采购计划换货备注")
private String replacementRemark;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -188,6 +188,4 @@ public class EvaluationForm extends BaseEntity {
@ApiModelProperty(value="状态:(0:未评价,1:已评价,2:二级审核通过,3:三级审核通过, -1 :审核未通过)")
private Integer status;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -49,8 +49,6 @@ public class FixedValueReport extends BaseEntity {
@ApiModelProperty(value="定值结果")
private String fixedResult;
@ApiModelProperty(value = "系统ID")
private String sId;

@ -88,6 +88,4 @@ public class InstructionBook extends BaseEntity {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -26,6 +26,4 @@ public class LocationInfo extends BaseEntity {
@ApiModelProperty(value = "新的存放位置")
private String newLocation;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -93,6 +93,4 @@ public class OutgoingContents extends BaseEntity {
@ApiModelProperty(value = "(领用物品仓库ID)")
private String reagentConsumableStashId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -161,6 +161,4 @@ public class PeriodVerificationImplementation extends BaseEntity {
@ApiModelProperty(value="提交时间")
private LocalDateTime commitTime;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -117,7 +117,5 @@ public class PeriodVerificationPlan extends BaseEntity {
@ApiModelProperty(value="id")
private String id;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -104,6 +104,4 @@ public class ProcurementContent extends BaseEntity {
@ApiModelProperty(value="procurementContentId")
private String procurementContentId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -43,6 +43,4 @@ public class ProvideServicesOrSupplies extends BaseEntity {
@ApiModelProperty(value="提供服务或供应品表ID")
private String id;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -80,7 +80,5 @@ public class PurchaseCatalogue extends BaseEntity {
@ApiModelProperty(value="purchaseCatalogueId")
private String purchaseCatalogueId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -55,7 +55,4 @@ public class PurchaseList extends BaseEntity {
*/
@ApiModelProperty(value="区分是分散采购申请还是采购计划")
private String type;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -60,7 +60,4 @@ public class PurchaseListDetails extends BaseEntity {
@ApiModelProperty(value="采购计划明细ID")
private String procurementContentId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -127,7 +127,4 @@ public class PurchasingPlan extends BaseEntity {
@ApiModelProperty(value = "采购计划ID")
private String purchasingPlanId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -76,6 +76,4 @@ public class ReagentConsumableInventory extends BaseEntity {
@ApiModelProperty(value = "(预警信息)")
private String warningInformation;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -81,6 +81,4 @@ public class ReagentConsumableStash extends BaseEntity {
@ApiModelProperty(value = "房间号")
private String roomNo;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -130,8 +130,4 @@ public class ReagentConsumables extends BaseEntity {
@ApiModelProperty(value="reagentConsumableId")
private String reagentConsumableId;
// @ApiModelProperty(value = "存储期限")
// private Integer storageLife;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -87,6 +87,4 @@ public class ReagentConsumablesSet extends BaseEntity {
@ApiModelProperty(value = "(领用物品仓库ID)")
private String reagentConsumableStashId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -70,6 +70,4 @@ public class ReferenceMaterial extends BaseEntity {
@ApiModelProperty(value = "单位")
private String referenceMaterialUnit;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -85,7 +85,4 @@ public class RequisitionRecord extends BaseEntity {
@TableId(value = "requisition_record_id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value = "requisitionRecordId")
private String requisitionRecordId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -34,6 +34,4 @@ public class SolutionUseForm extends BaseEntity {
@ApiModelProperty(value="(标准物质领用/归还登记表ID)")
private String standardMaterialApplicationId;
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -151,9 +151,4 @@ public class StandardMaterialApplication extends BaseEntity {
@ApiModelProperty(value="领取码")
private String claimCode;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -197,10 +197,5 @@ public class StandardMaterialApprovalForm extends BaseEntity {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
@ApiModelProperty(value="id")
private String id;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -123,9 +123,4 @@ public class StandardReserveSolution extends BaseEntity {
@ApiModelProperty(value="标准储备溶液及使用记录表ID")
private String id;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -75,10 +75,6 @@ public class StandardSolutionCurve extends BaseEntity {
@ApiModelProperty(value="(标准储备溶液ID)")
private String referenceMaterialId;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -110,11 +110,6 @@ public class SupplierInformation extends BaseEntity {
@ApiModelProperty(value="(编号)")
private String number;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
/**
* supplierInformationId
*/

@ -89,10 +89,6 @@ public class WarehousingContent extends BaseEntity {
@ApiModelProperty(value="柜子ID")
private String boxId;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -51,9 +51,4 @@ public class WarehousingRecordForm extends BaseEntity {
@ApiModelProperty(value = "id")
private String id;
/**
* sId
*/
@ApiModelProperty(value = "系统ID")
private String sId;
}

@ -101,108 +101,110 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
List<String> requestIdList = new ArrayList<>();
List<DetailsOfCentralized> updateList = new ArrayList<>();
//更新采购申请信息
centralizedRequestList.forEach(centralizedRequest -> {
requestIdList.add(centralizedRequest.getId());
centralizedRequest.setStatus(ReagentStatusConstants.CENTRALIZED_PURCHASING_TO_PLAN.getStatus());
centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
});
requestService.updateBatchById(centralizedRequestList);
List<DetailsOfCentralized> detailsOfCentralizeds = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>lambdaQuery().in(DetailsOfCentralized::getCentralizedRequestId, requestIdList));
// boolean flag = true;
Map<String, List<DetailsOfCentralized>> map = detailsOfCentralizeds.stream().collect(Collectors.groupingBy(item -> item.getReagentConsumableId()));
map.forEach((key, value) -> {
//证明有重复购买的物品,需要合并
if (value.size() > 1) {
ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
fillData(procurementContent, value.get(0));
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
procurementContent.setQuantityPurchased(0);
procurementContent.setNumberOfApplications(0);
value.forEach(detailsOfCentralized -> {
detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
updateList.add(detailsOfCentralized);
procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() + detailsOfCentralized.getQuantityPurchased());
});
procurementContent.setNumberOfApplications(procurementContent.getQuantityPurchased());
procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
list.add(procurementContent);//将计划明细添加至集合
} else {
DetailsOfCentralized detailsOfCentralized = value.get(0);
ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
fillData(procurementContent, detailsOfCentralized);
procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
list.add(procurementContent);//将计划明细添加至集合
updateList.add(detailsOfCentralized);
}
});
// for (DetailsOfCentralized detailsOfCentralized1 : detailsOfCentralizedAllList) {
// PurchasingPlanDTO purchasingPlanDTO = new PurchasingPlanDTO();
// BeanUtils.copyProperties(detailsOfCentralized1, purchasingPlanDTO);
// purchasingPlanDTO.setDetailsOfCentralizedId(detailsOfCentralized1.getId());
// //将列入计划的集中采购申请状态变为3
// CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId());
// centralizedRequest.setStatus(3);
// centralizedRequestList.forEach(centralizedRequest -> {
// requestIdList.add(centralizedRequest.getId());
// centralizedRequest.setStatus(ReagentStatusConstants.CENTRALIZED_PURCHASING_TO_PLAN.getStatus());
// centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
// requestService.updateById(centralizedRequest);
//
// DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
// ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
//
// flag = true;
// //合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
// if (list.size() != 0) {
// for (int i = 0; i < list.size(); i++) {
// if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) {
// list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
// //Set采购数量
// list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());//合并之前的数量加上被合并对象的数量
// list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());//计算小计
// //添加采购申请明细的采购数量
// detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
// detailsOfCentralized.setProcurementContentId(list.get(i).getProcurementContentId());
// detailsOfCentralizedService.updateById(detailsOfCentralized);
// //被合并后,改变flag,进入下一个循环
// flag = false;
// }
// }
// //无需合并的采购计划明细
// if (flag) {
// ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
// BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
// 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());//采购申请明细关联采购计划明细
// detailsOfCentralizedService.updateById(detailsOfCentralized);
// list.add(procurementContent);//将计划明细添加至集合
//
// }
//
// } else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
// ProcurementContent procurementContent = new ProcurementContent();
// BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
// DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
// byId.setQuantityPurchased(byId.getNumberOfApplications());
// });
// requestService.updateBatchById(centralizedRequestList);
List<DetailsOfCentralized> detailsOfCentralizeds = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>lambdaQuery().in(DetailsOfCentralized::getCentralizedRequestId, idList));
// boolean flag = true;
// Map<String, List<DetailsOfCentralized>> map = detailsOfCentralizeds.stream().collect(Collectors.groupingBy(item -> item.getReagentConsumableId()));
// map.forEach((key, value) -> {
// //证明有重复购买的物品,需要合并
// if (value.size() > 1) {
// ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
// fillData(procurementContent, value.get(0));
// procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
// procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
// procurementContent.setQuantityPurchased(0);
// procurementContent.setNumberOfApplications(0);
// value.forEach(detailsOfCentralized -> {
// detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());
// detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
// updateList.add(detailsOfCentralized);
// procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() + detailsOfCentralized.getQuantityPurchased());
// });
// procurementContent.setNumberOfApplications(procurementContent.getQuantityPurchased());
// procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
// list.add(procurementContent);//将计划明细添加至集合
// } else {
// DetailsOfCentralized detailsOfCentralized = value.get(0);
// ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
// procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
// procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
// procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
// fillData(procurementContent, detailsOfCentralized);
// procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
// procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
// procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice());
// byId.setProcurementContentId(procurementContent.getProcurementContentId());
// detailsOfCentralizedService.updateById(byId);
// list.add(procurementContent);
// detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());
// detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
// procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
// list.add(procurementContent);//将计划明细添加至集合
// updateList.add(detailsOfCentralized);
// }
// }
// });
boolean flag = true;
for (DetailsOfCentralized detailsOfCentralized1 : detailsOfCentralizeds) {
PurchasingPlanDTO purchasingPlanDTO = new PurchasingPlanDTO();
BeanUtils.copyProperties(detailsOfCentralized1, purchasingPlanDTO);
purchasingPlanDTO.setDetailsOfCentralizedId(detailsOfCentralized1.getId());
//将列入计划的集中采购申请状态变为3
CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId());
centralizedRequest.setStatus(3);
centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
requestService.updateById(centralizedRequest);
DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
flag = true;
//合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
if (list.size() != 0) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) {
list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
//Set采购数量
list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());//合并之前的数量加上被合并对象的数量
list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());//计算小计
//添加采购申请明细的采购数量
detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
detailsOfCentralized.setProcurementContentId(list.get(i).getProcurementContentId());
detailsOfCentralizedService.updateById(detailsOfCentralized);
//被合并后,改变flag,进入下一个循环
flag = false;
}
}
//无需合并的采购计划明细
if (flag) {
ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
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());//采购申请明细关联采购计划明细
detailsOfCentralizedService.updateById(detailsOfCentralized);
list.add(procurementContent);//将计划明细添加至集合
}
} else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
ProcurementContent procurementContent = new ProcurementContent();
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
byId.setQuantityPurchased(byId.getNumberOfApplications());
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice());
byId.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralizedService.updateById(byId);
list.add(procurementContent);
}
}
if (this.save(purchasingPlan) & procurementContentService.saveBatch(list) && detailsOfCentralizedService.updateBatchById(updateList)) {
calculatedAmount(purchasingPlan, list);//计算经费预算
@ -329,7 +331,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
procurementContentService.updateById(procurementContent);
detailsOfCentralizedService.updateById(detailsOfCentralized);
//计算修改后的经费
calculatedAmount(purchasingPlan,procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
calculatedAmount(purchasingPlan, procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
return procurementContent;
}
@ -355,7 +357,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
if (procurementContentService.updateById(procurementContent) && detailsOfCentralizedService.updateById(detailsOfCentralized)) {
//计算经费
calculatedAmount(purchasingPlan,procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
calculatedAmount(purchasingPlan, procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
return procurementContent;
} else throw new RuntimeException(String.format("修改失败"));
}
@ -381,7 +383,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
this.removeById(purchasingPlan);
return true;
}
calculatedAmount(purchasingPlan,procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
calculatedAmount(purchasingPlan, procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
return true;
} else {
return null;
@ -473,7 +475,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
purchasingPlan.setStatus(1);
purchasingPlan.setCommitTime(LocalDateTime.now());//
if (this.updateById(purchasingPlan)) {
calculatedAmount(purchasingPlan,procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
calculatedAmount(purchasingPlan, procurementContentService.list(Wrappers.<ProcurementContent>lambdaQuery().eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId())));
return purchasingPlan;
} else throw new RuntimeException(String.format("提交失败"));

Loading…
Cancel
Save