From 1f131810e0b21215893c393fc3d8a4042413fbf9 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, 18 Jul 2023 14:24:44 +0800 Subject: [PATCH] update --- .../entity/StandardMaterialApplication.java | 2 +- .../entity/StandardMaterialApprovalForm.java | 2 +- .../reagent/mapper/CheckScheduleMapper.java | 1 - .../ReagentConsumableInventoryService.java | 3 + .../DeliveryRegistrationFormServiceImpl.java | 286 +++++++----------- ...ReagentConsumableInventoryServiceImpl.java | 43 +-- ...tandardMaterialApplicationServiceImpl.java | 21 +- ...andardMaterialApprovalFormServiceImpl.java | 16 +- .../StandardReserveSolutionServiceImpl.java | 5 +- .../WarehousingRecordFormServiceImpl.java | 30 +- .../resources/mapper/CheckScheduleMapper.xml | 24 +- .../ReagentConsumableInventoryMapper.xml | 2 +- 12 files changed, 181 insertions(+), 254 deletions(-) diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java index 210620b..15f3abd 100644 --- a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java +++ b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApplication.java @@ -38,7 +38,7 @@ public class StandardMaterialApplication extends BaseEntity { /** * (状态) */ - @ApiModelProperty(value="(状态)") + @ApiModelProperty(value="(状态0:待归还 1:已归还 -1 无需归还)") private Integer status; /** diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApprovalForm.java b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApprovalForm.java index ea28504..072130e 100644 --- a/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApprovalForm.java +++ b/src/main/java/digital/laboratory/platform/reagent/entity/StandardMaterialApprovalForm.java @@ -181,7 +181,7 @@ public class StandardMaterialApprovalForm extends BaseEntity { @ApiModelProperty(value="(备注)") private String remarks; - @ApiModelProperty(value="(申请内容)") + @ApiModelProperty(value="(申请内容)1:停用 2:报废销毁 3:恢复使用 4:降级使用") private Integer applicationContent; /** diff --git a/src/main/java/digital/laboratory/platform/reagent/mapper/CheckScheduleMapper.java b/src/main/java/digital/laboratory/platform/reagent/mapper/CheckScheduleMapper.java index e0380e5..f12c881 100644 --- a/src/main/java/digital/laboratory/platform/reagent/mapper/CheckScheduleMapper.java +++ b/src/main/java/digital/laboratory/platform/reagent/mapper/CheckScheduleMapper.java @@ -21,6 +21,5 @@ import org.apache.ibatis.annotations.Param; public interface CheckScheduleMapper extends BaseMapper { IPage getCheckScheduleVOPage (IPage page,@Param(Constants.WRAPPER) QueryWrapper qw); - CheckScheduleVO getCheckScheduleVO (String checkScheduleId); } 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 b58a196..88b1054 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java @@ -59,4 +59,7 @@ public interface ReagentConsumableInventoryService extends IService reagentConsumableInventoryDTOList); + + //更新柜子系统方法,柜子ID、物品ID、入库OR出库 (opCode 1 or -1) + void updateCabinet(String latticeId, String itemId, int opCode); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java index 6cd7ce9..104eba2 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java @@ -16,7 +16,9 @@ import digital.laboratory.platform.reagent.service.*; import digital.laboratory.platform.reagent.vo.DeliveryRegistrationFormVO; import digital.laboratory.platform.reagent.vo.OutgoingContentsVO; import digital.laboratory.platform.reagent.vo.ReagentConsumablesSetVO; +import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData; import digital.laboratory.platform.sys.feign.RemoteCabinetService; +import io.seata.spring.annotation.GlobalTransactional; import io.swagger.models.auth.In; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -84,92 +86,81 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>(); reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId()); - List list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper); + List list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper);//领用申请明细 - List outgoingContentsList = new ArrayList<>(); + List outgoingContentsList = new ArrayList<>();//出库明细集合 //循环领用集合,创建出库集合 for (ReagentConsumablesSet reagentConsumablesSet : list) { - ReagentConsumables one = reagentConsumablesService.getById(reagentConsumablesSet.getReagentConsumableId()); - - if (one.getCategory().equals("标准物质") | one.getCategory().equals("标准储备溶液")) { - - OutgoingContents outgoingContents = new OutgoingContents(); + ReagentConsumables reagentConsumables = reagentConsumablesService.getById(reagentConsumablesSet.getReagentConsumableId());//试剂耗材信息 + if (reagentConsumables.getCategory().equals("标准物质") | reagentConsumables.getCategory().equals("标准储备溶液")) { + OutgoingContents outgoingContents = new OutgoingContents();//出库明细 LambdaQueryWrapper referenceMaterialLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ReferenceMaterial referenceMaterial = referenceMaterialService.getById(reagentConsumablesSet.getReferenceMaterialId());//标准物质 - ReferenceMaterial referenceMaterial = referenceMaterialService.getById(reagentConsumablesSet.getReferenceMaterialId()); - - outgoingContents.setReferenceMaterialId(referenceMaterial.getId()); - + outgoingContents.setReferenceMaterialId(referenceMaterial.getId());//标准物质ID outgoingContents.setId(IdWorker.get32UUID().toUpperCase()); - outgoingContents.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId()); - outgoingContents.setQuantity(reagentConsumablesSet.getQuantity()); - outgoingContents.setRemarks(reagentConsumablesSet.getRemarks()); + outgoingContents.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId());//关联出库登记表 + outgoingContents.setQuantity(reagentConsumablesSet.getQuantity());//领用申请数量 + outgoingContents.setRemarks(reagentConsumablesSet.getRemarks());//备注 outgoingContents.setOutboundUse(reagentConsumablesSet.getPurpose()); - outgoingContents.setReagentConsumableId(reagentConsumablesSet.getReagentConsumableId()); - outgoingContents.setReagentConsumableType(one.getCategory()); - outgoingContents.setReferenceMaterialNumber(referenceMaterial.getNumber()); - outgoingContents.setBatchDetailsId(reagentConsumablesSet.getBatchDetailsId()); - outgoingContents.setLocation(referenceMaterial.getLocation()); - outgoingContents.setLatticeId(referenceMaterial.getLatticeId()); - outgoingContents.setBoxId(referenceMaterial.getBoxId()); - outgoingContents.setCode(referenceMaterial.getNumber()); - outgoingContents.setReagentConsumablesSetId(reagentConsumablesSet.getId()); - - - outgoingContentsList.add(outgoingContents); + outgoingContents.setReagentConsumableId(reagentConsumablesSet.getReagentConsumableId());//试剂耗材ID + outgoingContents.setReagentConsumableType(reagentConsumables.getCategory());//试剂耗材类别 + outgoingContents.setReferenceMaterialNumber(referenceMaterial.getNumber());//标准物质编号 + outgoingContents.setBatchDetailsId(reagentConsumablesSet.getBatchDetailsId());//批次ID + outgoingContents.setLocation(referenceMaterial.getLocation());//位置信息 + outgoingContents.setLatticeId(referenceMaterial.getLatticeId());//格子ID + outgoingContents.setBoxId(referenceMaterial.getBoxId());//柜子ID + outgoingContents.setCode(referenceMaterial.getNumber());//扫码出库编号 + outgoingContents.setReagentConsumablesSetId(reagentConsumablesSet.getId());//关联领用申请明细 + + outgoingContentsList.add(outgoingContents);//集合 } else { - String reagentConsumableId = reagentConsumablesSet.getReagentConsumableId(); - + String reagentConsumableId = reagentConsumablesSet.getReagentConsumableId();//试剂耗材ID + //库存试剂耗材 ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.query().eq("reagent_consumable_id", reagentConsumableId)); - + //所有批次集合 List batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", reagentConsumableInventory.getReagentConsumableInventoryId()) .orderByAsc("create_time") .gt("quantity", 0)); - + //新建批次集合,用于存放需出库的物品批次 List batchDetails = new ArrayList<>(); - + //领用数量 Integer quantity = reagentConsumablesSet.getQuantity(); - + //数量,用于计算所需各个批次出库数量 Integer batchQuantity = 0; for (int i = 0; i < batchDetailsList.size(); i++) { - + //从最老的批次开始,如果这个批次的数量满足出库数量,则跳出循环 batchQuantity += batchDetailsList.get(i).getQuantity(); - batchDetails.add(batchDetailsList.get(i)); - if (batchQuantity >= quantity) { - break; } - } - + //循环应出库的对应所有批次 for (int i = 0; i < batchDetails.size(); i++) { OutgoingContents outgoingContents = new OutgoingContents(); outgoingContents.setId(IdWorker.get32UUID().toUpperCase()); - outgoingContents.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId()); + outgoingContents.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId());// outgoingContents.setQuantity(batchDetails.get(i).getQuantity()); outgoingContents.setRemarks(reagentConsumablesSet.getRemarks()); outgoingContents.setOutboundUse(reagentConsumablesSet.getPurpose()); outgoingContents.setReagentConsumableId(reagentConsumablesSet.getReagentConsumableId()); - outgoingContents.setReagentConsumableType(one.getCategory()); + outgoingContents.setReagentConsumableType(reagentConsumables.getCategory()); outgoingContents.setBatchDetailsId(batchDetails.get(i).getBatchDetailsId()); outgoingContents.setLocation(batchDetails.get(i).getLocation()); outgoingContents.setLatticeId(batchDetails.get(i).getLatticeId()); outgoingContents.setBoxId(batchDetails.get(i).getBoxId()); - outgoingContents.setCode(one.getCode()); + outgoingContents.setCode(reagentConsumables.getCode()); outgoingContents.setReagentConsumablesSetId(reagentConsumablesSet.getId()); - + //遍历至最后一个批次时,要计算出这个批次该出库的数量 if (i == batchDetails.size() - 1) { - Integer x = quantity - (batchQuantity - batchDetailsList.get(i).getQuantity()); - outgoingContents.setQuantity(x); } outgoingContentsList.add(outgoingContents); @@ -184,63 +175,49 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl outgoingContentsDTOS, DLPUser dlpUser) { - //得到出库登记表 - DeliveryRegistrationForm byId = this.getById(outgoingContentsDTOS.get(0).getDeliveryRegistrationFormId()); - - byId.setStatus(1); - - byId.setDepositorId(dlpUser.getId()); + DeliveryRegistrationForm deliveryRegistrationForm = this.getById(outgoingContentsDTOS.get(0).getDeliveryRegistrationFormId());//得到出库登记表 + deliveryRegistrationForm.setStatus(1);//状态 + deliveryRegistrationForm.setDepositorId(dlpUser.getId());//出库人// LambdaQueryWrapper outgoingContentsLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - outgoingContentsLambdaQueryWrapper.eq(OutgoingContents::getDeliveryRegistrationFormId, byId.getId()); + outgoingContentsLambdaQueryWrapper.eq(OutgoingContents::getDeliveryRegistrationFormId, deliveryRegistrationForm.getId()); //删除修改之前的内容(防止领用为X种,但实际出库只有n种,导致领用出库不一致) outgoingContentsService.removeBatchByIds(outgoingContentsService.list(outgoingContentsLambdaQueryWrapper)); - List standardMaterialApplications = new ArrayList<>(); + List standardMaterialApplications = new ArrayList<>();//标准物质领用归还登记表集合// - List outgoingContentsList = new ArrayList<>(); + List outgoingContentsList = new ArrayList<>();//出库明细集合 LambdaQueryWrapper applicationForUseLambdaQueryWrapper = new LambdaQueryWrapper<>(); + applicationForUseLambdaQueryWrapper.eq(ApplicationForUse::getDeliveryRegistrationFormId, deliveryRegistrationForm.getId()); + ApplicationForUse applicationForUse = applicationForUseService.getOne(applicationForUseLambdaQueryWrapper);//查询领用申请表 - applicationForUseLambdaQueryWrapper.eq(ApplicationForUse::getDeliveryRegistrationFormId, byId.getId()); - //查询领用申请表 - ApplicationForUse one = applicationForUseService.getOne(applicationForUseLambdaQueryWrapper); - - one.setClaimCode(""); + applicationForUse.setClaimCode("");//要将领取码置空 + applicationForUse.setStatus(2);//状态:已出库 - one.setStatus(2); - - applicationForUseService.updateById(one); + applicationForUseService.updateById(applicationForUse); for (OutgoingContentsDTO outgoingContentsDTO : outgoingContentsDTOS) { //传入出库数量,区分出库数量与领用数量 ReagentConsumablesSet reagentConsumablesSet = reagentConsumablesSetService.getById(outgoingContentsDTO.getReagentConsumablesSetId()); - + //因为这里领取的一种物品,可能会对应多个批次,多个数量,但是对于领用人来说,只关心出库总数量 if (reagentConsumablesSet.getQuantityDelivered() == null) { - - reagentConsumablesSet.setQuantityDelivered(outgoingContentsDTO.getQuantity()); + reagentConsumablesSet.setQuantityDelivered(outgoingContentsDTO.getQuantity());// } else { + //一个批次对应一个出库明细,出库多个批次的情况下,要将每个批次的数量相加 reagentConsumablesSet.setQuantityDelivered(reagentConsumablesSet.getQuantityDelivered() + outgoingContentsDTO.getQuantity()); } - reagentConsumablesSetService.updateById(reagentConsumablesSet); OutgoingContents outgoingContents = new OutgoingContents(); - BeanUtils.copyProperties(outgoingContentsDTO, outgoingContents); - outgoingContents.setId(IdWorker.get32UUID().toUpperCase()); - ReagentConsumables reagentConsumables = reagentConsumablesService.getById(outgoingContents.getReagentConsumableId()); - outgoingContents.setReagentConsumableType(reagentConsumables.getCategory()); - - outgoingContents.setDeliveryRegistrationFormId(byId.getId()); - + outgoingContents.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId()); outgoingContents.setReferenceMaterialNumber(outgoingContentsDTO.getNumber()); if (reagentConsumables.getCategory().equals("标准物质")) { @@ -248,80 +225,69 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImplquery().eq("reference_id", outgoingContentsDTO.getReferenceMaterialId())); - //创建标准物质领用/归还登记表 StandardMaterialApplication standardMaterialApplication = new StandardMaterialApplication(); standardMaterialApplication.setReferenceMaterialNumber(outgoingContentsDTO.getNumber()); standardMaterialApplication.setStandardMaterialApplicationId(IdWorker.get32UUID().toUpperCase()); standardMaterialApplication.setPurpose(outgoingContents.getOutboundUse()); standardMaterialApplication.setDateOfClaim(LocalDateTime.now()); - standardMaterialApplication.setRecipientId(one.getRecipientId()); + standardMaterialApplication.setRecipientId(applicationForUse.getRecipientId()); standardMaterialApplication.setReferenceSubstanceId(reagentConsumables.getReagentConsumableId()); standardMaterialApplication.setSpecification(reagentConsumables.getSpecificationAndModel()); standardMaterialApplication.setRequisitionedQuantity(outgoingContents.getQuantity()); standardMaterialApplication.setSpecification(reagentConsumables.getSpecificationAndModel()); - standardMaterialApplication.setApplicationForUseId(one.getId()); - standardMaterialApplication.setDeliveryRegistrationFormId(byId.getId()); + standardMaterialApplication.setApplicationForUseId(applicationForUse.getId()); + standardMaterialApplication.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId()); standardMaterialApplication.setReferenceSubstanceName(reference_id.getSolutionName()); - if (outgoingContentsDTO.getOutboundUse() == 2) { standardMaterialApplication.setPurposeAndQuantity(outgoingContents.getQuantity().toString()); standardMaterialApplication.setStatus(1); @@ -333,37 +299,25 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl getDeliveryRegistrationFormVOPage(Page page, QueryWrapper qw) { - Page deliveryRegistrationFormVOPage = baseMapper.getDeliveryRegistrationFormVOPage(page, qw); - return deliveryRegistrationFormVOPage; } @Override//通过ID查询出库内容 public DeliveryRegistrationFormVO getDeliveryRegistrationFormVOById(String deliveryRegistrationFormId) { - + //得到VO DeliveryRegistrationFormVO deliveryRegistrationFormVOById = baseMapper.getDeliveryRegistrationFormVOById(deliveryRegistrationFormId); LambdaQueryWrapper outgoingContentsLambdaQueryWrapper = new LambdaQueryWrapper<>(); - outgoingContentsLambdaQueryWrapper.eq(OutgoingContents::getDeliveryRegistrationFormId, deliveryRegistrationFormVOById.getId()); - + //出库明细 List list = outgoingContentsService.list(outgoingContentsLambdaQueryWrapper); List outgoingContentsVOS = new ArrayList<>(); - if (list.size() != 0) { - + //为出库明细关联试剂耗材信息与供应商信息 for (OutgoingContents outgoingContents : list) { OutgoingContentsVO outgoingContentsVO = new OutgoingContentsVO(); - BeanUtils.copyProperties(outgoingContents, outgoingContentsVO); - LambdaQueryWrapper reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, outgoingContents.getReagentConsumableId()); + ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); + outgoingContentsVO.setReagentConsumableInventory(reagentConsumableInventory);//试剂耗材信息 + BatchDetails batchDetails = batchDetailsService.getById(outgoingContents.getBatchDetailsId()); - ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); - - outgoingContentsVO.setReagentConsumableInventory(one); - - BatchDetails byId = batchDetailsService.getById(outgoingContents.getBatchDetailsId()); - - if (byId != null) { - - outgoingContentsVO.setBatch(byId.getBatch()); - - outgoingContentsVO.setSupplierName(supplierInformationService.getById(byId.getSupplierId()).getSupplierName()); + if (batchDetails != null) { + outgoingContentsVO.setBatch(batchDetails.getBatch());//批次 + outgoingContentsVO.setSupplierName(supplierInformationService.getById(batchDetails.getSupplierId()).getSupplierName());//供应商名称 } outgoingContentsVOS.add(outgoingContentsVO); } - deliveryRegistrationFormVOById.setOutgoingContentsList(outgoingContentsVOS); } - return deliveryRegistrationFormVOById; } - @Override//通过ID查询出库内容 + @Override//通过输入领用码的方式查询出库内容 public DeliveryRegistrationFormVO getDeliveryRegistrationFormVOByCode(String claimCode) { if (!StrUtil.isNotBlank(claimCode)) { - return null; } ApplicationForUse applicationForUse = applicationForUseService.getOne(Wrappers.query() .eq("claim_code", claimCode)); - if (applicationForUse == null) { - return null; } - DeliveryRegistrationFormVO deliveryRegistrationFormVOById = baseMapper.getDeliveryRegistrationFormVOById(applicationForUse.getDeliveryRegistrationFormId()); - LambdaQueryWrapper outgoingContentsLambdaQueryWrapper = new LambdaQueryWrapper<>(); - outgoingContentsLambdaQueryWrapper.eq(OutgoingContents::getDeliveryRegistrationFormId, deliveryRegistrationFormVOById.getId()); - List list = outgoingContentsService.list(outgoingContentsLambdaQueryWrapper); - List outgoingContentsVOS = new ArrayList<>(); - if (list.size() != 0) { - + //为出库明细关联试剂耗材信息与供应商信息 for (OutgoingContents outgoingContents : list) { - OutgoingContentsVO outgoingContentsVO = new OutgoingContentsVO(); - BeanUtils.copyProperties(outgoingContents, outgoingContentsVO); - LambdaQueryWrapper reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, outgoingContents.getReagentConsumableId()); - ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); - outgoingContentsVO.setReagentConsumableInventory(one); - outgoingContentsVOS.add(outgoingContentsVO); } - deliveryRegistrationFormVOById.setOutgoingContentsList(outgoingContentsVOS); } - return deliveryRegistrationFormVOById; } 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 b19cb73..3ef321a 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 @@ -31,7 +31,6 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -649,7 +648,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getUserList() { @@ -660,6 +658,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl reagentConsumableInventoryDTOList) { for (ReagentConsumableInventoryDTO reagentConsumableInventoryDTO : reagentConsumableInventoryDTOList) { + + String location = "F" + reagentConsumableInventoryDTO.getRoomNo().charAt(0) + "_试剂柜-" + reagentConsumableInventoryDTO + .getLocation().charAt(0) + "_" + reagentConsumableInventoryDTO.getLocation(); ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory(); BeanUtils.copyProperties(reagentConsumableInventoryDTO, reagentConsumableInventory); reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase()); @@ -685,54 +686,54 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl cellAndStoreSupplyDataArrayList = new ArrayList<>();//柜子数组 - CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); - cellAndStoreSupplyData.setCellStatus("1"); - cellAndStoreSupplyData.setCellId(cabinetCell.getId()); - ArrayList arrayList = new ArrayList<>(); - arrayList.add(reagentConsumableInventory.getReagentConsumableInventoryId()); - cellAndStoreSupplyData.setStoreSupplyList(arrayList); - cellAndStoreSupplyDataArrayList.add(cellAndStoreSupplyData); - remoteCabinetService.takeOrSaveGoodsFromCabinet(cellAndStoreSupplyDataArrayList, 1); - - //获取柜子信息 + batchDetails.setLatticeId(cabinetCell.getId()); batchDetails.setBoxId(cabinetCell.getCabinetId()); - batchDetails.setLocation(reagentConsumableInventoryDTO.getRoomNo() + "-" + reagentConsumableInventoryDTO.getLocation()); + batchDetails.setLocation(location); batchDetails.setPurchaseTime(LocalDateTime.now()); batchDetails.setBatchNumber("/"); batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase()); batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId()); ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(reagentConsumableInventory); reagentConsumableInventory.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); + this.updateCabinet(cabinetCell.getId(), reagentConsumables.getReagentConsumableId(), 1); //导入标准物质 if (reagentConsumableInventoryDTO.getCategory().equals("标准物质")) { ReferenceMaterial referenceMaterial = new ReferenceMaterial(); referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId()); - referenceMaterial.setLocation(reagentConsumableInventoryDTO.getLocation()); + referenceMaterial.setLocation(location); referenceMaterial.setStatus(0); referenceMaterial.setLatticeId(cabinetCell.getId()); referenceMaterial.setBoxId(cabinetCell.getCabinetId()); Calendar instance = Calendar.getInstance(); int year = instance.get(Calendar.YEAR); String roomNo = reagentConsumableInventoryDTO.getRoomNo(); - String substring = roomNo.substring(0, 1); - referenceMaterial.setNumber(reagentConsumableInventoryDTO.getAlias() + "-" + year + "-" + substring + "-1");//自动生成编号 + referenceMaterial.setNumber(reagentConsumableInventoryDTO.getAlias() + "-" + year + "-" + roomNo.charAt(0) + "-1");//自动生成编号 referenceMaterial.setCode(referenceMaterial.getNumber()); referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId()); referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); referenceMaterialService.save(referenceMaterial); - } this.save(reagentConsumableInventory); batchDetailsService.save(batchDetails); - -// remoteCabinetService.updateCabinet(reagentConsumableInventoryDTO.getLatticeId(), reagentConsumableInventory.getReagentConsumableInventoryId(), "1"); - } } + @Override + //更新柜子系统方法,柜子ID、物品ID、入库OR出库 (opCode 1 or -1) + public void updateCabinet(String latticeId, String itemId, int opCode) { + + ArrayList cellAndStoreSupplyDataArrayList = new ArrayList<>();//柜子数组 + CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); + cellAndStoreSupplyData.setCellStatus("1"); + cellAndStoreSupplyData.setCellId(latticeId); + ArrayList arrayList = new ArrayList<>(); + arrayList.add(itemId); + cellAndStoreSupplyData.setStoreSupplyList(arrayList); + cellAndStoreSupplyDataArrayList.add(cellAndStoreSupplyData); + remoteCabinetService.takeOrSaveGoodsFromCabinet(cellAndStoreSupplyDataArrayList, opCode); + } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java index 0974a19..1a1a451 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApplicationServiceImpl.java @@ -21,6 +21,7 @@ import digital.laboratory.platform.reagent.vo.StandardMaterialApplicationVO; import digital.laboratory.platform.sys.feign.RemoteCabinetService; import feign.Response; +import io.seata.spring.annotation.GlobalTransactional; import lombok.RequiredArgsConstructor; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.ibatis.annotations.Param; @@ -71,16 +72,14 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl0){ + if (byId2.getQuantity() > 0) { byId2.setServiceStatus(1); } batchDetailsService.updateById(byId2); reagentConsumableInventoryService.updateById(byId1); - remoteCabinetService.updateCabinet(standardMaterialApplicationDTO.getLatticeId(),referenceMaterial.getId(),"1"); + remoteCabinetService.updateCabinet(standardMaterialApplicationDTO.getLatticeId(), referenceMaterial.getId(), "1"); + reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1); } referenceMaterialService.updateById(referenceMaterial); diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApprovalFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApprovalFormServiceImpl.java index c758356..87d0f5c 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApprovalFormServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/StandardMaterialApprovalFormServiceImpl.java @@ -15,15 +15,15 @@ import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.oss.service.OssFile; import digital.laboratory.platform.reagent.dto.AuditAndApproveDTO; import digital.laboratory.platform.reagent.dto.StandardMaterialApprovalFormDTO; -import digital.laboratory.platform.reagent.entity.ReferenceMaterial; -import digital.laboratory.platform.reagent.entity.StandardMaterialApprovalForm; -import digital.laboratory.platform.reagent.entity.SupplierInformation; +import digital.laboratory.platform.reagent.entity.*; import digital.laboratory.platform.reagent.mapper.StandardMaterialApprovalFormMapper; +import digital.laboratory.platform.reagent.service.ReagentConsumableInventoryService; import digital.laboratory.platform.reagent.service.ReferenceMaterialService; import digital.laboratory.platform.reagent.service.StandardMaterialApprovalFormService; import digital.laboratory.platform.reagent.service.SupplierInformationService; import digital.laboratory.platform.reagent.vo.StandardMaterialApprovalFormVO; import feign.Response; +import io.seata.spring.annotation.GlobalTransactional; import org.apache.commons.io.output.ByteArrayOutputStream; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -58,6 +58,9 @@ public class StandardMaterialApprovalFormServiceImpl extends ServiceImpl list = referenceMaterialService.list(Wrappers.query() @@ -281,7 +290,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl list = referenceMaterialService.list(Wrappers.query() @@ -323,18 +332,15 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl list = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id",warehousingRecordFormId)); + List list = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id", warehousingRecordFormId)); WarehousingRecordForm warehousingRecordForm = this.getById(warehousingRecordFormId); PurchaseList purchaseList = purchaseListService.getById(purchaseListDetailsService.getById(warehousingContent.getPurchaseListDetailsId()).getPurchaseListId());//查询采购清单 diff --git a/src/main/resources/mapper/CheckScheduleMapper.xml b/src/main/resources/mapper/CheckScheduleMapper.xml index b601a3d..1dd479b 100644 --- a/src/main/resources/mapper/CheckScheduleMapper.xml +++ b/src/main/resources/mapper/CheckScheduleMapper.xml @@ -31,15 +31,15 @@ - SELECT cs.*, + SELECT csv.*, ( select department from dlp_base.sys_user - where user_id = cs.create_by) as department + where user_id = csv.create_by) as department , - (SELECT user.name FROM dlp_base.sys_user user WHERE user.user_id=cs.technical_director_id ) as technical_director_name, - (SELECT user.name FROM dlp_base.sys_user user WHERE user.user_id=cs.manager_id ) as manager_mame - FROM check_schedule cs + (SELECT user.name FROM dlp_base.sys_user user WHERE user.user_id=csv.technical_director_id ) as technical_director_name, + (SELECT user.name FROM dlp_base.sys_user user WHERE user.user_id=csv.manager_id ) as manager_mame + FROM check_schedule csv diff --git a/src/main/resources/mapper/ReagentConsumableInventoryMapper.xml b/src/main/resources/mapper/ReagentConsumableInventoryMapper.xml index ca07986..d7d367b 100644 --- a/src/main/resources/mapper/ReagentConsumableInventoryMapper.xml +++ b/src/main/resources/mapper/ReagentConsumableInventoryMapper.xml @@ -68,7 +68,7 @@