main
杨海航 9 months ago
parent c8f8398875
commit 6f66ef0abf
  1. 14
      src/main/java/digital/laboratory/platform/reagent/ReagentManagmentApplication.java
  2. 1
      src/main/java/digital/laboratory/platform/reagent/service/ReferenceMaterialService.java
  3. 275
      src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java
  4. 131
      src/main/java/digital/laboratory/platform/reagent/service/impl/ApplicationForUseServiceImpl.java
  5. 42
      src/main/java/digital/laboratory/platform/reagent/service/impl/BatchDetailsServiceImpl.java
  6. 29
      src/main/java/digital/laboratory/platform/reagent/service/impl/BlacklistServiceImpl.java
  7. 27
      src/main/java/digital/laboratory/platform/reagent/service/impl/CategoryTableServiceImpl.java
  8. 4
      src/main/java/digital/laboratory/platform/reagent/service/impl/CentralizedRequestServiceImpl.java
  9. 86
      src/main/java/digital/laboratory/platform/reagent/service/impl/CheckScheduleServiceImpl.java
  10. 28
      src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java
  11. 55
      src/main/java/digital/laboratory/platform/reagent/service/impl/ReferenceMaterialServiceImpl.java
  12. 75
      src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java
  13. 3
      src/main/resources/mapper/WarehousingContentMapper.xml

@ -14,23 +14,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDLPFeignClients @EnableDLPFeignClients
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableDLPResourceServer @EnableDLPResourceServer
@SpringBootApplication(scanBasePackages="digital.laboratory.platform") @SpringBootApplication(scanBasePackages = "digital.laboratory.platform")
@EnableScheduling @EnableScheduling
public class ReagentManagmentApplication { public class ReagentManagmentApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ReagentManagmentApplication.class, 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();
// }
//
} }

@ -22,4 +22,5 @@ public interface ReferenceMaterialService extends IService<ReferenceMaterial> {
List<ReferenceMaterialVO> getReferenceMaterialList(); List<ReferenceMaterialVO> getReferenceMaterialList();
String createNo(String alias, String location);
} }

@ -52,14 +52,12 @@ import java.util.List;
@Service @Service
@SuppressWarnings("all") @SuppressWarnings("all")
public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecordFormMapper, AcceptanceRecordForm> implements AcceptanceRecordFormService { public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecordFormMapper, AcceptanceRecordForm> implements AcceptanceRecordFormService {
@Autowired @Autowired
private BlacklistService blacklistService; private BlacklistService blacklistService;
@Autowired @Autowired
private AcceptanceSignForService acceptanceSignForService; private AcceptanceSignForService acceptanceSignForService;
@Autowired @Autowired
private ReagentConsumablesService reagentConsumablesService; private ReagentConsumablesService reagentConsumablesService;
@Autowired @Autowired
private WarehousingContentService warehousingContentService; private WarehousingContentService warehousingContentService;
@Autowired @Autowired
@ -72,7 +70,6 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Transactional @Transactional
@Override//批量提交 @Override//批量提交
public void culkCommit(List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, DLPUser dlpUser) { public void culkCommit(List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, DLPUser dlpUser) {
for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) { for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) {
//调用单个提交方法 //调用单个提交方法
AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser); AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser);
@ -81,83 +78,64 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//提交验收记录表 @Override//提交验收记录表
public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) { public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) {
AcceptanceRecordForm acceptanceRecordForm = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId());
AcceptanceRecordForm byId = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId()); BeanUtils.copyProperties(acceptanceRecordFormDTO, acceptanceRecordForm);
//验收记录状态为-2,代表验收审核不通过后重新提交,需置空原有审核信息 acceptanceRecordForm.setUserName(dlpUser.getName());
if (byId.getStatus() == -2) { acceptanceRecordForm.setCommitTime(LocalDateTime.now());
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); acceptanceRecordForm.setStatus(1);
byId.setUserName(dlpUser.getName()); acceptanceRecordForm.setDateOfAcceptance(LocalDateTime.now());
byId.setAuditResultOfPrimary(false); acceptanceRecordForm.setCreateBy(dlpUser.getId());
byId.setAuditOpinionOfPrimary(""); //验收记录状态为-2\-3\-4,代表验收审核不通过后重新提交,需置空原有审核信息
byId.setAuditTimeOfPrimary(null); switch (acceptanceRecordForm.getStatus()) {
byId.setPrimaryAuditorId(""); case -2: {
byId.setCommitTime(LocalDateTime.now()); acceptanceRecordForm.setAuditResultOfPrimary(false);
byId.setStatus(1); acceptanceRecordForm.setAuditOpinionOfPrimary("");
byId.setDateOfAcceptance(LocalDateTime.now()); acceptanceRecordForm.setAuditTimeOfPrimary(null);
byId.setCreateBy(dlpUser.getId()); acceptanceRecordForm.setPrimaryAuditorId("");
if (this.updateById(byId)) { if (this.updateById(acceptanceRecordForm)) {
return byId; return acceptanceRecordForm;
} else { } else {
throw new RuntimeException(String.format("重新提交失败")); throw new RuntimeException(String.format("重新提交失败"));
}
} }
} case -3: {
if (byId.getStatus() == -3) { acceptanceRecordForm.setAuditResultOfSecondary(false);
acceptanceRecordForm.setAuditOpinionOfSecondary("");
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); acceptanceRecordForm.setAuditTimeOfSecondary(null);
byId.setUserName(dlpUser.getName()); acceptanceRecordForm.setSecondaryAuditorId("");
byId.setAuditResultOfSecondary(false); acceptanceRecordForm.setAuditResultOfPrimary(false);
byId.setAuditOpinionOfSecondary(""); acceptanceRecordForm.setAuditOpinionOfPrimary("");
byId.setAuditTimeOfSecondary(null); acceptanceRecordForm.setAuditTimeOfPrimary(null);
byId.setSecondaryAuditorId(""); acceptanceRecordForm.setPrimaryAuditorId("");
byId.setAuditResultOfPrimary(false); if (this.updateById(acceptanceRecordForm)) {
byId.setAuditOpinionOfPrimary(""); return acceptanceRecordForm;
byId.setAuditTimeOfPrimary(null); } else {
byId.setPrimaryAuditorId(""); throw new RuntimeException(String.format("重新提交失败"));
byId.setCommitTime(LocalDateTime.now()); }
byId.setStatus(1);
byId.setDateOfAcceptance(LocalDateTime.now());
byId.setCreateBy(dlpUser.getId());
if (this.updateById(byId)) {
return byId;
} else {
throw new RuntimeException(String.format("重新提交失败"));
} }
} case -4: {
if (byId.getStatus() == -4) { acceptanceRecordForm.setAuditResultOfThreeLevel(false);
acceptanceRecordForm.setAuditOpinionOfThreeLevel("");
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); acceptanceRecordForm.setAuditTimeOfThreeLevel(null);
byId.setUserName(dlpUser.getName()); acceptanceRecordForm.setThreeLevelAuditorId("");
byId.setAuditResultOfThreeLevel(false); acceptanceRecordForm.setAuditResultOfSecondary(false);
byId.setAuditOpinionOfThreeLevel(""); acceptanceRecordForm.setAuditOpinionOfSecondary("");
byId.setAuditTimeOfThreeLevel(null); acceptanceRecordForm.setAuditTimeOfSecondary(null);
byId.setThreeLevelAuditorId(""); acceptanceRecordForm.setSecondaryAuditorId("");
byId.setAuditResultOfSecondary(false); acceptanceRecordForm.setAuditResultOfPrimary(false);
byId.setAuditOpinionOfSecondary(""); acceptanceRecordForm.setAuditOpinionOfPrimary("");
byId.setAuditTimeOfSecondary(null); acceptanceRecordForm.setAuditTimeOfPrimary(null);
byId.setSecondaryAuditorId(""); acceptanceRecordForm.setPrimaryAuditorId("");
byId.setAuditResultOfPrimary(false); if (this.updateById(acceptanceRecordForm)) {
byId.setAuditOpinionOfPrimary(""); return acceptanceRecordForm;
byId.setAuditTimeOfPrimary(null); } else {
byId.setPrimaryAuditorId(""); throw new RuntimeException(String.format("重新提交失败"));
byId.setCommitTime(LocalDateTime.now()); }
byId.setStatus(1);
byId.setDateOfAcceptance(LocalDateTime.now());
byId.setCreateBy(dlpUser.getId());
if (this.updateById(byId)) {
return byId;
} else {
throw new RuntimeException(String.format("重新提交失败"));
} }
} }
//正常提交 //正常提交
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); if (this.updateById(acceptanceRecordForm)) {
byId.setUserName(dlpUser.getName()); return acceptanceRecordForm;
byId.setCommitTime(LocalDateTime.now());
byId.setStatus(1);
byId.setCreateBy(dlpUser.getId());
byId.setDateOfAcceptance(LocalDateTime.now());
if (this.updateById(byId)) {
return byId;
} else { } else {
throw new RuntimeException(String.format("提交失败")); throw new RuntimeException(String.format("提交失败"));
} }
@ -165,83 +143,41 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override @Override
public AcceptanceRecordForm addForm(String reagentConsumableId, String supplierId, String acceptanceSignForId) { public AcceptanceRecordForm addForm(String reagentConsumableId, String supplierId, String acceptanceSignForId) {
AcceptanceRecordForm acceptanceRecordForm = new AcceptanceRecordForm(); AcceptanceRecordForm acceptanceRecordForm = new AcceptanceRecordForm();
acceptanceRecordForm.setId(IdWorker.get32UUID().toUpperCase()); acceptanceRecordForm.setId(IdWorker.get32UUID().toUpperCase());
acceptanceRecordForm.setSupplierId(supplierId);//供应商ID acceptanceRecordForm.setSupplierId(supplierId);//供应商ID
acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);//验收分类ID acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);//验收分类ID
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);//验收试剂耗材ID acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);//验收试剂耗材ID
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(reagentConsumableId);
ReagentConsumables byId = reagentConsumablesService.getById(reagentConsumableId); acceptanceRecordForm.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//将物品名称赋值给验收记录表
acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());//将物品名称赋值给验收记录表
acceptanceRecordForm.setStatus(0);//初始化状态 acceptanceRecordForm.setStatus(0);//初始化状态
if ((this.save(acceptanceRecordForm))) { if ((this.save(acceptanceRecordForm))) {
return acceptanceRecordForm; return acceptanceRecordForm;
} else throw new RuntimeException(String.format("创建验收任务失败")); } else throw new RuntimeException(String.format("创建验收任务失败"));
} }
@Override @Override
public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm> qw) { public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm> qw) {
IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表 IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表
List<AcceptanceRecordFormVO> records = acceptanceRecordFormVOPage.getRecords(); List<AcceptanceRecordFormVO> records = acceptanceRecordFormVOPage.getRecords();
//添加试剂耗材信息至VO //添加试剂耗材信息至VO
for (AcceptanceRecordFormVO record : records) { for (AcceptanceRecordFormVO record : records) {
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(record.getReagentConsumableId());
ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId()); record.setReagentConsumables(reagentConsumables);
record.setReagentConsumables(byId);
} }
return acceptanceRecordFormVOPage; return acceptanceRecordFormVOPage;
} }
// @Override
// public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page) {
//
// LambdaQueryWrapper<AcceptanceRecordForm> acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
//
// acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
//
// List<AcceptanceRecordForm> list = this.list(acceptanceRecordFormLambdaQueryWrapper);
//
// ArrayList<AcceptanceRecordFormVO> 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 @Override
public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) { public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) {
AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);//查询单个验收记录表 AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);//查询单个验收记录表
if (acceptanceRecordFormVO == null) { if (acceptanceRecordFormVO == null) {
return null; return null;
} }
//查询试剂耗材信息
ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());//查询试剂耗材信息 acceptanceRecordFormVO.setReagentConsumables(reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId()));
acceptanceRecordFormVO.setReagentConsumables(byId);
return acceptanceRecordFormVO; return acceptanceRecordFormVO;
} }
@ -250,26 +186,21 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
public boolean primaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) { public boolean primaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核 //批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组 List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合 List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
for (String id : uuId) { for (String id : uuId) {
AcceptanceRecordForm acceptanceRecordForm = this.getById(id);
AcceptanceRecordForm byId = this.getById(id); if (acceptanceRecordForm.getStatus() != 1) {
if (byId.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setPrimaryAuditorId(dlpUser.getId());//审核人ID acceptanceRecordForm.setPrimaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 acceptanceRecordForm.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间 acceptanceRecordForm.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 acceptanceRecordForm.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(2);//审核成功状态 acceptanceRecordForm.setStatus(2);//审核成功状态
} else byId.setStatus(-2);//审核失败状态 } else acceptanceRecordForm.setStatus(-2);//审核失败状态
acceptanceRecordForms.add(acceptanceRecordForm);
acceptanceRecordForms.add(byId);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
return true; return true;
@ -283,23 +214,21 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
//批量审核 //批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组 List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合 List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
for (String id : uuId) { for (String id : uuId) {
AcceptanceRecordForm acceptanceRecordForm = this.getById(id);
AcceptanceRecordForm byId = this.getById(id); if (acceptanceRecordForm.getStatus() != 2) {
if (byId.getStatus() != 2) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setSecondaryAuditorId(dlpUser.getId());//审核人ID acceptanceRecordForm.setSecondaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 acceptanceRecordForm.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间 acceptanceRecordForm.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 acceptanceRecordForm.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(3);//审核成功状态 acceptanceRecordForm.setStatus(3);//审核成功状态
} else byId.setStatus(-3);//审核失败状态 } else acceptanceRecordForm.setStatus(-3);//审核失败状态
acceptanceRecordForms.add(byId); acceptanceRecordForms.add(acceptanceRecordForm);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
return true; return true;
@ -317,51 +246,45 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
List<String> stringList = new ArrayList<>();//用于接收验收集合表ID List<String> stringList = new ArrayList<>();//用于接收验收集合表ID
for (String s : uuId) { for (String s : uuId) {
AcceptanceRecordForm byId = this.getById(s); AcceptanceRecordForm acceptanceRecordForm = this.getById(s);
if (!stringList.contains(byId.getAcceptanceSignForId())) {//添加验收集合表ID至数组 if (!stringList.contains(acceptanceRecordForm.getAcceptanceSignForId())) {//添加验收集合表ID至数组
stringList.add(byId.getAcceptanceSignForId()); stringList.add(acceptanceRecordForm.getAcceptanceSignForId());
} }
if (byId.getStatus() != 3) { if (acceptanceRecordForm.getStatus() != 3) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setThreeLevelAuditorId(dlpUser.getId());//审核人ID acceptanceRecordForm.setThreeLevelAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见 acceptanceRecordForm.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间 acceptanceRecordForm.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间
byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果 acceptanceRecordForm.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过 if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过
if (byId.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单 if (acceptanceRecordForm.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单
blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId()); blacklistService.addListById2(acceptanceRecordForm.getReagentConsumableId(), acceptanceRecordForm.getSupplierId());
} }
byId.setStatus(6); acceptanceRecordForm.setStatus(6);
} else byId.setStatus(-4); } else acceptanceRecordForm.setStatus(-4);
acceptanceRecordForms.add(byId); acceptanceRecordForms.add(acceptanceRecordForm);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
//判断是否验收完毕,更改验收集合表状态 //判断是否验收完毕,更改验收集合表状态
for (String s : stringList) { for (String id : stringList) {
AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(id);//批量审核的验收记录关联的所有验收集合表
AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);//批量审核的验收记录关联的所有验收集合表
//得到签收物品集合 //得到签收物品集合
List<WarehousingContent> warehousingContentList = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId())); List<WarehousingContent> warehousingContentList = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId()));
//得到验收集合中的所有验收记录表 //得到验收集合中的所有验收记录表
List<AcceptanceRecordForm> recordFormList = this.list(Wrappers.<AcceptanceRecordForm>query().eq("acceptance_sign_for_id", s)); List<AcceptanceRecordForm> recordFormList = this.list(Wrappers.<AcceptanceRecordForm>query().eq("acceptance_sign_for_id", id));
if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表) if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表)
int index = 0;
int x = 0;
for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) { for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) {
if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态 if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态
x = x + 1; index += 1;
} }
} }
if (x == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成 if (index == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成
AcceptanceSignFor byId = acceptanceSignForService.getById(s); AcceptanceSignFor acceptanceSignForById = acceptanceSignForService.getById(id);
byId.setStatus(2); acceptanceSignForById.setStatus(2);
acceptanceSignForService.updateById(byId); acceptanceSignForService.updateById(acceptanceSignForById);
} }
} }
} }

@ -1,9 +1,11 @@
package digital.laboratory.platform.reagent.service.impl; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; 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.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
@ -55,13 +57,9 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
@Override//通过ID查询领用申请表 @Override//通过ID查询领用申请表
public ApplicationForUseVO getApplicationForUseVO(String applicationForUseId) { public ApplicationForUseVO getApplicationForUseVO(String applicationForUseId) {
ApplicationForUseVO applicationForUseVO = baseMapper.getApplicationForUseVO(applicationForUseId); ApplicationForUseVO applicationForUseVO = baseMapper.getApplicationForUseVO(applicationForUseId);
List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUseId); List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUseId);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
applicationForUseVO.setReagentConsumablesSetVOList(list); applicationForUseVO.setReagentConsumablesSetVOList(list);
} }
return applicationForUseVO; return applicationForUseVO;
@ -69,15 +67,10 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
@Override//分页查询 @Override//分页查询
public IPage<ApplicationForUseVO> getApplicationForUseVOPage(IPage<ApplicationForUse> page, QueryWrapper<ApplicationForUse> qw) { public IPage<ApplicationForUseVO> getApplicationForUseVOPage(IPage<ApplicationForUse> page, QueryWrapper<ApplicationForUse> qw) {
IPage<ApplicationForUseVO> applicationForUseVOPage = baseMapper.getApplicationForUseVOPage(page, qw); IPage<ApplicationForUseVO> applicationForUseVOPage = baseMapper.getApplicationForUseVOPage(page, qw);
List<ApplicationForUseVO> records = applicationForUseVOPage.getRecords(); List<ApplicationForUseVO> records = applicationForUseVOPage.getRecords();
for (ApplicationForUseVO record : records) { for (ApplicationForUseVO record : records) {
ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(record.getId()); ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(record.getId());
BeanUtils.copyProperties(applicationForUseVO, record); BeanUtils.copyProperties(applicationForUseVO, record);
} }
return applicationForUseVOPage; return applicationForUseVOPage;
@ -91,86 +84,51 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
@Transactional @Transactional
@Override//创建领用申请表(试剂耗材领用、标准物质领用、标准溶液领用) @Override//创建领用申请表(试剂耗材领用、标准物质领用、标准溶液领用)
public ApplicationForUseVO addApplication(ApplicationForUseDTO applicationForUseDTO, DLPUser dlpUser) { public ApplicationForUseVO addApplication(ApplicationForUseDTO applicationForUseDTO, DLPUser dlpUser) {
//在已有领用记录的申请上继续添加领用物品
if (applicationForUseDTO.getApplicationForUseId() != null) { if (applicationForUseDTO.getApplicationForUseId() != null) {
ApplicationForUse byId = this.getById(applicationForUseDTO.getApplicationForUseId()); ApplicationForUse application = this.getById(applicationForUseDTO.getApplicationForUseId());
if (application != null) {
if (byId != null) {
ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet(); ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet();
BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet); BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet);
reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase()); reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase());
reagentConsumablesSet.setApplicationForUseId(application.getId());
reagentConsumablesSet.setApplicationForUseId(byId.getId());
if (applicationForUseDTO.getReagentConsumableStashId() != null) { if (applicationForUseDTO.getReagentConsumableStashId() != null) {
reagentConsumablesSet.setReagentConsumableStashId(applicationForUseDTO.getReagentConsumableStashId()); reagentConsumablesSet.setReagentConsumableStashId(applicationForUseDTO.getReagentConsumableStashId());
} }
if (applicationForUseDTO.getReferenceMaterialId() != null) { if (applicationForUseDTO.getReferenceMaterialId() != null) {
reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId()); reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId());
} }
LambdaQueryWrapper<ReagentConsumableInventory> reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity();
reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId());
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper);
Integer totalQuantity = one.getTotalQuantity();
if (reagentConsumablesSet.getQuantity() > totalQuantity) { if (reagentConsumablesSet.getQuantity() > totalQuantity) {
throw new RuntimeException(String.format("领用数量不能大于库存量")); throw new RuntimeException(String.format("领用数量不能大于库存量"));
} }
if (reagentConsumablesSetService.save(reagentConsumablesSet) if (reagentConsumablesSetService.save(reagentConsumablesSet)) {
) { ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(application.getId());
ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(byId.getId());
return applicationForUseVO; return applicationForUseVO;
} else return null; } else return null;
} }
//录入领用申请表
} }
//首次添加
ApplicationForUse applicationForUse = new ApplicationForUse(); ApplicationForUse applicationForUse = new ApplicationForUse();
applicationForUse.setId(IdWorker.get32UUID().toUpperCase()); applicationForUse.setId(IdWorker.get32UUID().toUpperCase());
applicationForUse.setStatus(0); applicationForUse.setStatus(0);
applicationForUse.setRecipientId(dlpUser.getId()); applicationForUse.setRecipientId(dlpUser.getId());
//录入领用申请内容 //录入领用申请内容
//生成领用登记表集合 //生成领用登记表集合
ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet(); ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet();
BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet); BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet);
reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase()); reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase());
reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId()); reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId());
if (applicationForUseDTO.getReferenceMaterialId() != null) { if (applicationForUseDTO.getReferenceMaterialId() != null) {
reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId()); reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId());
} }
LambdaQueryWrapper<ReagentConsumableInventory> reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>(); Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity();
reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId());
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper);
Integer totalQuantity = one.getTotalQuantity();
if (reagentConsumablesSet.getQuantity() > totalQuantity) { if (reagentConsumablesSet.getQuantity() > totalQuantity) {
throw new RuntimeException(String.format("领用数量不能大于库存量")); 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()); ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId());
return applicationForUseVO; return applicationForUseVO;
} else return null; } else return null;
@ -179,59 +137,36 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
@Override//提交领用申请记录 @Override//提交领用申请记录
@Transactional @Transactional
public ApplicationForUseVO commitApplication(String id, DLPUser dlpUser) { public ApplicationForUseVO commitApplication(String id, DLPUser dlpUser) {
ApplicationForUse applicationForUse = this.getById(id); ApplicationForUse applicationForUse = this.getById(id);
applicationForUse.setStatus(1); applicationForUse.setStatus(1);
String code = getCode(); String code = getCode();
//领取码 //领取码
applicationForUse.setClaimCode(code); applicationForUse.setClaimCode(code);
applicationForUse.setDateOfCollection(LocalDateTime.now()); applicationForUse.setDateOfCollection(LocalDateTime.now());
this.updateById(applicationForUse); this.updateById(applicationForUse);
deliveryRegistrationFormService.addFrom(applicationForUse.getId()); deliveryRegistrationFormService.addFrom(applicationForUse.getId());
ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId()); ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId());
return applicationForUseVO; return applicationForUseVO;
} }
@Override//通过ID删除领用申请表(标准物质领用/归还登记表) @Override//通过ID删除领用申请表(标准物质领用/归还登记表)
@Transactional @Transactional
public Boolean delApplication(String applicationForUseId) { public Boolean delApplication(String applicationForUseId) {
ApplicationForUse applicationForUse = this.getById(applicationForUseId); ApplicationForUse applicationForUse = this.getById(applicationForUseId);
if (applicationForUse.getStatus() == 0) { if (applicationForUse.getStatus() == 0) {
return reagentConsumablesSetService.remove(Wrappers.<ReagentConsumablesSet>lambdaQuery().eq(ReagentConsumablesSet::getApplicationForUseId,applicationForUse.getId()))&&this.removeById(applicationForUse);
LambdaQueryWrapper<ReagentConsumablesSet> reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId());
List<ReagentConsumablesSet> list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper);
return reagentConsumablesSetService.removeBatchByIds(list) & this.removeById(applicationForUse);
} else throw new RuntimeException(String.format("当前状态不能删除")); } else throw new RuntimeException(String.format("当前状态不能删除"));
} }
public String getCode() { public String getCode() {
//生成随机数 //生成6位随机数
String random = "" + Math.random(); String random = "" + Math.random();
String substring = random.substring(random.length() - 6); String substring = random.substring(random.length() - 6);
QueryWrapper<ApplicationForUse> applicationForUseQueryWrapper = new QueryWrapper<>(); QueryWrapper<ApplicationForUse> applicationForUseQueryWrapper = new QueryWrapper<>();
//判断随机数是否重复 //判断随机数是否重复
applicationForUseQueryWrapper.eq("claim_code", substring); applicationForUseQueryWrapper.eq("claim_code", substring);
if (this.getOne(applicationForUseQueryWrapper) != null) { if (this.getOne(applicationForUseQueryWrapper) != null) {
substring = random.substring(random.length() - 6); substring = random.substring(random.length() - 6);
getCode(); getCode();
} }
return substring; return substring;
@ -241,54 +176,31 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
@Transactional @Transactional
@Override @Override
public ApplicationForUseVO batchCommit(ApplicationForUseBatchDTO applicationForUseBatchDTO, DLPUser dlpUser) { public ApplicationForUseVO batchCommit(ApplicationForUseBatchDTO applicationForUseBatchDTO, DLPUser dlpUser) {
ApplicationForUse applicationForUse = new ApplicationForUse(); ApplicationForUse applicationForUse = new ApplicationForUse();
applicationForUse.setId(IdWorker.get32UUID().toUpperCase()); applicationForUse.setId(IdWorker.get32UUID().toUpperCase());
applicationForUse.setStatus(0); applicationForUse.setStatus(0);
applicationForUse.setRecipientId(dlpUser.getId()); applicationForUse.setRecipientId(dlpUser.getId());
if (StringUtils.isNotBlank(applicationForUseBatchDTO.getExperimentId())){
applicationForUse.setExperimentId(applicationForUseBatchDTO.getExperimentId()); applicationForUse.setExperimentId(applicationForUseBatchDTO.getExperimentId());
}
List<ReagentConsumablesSet> reagentConsumablesSets = new ArrayList<>(); List<ReagentConsumablesSet> reagentConsumablesSets = new ArrayList<>();
List<ApplicationForUseDTO> applicationForUseDTOList = applicationForUseBatchDTO.getApplicationForUseDTOList(); List<ApplicationForUseDTO> applicationForUseDTOList = applicationForUseBatchDTO.getApplicationForUseDTOList();
for (ApplicationForUseDTO applicationForUseDTO : applicationForUseDTOList) { for (ApplicationForUseDTO applicationForUseDTO : applicationForUseDTOList) {
ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet(); ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet();
BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet); BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet);
reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase()); reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase());
reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId()); reagentConsumablesSet.setApplicationForUseId(applicationForUse.getId());
if (applicationForUseDTO.getReferenceMaterialId() != null) { if (applicationForUseDTO.getReferenceMaterialId() != null) {
reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId()); reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId());
} }
LambdaQueryWrapper<ReagentConsumableInventory> reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
ReferenceMaterial referenceMaterial = referenceMaterialService.getById(applicationForUseDTO.getReferenceMaterialId()); ReferenceMaterial referenceMaterial = referenceMaterialService.getById(applicationForUseDTO.getReferenceMaterialId());
Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>lambdaQuery().eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId())).getTotalQuantity();
reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, referenceMaterial.getReagentConsumableId());
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper);
Integer totalQuantity = one.getTotalQuantity();
if (reagentConsumablesSet.getQuantity() > totalQuantity) { if (reagentConsumablesSet.getQuantity() > totalQuantity) {
throw new RuntimeException(String.format("领用数量不能大于库存量")); throw new RuntimeException(String.format("领用数量不能大于库存量"));
} }
reagentConsumablesSets.add(reagentConsumablesSet); reagentConsumablesSets.add(reagentConsumablesSet);
} }
if (this.save(applicationForUse) & reagentConsumablesSetService.saveBatch(reagentConsumablesSets) if (this.save(applicationForUse) && reagentConsumablesSetService.saveBatch(reagentConsumablesSets)) {
) {
this.commitApplication(applicationForUse.getId(), dlpUser); this.commitApplication(applicationForUse.getId(), dlpUser);
ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId()); ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId());
return applicationForUseVO; return applicationForUseVO;
@ -299,15 +211,10 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
*通过实验模板ID查询领用的所有物品*/ *通过实验模板ID查询领用的所有物品*/
@Override @Override
public List<ReagentConsumablesSetVO> getReagentConsumablesSets(String id) { public List<ReagentConsumablesSetVO> getReagentConsumablesSets(String id) {
List<ApplicationForUse> applicationForUseList = this.list(Wrappers.<ApplicationForUse>query().eq("experiment_id", id)); List<ApplicationForUse> applicationForUseList = this.list(Wrappers.<ApplicationForUse>query().eq("experiment_id", id));
List<ReagentConsumablesSetVO> reagentConsumablesSetList = new ArrayList<>(); List<ReagentConsumablesSetVO> reagentConsumablesSetList = new ArrayList<>();
for (ApplicationForUse applicationForUse : applicationForUseList) { for (ApplicationForUse applicationForUse : applicationForUseList) {
List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUse.getId()); List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUse.getId());
reagentConsumablesSetList.addAll(list); reagentConsumablesSetList.addAll(list);
} }
return reagentConsumablesSetList; return reagentConsumablesSetList;

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,53 +34,46 @@ public class BatchDetailsServiceImpl extends ServiceImpl<BatchDetailsMapper, Bat
@Autowired @Autowired
private ReagentConsumableStashService reagentConsumableStashService; private ReagentConsumableStashService reagentConsumableStashService;
@Autowired @Resource
private RemoteCabinetService remoteCabinetService; private RemoteCabinetService remoteCabinetService;
@Override @Override
public List<BatchDetailsVO> getBatchDetailsList(String reagentConsumableInventoryId) { public List<BatchDetailsVO> getBatchDetailsList(String reagentConsumableInventoryId) {
LambdaQueryWrapper<BatchDetails> batchDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BatchDetails> batchDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
batchDetailsLambdaQueryWrapper.eq(BatchDetails::getReagentConsumableInventoryId, reagentConsumableInventoryId) batchDetailsLambdaQueryWrapper.eq(BatchDetails::getReagentConsumableInventoryId, reagentConsumableInventoryId)
.eq(BatchDetails::getServiceStatus, 1); .eq(BatchDetails::getServiceStatus, 1);
List<BatchDetails> list = this.list(batchDetailsLambdaQueryWrapper); List<BatchDetails> list = this.list(batchDetailsLambdaQueryWrapper);
List<BatchDetailsVO> batchDetailsVOS = new ArrayList<>(); List<BatchDetailsVO> batchDetailsVOS = new ArrayList<>();
for (BatchDetails batchDetails : list) { for (BatchDetails batchDetails : list) {
SupplierInformation byId1 = supplierInformationService.getById(batchDetails.getSupplierId()); SupplierInformation supplierInformation = supplierInformationService.getById(batchDetails.getSupplierId());
BatchDetailsVO batchDetailsVO = new BatchDetailsVO(); BatchDetailsVO batchDetailsVO = new BatchDetailsVO();
BeanUtils.copyProperties(batchDetails, batchDetailsVO); BeanUtils.copyProperties(batchDetails, batchDetailsVO);
batchDetailsVO.setSupplierName(byId1.getSupplierName()); batchDetailsVO.setSupplierName(supplierInformation.getSupplierName());
batchDetailsVOS.add(batchDetailsVO); batchDetailsVOS.add(batchDetailsVO);
} }
return batchDetailsVOS; return batchDetailsVOS;
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
//修改库存(只能修改批次数量,同时更新总数量与对应仓库数量) // //修改库存(只能修改批次数量,同时更新总数量与对应仓库数量)
public BatchDetails updateQuantity(String batchDetailsId, Integer quantity) { // public BatchDetails updateQuantity(String batchDetailsId, Integer quantity) {
// BatchDetails batchDetails = this.getById(batchDetailsId);
BatchDetails batchDetails = this.getById(batchDetailsId); // ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getById(batchDetails.getReagentConsumableInventoryId());
// ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getById(batchDetails.getReagentConsumableStashId());
ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getById(batchDetails.getReagentConsumableInventoryId()); // reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity);
// reagentConsumableStash.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity);
ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getById(batchDetails.getReagentConsumableStashId()); // batchDetails.setQuantity(quantity);
// if (this.updateById(batchDetails) && reagentConsumableStashService.updateById(reagentConsumableStash) && reagentConsumableInventoryService.updateById(reagentConsumableInventory)) {
reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); // return batchDetails;
reagentConsumableStash.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() - batchDetails.getQuantity() + quantity); // } else {
batchDetails.setQuantity(quantity); // throw new RuntimeException(String.format("修改失败"));
// }
if (this.updateById(batchDetails) && reagentConsumableStashService.updateById(reagentConsumableStash) && reagentConsumableInventoryService.updateById(reagentConsumableInventory)) { // }
return batchDetails;
} else {
throw new RuntimeException(String.format("修改失败"));
}
}
@Override @Override
@Transactional @Transactional
public void updateCabinetData() { public void updateCabinetData() {
List<BatchDetails> list = this.list(new LambdaQueryWrapper<BatchDetails>().gt(BatchDetails::getQuantity, 0)); List<BatchDetails> list = this.list(new LambdaQueryWrapper<BatchDetails>().gt(BatchDetails::getQuantity, 0));
int x = 1;
for (BatchDetails batchDetails : list) { for (BatchDetails batchDetails : list) {
String latticeId = batchDetails.getLatticeId(); String latticeId = batchDetails.getLatticeId();
reagentConsumableInventoryService.updateCabinet(latticeId, batchDetails.getReagentConsumableInventoryId(), 1); reagentConsumableInventoryService.updateCabinet(latticeId, batchDetails.getReagentConsumableInventoryId(), 1);

@ -2,6 +2,7 @@ package digital.laboratory.platform.reagent.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.reagent.entity.Blacklist; import digital.laboratory.platform.reagent.entity.Blacklist;
import digital.laboratory.platform.reagent.entity.ReagentConsumables; import digital.laboratory.platform.reagent.entity.ReagentConsumables;
@ -31,23 +32,19 @@ public class BlacklistServiceImpl extends ServiceImpl<BlacklistMapper, Blacklist
public Blacklist addListById(String reagentConsumableId, String supplierId) { public Blacklist addListById(String reagentConsumableId, String supplierId) {
Blacklist blacklist = new Blacklist(); Blacklist blacklist = new Blacklist();
blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase()); blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase());
blacklist.setSupplierId(supplierId); blacklist.setSupplierId(supplierId);
blacklist.setResultsOfComplianceCheck(false); blacklist.setResultsOfComplianceCheck(false);
blacklist.setReagentConsumableId(reagentConsumableId); blacklist.setReagentConsumableId(reagentConsumableId);
if (this.save(blacklist)) { if (this.save(blacklist)) {
return blacklist; return blacklist;
} else return null; } else return null;
} }
@Override @Override
public Blacklist addListById2(String reagentConsumableId, String supplierId) { public Blacklist addListById2(String reagentConsumableId, String supplierId) {
Blacklist blacklist = new Blacklist(); Blacklist blacklist = new Blacklist();
blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase()); blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase());
blacklist.setSupplierId(supplierId); blacklist.setSupplierId(supplierId);
blacklist.setReagentConsumableId(reagentConsumableId); blacklist.setReagentConsumableId(reagentConsumableId);
@ -61,29 +58,17 @@ public class BlacklistServiceImpl extends ServiceImpl<BlacklistMapper, Blacklist
@Override @Override
public List<BlackListVO> getBlacklist(String supplierInformationId) { public List<BlackListVO> getBlacklist(String supplierInformationId) {
LambdaQueryWrapper<Blacklist> blacklistLambdaQueryWrapper = new LambdaQueryWrapper<>(); List<Blacklist> list = this.list(Wrappers.<Blacklist>lambdaQuery().eq(Blacklist::getSupplierId, supplierInformationId));
blacklistLambdaQueryWrapper.eq(Blacklist::getSupplierId, supplierInformationId);
List<Blacklist> list = this.list(blacklistLambdaQueryWrapper);
List<BlackListVO> blackListVOS = new ArrayList<>(); List<BlackListVO> blackListVOS = new ArrayList<>();
for (Blacklist blacklist : list) { for (Blacklist blacklist : list) {
BlackListVO blackListVO = new BlackListVO(); BlackListVO blackListVO = new BlackListVO();
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(blacklist.getReagentConsumableId());
ReagentConsumables byId = reagentConsumablesService.getById(blacklist.getReagentConsumableId()); blackListVO.setReagentConsumableName(reagentConsumables.getReagentConsumableName());
blackListVO.setCategory(reagentConsumables.getCategory());
blackListVO.setReagentConsumableName(byId.getReagentConsumableName()); blackListVO.setBrand(reagentConsumables.getBrand());
blackListVO.setCategory(byId.getCategory()); blackListVO.setSpecificationAndModel(reagentConsumables.getSpecificationAndModel());
blackListVO.setBrand(byId.getBrand());
blackListVO.setSpecificationAndModel(byId.getSpecificationAndModel());
blackListVOS.add(blackListVO); blackListVOS.add(blackListVO);
} }
return blackListVOS; return blackListVOS;
} }
} }

@ -24,29 +24,17 @@ public class CategoryTableServiceImpl extends ServiceImpl<CategoryTableMapper, C
@Override @Override
public CategoryTable addSpecies(String category, String species) { public CategoryTable addSpecies(String category, String species) {
LambdaQueryWrapper<CategoryTable> categoryTableLambdaQueryWrapper = new LambdaQueryWrapper<>(); CategoryTable oldCategoryTable = this.getOne(Wrappers.<CategoryTable>lambdaQuery().eq(CategoryTable::getCategory, category).eq(CategoryTable::getSpecies, species));
categoryTableLambdaQueryWrapper.eq(CategoryTable::getSpecies, species);
categoryTableLambdaQueryWrapper.eq(CategoryTable::getCategory, category);
CategoryTable one = this.getOne(categoryTableLambdaQueryWrapper);
if (one == null) {
if (oldCategoryTable == null) {
CategoryTable categoryTable = new CategoryTable(); CategoryTable categoryTable = new CategoryTable();
categoryTable.setId(IdWorker.get32UUID().toUpperCase()); categoryTable.setId(IdWorker.get32UUID().toUpperCase());
categoryTable.setSpecies(species); categoryTable.setSpecies(species);
categoryTable.setCategory(category); categoryTable.setCategory(category);
this.save(categoryTable); this.save(categoryTable);
return categoryTable; return categoryTable;
} }
return one; return oldCategoryTable;
} }
@Override @Override
@ -59,14 +47,7 @@ public class CategoryTableServiceImpl extends ServiceImpl<CategoryTableMapper, C
@Override @Override
public List<CategoryTable> getSpecies(String category) { public List<CategoryTable> getSpecies(String category) {
return this.list(Wrappers.<CategoryTable>lambdaQuery().eq(CategoryTable::getCategory, category));
LambdaQueryWrapper<CategoryTable> typeTableLambdaQueryWrapper = new LambdaQueryWrapper<>();
typeTableLambdaQueryWrapper.eq(CategoryTable::getCategory, category);
List<CategoryTable> list = this.list(typeTableLambdaQueryWrapper);
return list;
} }
} }

@ -22,6 +22,7 @@ import digital.laboratory.platform.reagent.mapper.CentralizedRequestMapper;
import digital.laboratory.platform.reagent.service.*; import digital.laboratory.platform.reagent.service.*;
import digital.laboratory.platform.reagent.vo.*; import digital.laboratory.platform.reagent.vo.*;
import feign.Response; import feign.Response;
import io.seata.common.util.StringUtils;
import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -83,7 +84,7 @@ public class CentralizedRequestServiceImpl extends ServiceImpl<CentralizedReques
public CentralizedRequest addRequest(List<CentralizedRequestDTO> centralizedRequestDTOList, DLPUser dlpUser) { public CentralizedRequest addRequest(List<CentralizedRequestDTO> centralizedRequestDTOList, DLPUser dlpUser) {
String centralizedRequestId = centralizedRequestDTOList.get(0).getCentralizedRequestId(); String centralizedRequestId = centralizedRequestDTOList.get(0).getCentralizedRequestId();
List<DetailsOfCentralized> detailsOfCentralizedList = new ArrayList<>(); List<DetailsOfCentralized> detailsOfCentralizedList = new ArrayList<>();
if (centralizedRequestId == null) { if (!StringUtils.isNotBlank(centralizedRequestId)) {
CentralizedRequest centralizedRequest = new CentralizedRequest(); CentralizedRequest centralizedRequest = new CentralizedRequest();
centralizedRequest.setApplicantId(dlpUser.getId()); centralizedRequest.setApplicantId(dlpUser.getId());
centralizedRequest.setId(IdWorker.get32UUID().toUpperCase()); centralizedRequest.setId(IdWorker.get32UUID().toUpperCase());
@ -255,6 +256,7 @@ public class CentralizedRequestServiceImpl extends ServiceImpl<CentralizedReques
if (centralizedRequest.getStatus() != 4) { if (centralizedRequest.getStatus() != 4) {
throw new RuntimeException(String.format("当前采购还未被制定为清单,无法打印")); throw new RuntimeException(String.format("当前采购还未被制定为清单,无法打印"));
} }
List<DetailsOfCentralizedVO> detailsOfCentralizedVOList = centralizedRequest.getDetailsOfCentralizedVOList(); List<DetailsOfCentralizedVO> detailsOfCentralizedVOList = centralizedRequest.getDetailsOfCentralizedVOList();
for (DetailsOfCentralizedVO detailsOfCentralized : detailsOfCentralizedVOList) { for (DetailsOfCentralizedVO detailsOfCentralized : detailsOfCentralizedVOList) {
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId()); ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.Configure;
@ -67,7 +68,6 @@ public class CheckScheduleServiceImpl extends ServiceImpl<CheckScheduleMapper, C
public CheckScheduleVO addPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS, DLPUser dlpUser) { public CheckScheduleVO addPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS, DLPUser dlpUser) {
CheckSchedule checkSchedule = new CheckSchedule(); CheckSchedule checkSchedule = new CheckSchedule();
checkSchedule.setId(IdWorker.get32UUID().toUpperCase()); checkSchedule.setId(IdWorker.get32UUID().toUpperCase());
checkSchedule.setManagerId(dlpUser.getId()); checkSchedule.setManagerId(dlpUser.getId());
checkSchedule.setStatus(0); checkSchedule.setStatus(0);
@ -75,22 +75,15 @@ public class CheckScheduleServiceImpl extends ServiceImpl<CheckScheduleMapper, C
List<PeriodVerificationPlan> periodVerificationPlans = new ArrayList<>(); List<PeriodVerificationPlan> periodVerificationPlans = new ArrayList<>();
for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) { for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) {
PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan(); PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan();
BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan); BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan);
periodVerificationPlan.setCheckScheduleId(checkSchedule.getId()); periodVerificationPlan.setCheckScheduleId(checkSchedule.getId());
periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty()); periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty());
periodVerificationPlans.add(periodVerificationPlan); periodVerificationPlans.add(periodVerificationPlan);
} }
if (this.save(checkSchedule) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) { if (this.save(checkSchedule) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) {
CheckScheduleVO checkScheduleVO = this.getCheckScheduleVO(checkSchedule.getId()); CheckScheduleVO checkScheduleVO = this.getCheckScheduleVO(checkSchedule.getId());
return checkScheduleVO; return checkScheduleVO;
} else throw new RuntimeException(String.format("保存失败")); } else throw new RuntimeException(String.format("保存失败"));
} }
@ -100,34 +93,21 @@ public class CheckScheduleServiceImpl extends ServiceImpl<CheckScheduleMapper, C
@Transactional @Transactional
public CheckSchedule editPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS) { public CheckSchedule editPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS) {
CheckSchedule byId = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); CheckSchedule checkSchedule = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId());
LambdaQueryWrapper<PeriodVerificationPlan> periodVerificationPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
periodVerificationPlanLambdaQueryWrapper.eq(PeriodVerificationPlan::getCheckScheduleId, byId.getId());
List<PeriodVerificationPlan> list = periodVerificationPlanService.list(periodVerificationPlanLambdaQueryWrapper);
periodVerificationPlanService.removeBatchByIds(list); periodVerificationPlanService.remove(Wrappers.<PeriodVerificationPlan>lambdaQuery().eq(PeriodVerificationPlan::getCheckScheduleId, checkSchedule.getId()));
List<PeriodVerificationPlan> periodVerificationPlans = new ArrayList<>(); List<PeriodVerificationPlan> periodVerificationPlans = new ArrayList<>();
for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) { for (PeriodVerificationPlanDTO periodVerificationPlanDTO : periodVerificationPlanDTOS) {
PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan(); PeriodVerificationPlan periodVerificationPlan = new PeriodVerificationPlan();
BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan); BeanUtils.copyProperties(periodVerificationPlanDTO, periodVerificationPlan);
periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty()); periodVerificationPlan.setDeviationAndUncertainty(periodVerificationPlanDTO.getDeviationOrUncertainty());
periodVerificationPlan.setCheckScheduleId(checkSchedule.getId());
periodVerificationPlan.setCheckScheduleId(byId.getId());
periodVerificationPlans.add(periodVerificationPlan); periodVerificationPlans.add(periodVerificationPlan);
} }
if (this.updateById(checkSchedule) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) {
if (this.updateById(byId) && periodVerificationPlanService.saveBatch(periodVerificationPlans)) { return checkSchedule;
return byId;
} else throw new RuntimeException(String.format("保存失败")); } else throw new RuntimeException(String.format("保存失败"));
} }
@ -135,35 +115,23 @@ public class CheckScheduleServiceImpl extends ServiceImpl<CheckScheduleMapper, C
@Override @Override
@Transactional @Transactional
public CheckSchedule commitPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS, DLPUser dlpUser) { public CheckSchedule commitPlan(List<PeriodVerificationPlanDTO> periodVerificationPlanDTOS, DLPUser dlpUser) {
CheckSchedule oldCheckSchedule = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId());
CheckSchedule byId = this.getById(periodVerificationPlanDTOS.get(0).getCheckScheduleId()); if (oldCheckSchedule == null) {
if (byId == null) {
CheckSchedule checkSchedule = this.addPlan(periodVerificationPlanDTOS, dlpUser); CheckSchedule checkSchedule = this.addPlan(periodVerificationPlanDTOS, dlpUser);
checkSchedule.setStatus(1); checkSchedule.setStatus(1);
checkSchedule.setCommitTime(LocalDateTime.now()); checkSchedule.setCommitTime(LocalDateTime.now());
this.updateById(checkSchedule); this.updateById(checkSchedule);
return checkSchedule; return checkSchedule;
} else { } else {
if (oldCheckSchedule.getStatus() == -2) {
if (byId.getStatus() == -2) {
CheckScheduleVO checkScheduleVO = this.addPlan(periodVerificationPlanDTOS, dlpUser); CheckScheduleVO checkScheduleVO = this.addPlan(periodVerificationPlanDTOS, dlpUser);
return checkScheduleVO; return checkScheduleVO;
} }
CheckSchedule checkSchedule = this.editPlan(periodVerificationPlanDTOS); CheckSchedule checkSchedule = this.editPlan(periodVerificationPlanDTOS);
checkSchedule.setStatus(1); checkSchedule.setStatus(1);
checkSchedule.setCommitTime(LocalDateTime.now()); checkSchedule.setCommitTime(LocalDateTime.now());
this.updateById(checkSchedule); this.updateById(checkSchedule);
return checkSchedule; return checkSchedule;
} }
@ -172,53 +140,39 @@ public class CheckScheduleServiceImpl extends ServiceImpl<CheckScheduleMapper, C
@Override @Override
public CheckSchedule auditPlan(AuditAndApproveDTO auditAndApproveDTO, DLPUser dlpUser) { public CheckSchedule auditPlan(AuditAndApproveDTO auditAndApproveDTO, DLPUser dlpUser) {
CheckSchedule byId = this.getById(auditAndApproveDTO.getUuId()); CheckSchedule checkSchedule = this.getById(auditAndApproveDTO.getUuId());
byId.setAuditOpinionOfTechnical(auditAndApproveDTO.getAuditOpinion()); checkSchedule.setAuditOpinionOfTechnical(auditAndApproveDTO.getAuditOpinion());
byId.setAuditResultOfTechnical(auditAndApproveDTO.getAuditResult()); checkSchedule.setAuditResultOfTechnical(auditAndApproveDTO.getAuditResult());
byId.setAuditTimeOfTechnical(LocalDateTime.now()); checkSchedule.setAuditTimeOfTechnical(LocalDateTime.now());
byId.setTechnicalDirectorId(dlpUser.getId()); checkSchedule.setTechnicalDirectorId(dlpUser.getId());
if (auditAndApproveDTO.getAuditResult() == true) { if (auditAndApproveDTO.getAuditResult() == true) {
List<PeriodVerificationPlan> list = periodVerificationPlanService.list(Wrappers.<PeriodVerificationPlan>lambdaQuery().eq(PeriodVerificationPlan::getCheckScheduleId, checkSchedule.getId()));
LambdaQueryWrapper<PeriodVerificationPlan> periodVerificationPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
periodVerificationPlanLambdaQueryWrapper.eq(PeriodVerificationPlan::getCheckScheduleId, byId.getId());
List<PeriodVerificationPlan> list = periodVerificationPlanService.list(periodVerificationPlanLambdaQueryWrapper);
for (PeriodVerificationPlan periodVerificationPlan : list) { for (PeriodVerificationPlan periodVerificationPlan : list) {
periodVerificationImplementationService.addById(periodVerificationPlan); periodVerificationImplementationService.addById(periodVerificationPlan);
} }
byId.setStatus(6); checkSchedule.setStatus(6);
} else { } else {
byId.setStatus(-2); checkSchedule.setStatus(-2);
} }
if (this.updateById(byId)) { if (this.updateById(checkSchedule)) {
return byId; return checkSchedule;
} else throw new RuntimeException(String.format("审核失败")); } else throw new RuntimeException(String.format("审核失败"));
} }
@Override @Override
public IPage<CheckScheduleVO> getCheckScheduleVOPage(IPage<CheckSchedule> page, QueryWrapper<CheckSchedule> qw) { public IPage<CheckScheduleVO> getCheckScheduleVOPage(IPage<CheckSchedule> page, QueryWrapper<CheckSchedule> qw) {
return baseMapper.getCheckScheduleVOPage(page, qw);
IPage<CheckScheduleVO> checkScheduleVOPage = baseMapper.getCheckScheduleVOPage(page, qw);
return checkScheduleVOPage;
} }
@Override @Override
public CheckScheduleVO getCheckScheduleVO(String checkScheduleId) { public CheckScheduleVO getCheckScheduleVO(String checkScheduleId) {
CheckScheduleVO checkScheduleVO = baseMapper.getCheckScheduleVO(checkScheduleId); CheckScheduleVO checkScheduleVO = baseMapper.getCheckScheduleVO(checkScheduleId);
List<PeriodVerificationPlanVO> periodVerificationPlanVOList = periodVerificationPlanService.getPeriodVerificationPlanVOList(checkScheduleVO.getId()); List<PeriodVerificationPlanVO> periodVerificationPlanVOList = periodVerificationPlanService.getPeriodVerificationPlanVOList(checkScheduleVO.getId());
checkScheduleVO.setPeriodVerificationPlanVOS(periodVerificationPlanVOList); checkScheduleVO.setPeriodVerificationPlanVOS(periodVerificationPlanVOList);
return checkScheduleVO; return checkScheduleVO;
} }

@ -112,9 +112,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@Override//标准物质标准物质管理列表 @Override//标准物质标准物质管理列表
public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryRMVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) { public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryRMVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) {
Integer reagentCategory = 1; Integer reagentCategory = 1;
// if (warning != null && warning == 2) {
// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory);
// }
IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory); IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory);
return reagentConsumableInventoryVOPage; return reagentConsumableInventoryVOPage;
} }
@ -122,9 +119,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@Override//试剂耗材管理列表 @Override//试剂耗材管理列表
public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryREVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) { public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryREVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) {
Integer reagentCategory = 0; Integer reagentCategory = 0;
// if (warning != null && warning == 2) {
// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory);
// }
IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory); IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory);
return reagentConsumableInventoryVOPage; return reagentConsumableInventoryVOPage;
} }
@ -142,23 +136,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
return reagentConsumableInventoryVOIPage; return reagentConsumableInventoryVOIPage;
} else return null; } else return null;
} }
// List<ReagentConsumableInventoryVO> reagentConsumableInventoryVOList = new ArrayList<>();
// List<BatchDetails> list = batchDetailsService.list(Wrappers.<BatchDetails>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//入库增加库存 @Override//入库增加库存
@ -172,7 +149,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
one.setTotalQuantity(one.getTotalQuantity() + quantity); one.setTotalQuantity(one.getTotalQuantity() + quantity);
if (this.updateById(one)) { if (this.updateById(one)) {
return one; return one;
@ -444,12 +420,10 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
public String buildCodeLabelContent(String id) { public String buildCodeLabelContent(String id) {
//录入二维码信息 //录入二维码信息
ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(id); ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(id);
referenceMaterialServiceById.setCode(referenceMaterialServiceById.getNumber()); referenceMaterialServiceById.setCode(referenceMaterialServiceById.getNumber());
referenceMaterialService.updateById(referenceMaterialServiceById); referenceMaterialService.updateById(referenceMaterialServiceById);
if (referenceMaterialServiceById == null) { if (referenceMaterialServiceById == null) {
throw new RuntimeException(String.format("请先入库后再进行打印条码")); throw new RuntimeException(String.format("请先入库后再进行打印条码"));
} }
//获取打印信息 //获取打印信息
@ -465,13 +439,11 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
referenceMaterial.setTime("到期:" + byId1.getExpirationDate()); referenceMaterial.setTime("到期:" + byId1.getExpirationDate());
data.put("referenceMaterial", referenceMaterial); data.put("referenceMaterial", referenceMaterial);
String templateFileName = "标准物质标签模板.vm"; String templateFileName = "标准物质标签模板.vm";
return remoteTemplate2htmlService.getHtml(templateFileName, data); return remoteTemplate2htmlService.getHtml(templateFileName, data);
} }
@Override @Override
public String printSolutionTag(String id) { public String printSolutionTag(String id) {
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id);
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("standardReserveSolution", standardReserveSolutionVOById); data.put("standardReserveSolution", standardReserveSolutionVOById);

@ -1,5 +1,6 @@
package digital.laboratory.platform.reagent.service.impl; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -7,25 +8,24 @@ import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile; import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.reagent.entity.ReagentConsumables; import digital.laboratory.platform.reagent.entity.ReagentConsumables;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial; 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.mapper.ReferenceMaterialMapper;
import digital.laboratory.platform.reagent.service.ReagentConsumablesService; import digital.laboratory.platform.reagent.service.ReagentConsumablesService;
import digital.laboratory.platform.reagent.service.ReferenceMaterialService; import digital.laboratory.platform.reagent.service.ReferenceMaterialService;
import digital.laboratory.platform.reagent.service.StandardMaterialApprovalFormService; import digital.laboratory.platform.reagent.service.StandardMaterialApprovalFormService;
import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO; import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO;
import digital.laboratory.platform.reagent.vo.StandardMaterialApprovalFormVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
/** /**
* 服务实现类 * 服务实现类
* *
* @author Zhang Xiaolong created at 2023-03-23 * @author Zhang Xiaolong created at 2023-03-23
* @describe 服务实现类 * @describe 服务实现类
*/ */
@Service @Service
@ -45,27 +45,23 @@ public class ReferenceMaterialServiceImpl extends ServiceImpl<ReferenceMaterialM
@Autowired @Autowired
private StandardMaterialApprovalFormService standardMaterialApprovalFormService; private StandardMaterialApprovalFormService standardMaterialApprovalFormService;
/**
* 通过批次ID查询标准物质
*
* @param batchDetailsId
* @return
*/
@Override @Override
public List<ReferenceMaterialVO> getReferenceMaterialVOList(String batchDetailsId){ public List<ReferenceMaterialVO> getReferenceMaterialVOList(String batchDetailsId) {
LambdaQueryWrapper<ReferenceMaterial> referenceMaterialLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ReferenceMaterial> referenceMaterialLambdaQueryWrapper = new LambdaQueryWrapper<>();
referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId, batchDetailsId);
referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId,batchDetailsId);
List<ReferenceMaterial> list = this.list(referenceMaterialLambdaQueryWrapper); List<ReferenceMaterial> list = this.list(referenceMaterialLambdaQueryWrapper);
List<ReferenceMaterialVO> referenceMaterialVOS = new ArrayList<>(); List<ReferenceMaterialVO> referenceMaterialVOS = new ArrayList<>();
for (ReferenceMaterial referenceMaterial : list) { for (ReferenceMaterial referenceMaterial : list) {
ReagentConsumables byId = reagentConsumablesService.getById(referenceMaterial.getReagentConsumableId()); ReagentConsumables byId = reagentConsumablesService.getById(referenceMaterial.getReagentConsumableId());
ReferenceMaterialVO referenceMaterialVO = new ReferenceMaterialVO(); ReferenceMaterialVO referenceMaterialVO = new ReferenceMaterialVO();
BeanUtils.copyProperties(referenceMaterial, referenceMaterialVO);
BeanUtils.copyProperties(referenceMaterial,referenceMaterialVO);
referenceMaterialVO.setReferenceMaterialName(byId.getReagentConsumableName()); referenceMaterialVO.setReferenceMaterialName(byId.getReagentConsumableName());
referenceMaterialVOS.add(referenceMaterialVO); referenceMaterialVOS.add(referenceMaterialVO);
} }
@ -73,13 +69,32 @@ public class ReferenceMaterialServiceImpl extends ServiceImpl<ReferenceMaterialM
} }
@Override @Override
public List<ReferenceMaterialVO> getReferenceMaterialList(){ public List<ReferenceMaterialVO> getReferenceMaterialList() {
List<ReferenceMaterialVO> referenceMaterialVOList = baseMapper.getReferenceMaterialVOList(); List<ReferenceMaterialVO> referenceMaterialVOList = baseMapper.getReferenceMaterialVOList();
return referenceMaterialVOList; 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<ReferenceMaterial> list = this.list(Wrappers.<ReferenceMaterial>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;
}
} }

@ -112,15 +112,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
BeanUtils.copyProperties(form, vo); BeanUtils.copyProperties(form, vo);
//查询出签收物品明细,将明细添加至签收记录VO //查询出签收物品明细,将明细添加至签收记录VO
List<WarehousingContentVO> warehousingContentVOList = warehousingContentMapper.getWarehousingContentVOList(warehousingRecordFormId, opCode, keywords, category); List<WarehousingContentVO> warehousingContentVOList = warehousingContentMapper.getWarehousingContentVOList(warehousingRecordFormId, opCode, keywords, category);
// List<WarehousingBatchListVO> warehousingBatchListVOList = warehousingBatchListMapper.getWarehousingBatchListVOList(warehousingRecordFormId, keywords);
// for (int i = 0; i < warehousingContentVOList.size(); i++) {
// if (i == 0) {
// warehousingContentVOList.get(i).setWarehousingBatchListVOList(warehousingBatchListVOList);
// } else {
// List<WarehousingBatchListVO> warehousingBatchListVOS = new ArrayList<>();
// warehousingContentVOList.get(i).setWarehousingBatchListVOList(warehousingBatchListVOS);
// }
// }
vo.setWarehousingContentVOList(warehousingContentVOList); vo.setWarehousingContentVOList(warehousingContentVOList);
return vo; return vo;
} }
@ -145,6 +136,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
warehousingRecordFormDTO.getBoxId().isEmpty()) { warehousingRecordFormDTO.getBoxId().isEmpty()) {
throw new RuntimeException(String.format("请选择存放位置后再进行提交")); throw new RuntimeException(String.format("请选择存放位置后再进行提交"));
} }
int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
String latticeId = warehousingRecordFormDTO.getLatticeId();//格子ID String latticeId = warehousingRecordFormDTO.getLatticeId();//格子ID
String boxId = warehousingRecordFormDTO.getBoxId();//柜子ID String boxId = warehousingRecordFormDTO.getBoxId();//柜子ID
@ -180,9 +172,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
warehousingContent.setCode(warehousingRecordFormDTO.getCode()); warehousingContent.setCode(warehousingRecordFormDTO.getCode());
} }
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId())); ReagentConsumableInventory oldReagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId()));
//录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息 //录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息
if (one == null) { if (oldReagentConsumableInventory == null) {
ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();//创建库存对象 ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();//创建库存对象
BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);//拷贝信息 BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);//拷贝信息
reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase()); reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase());
@ -199,8 +191,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} }
reagentConsumablesService.updateById(reagentConsumables); reagentConsumablesService.updateById(reagentConsumables);
BatchDetails batchDetails = new BatchDetails();//创建批次信息 BatchDetails batchDetails = new BatchDetails();//创建批次信息
int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);//拷贝批次信息 BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);//拷贝批次信息
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase()); batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
batchDetails.setServiceStatus(1);//状态 1为正常 batchDetails.setServiceStatus(1);//状态 1为正常
@ -223,7 +213,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());//关联签收批次 batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());//关联签收批次
if (!reagentConsumables.getCategory().equals("标准物质")) { if (!reagentConsumables.getCategory().equals("标准物质")) {
ReagentConsumableStash reagentConsumableStash = new ReagentConsumableStash(); ReagentConsumableStash reagentConsumableStash = new ReagentConsumableStash();
BeanUtils.copyProperties(reagentConsumables, reagentConsumableStash); BeanUtils.copyProperties(reagentConsumables, reagentConsumableStash);
reagentConsumableStash.setId(IdWorker.get32UUID().toUpperCase()); reagentConsumableStash.setId(IdWorker.get32UUID().toUpperCase());
@ -259,23 +248,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
//更新格子信息(标准物质传入对象ID) //更新格子信息(标准物质传入对象ID)
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1); reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
//生成编号 //生成编号
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-"; referenceMaterial.setNumber(referenceMaterialService.createNo(reagentConsumables.getAlias(),location));
List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>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);
referenceMaterialService.save(referenceMaterial); referenceMaterialService.save(referenceMaterial);
} }
} }
@ -299,7 +272,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} else { } else {
batchDetails.setExpirationDate(LocalDate.now().plusYears(99)); batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
} }
batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId()); batchDetails.setReagentConsumableInventoryId(oldReagentConsumableInventory.getReagentConsumableInventoryId());
batchDetails.setQuantity(quantity); batchDetails.setQuantity(quantity);
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId()); batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId()); warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
@ -327,10 +300,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
reagentConsumableStashService.updateById(reagentConsumableStash); reagentConsumableStashService.updateById(reagentConsumableStash);
} }
} }
int year = Calendar.getInstance().get(Calendar.YEAR);
Integer years = Integer.valueOf(year);//进行包装,方便运算 Integer years = Integer.valueOf(year);//进行包装,方便运算
//查询相同年份相同供应商相同物品的所有批次信息 //查询相同年份相同供应商相同物品的所有批次信息
List<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId()) List<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", oldReagentConsumableInventory.getReagentConsumableInventoryId())
.eq("supplier_id", warehousingContent.getSupplierId()) .eq("supplier_id", warehousingContent.getSupplierId())
.like("batch", years)); .like("batch", years));
//如果没有批次信心,则默认为1 //如果没有批次信心,则默认为1
@ -342,18 +314,18 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} }
if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) { if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) {
//更新格子信息(试剂耗材传入类ID) //更新格子信息(试剂耗材传入类ID)
reagentConsumableInventoryService.updateCabinet(batchDetails.getLatticeId(), one.getReagentConsumableInventoryId(), 1); reagentConsumableInventoryService.updateCabinet(batchDetails.getLatticeId(), oldReagentConsumableInventory.getReagentConsumableInventoryId(), 1);
} }
one.setTotalQuantity(one.getTotalQuantity() + batchDetails.getQuantity()); oldReagentConsumableInventory.setTotalQuantity(oldReagentConsumableInventory.getTotalQuantity() + batchDetails.getQuantity());
one.setWarningValue(warehousingRecordFormDTO.getWarningValue()); oldReagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue());
if (reagentConsumables.getCategory().equals("标准物质")) { if (reagentConsumables.getCategory().equals("标准物质")) {
for (int j = 0; j < batchDetails.getQuantity(); j++) { for (int j = 0; j < batchDetails.getQuantity(); j++) {
ReferenceMaterial referenceMaterial = new ReferenceMaterial(); ReferenceMaterial referenceMaterial = new ReferenceMaterial();
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
referenceMaterial.setReagentConsumableId(one.getReagentConsumableId()); referenceMaterial.setReagentConsumableId(oldReagentConsumableInventory.getReagentConsumableId());
referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId()); referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());
referenceMaterial.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId()); referenceMaterial.setReagentConsumableInventoryId(oldReagentConsumableInventory.getReagentConsumableInventoryId());
referenceMaterial.setStatus(0); referenceMaterial.setStatus(0);
referenceMaterial.setLocation(warehousingRecordFormDTO.getLocation()); referenceMaterial.setLocation(warehousingRecordFormDTO.getLocation());
referenceMaterial.setLatticeId(warehousingRecordFormDTO.getLatticeId()); referenceMaterial.setLatticeId(warehousingRecordFormDTO.getLatticeId());
@ -365,28 +337,12 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
//更新格子信息(试剂耗材传入类ID) //更新格子信息(试剂耗材传入类ID)
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1); reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
//生成编号 //生成编号
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-"; referenceMaterial.setNumber(referenceMaterialService.createNo(reagentConsumables.getAlias(), location));
List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>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);
referenceMaterialService.save(referenceMaterial); referenceMaterialService.save(referenceMaterial);
} }
} }
reagentConsumableInventoryService.updateById(one); reagentConsumableInventoryService.updateById(oldReagentConsumableInventory);
batchDetailsService.save(batchDetails); batchDetailsService.save(batchDetails);
} }
@ -403,13 +359,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
//遍历采购内容,判断试剂耗材是否入库完毕 //遍历采购内容,判断试剂耗材是否入库完毕
for (WarehousingContent warehousingContentFull : list) { for (WarehousingContent warehousingContentFull : list) {
if (warehousingContentFull.getWarehousingQuantity() == warehousingContentFull.getTotalQuantity()) {//签收数量=购买数量 if (warehousingContentFull.getWarehousingQuantity() == warehousingContentFull.getTotalQuantity()) {//签收数量=购买数量
warehousingContentFull.setStatus(1);//签收成功 warehousingContentFull.setStatus(1);//签收成功
warehousingContentService.updateById(warehousingContentFull); warehousingContentService.updateById(warehousingContentFull);
if (warehousingContentFull.getAcceptanceRecordFormId() == null) {//如果没有验收记录表,那就创建 if (warehousingContentFull.getAcceptanceRecordFormId() == null) {//如果没有验收记录表,那就创建
//首先创建验收集合表 //首先创建验收集合表
AcceptanceSignFor acceptanceSignForServiceOne = acceptanceSignForService.getOne(Wrappers.<AcceptanceSignFor>query().eq("warehousing_record_form_id", warehousingRecordFormId)); AcceptanceSignFor acceptanceSignForServiceOne = acceptanceSignForService.getOne(Wrappers.<AcceptanceSignFor>query().eq("warehousing_record_form_id", warehousingRecordFormId));
@ -430,7 +382,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} }
warehousingContentService.updateById(warehousingContent); warehousingContentService.updateById(warehousingContent);
} }
i = i + 1; i = i + 1;
} }
} }

@ -95,8 +95,7 @@
rc.standard_value_or_purity, rc.standard_value_or_purity,
rc.specification_and_model, rc.specification_and_model,
rc.category, rc.category,
u.`name` as u.`name` as depositor_name
depositor_name
FROM warehousing_batch_list wb FROM warehousing_batch_list wb
LEFT JOIN warehousing_content wc ON wb.warehousing_content_id = wc.id LEFT JOIN warehousing_content wc ON wb.warehousing_content_id = wc.id
LEFT JOIN reagent_consumables rc ON wc.reagent_consumable_id = rc.reagent_consumable_id LEFT JOIN reagent_consumables rc ON wc.reagent_consumable_id = rc.reagent_consumable_id

Loading…
Cancel
Save