From 6f7a8de1ea553e6eca3b04822bd4c93587860f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B5=B7=E8=88=AA?= <1344638791@qq.com> Date: Tue, 26 Sep 2023 17:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E4=BD=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=8E=B7=E5=8F=96=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E5=8F=B7=E4=BB=A5=E5=8F=8A=E5=B1=95=E7=A4=BA=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=AF=95=E5=89=82=E8=80=97=E6=9D=90=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReagentConsumableInventoryController.java | 15 ++-- .../platform/reagent/entity/BatchDetails.java | 1 + .../reagent/service/PurchaseListService.java | 1 + .../ReagentConsumableInventoryService.java | 3 + .../impl/DecentralizedRequestServiceImpl.java | 69 ++------------- .../service/impl/PurchaseListServiceImpl.java | 83 +++++++++++++++---- .../impl/PurchasingPlanServiceImpl.java | 28 +------ ...ReagentConsumableInventoryServiceImpl.java | 24 +++++- .../impl/ReagentConsumablesServiceImpl.java | 9 +- ...tandardMaterialApplicationServiceImpl.java | 19 +++-- .../WarehousingRecordFormServiceImpl.java | 3 + .../vo/StandardMaterialApplicationVO.java | 2 +- 12 files changed, 130 insertions(+), 127 deletions(-) diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java index 8b7f3f6..4f9f6cf 100644 --- a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java +++ b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java @@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.security.Principal; import java.util.List; +import java.util.Map; /** * 试剂耗材库存 @@ -405,14 +406,18 @@ public class ReagentConsumableInventoryController { @PutMapping("/update/location") @ApiOperation(value = "修改试剂/耗材位置信息", - notes = "需要将四个参数传入包装体:" +"\n"+ - "1. 对应试剂耗材批次ID:batchDetailsId" +"\n"+ - "2. 格子ID:latticeId" +"\n"+ - "3. 柜子ID :boxId" +"\n"+ + notes = "需要将四个参数传入包装体:" + "\n" + + "1. 对应试剂耗材批次ID:batchDetailsId" + "\n" + + "2. 格子ID:latticeId" + "\n" + + "3. 柜子ID :boxId" + "\n" + "4. 位置信息:location") public R updateLocation(@RequestBody BatchDetails batchDetails) { return reagentConsumableInventoryService.updateLocation(batchDetails) ? R.ok("修改成功!") : R.failed("修改失败"); } - + @GetMapping("/get/batch/{batchDetailsId}") + @ApiOperation(value = "通过对应批次ID查找批次物品详情信息") + public R getBatch(@PathVariable String batchDetailsId) { + return R.ok(reagentConsumableInventoryService.getBatchVO(batchDetailsId)); + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/BatchDetails.java b/src/main/java/digital/laboratory/platform/reagent/entity/BatchDetails.java index 2863314..6ea9204 100644 --- a/src/main/java/digital/laboratory/platform/reagent/entity/BatchDetails.java +++ b/src/main/java/digital/laboratory/platform/reagent/entity/BatchDetails.java @@ -101,4 +101,5 @@ public class BatchDetails extends BaseEntity { private String batchDetailsId; + } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/PurchaseListService.java b/src/main/java/digital/laboratory/platform/reagent/service/PurchaseListService.java index 3dd1244..12e44c5 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/PurchaseListService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/PurchaseListService.java @@ -37,4 +37,5 @@ public interface PurchaseListService extends IService { IPage getPurchaseListVOPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw); + List addList(String id, Integer type); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java index f220ff7..14b1b75 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; /** * 试剂耗材库存服务类 @@ -66,5 +67,7 @@ public interface ReagentConsumableInventoryService extends IService getBatchVO(String id); + // List getOrgList(); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/DecentralizedRequestServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/DecentralizedRequestServiceImpl.java index 980d901..8c27072 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/DecentralizedRequestServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/DecentralizedRequestServiceImpl.java @@ -3,6 +3,8 @@ package digital.laboratory.platform.reagent.service.impl; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -292,81 +294,23 @@ public class DecentralizedRequestServiceImpl extends ServiceImpl decentralizeDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - decentralizeDetailsLambdaQueryWrapper.eq(DecentralizeDetails::getDecentralizedRequestId, byId.getId()); - - List decentralizeDetailsList = decentralizeDetailsService.list(decentralizeDetailsLambdaQueryWrapper); - - LambdaQueryWrapper reagentConsumablesLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - for (DecentralizeDetails decentralizeDetails : decentralizeDetailsList) { - - if (decentralizeDetails.getReagentConsumableId() == null) { - - ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(decentralizeDetails); - - decentralizeDetails.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); - - decentralizeDetailsService.updateById(decentralizeDetails); - } else { - ReagentConsumables byId1 = reagentConsumablesService.getById(decentralizeDetails.getReagentConsumableId()); - byId1.setTechnicalParameter(decentralizeDetails.getTechnicalParameter()); - reagentConsumablesService.updateById(byId1); - } - } - + List decentralizeDetailsList = decentralizeDetailsService.list(new LambdaQueryWrapper().eq(DecentralizeDetails::getDecentralizedRequestId, byId.getId())); //创建采购清单 - LambdaQueryWrapper decentralizeDetailsLambdaQueryWrapper1 = new LambdaQueryWrapper<>(); - - decentralizeDetailsLambdaQueryWrapper1.eq(DecentralizeDetails::getDecentralizedRequestId, byId.getId()); - - List list = decentralizeDetailsService.list(decentralizeDetailsLambdaQueryWrapper1); - - PurchaseList purchaseList = new PurchaseList(); - purchaseList.setName(DateTime.now() + "采购清单"); - purchaseList.setStatus(0); - purchaseList.setCreateBy(byId.getCreateBy()); - purchaseList.setType("分散采购申请"); - purchaseList.setId(IdWorker.get32UUID().toUpperCase()); - - byId.setPurchaseListId(purchaseList.getId()); - this.updateById(byId); - - purchaseListService.save(purchaseList); - - for (DecentralizeDetails decentralizeDetails : list) { - - PurchaseListDetails purchaseListDetails = new PurchaseListDetails(); - purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); - purchaseListDetails.setReagentConsumableId(decentralizeDetails.getReagentConsumableId()); - purchaseListDetails.setPurchaseListId(purchaseList.getId()); - purchaseListDetails.setPurchaseQuantity(decentralizeDetails.getQuantity()); - - purchaseListDetailsService.save(purchaseListDetails); - decentralizeDetails.setPurchaseListDetailsId(purchaseListDetails.getId()); - decentralizeDetailsService.updateById(decentralizeDetails); + List purchaseListDetailsList = purchaseListService.addList(byId.getId(), 0); + if (purchaseListDetailsList == null) { + throw new RuntimeException(String.format("出错了,请及时联系工作人员")); } - byId.setStatus(5); } else { byId.setStatus(-5); @@ -374,7 +318,6 @@ public class DecentralizedRequestServiceImpl extends ServiceImpl getPurchaseListVOPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw) { - IPage purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw); - return purchaseListVOPage; } + @Override + public List addList(String id, Integer type) { + if (type == 0) { + List decentralizeDetailsList = decentralizeDetailsService.list(new LambdaQueryWrapper().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 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 procurementContentList = procurementContentService.list(new LambdaQueryWrapper().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 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; + } + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java index 7fd6dc7..9aeafda 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java @@ -498,30 +498,10 @@ public class PurchasingPlanServiceImpl extends ServiceImpl procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); - procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); - List list = procurementContentService.list(procurementContentLambdaQueryWrapper);//采购计划明细 - - PurchaseList purchaseList = new PurchaseList();//创建采购清单 - purchaseList.setId(IdWorker.get32UUID().toUpperCase()); - purchaseList.setName(DateTime.now() + "采购清单");//清单名称 - purchaseList.setStatus(0);//状态 - purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划 - purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人 - purchaseListService.save(purchaseList); - purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单 - - for (ProcurementContent procurementContent : list) { - - 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());//关联采购计划明细 - purchaseListDetailsService.save(purchaseListDetails); + List purchaseListDetailsList = purchaseListService.addList(purchasingPlan.getPurchasingPlanId(), 1); + if (purchaseListDetailsList == null) { + throw new RuntimeException(String.format("出错了,请及时联系工作人员")); } } else { purchasingPlan.setStatus(-5);//审核不通过 @@ -578,7 +558,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl voList, HttpServletResponse response){ + public void print(List voList, HttpServletResponse response) { } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java index dd5e667..58fb24b 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java @@ -804,7 +804,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getBatchVO(String id) { + + BatchDetails batchDetails = batchDetailsService.getById(id); + if (batchDetails == null) { + throw new RuntimeException(String.format("没有找到对应的物品信息")); + } + BatchDetailsVO batchDetailsVO = new BatchDetailsVO(); + BeanUtils.copyProperties(batchDetails, batchDetailsVO); + batchDetailsVO.setSupplierName(supplierInformationService.getById(batchDetails.getSupplierId()).getSupplierName()); + ReagentConsumableInventory reagentConsumableInventory = this.getById(batchDetails.getReagentConsumableInventoryId()); + + HashMap objectObjectHashMap = new HashMap<>(); + + objectObjectHashMap.put("batchDetails", batchDetailsVO); + objectObjectHashMap.put("reagentConsumableInventory", reagentConsumableInventory); + + return objectObjectHashMap; + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumablesServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumablesServiceImpl.java index 12ef6c0..3104136 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumablesServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumablesServiceImpl.java @@ -20,19 +20,12 @@ public class ReagentConsumablesServiceImpl extends ServiceImpl standardReserveSolutionLambdaQueryWrapper = new LambdaQueryWrapper<>(); - standardReserveSolutionLambdaQueryWrapper.eq(StandardReserveSolution::getReferenceId, record.getReferenceMaterialId()); - StandardReserveSolution one = standardReserveSolutionService.getOne(standardReserveSolutionLambdaQueryWrapper); - record.setReagentConsumables(byId); if (one != null) { - double configurationConcentration = one.getConfigurationConcentration(); - record.setConfigurationConcentration(configurationConcentration); - + Double configurationConcentration = one.getConfigurationConcentration(); + record.setConfigurationConcentration(String.format("%.4f",configurationConcentration)+" mg/ml"); } } @@ -208,13 +204,18 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl() + .eq(StandardReserveSolution::getReferenceId, standardMaterialApplicationVO.getReferenceMaterialId())); + + if (!ObjectUtil.isNull(standardReserveSolution)){ + standardMaterialApplicationVO.setSpecification(String.format("%.4f",standardReserveSolution.getConfigurationConcentration())+" mg/ml"); + } standardMaterialApplicationVO.setDateOfClaims(LocalDateTimeUtil.format(standardMaterialApplicationVO.getDateOfClaim(), "yyyy年MM月dd日")); standardMaterialApplicationVO.setDateOfReturns(LocalDateTimeUtil.format(standardMaterialApplicationVO.getDateOfReturn(), "yyyy年MM月dd日")); standardMaterialApplicationVO.setIndex(x.toString()); if (standardMaterialApplicationVO.getPurpose() == 0) { standardMaterialApplicationVO.setPrintPurposeAndQuantity("案件," + standardMaterialApplicationVO.getPurposeAndQuantity()); - } else { standardMaterialApplicationVO.setPrintPurposeAndQuantity("其他," + standardMaterialApplicationVO.getPurposeAndQuantity()); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java index e04384b..bd657ac 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java @@ -172,6 +172,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl