diff --git a/src/main/java/digital/laboratory/platform/reagent/ReagentManagmentApplication.java b/src/main/java/digital/laboratory/platform/reagent/ReagentManagmentApplication.java index 53c9e55..7803a4c 100644 --- a/src/main/java/digital/laboratory/platform/reagent/ReagentManagmentApplication.java +++ b/src/main/java/digital/laboratory/platform/reagent/ReagentManagmentApplication.java @@ -14,23 +14,11 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableDLPFeignClients @EnableDiscoveryClient @EnableDLPResourceServer -@SpringBootApplication(scanBasePackages="digital.laboratory.platform") +@SpringBootApplication(scanBasePackages = "digital.laboratory.platform") @EnableScheduling public class ReagentManagmentApplication { public static void main(String[] args) { SpringApplication.run(ReagentManagmentApplication.class, args); - - // System.out.println("\n\n\n"); - // System.out.println("-----------------------------"); - // System.out.println("end of Spring Application main()"); - // System.out.println("-----------------------------"); - // System.out.println("\n\n\n"); } - - // @Bean - // RestTemplate restTemplate() { - // return new RestTemplate(); - // } - // } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/ReferenceMaterialService.java b/src/main/java/digital/laboratory/platform/reagent/service/ReferenceMaterialService.java index 66b8082..3a89797 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/ReferenceMaterialService.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/ReferenceMaterialService.java @@ -22,4 +22,5 @@ public interface ReferenceMaterialService extends IService { List getReferenceMaterialList(); + String createNo(String alias, String location); } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java index b31502a..a50e8c7 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java @@ -52,14 +52,12 @@ import java.util.List; @Service @SuppressWarnings("all") public class AcceptanceRecordFormServiceImpl extends ServiceImpl implements AcceptanceRecordFormService { - @Autowired private BlacklistService blacklistService; @Autowired private AcceptanceSignForService acceptanceSignForService; @Autowired private ReagentConsumablesService reagentConsumablesService; - @Autowired private WarehousingContentService warehousingContentService; @Autowired @@ -72,7 +70,6 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl acceptanceRecordFormDTOList, DLPUser dlpUser) { - for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) { //调用单个提交方法 AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser); @@ -81,83 +78,64 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl getAcceptanceRecordFormVOPage(IPage page, QueryWrapper qw) { - IPage acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表 - List records = acceptanceRecordFormVOPage.getRecords(); //添加试剂耗材信息至VO for (AcceptanceRecordFormVO record : records) { - - ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId()); - - record.setReagentConsumables(byId); + ReagentConsumables reagentConsumables = reagentConsumablesService.getById(record.getReagentConsumableId()); + record.setReagentConsumables(reagentConsumables); } return acceptanceRecordFormVOPage; } -// @Override -// public IPage getAcceptanceRecordFormVORecordPage(IPage page) { -// -// LambdaQueryWrapper acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>(); -// -// acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4); -// -// List list = this.list(acceptanceRecordFormLambdaQueryWrapper); -// -// ArrayList acceptanceRecordFormVOS = new ArrayList<>(); -// -// if (list.size() != 0) { -// -// for (AcceptanceRecordForm acceptanceRecordForm : list) { -// -// AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId()); -// -// acceptanceRecordFormVOS.add(acceptanceRecordFormVO); -// } -// } -// PageUtils pageUtils = new PageUtils(); -// -// Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS); -// -// return pages; -// } - @Override public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) { AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);//查询单个验收记录表 - if (acceptanceRecordFormVO == null) { return null; } - - ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());//查询试剂耗材信息 - - acceptanceRecordFormVO.setReagentConsumables(byId); - + //查询试剂耗材信息 + acceptanceRecordFormVO.setReagentConsumables(reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId())); return acceptanceRecordFormVO; } @@ -250,26 +186,21 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组 - List acceptanceRecordForms = new ArrayList<>();//验收记录表集合 - for (String id : uuId) { - - AcceptanceRecordForm byId = this.getById(id); - - if (byId.getStatus() != 1) { + AcceptanceRecordForm acceptanceRecordForm = this.getById(id); + if (acceptanceRecordForm.getStatus() != 1) { throw new RuntimeException(String.format("当前状态不能审核")); } - byId.setPrimaryAuditorId(dlpUser.getId());//审核人ID - byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 - byId.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间 - byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 + acceptanceRecordForm.setPrimaryAuditorId(dlpUser.getId());//审核人ID + acceptanceRecordForm.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 + acceptanceRecordForm.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间 + acceptanceRecordForm.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { - byId.setStatus(2);//审核成功状态 - } else byId.setStatus(-2);//审核失败状态 - - acceptanceRecordForms.add(byId); + acceptanceRecordForm.setStatus(2);//审核成功状态 + } else acceptanceRecordForm.setStatus(-2);//审核失败状态 + acceptanceRecordForms.add(acceptanceRecordForm); } if (this.updateBatchById(acceptanceRecordForms)) { return true; @@ -283,23 +214,21 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组 List acceptanceRecordForms = new ArrayList<>();//验收记录表集合 - for (String id : uuId) { + AcceptanceRecordForm acceptanceRecordForm = this.getById(id); - AcceptanceRecordForm byId = this.getById(id); - - if (byId.getStatus() != 2) { + if (acceptanceRecordForm.getStatus() != 2) { throw new RuntimeException(String.format("当前状态不能审核")); } - byId.setSecondaryAuditorId(dlpUser.getId());//审核人ID - byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 - byId.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间 - byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 + acceptanceRecordForm.setSecondaryAuditorId(dlpUser.getId());//审核人ID + acceptanceRecordForm.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 + acceptanceRecordForm.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间 + acceptanceRecordForm.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { - byId.setStatus(3);//审核成功状态 - } else byId.setStatus(-3);//审核失败状态 - acceptanceRecordForms.add(byId); + acceptanceRecordForm.setStatus(3);//审核成功状态 + } else acceptanceRecordForm.setStatus(-3);//审核失败状态 + acceptanceRecordForms.add(acceptanceRecordForm); } if (this.updateBatchById(acceptanceRecordForms)) { return true; @@ -317,51 +246,45 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl stringList = new ArrayList<>();//用于接收验收集合表ID for (String s : uuId) { - AcceptanceRecordForm byId = this.getById(s); - if (!stringList.contains(byId.getAcceptanceSignForId())) {//添加验收集合表ID至数组 - stringList.add(byId.getAcceptanceSignForId()); + AcceptanceRecordForm acceptanceRecordForm = this.getById(s); + if (!stringList.contains(acceptanceRecordForm.getAcceptanceSignForId())) {//添加验收集合表ID至数组 + stringList.add(acceptanceRecordForm.getAcceptanceSignForId()); } - if (byId.getStatus() != 3) { + if (acceptanceRecordForm.getStatus() != 3) { throw new RuntimeException(String.format("当前状态不能审核")); } - byId.setThreeLevelAuditorId(dlpUser.getId());//审核人ID - byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 - byId.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间 - byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 - + acceptanceRecordForm.setThreeLevelAuditorId(dlpUser.getId());//审核人ID + acceptanceRecordForm.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 + acceptanceRecordForm.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间 + acceptanceRecordForm.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过 - if (byId.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单 - blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId()); + if (acceptanceRecordForm.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单 + blacklistService.addListById2(acceptanceRecordForm.getReagentConsumableId(), acceptanceRecordForm.getSupplierId()); } - byId.setStatus(6); - } else byId.setStatus(-4); - acceptanceRecordForms.add(byId); + acceptanceRecordForm.setStatus(6); + } else acceptanceRecordForm.setStatus(-4); + acceptanceRecordForms.add(acceptanceRecordForm); } if (this.updateBatchById(acceptanceRecordForms)) { //判断是否验收完毕,更改验收集合表状态 - for (String s : stringList) { - - AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);//批量审核的验收记录关联的所有验收集合表 + for (String id : stringList) { + AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(id);//批量审核的验收记录关联的所有验收集合表 //得到签收物品集合 List warehousingContentList = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId())); //得到验收集合中的所有验收记录表 - List recordFormList = this.list(Wrappers.query().eq("acceptance_sign_for_id", s)); - + List recordFormList = this.list(Wrappers.query().eq("acceptance_sign_for_id", id)); if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表) - - int x = 0; - + int index = 0; for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) { - if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态 - x = x + 1; + index += 1; } } - if (x == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成 - AcceptanceSignFor byId = acceptanceSignForService.getById(s); - byId.setStatus(2); - acceptanceSignForService.updateById(byId); + if (index == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成 + AcceptanceSignFor acceptanceSignForById = acceptanceSignForService.getById(id); + acceptanceSignForById.setStatus(2); + acceptanceSignForService.updateById(acceptanceSignForById); } } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/ApplicationForUseServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/ApplicationForUseServiceImpl.java index a4bf4d1..cc7cf81 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/ApplicationForUseServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/ApplicationForUseServiceImpl.java @@ -1,9 +1,11 @@ package digital.laboratory.platform.reagent.service.impl; +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; import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import digital.laboratory.platform.common.mybatis.security.service.DLPUser; @@ -55,13 +57,9 @@ public class ApplicationForUseServiceImpl extends ServiceImpl list = reagentConsumablesSetService.getList(applicationForUseId); - if (list != null && list.size() > 0) { - applicationForUseVO.setReagentConsumablesSetVOList(list); } return applicationForUseVO; @@ -69,15 +67,10 @@ public class ApplicationForUseServiceImpl extends ServiceImpl getApplicationForUseVOPage(IPage page, QueryWrapper qw) { - IPage applicationForUseVOPage = baseMapper.getApplicationForUseVOPage(page, qw); - List records = applicationForUseVOPage.getRecords(); - for (ApplicationForUseVO record : records) { - ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(record.getId()); - BeanUtils.copyProperties(applicationForUseVO, record); } return applicationForUseVOPage; @@ -91,86 +84,51 @@ public class ApplicationForUseServiceImpl extends ServiceImpl reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId()); - - ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); - - Integer totalQuantity = one.getTotalQuantity(); + Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity(); if (reagentConsumablesSet.getQuantity() > totalQuantity) { - throw new RuntimeException(String.format("领用数量不能大于库存量")); } - if (reagentConsumablesSetService.save(reagentConsumablesSet) - ) { - ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(byId.getId()); + if (reagentConsumablesSetService.save(reagentConsumablesSet)) { + ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(application.getId()); return applicationForUseVO; } else return null; } - //录入领用申请表 - } + //首次添加 ApplicationForUse applicationForUse = new ApplicationForUse(); - applicationForUse.setId(IdWorker.get32UUID().toUpperCase()); - applicationForUse.setStatus(0); - applicationForUse.setRecipientId(dlpUser.getId()); //录入领用申请内容 //生成领用登记表集合 ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet(); - BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet); - reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase()); - reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId()); - if (applicationForUseDTO.getReferenceMaterialId() != null) { - reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId()); } - LambdaQueryWrapper reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId()); - - ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); - - Integer totalQuantity = one.getTotalQuantity(); - + Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity(); if (reagentConsumablesSet.getQuantity() > totalQuantity) { - throw new RuntimeException(String.format("领用数量不能大于库存量")); } - if (this.save(applicationForUse) & reagentConsumablesSetService.save(reagentConsumablesSet) - ) { + if (this.save(applicationForUse) & reagentConsumablesSetService.save(reagentConsumablesSet)) { ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId()); return applicationForUseVO; } else return null; @@ -179,59 +137,36 @@ public class ApplicationForUseServiceImpl extends ServiceImpl reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId()); - - List list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper); - - return reagentConsumablesSetService.removeBatchByIds(list) & this.removeById(applicationForUse); - + return reagentConsumablesSetService.remove(Wrappers.lambdaQuery().eq(ReagentConsumablesSet::getApplicationForUseId,applicationForUse.getId()))&&this.removeById(applicationForUse); } else throw new RuntimeException(String.format("当前状态不能删除")); } public String getCode() { - //生成随机数 + //生成6位随机数 String random = "" + Math.random(); - String substring = random.substring(random.length() - 6); - QueryWrapper applicationForUseQueryWrapper = new QueryWrapper<>(); //判断随机数是否重复 applicationForUseQueryWrapper.eq("claim_code", substring); - if (this.getOne(applicationForUseQueryWrapper) != null) { - substring = random.substring(random.length() - 6); - getCode(); } return substring; @@ -241,54 +176,31 @@ public class ApplicationForUseServiceImpl extends ServiceImpl reagentConsumablesSets = new ArrayList<>(); - List applicationForUseDTOList = applicationForUseBatchDTO.getApplicationForUseDTOList(); - for (ApplicationForUseDTO applicationForUseDTO : applicationForUseDTOList) { - ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet(); - BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet); - reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase()); - reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId()); - if (applicationForUseDTO.getReferenceMaterialId() != null) { - reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId()); } - LambdaQueryWrapper reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); - ReferenceMaterial referenceMaterial = referenceMaterialService.getById(applicationForUseDTO.getReferenceMaterialId()); - - reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, referenceMaterial.getReagentConsumableId()); - - ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper); - - Integer totalQuantity = one.getTotalQuantity(); - + Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity(); if (reagentConsumablesSet.getQuantity() > totalQuantity) { - throw new RuntimeException(String.format("领用数量不能大于库存量")); } - reagentConsumablesSets.add(reagentConsumablesSet); } - if (this.save(applicationForUse) & reagentConsumablesSetService.saveBatch(reagentConsumablesSets) - ) { + if (this.save(applicationForUse) && reagentConsumablesSetService.saveBatch(reagentConsumablesSets)) { this.commitApplication(applicationForUse.getId(), dlpUser); ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId()); return applicationForUseVO; @@ -299,15 +211,10 @@ public class ApplicationForUseServiceImpl extends ServiceImpl getReagentConsumablesSets(String id) { - List applicationForUseList = this.list(Wrappers.query().eq("experiment_id", id)); - List reagentConsumablesSetList = new ArrayList<>(); - for (ApplicationForUse applicationForUse : applicationForUseList) { - List list = reagentConsumablesSetService.getList(applicationForUse.getId()); - reagentConsumablesSetList.addAll(list); } return reagentConsumablesSetList; diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/BatchDetailsServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/BatchDetailsServiceImpl.java index e0c38dc..3d95b81 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/BatchDetailsServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/BatchDetailsServiceImpl.java @@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; @@ -33,53 +34,46 @@ public class BatchDetailsServiceImpl extends ServiceImpl getBatchDetailsList(String reagentConsumableInventoryId) { - LambdaQueryWrapper batchDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); batchDetailsLambdaQueryWrapper.eq(BatchDetails::getReagentConsumableInventoryId, reagentConsumableInventoryId) .eq(BatchDetails::getServiceStatus, 1); List list = this.list(batchDetailsLambdaQueryWrapper); List batchDetailsVOS = new ArrayList<>(); for (BatchDetails batchDetails : list) { - SupplierInformation byId1 = supplierInformationService.getById(batchDetails.getSupplierId()); + SupplierInformation supplierInformation = supplierInformationService.getById(batchDetails.getSupplierId()); BatchDetailsVO batchDetailsVO = new BatchDetailsVO(); BeanUtils.copyProperties(batchDetails, batchDetailsVO); - batchDetailsVO.setSupplierName(byId1.getSupplierName()); + batchDetailsVO.setSupplierName(supplierInformation.getSupplierName()); batchDetailsVOS.add(batchDetailsVO); } return batchDetailsVOS; } //---------------------------------------------------------------- - //修改库存(只能修改批次数量,同时更新总数量与对应仓库数量) - public BatchDetails updateQuantity(String batchDetailsId, Integer quantity) { - - BatchDetails batchDetails = this.getById(batchDetailsId); - - ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getById(batchDetails.getReagentConsumableInventoryId()); - - ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getById(batchDetails.getReagentConsumableStashId()); - - reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); - reagentConsumableStash.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); - batchDetails.setQuantity(quantity); - - if (this.updateById(batchDetails) && reagentConsumableStashService.updateById(reagentConsumableStash) && reagentConsumableInventoryService.updateById(reagentConsumableInventory)) { - return batchDetails; - } else { - throw new RuntimeException(String.format("修改失败")); - } - } +// //修改库存(只能修改批次数量,同时更新总数量与对应仓库数量) +// public BatchDetails updateQuantity(String batchDetailsId, Integer quantity) { +// BatchDetails batchDetails = this.getById(batchDetailsId); +// ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getById(batchDetails.getReagentConsumableInventoryId()); +// ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getById(batchDetails.getReagentConsumableStashId()); +// reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); +// reagentConsumableStash.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); +// batchDetails.setQuantity(quantity); +// if (this.updateById(batchDetails) && reagentConsumableStashService.updateById(reagentConsumableStash) && reagentConsumableInventoryService.updateById(reagentConsumableInventory)) { +// return batchDetails; +// } else { +// throw new RuntimeException(String.format("修改失败")); +// } +// } @Override @Transactional public void updateCabinetData() { List list = this.list(new LambdaQueryWrapper().gt(BatchDetails::getQuantity, 0)); - int x = 1; for (BatchDetails batchDetails : list) { String latticeId = batchDetails.getLatticeId(); reagentConsumableInventoryService.updateCabinet(latticeId, batchDetails.getReagentConsumableInventoryId(), 1); diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/BlacklistServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/BlacklistServiceImpl.java index 74061bb..f0b2689 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/BlacklistServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/BlacklistServiceImpl.java @@ -2,6 +2,7 @@ package digital.laboratory.platform.reagent.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import digital.laboratory.platform.reagent.entity.Blacklist; import digital.laboratory.platform.reagent.entity.ReagentConsumables; @@ -31,23 +32,19 @@ public class BlacklistServiceImpl extends ServiceImpl getBlacklist(String supplierInformationId) { - LambdaQueryWrapper blacklistLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - blacklistLambdaQueryWrapper.eq(Blacklist::getSupplierId, supplierInformationId); - - List list = this.list(blacklistLambdaQueryWrapper); - + List list = this.list(Wrappers.lambdaQuery().eq(Blacklist::getSupplierId, supplierInformationId)); List blackListVOS = new ArrayList<>(); - for (Blacklist blacklist : list) { - BlackListVO blackListVO = new BlackListVO(); - - ReagentConsumables byId = reagentConsumablesService.getById(blacklist.getReagentConsumableId()); - - blackListVO.setReagentConsumableName(byId.getReagentConsumableName()); - blackListVO.setCategory(byId.getCategory()); - blackListVO.setBrand(byId.getBrand()); - blackListVO.setSpecificationAndModel(byId.getSpecificationAndModel()); - + ReagentConsumables reagentConsumables = reagentConsumablesService.getById(blacklist.getReagentConsumableId()); + blackListVO.setReagentConsumableName(reagentConsumables.getReagentConsumableName()); + blackListVO.setCategory(reagentConsumables.getCategory()); + blackListVO.setBrand(reagentConsumables.getBrand()); + blackListVO.setSpecificationAndModel(reagentConsumables.getSpecificationAndModel()); blackListVOS.add(blackListVO); } - return blackListVOS; } - } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/CategoryTableServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/CategoryTableServiceImpl.java index f035538..8e9a384 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/CategoryTableServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/CategoryTableServiceImpl.java @@ -24,29 +24,17 @@ public class CategoryTableServiceImpl extends ServiceImpl categoryTableLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - categoryTableLambdaQueryWrapper.eq(CategoryTable::getSpecies, species); - - categoryTableLambdaQueryWrapper.eq(CategoryTable::getCategory, category); - - CategoryTable one = this.getOne(categoryTableLambdaQueryWrapper); - - if (one == null) { + CategoryTable oldCategoryTable = this.getOne(Wrappers.lambdaQuery().eq(CategoryTable::getCategory, category).eq(CategoryTable::getSpecies, species)); + if (oldCategoryTable == null) { CategoryTable categoryTable = new CategoryTable(); - categoryTable.setId(IdWorker.get32UUID().toUpperCase()); - categoryTable.setSpecies(species); - categoryTable.setCategory(category); - this.save(categoryTable); - return categoryTable; } - return one; + return oldCategoryTable; } @Override @@ -59,14 +47,7 @@ public class CategoryTableServiceImpl extends ServiceImpl getSpecies(String category) { - - LambdaQueryWrapper typeTableLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - typeTableLambdaQueryWrapper.eq(CategoryTable::getCategory, category); - - List list = this.list(typeTableLambdaQueryWrapper); - - return list; + return this.list(Wrappers.lambdaQuery().eq(CategoryTable::getCategory, category)); } } diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/CentralizedRequestServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/CentralizedRequestServiceImpl.java index 7ec99f7..e1d5e21 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/CentralizedRequestServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/CentralizedRequestServiceImpl.java @@ -22,6 +22,7 @@ import digital.laboratory.platform.reagent.mapper.CentralizedRequestMapper; import digital.laboratory.platform.reagent.service.*; import digital.laboratory.platform.reagent.vo.*; import feign.Response; +import io.seata.common.util.StringUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -83,7 +84,7 @@ public class CentralizedRequestServiceImpl extends ServiceImpl centralizedRequestDTOList, DLPUser dlpUser) { String centralizedRequestId = centralizedRequestDTOList.get(0).getCentralizedRequestId(); List detailsOfCentralizedList = new ArrayList<>(); - if (centralizedRequestId == null) { + if (!StringUtils.isNotBlank(centralizedRequestId)) { CentralizedRequest centralizedRequest = new CentralizedRequest(); centralizedRequest.setApplicantId(dlpUser.getId()); centralizedRequest.setId(IdWorker.get32UUID().toUpperCase()); @@ -255,6 +256,7 @@ public class CentralizedRequestServiceImpl extends ServiceImpl detailsOfCentralizedVOList = centralizedRequest.getDetailsOfCentralizedVOList(); for (DetailsOfCentralizedVO detailsOfCentralized : detailsOfCentralizedVOList) { ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId()); diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/CheckScheduleServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/CheckScheduleServiceImpl.java index f7f84f4..b70f92a 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/CheckScheduleServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/CheckScheduleServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; @@ -67,7 +68,6 @@ public class CheckScheduleServiceImpl extends ServiceImpl periodVerificationPlanDTOS, DLPUser dlpUser) { CheckSchedule checkSchedule = new CheckSchedule(); - checkSchedule.setId(IdWorker.get32UUID().toUpperCase()); checkSchedule.setManagerId(dlpUser.getId()); checkSchedule.setStatus(0); @@ -75,22 +75,15 @@ public class CheckScheduleServiceImpl extends ServiceImpl periodVerificationPlans = new ArrayList<>(); for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) { - PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan(); - BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan); - periodVerificationPlan.setCheckScheduleId(checkSchedule.getId()); - periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty()); - periodVerificationPlans.add(periodVerificationPlan); } if (this.save(checkSchedule) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) { - CheckScheduleVO checkScheduleVO = this.getCheckScheduleVO(checkSchedule.getId()); - return checkScheduleVO; } else throw new RuntimeException(String.format("保存失败")); } @@ -100,34 +93,21 @@ public class CheckScheduleServiceImpl extends ServiceImpl periodVerificationPlanDTOS) { - CheckSchedule byId = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); - - LambdaQueryWrapper periodVerificationPlanLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - periodVerificationPlanLambdaQueryWrapper.eq(PeriodVerificationPlan::getCheckScheduleId, byId.getId()); - - List list = periodVerificationPlanService.list(periodVerificationPlanLambdaQueryWrapper); + CheckSchedule checkSchedule = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); - periodVerificationPlanService.removeBatchByIds(list); + periodVerificationPlanService.remove(Wrappers.lambdaQuery().eq(PeriodVerificationPlan::getCheckScheduleId, checkSchedule.getId())); List periodVerificationPlans = new ArrayList<>(); for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) { - PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan(); - BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan); - periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty()); - - periodVerificationPlan.setCheckScheduleId(byId.getId()); - + periodVerificationPlan.setCheckScheduleId(checkSchedule.getId()); periodVerificationPlans.add(periodVerificationPlan); } - - if (this.updateById(byId) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) { - - return byId; + if (this.updateById(checkSchedule) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) { + return checkSchedule; } else throw new RuntimeException(String.format("保存失败")); } @@ -135,35 +115,23 @@ public class CheckScheduleServiceImpl extends ServiceImpl periodVerificationPlanDTOS, DLPUser dlpUser) { - - CheckSchedule byId = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); - - if (byId == null) { - + CheckSchedule oldCheckSchedule = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); + if (oldCheckSchedule == null) { CheckSchedule checkSchedule = this.addPlan(periodVerificationPlanDTOS, dlpUser); checkSchedule.setStatus(1); checkSchedule.setCommitTime(LocalDateTime.now()); this.updateById(checkSchedule); - return checkSchedule; } else { - - if (byId.getStatus() == -2) { - + if (oldCheckSchedule.getStatus() == -2) { CheckScheduleVO checkScheduleVO = this.addPlan(periodVerificationPlanDTOS, dlpUser); - return checkScheduleVO; } - - CheckSchedule checkSchedule = this.editPlan(periodVerificationPlanDTOS); - checkSchedule.setStatus(1); checkSchedule.setCommitTime(LocalDateTime.now()); - this.updateById(checkSchedule); - return checkSchedule; } @@ -172,53 +140,39 @@ public class CheckScheduleServiceImpl extends ServiceImpl periodVerificationPlanLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - periodVerificationPlanLambdaQueryWrapper.eq(PeriodVerificationPlan::getCheckScheduleId, byId.getId()); - - List list = periodVerificationPlanService.list(periodVerificationPlanLambdaQueryWrapper); - + List list = periodVerificationPlanService.list(Wrappers.lambdaQuery().eq(PeriodVerificationPlan::getCheckScheduleId, checkSchedule.getId())); for (PeriodVerificationPlan periodVerificationPlan : list) { - periodVerificationImplementationService.addById(periodVerificationPlan); - } - byId.setStatus(6); + checkSchedule.setStatus(6); } else { - byId.setStatus(-2); + checkSchedule.setStatus(-2); } - if (this.updateById(byId)) { - return byId; + if (this.updateById(checkSchedule)) { + return checkSchedule; } else throw new RuntimeException(String.format("审核失败")); } @Override public IPage getCheckScheduleVOPage(IPage page, QueryWrapper qw) { - - IPage checkScheduleVOPage = baseMapper.getCheckScheduleVOPage(page, qw); - - return checkScheduleVOPage; + return baseMapper.getCheckScheduleVOPage(page, qw); } @Override public CheckScheduleVO getCheckScheduleVO(String checkScheduleId) { CheckScheduleVO checkScheduleVO = baseMapper.getCheckScheduleVO(checkScheduleId); - List periodVerificationPlanVOList = periodVerificationPlanService.getPeriodVerificationPlanVOList(checkScheduleVO.getId()); - checkScheduleVO.setPeriodVerificationPlanVOS(periodVerificationPlanVOList); - return checkScheduleVO; } 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 658bd45..e6b9bcb 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 @@ -112,9 +112,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getReagentConsumableInventoryRMVOList(IPage page, Integer warning, String keywords) { Integer reagentCategory = 1; -// if (warning != null && warning == 2) { -// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory); -// } IPage reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory); return reagentConsumableInventoryVOPage; } @@ -122,9 +119,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getReagentConsumableInventoryREVOList(IPage page, Integer warning, String keywords) { Integer reagentCategory = 0; -// if (warning != null && warning == 2) { -// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory); -// } IPage reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory); return reagentConsumableInventoryVOPage; } @@ -142,23 +136,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl reagentConsumableInventoryVOList = new ArrayList<>(); -// List list = batchDetailsService.list(Wrappers.query().eq("warning_information", "即将过期").or().eq("warning_information", "已过期").or().eq("warning_information", "即将到达存储期限").or().eq("warning_information", "已超过存储期限")); -// //查找具有到期批次物品的试剂耗材\标准物质类信息 -// if (list != null && list.size() != 0) { -// for (BatchDetails batchDetails : list) { -// ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory(); -// -//// if (reagentConsumableInventory != null) { -// ReagentConsumableInventoryVO reagentConsumableInventoryVO = new ReagentConsumableInventoryVO(); -// BeanUtils.copyProperties(reagentConsumableInventory, reagentConsumableInventoryVO); -// reagentConsumableInventoryVO.setBatchDetailsVOS(batchDetailsService.getBatchDetailsList(reagentConsumableInventoryVO.getReagentConsumableInventoryId())); -// reagentConsumableInventoryVOList.add(reagentConsumableInventoryVO); -// } -// } -// } -// PageUtils pageUtils = new PageUtils(); -// return pageUtils.getPages((int) page.getCurrent(), (int) page.getSize(), reagentConsumableInventoryVOList); } @Override//入库增加库存 @@ -172,7 +149,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl data = new HashMap<>(); data.put("standardReserveSolution", standardReserveSolutionVOById); diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReferenceMaterialServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReferenceMaterialServiceImpl.java index 56a215c..ed56da2 100644 --- a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReferenceMaterialServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReferenceMaterialServiceImpl.java @@ -1,5 +1,6 @@ package digital.laboratory.platform.reagent.service.impl; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -7,25 +8,24 @@ import digital.laboratory.platform.common.feign.RemoteWord2PDFService; import digital.laboratory.platform.common.oss.service.OssFile; import digital.laboratory.platform.reagent.entity.ReagentConsumables; import digital.laboratory.platform.reagent.entity.ReferenceMaterial; -import digital.laboratory.platform.reagent.entity.StandardMaterialApprovalForm; import digital.laboratory.platform.reagent.mapper.ReferenceMaterialMapper; import digital.laboratory.platform.reagent.service.ReagentConsumablesService; import digital.laboratory.platform.reagent.service.ReferenceMaterialService; import digital.laboratory.platform.reagent.service.StandardMaterialApprovalFormService; import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO; -import digital.laboratory.platform.reagent.vo.StandardMaterialApprovalFormVO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; /** * 服务实现类 * * @author Zhang Xiaolong created at 2023-03-23 - * @describe 服务实现类 + * @describe 服务实现类 */ @Service @@ -45,27 +45,23 @@ public class ReferenceMaterialServiceImpl extends ServiceImpl getReferenceMaterialVOList(String batchDetailsId){ - + public List getReferenceMaterialVOList(String batchDetailsId) { LambdaQueryWrapper referenceMaterialLambdaQueryWrapper = new LambdaQueryWrapper<>(); - - referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId,batchDetailsId); - + referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId, batchDetailsId); List list = this.list(referenceMaterialLambdaQueryWrapper); - List referenceMaterialVOS = new ArrayList<>(); - for (ReferenceMaterial referenceMaterial : list) { - ReagentConsumables byId = reagentConsumablesService.getById(referenceMaterial.getReagentConsumableId()); - ReferenceMaterialVO referenceMaterialVO = new ReferenceMaterialVO(); - - BeanUtils.copyProperties(referenceMaterial,referenceMaterialVO); - + BeanUtils.copyProperties(referenceMaterial, referenceMaterialVO); referenceMaterialVO.setReferenceMaterialName(byId.getReagentConsumableName()); - referenceMaterialVOS.add(referenceMaterialVO); } @@ -73,13 +69,32 @@ public class ReferenceMaterialServiceImpl extends ServiceImpl getReferenceMaterialList(){ - + public List getReferenceMaterialList() { List referenceMaterialVOList = baseMapper.getReferenceMaterialVOList(); - return referenceMaterialVOList; - }; + } + @Override + public String createNo(String alias, String location) { + int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年 + String prefix = alias + "-" + year + "-" + location.charAt(1) + "-"; + List list = this.list(Wrappers.query() + .likeRight("number", prefix) + .orderByDesc("number")); + int newNo = 1; + if ((list != null) && (list.size() > 0)) { + ReferenceMaterial referenceMaterial1 = list.get(0); + String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix); + try { + int maxno = Integer.parseUnsignedInt(strMaxNo); + newNo = maxno + 1; + } catch (NumberFormatException e) { + // 如果后缀有非数字, 则无视之, 重头编码 + newNo = 1; + } + } + return prefix + newNo; + } } 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 2c3361a..2350b27 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 @@ -112,15 +112,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl warehousingContentVOList = warehousingContentMapper.getWarehousingContentVOList(warehousingRecordFormId, opCode, keywords, category); -// List warehousingBatchListVOList = warehousingBatchListMapper.getWarehousingBatchListVOList(warehousingRecordFormId, keywords); -// for (int i = 0; i < warehousingContentVOList.size(); i++) { -// if (i == 0) { -// warehousingContentVOList.get(i).setWarehousingBatchListVOList(warehousingBatchListVOList); -// } else { -// List warehousingBatchListVOS = new ArrayList<>(); -// warehousingContentVOList.get(i).setWarehousingBatchListVOList(warehousingBatchListVOS); -// } -// } vo.setWarehousingContentVOList(warehousingContentVOList); return vo; } @@ -145,6 +136,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImplquery().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId())); + ReagentConsumableInventory oldReagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.query().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId())); //录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息 - if (one == null) { + if (oldReagentConsumableInventory == null) { ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();//创建库存对象 BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);//拷贝信息 reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase()); @@ -199,8 +191,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl list = referenceMaterialService.list(Wrappers.query() - .likeRight("number", prefix) - .orderByDesc("number")); - int newNo = 1; - if ((list != null) && (list.size() > 0)) { - ReferenceMaterial referenceMaterial1 = list.get(0); - String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix); - try { - int maxno = Integer.parseUnsignedInt(strMaxNo); - newNo = maxno + 1; - } catch (NumberFormatException e) { - // 如果后缀有非数字, 则无视之, 重头编码 - newNo = 1; - } - } - referenceMaterial.setNumber(prefix + newNo); + referenceMaterial.setNumber(referenceMaterialService.createNo(reagentConsumables.getAlias(),location)); referenceMaterialService.save(referenceMaterial); } } @@ -299,7 +272,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId()) + List batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", oldReagentConsumableInventory.getReagentConsumableInventoryId()) .eq("supplier_id", warehousingContent.getSupplierId()) .like("batch", years)); //如果没有批次信心,则默认为1 @@ -342,18 +314,18 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl list = referenceMaterialService.list(Wrappers.query() - .likeRight("number", prefix) - .orderByDesc("number")); - int newNo = 1; - if ((list != null) && (list.size() > 0)) { - ReferenceMaterial referenceMaterial1 = list.get(0); - String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix); - try { - int maxno = Integer.parseUnsignedInt(strMaxNo); - newNo = maxno + 1; - } catch (NumberFormatException e) { - // 如果后缀有非数字, 则无视之, 重头编码 - newNo = 1; - } - } - referenceMaterial.setNumber(prefix + newNo); + referenceMaterial.setNumber(referenceMaterialService.createNo(reagentConsumables.getAlias(), location)); referenceMaterialService.save(referenceMaterial); } } - reagentConsumableInventoryService.updateById(one); + reagentConsumableInventoryService.updateById(oldReagentConsumableInventory); batchDetailsService.save(batchDetails); } @@ -403,13 +359,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImplquery().eq("warehousing_record_form_id", warehousingRecordFormId)); @@ -430,7 +382,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl