update
This commit is contained in:
@@ -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();
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
+1
@@ -22,4 +22,5 @@ public interface ReferenceMaterialService extends IService<ReferenceMaterial> {
|
||||
List<ReferenceMaterialVO> getReferenceMaterialList();
|
||||
|
||||
|
||||
String createNo(String alias, String location);
|
||||
}
|
||||
|
||||
+99
-176
@@ -52,14 +52,12 @@ import java.util.List;
|
||||
@Service
|
||||
@SuppressWarnings("all")
|
||||
public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecordFormMapper, AcceptanceRecordForm> 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<AcceptanceRecor
|
||||
@Transactional
|
||||
@Override//批量提交
|
||||
public void culkCommit(List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, DLPUser dlpUser) {
|
||||
|
||||
for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) {
|
||||
//调用单个提交方法
|
||||
AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser);
|
||||
@@ -81,83 +78,64 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
|
||||
|
||||
@Override//提交验收记录表
|
||||
public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) {
|
||||
|
||||
AcceptanceRecordForm byId = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId());
|
||||
//验收记录状态为-2,代表验收审核不通过后重新提交,需置空原有审核信息
|
||||
if (byId.getStatus() == -2) {
|
||||
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
|
||||
byId.setUserName(dlpUser.getName());
|
||||
byId.setAuditResultOfPrimary(false);
|
||||
byId.setAuditOpinionOfPrimary("");
|
||||
byId.setAuditTimeOfPrimary(null);
|
||||
byId.setPrimaryAuditorId("");
|
||||
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("重新提交失败"));
|
||||
AcceptanceRecordForm acceptanceRecordForm = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId());
|
||||
BeanUtils.copyProperties(acceptanceRecordFormDTO, acceptanceRecordForm);
|
||||
acceptanceRecordForm.setUserName(dlpUser.getName());
|
||||
acceptanceRecordForm.setCommitTime(LocalDateTime.now());
|
||||
acceptanceRecordForm.setStatus(1);
|
||||
acceptanceRecordForm.setDateOfAcceptance(LocalDateTime.now());
|
||||
acceptanceRecordForm.setCreateBy(dlpUser.getId());
|
||||
//验收记录状态为-2\-3\-4,代表验收审核不通过后重新提交,需置空原有审核信息
|
||||
switch (acceptanceRecordForm.getStatus()) {
|
||||
case -2: {
|
||||
acceptanceRecordForm.setAuditResultOfPrimary(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfPrimary("");
|
||||
acceptanceRecordForm.setAuditTimeOfPrimary(null);
|
||||
acceptanceRecordForm.setPrimaryAuditorId("");
|
||||
if (this.updateById(acceptanceRecordForm)) {
|
||||
return acceptanceRecordForm;
|
||||
} else {
|
||||
throw new RuntimeException(String.format("重新提交失败"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (byId.getStatus() == -3) {
|
||||
|
||||
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
|
||||
byId.setUserName(dlpUser.getName());
|
||||
byId.setAuditResultOfSecondary(false);
|
||||
byId.setAuditOpinionOfSecondary("");
|
||||
byId.setAuditTimeOfSecondary(null);
|
||||
byId.setSecondaryAuditorId("");
|
||||
byId.setAuditResultOfPrimary(false);
|
||||
byId.setAuditOpinionOfPrimary("");
|
||||
byId.setAuditTimeOfPrimary(null);
|
||||
byId.setPrimaryAuditorId("");
|
||||
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 -3: {
|
||||
acceptanceRecordForm.setAuditResultOfSecondary(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfSecondary("");
|
||||
acceptanceRecordForm.setAuditTimeOfSecondary(null);
|
||||
acceptanceRecordForm.setSecondaryAuditorId("");
|
||||
acceptanceRecordForm.setAuditResultOfPrimary(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfPrimary("");
|
||||
acceptanceRecordForm.setAuditTimeOfPrimary(null);
|
||||
acceptanceRecordForm.setPrimaryAuditorId("");
|
||||
if (this.updateById(acceptanceRecordForm)) {
|
||||
return acceptanceRecordForm;
|
||||
} else {
|
||||
throw new RuntimeException(String.format("重新提交失败"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (byId.getStatus() == -4) {
|
||||
|
||||
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
|
||||
byId.setUserName(dlpUser.getName());
|
||||
byId.setAuditResultOfThreeLevel(false);
|
||||
byId.setAuditOpinionOfThreeLevel("");
|
||||
byId.setAuditTimeOfThreeLevel(null);
|
||||
byId.setThreeLevelAuditorId("");
|
||||
byId.setAuditResultOfSecondary(false);
|
||||
byId.setAuditOpinionOfSecondary("");
|
||||
byId.setAuditTimeOfSecondary(null);
|
||||
byId.setSecondaryAuditorId("");
|
||||
byId.setAuditResultOfPrimary(false);
|
||||
byId.setAuditOpinionOfPrimary("");
|
||||
byId.setAuditTimeOfPrimary(null);
|
||||
byId.setPrimaryAuditorId("");
|
||||
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: {
|
||||
acceptanceRecordForm.setAuditResultOfThreeLevel(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfThreeLevel("");
|
||||
acceptanceRecordForm.setAuditTimeOfThreeLevel(null);
|
||||
acceptanceRecordForm.setThreeLevelAuditorId("");
|
||||
acceptanceRecordForm.setAuditResultOfSecondary(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfSecondary("");
|
||||
acceptanceRecordForm.setAuditTimeOfSecondary(null);
|
||||
acceptanceRecordForm.setSecondaryAuditorId("");
|
||||
acceptanceRecordForm.setAuditResultOfPrimary(false);
|
||||
acceptanceRecordForm.setAuditOpinionOfPrimary("");
|
||||
acceptanceRecordForm.setAuditTimeOfPrimary(null);
|
||||
acceptanceRecordForm.setPrimaryAuditorId("");
|
||||
if (this.updateById(acceptanceRecordForm)) {
|
||||
return acceptanceRecordForm;
|
||||
} else {
|
||||
throw new RuntimeException(String.format("重新提交失败"));
|
||||
}
|
||||
}
|
||||
}
|
||||
//正常提交
|
||||
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
|
||||
byId.setUserName(dlpUser.getName());
|
||||
byId.setCommitTime(LocalDateTime.now());
|
||||
byId.setStatus(1);
|
||||
byId.setCreateBy(dlpUser.getId());
|
||||
byId.setDateOfAcceptance(LocalDateTime.now());
|
||||
if (this.updateById(byId)) {
|
||||
return byId;
|
||||
if (this.updateById(acceptanceRecordForm)) {
|
||||
return acceptanceRecordForm;
|
||||
} else {
|
||||
throw new RuntimeException(String.format("提交失败"));
|
||||
}
|
||||
@@ -165,83 +143,41 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
|
||||
|
||||
@Override
|
||||
public AcceptanceRecordForm addForm(String reagentConsumableId, String supplierId, String acceptanceSignForId) {
|
||||
|
||||
AcceptanceRecordForm acceptanceRecordForm = new AcceptanceRecordForm();
|
||||
|
||||
acceptanceRecordForm.setId(IdWorker.get32UUID().toUpperCase());
|
||||
acceptanceRecordForm.setSupplierId(supplierId);//供应商ID
|
||||
acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);//验收分类ID
|
||||
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);//验收试剂耗材ID
|
||||
|
||||
ReagentConsumables byId = reagentConsumablesService.getById(reagentConsumableId);
|
||||
|
||||
acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());//将物品名称赋值给验收记录表
|
||||
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(reagentConsumableId);
|
||||
acceptanceRecordForm.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//将物品名称赋值给验收记录表
|
||||
acceptanceRecordForm.setStatus(0);//初始化状态
|
||||
|
||||
if ((this.save(acceptanceRecordForm))) {
|
||||
|
||||
return acceptanceRecordForm;
|
||||
|
||||
} else throw new RuntimeException(String.format("创建验收任务失败"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm> qw) {
|
||||
|
||||
IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表
|
||||
|
||||
List<AcceptanceRecordFormVO> 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<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
|
||||
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<AcceptanceRecor
|
||||
public boolean primaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
|
||||
//批量审核
|
||||
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
|
||||
|
||||
List<AcceptanceRecordForm> 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<AcceptanceRecor
|
||||
//批量审核
|
||||
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
|
||||
List<AcceptanceRecordForm> 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<AcceptanceRecor
|
||||
List<String> 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<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()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-112
@@ -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<ApplicationForUseM
|
||||
|
||||
@Override//通过ID查询领用申请表
|
||||
public ApplicationForUseVO getApplicationForUseVO(String applicationForUseId) {
|
||||
|
||||
ApplicationForUseVO applicationForUseVO = baseMapper.getApplicationForUseVO(applicationForUseId);
|
||||
|
||||
List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUseId);
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
|
||||
applicationForUseVO.setReagentConsumablesSetVOList(list);
|
||||
}
|
||||
return applicationForUseVO;
|
||||
@@ -69,15 +67,10 @@ public class ApplicationForUseServiceImpl extends ServiceImpl<ApplicationForUseM
|
||||
|
||||
@Override//分页查询
|
||||
public IPage<ApplicationForUseVO> getApplicationForUseVOPage(IPage<ApplicationForUse> page, QueryWrapper<ApplicationForUse> qw) {
|
||||
|
||||
IPage<ApplicationForUseVO> applicationForUseVOPage = baseMapper.getApplicationForUseVOPage(page, qw);
|
||||
|
||||
List<ApplicationForUseVO> 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<ApplicationForUseM
|
||||
@Transactional
|
||||
@Override//创建领用申请表(试剂耗材领用、标准物质领用、标准溶液领用)
|
||||
public ApplicationForUseVO addApplication(ApplicationForUseDTO applicationForUseDTO, DLPUser dlpUser) {
|
||||
|
||||
//在已有领用记录的申请上继续添加领用物品
|
||||
if (applicationForUseDTO.getApplicationForUseId() != null) {
|
||||
ApplicationForUse byId = this.getById(applicationForUseDTO.getApplicationForUseId());
|
||||
|
||||
if (byId != null) {
|
||||
|
||||
ApplicationForUse application = this.getById(applicationForUseDTO.getApplicationForUseId());
|
||||
if (application != null) {
|
||||
ReagentConsumablesSet reagentConsumablesSet = new ReagentConsumablesSet();
|
||||
|
||||
BeanUtils.copyProperties(applicationForUseDTO, reagentConsumablesSet);
|
||||
|
||||
reagentConsumablesSet.setId(IdWorker.get32UUID().toUpperCase());
|
||||
|
||||
reagentConsumablesSet.setApplicationForUseId(byId.getId());
|
||||
|
||||
reagentConsumablesSet.setApplicationForUseId(application.getId());
|
||||
if (applicationForUseDTO.getReagentConsumableStashId() != null) {
|
||||
|
||||
reagentConsumablesSet.setReagentConsumableStashId(applicationForUseDTO.getReagentConsumableStashId());
|
||||
}
|
||||
|
||||
if (applicationForUseDTO.getReferenceMaterialId() != null) {
|
||||
|
||||
reagentConsumablesSet.setReferenceMaterialId(applicationForUseDTO.getReferenceMaterialId());
|
||||
}
|
||||
LambdaQueryWrapper<ReagentConsumableInventory> reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId());
|
||||
|
||||
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper);
|
||||
|
||||
Integer totalQuantity = one.getTotalQuantity();
|
||||
Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>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<ReagentConsumableInventory> reagentConsumableInventoryLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
reagentConsumableInventoryLambdaQueryWrapper.eq(ReagentConsumableInventory::getReagentConsumableId, applicationForUseDTO.getReagentConsumableId());
|
||||
|
||||
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(reagentConsumableInventoryLambdaQueryWrapper);
|
||||
|
||||
Integer totalQuantity = one.getTotalQuantity();
|
||||
|
||||
Integer totalQuantity = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>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<ApplicationForUseM
|
||||
@Override//提交领用申请记录
|
||||
@Transactional
|
||||
public ApplicationForUseVO commitApplication(String id, DLPUser dlpUser) {
|
||||
|
||||
ApplicationForUse applicationForUse = this.getById(id);
|
||||
|
||||
applicationForUse.setStatus(1);
|
||||
|
||||
String code = getCode();
|
||||
//领取码
|
||||
applicationForUse.setClaimCode(code);
|
||||
|
||||
applicationForUse.setDateOfCollection(LocalDateTime.now());
|
||||
|
||||
this.updateById(applicationForUse);
|
||||
|
||||
deliveryRegistrationFormService.addFrom(applicationForUse.getId());
|
||||
|
||||
ApplicationForUseVO applicationForUseVO = this.getApplicationForUseVO(applicationForUse.getId());
|
||||
|
||||
return applicationForUseVO;
|
||||
}
|
||||
|
||||
@Override//通过ID删除领用申请表(标准物质领用/归还登记表)
|
||||
@Transactional
|
||||
public Boolean delApplication(String applicationForUseId) {
|
||||
|
||||
ApplicationForUse applicationForUse = this.getById(applicationForUseId);
|
||||
|
||||
if (applicationForUse.getStatus() == 0) {
|
||||
|
||||
LambdaQueryWrapper<ReagentConsumablesSet> reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId());
|
||||
|
||||
List<ReagentConsumablesSet> list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper);
|
||||
|
||||
return reagentConsumablesSetService.removeBatchByIds(list) & this.removeById(applicationForUse);
|
||||
|
||||
return reagentConsumablesSetService.remove(Wrappers.<ReagentConsumablesSet>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<ApplicationForUse> 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<ApplicationForUseM
|
||||
@Transactional
|
||||
@Override
|
||||
public ApplicationForUseVO batchCommit(ApplicationForUseBatchDTO applicationForUseBatchDTO, DLPUser dlpUser) {
|
||||
|
||||
ApplicationForUse applicationForUse = new ApplicationForUse();
|
||||
|
||||
applicationForUse.setId(IdWorker.get32UUID().toUpperCase());
|
||||
|
||||
applicationForUse.setStatus(0);
|
||||
|
||||
applicationForUse.setRecipientId(dlpUser.getId());
|
||||
|
||||
applicationForUse.setExperimentId(applicationForUseBatchDTO.getExperimentId());
|
||||
|
||||
if (StringUtils.isNotBlank(applicationForUseBatchDTO.getExperimentId())){
|
||||
applicationForUse.setExperimentId(applicationForUseBatchDTO.getExperimentId());
|
||||
}
|
||||
List<ReagentConsumablesSet> reagentConsumablesSets = new ArrayList<>();
|
||||
|
||||
List<ApplicationForUseDTO> 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<ReagentConsumableInventory> 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.<ReagentConsumableInventory>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<ApplicationForUseM
|
||||
*通过实验模板ID查询领用的所有物品*/
|
||||
@Override
|
||||
public List<ReagentConsumablesSetVO> getReagentConsumablesSets(String id) {
|
||||
|
||||
List<ApplicationForUse> applicationForUseList = this.list(Wrappers.<ApplicationForUse>query().eq("experiment_id", id));
|
||||
|
||||
List<ReagentConsumablesSetVO> reagentConsumablesSetList = new ArrayList<>();
|
||||
|
||||
for (ApplicationForUse applicationForUse : applicationForUseList) {
|
||||
|
||||
List<ReagentConsumablesSetVO> list = reagentConsumablesSetService.getList(applicationForUse.getId());
|
||||
|
||||
reagentConsumablesSetList.addAll(list);
|
||||
}
|
||||
return reagentConsumablesSetList;
|
||||
|
||||
+18
-24
@@ -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<BatchDetailsMapper, Bat
|
||||
@Autowired
|
||||
private ReagentConsumableStashService reagentConsumableStashService;
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private RemoteCabinetService remoteCabinetService;
|
||||
|
||||
@Override
|
||||
public List<BatchDetailsVO> getBatchDetailsList(String reagentConsumableInventoryId) {
|
||||
|
||||
LambdaQueryWrapper<BatchDetails> batchDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
batchDetailsLambdaQueryWrapper.eq(BatchDetails::getReagentConsumableInventoryId, reagentConsumableInventoryId)
|
||||
.eq(BatchDetails::getServiceStatus, 1);
|
||||
List<BatchDetails> list = this.list(batchDetailsLambdaQueryWrapper);
|
||||
List<BatchDetailsVO> 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<BatchDetails> list = this.list(new LambdaQueryWrapper<BatchDetails>().gt(BatchDetails::getQuantity, 0));
|
||||
int x = 1;
|
||||
for (BatchDetails batchDetails : list) {
|
||||
String latticeId = batchDetails.getLatticeId();
|
||||
reagentConsumableInventoryService.updateCabinet(latticeId, batchDetails.getReagentConsumableInventoryId(), 1);
|
||||
|
||||
+7
-22
@@ -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<BlacklistMapper, Blacklist
|
||||
public Blacklist addListById(String reagentConsumableId, String supplierId) {
|
||||
|
||||
Blacklist blacklist = new Blacklist();
|
||||
|
||||
blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase());
|
||||
blacklist.setSupplierId(supplierId);
|
||||
blacklist.setResultsOfComplianceCheck(false);
|
||||
blacklist.setReagentConsumableId(reagentConsumableId);
|
||||
|
||||
if (this.save(blacklist)) {
|
||||
|
||||
return blacklist;
|
||||
} else return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Blacklist addListById2(String reagentConsumableId, String supplierId) {
|
||||
|
||||
Blacklist blacklist = new Blacklist();
|
||||
|
||||
blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase());
|
||||
blacklist.setSupplierId(supplierId);
|
||||
blacklist.setReagentConsumableId(reagentConsumableId);
|
||||
@@ -61,29 +58,17 @@ public class BlacklistServiceImpl extends ServiceImpl<BlacklistMapper, Blacklist
|
||||
@Override
|
||||
public List<BlackListVO> getBlacklist(String supplierInformationId) {
|
||||
|
||||
LambdaQueryWrapper<Blacklist> blacklistLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
blacklistLambdaQueryWrapper.eq(Blacklist::getSupplierId, supplierInformationId);
|
||||
|
||||
List<Blacklist> list = this.list(blacklistLambdaQueryWrapper);
|
||||
|
||||
List<Blacklist> list = this.list(Wrappers.<Blacklist>lambdaQuery().eq(Blacklist::getSupplierId, supplierInformationId));
|
||||
List<BlackListVO> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-23
@@ -24,29 +24,17 @@ public class CategoryTableServiceImpl extends ServiceImpl<CategoryTableMapper, C
|
||||
@Override
|
||||
public CategoryTable addSpecies(String category, String species) {
|
||||
|
||||
LambdaQueryWrapper<CategoryTable> 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.<CategoryTable>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<CategoryTableMapper, C
|
||||
|
||||
@Override
|
||||
public List<CategoryTable> getSpecies(String category) {
|
||||
|
||||
LambdaQueryWrapper<CategoryTable> typeTableLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
typeTableLambdaQueryWrapper.eq(CategoryTable::getCategory, category);
|
||||
|
||||
List<CategoryTable> list = this.list(typeTableLambdaQueryWrapper);
|
||||
|
||||
return list;
|
||||
return this.list(Wrappers.<CategoryTable>lambdaQuery().eq(CategoryTable::getCategory, category));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -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<CentralizedReques
|
||||
public CentralizedRequest addRequest(List<CentralizedRequestDTO> centralizedRequestDTOList, DLPUser dlpUser) {
|
||||
String centralizedRequestId = centralizedRequestDTOList.get(0).getCentralizedRequestId();
|
||||
List<DetailsOfCentralized> 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<CentralizedReques
|
||||
if (centralizedRequest.getStatus() != 4) {
|
||||
throw new RuntimeException(String.format("当前采购还未被制定为清单,无法打印"));
|
||||
}
|
||||
|
||||
List<DetailsOfCentralizedVO> detailsOfCentralizedVOList = centralizedRequest.getDetailsOfCentralizedVOList();
|
||||
for (DetailsOfCentralizedVO detailsOfCentralized : detailsOfCentralizedVOList) {
|
||||
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());
|
||||
|
||||
+20
-66
@@ -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<CheckScheduleMapper, C
|
||||
public CheckScheduleVO addPlan(List<PeriodVerificationPlanDTO> 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<CheckScheduleMapper, C
|
||||
List<PeriodVerificationPlan> 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<CheckScheduleMapper, C
|
||||
@Transactional
|
||||
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<>();
|
||||
|
||||
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<CheckScheduleMapper, C
|
||||
@Override
|
||||
@Transactional
|
||||
public CheckSchedule commitPlan(List<PeriodVerificationPlanDTO> 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<CheckScheduleMapper, C
|
||||
@Override
|
||||
public CheckSchedule auditPlan(AuditAndApproveDTO auditAndApproveDTO, DLPUser dlpUser) {
|
||||
|
||||
CheckSchedule byId = this.getById(auditAndApproveDTO.getUuId());
|
||||
CheckSchedule checkSchedule = this.getById(auditAndApproveDTO.getUuId());
|
||||
|
||||
byId.setAuditOpinionOfTechnical(auditAndApproveDTO.getAuditOpinion());
|
||||
byId.setAuditResultOfTechnical(auditAndApproveDTO.getAuditResult());
|
||||
byId.setAuditTimeOfTechnical(LocalDateTime.now());
|
||||
byId.setTechnicalDirectorId(dlpUser.getId());
|
||||
checkSchedule.setAuditOpinionOfTechnical(auditAndApproveDTO.getAuditOpinion());
|
||||
checkSchedule.setAuditResultOfTechnical(auditAndApproveDTO.getAuditResult());
|
||||
checkSchedule.setAuditTimeOfTechnical(LocalDateTime.now());
|
||||
checkSchedule.setTechnicalDirectorId(dlpUser.getId());
|
||||
|
||||
if (auditAndApproveDTO.getAuditResult() == true) {
|
||||
|
||||
LambdaQueryWrapper<PeriodVerificationPlan> periodVerificationPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
periodVerificationPlanLambdaQueryWrapper.eq(PeriodVerificationPlan::getCheckScheduleId, byId.getId());
|
||||
|
||||
List<PeriodVerificationPlan> list = periodVerificationPlanService.list(periodVerificationPlanLambdaQueryWrapper);
|
||||
|
||||
List<PeriodVerificationPlan> list = periodVerificationPlanService.list(Wrappers.<PeriodVerificationPlan>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<CheckScheduleVO> getCheckScheduleVOPage(IPage<CheckSchedule> page, QueryWrapper<CheckSchedule> qw) {
|
||||
|
||||
IPage<CheckScheduleVO> checkScheduleVOPage = baseMapper.getCheckScheduleVOPage(page, qw);
|
||||
|
||||
return checkScheduleVOPage;
|
||||
return baseMapper.getCheckScheduleVOPage(page, qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckScheduleVO getCheckScheduleVO(String checkScheduleId) {
|
||||
|
||||
CheckScheduleVO checkScheduleVO = baseMapper.getCheckScheduleVO(checkScheduleId);
|
||||
|
||||
List<PeriodVerificationPlanVO> periodVerificationPlanVOList = periodVerificationPlanService.getPeriodVerificationPlanVOList(checkScheduleVO.getId());
|
||||
|
||||
checkScheduleVO.setPeriodVerificationPlanVOS(periodVerificationPlanVOList);
|
||||
|
||||
return checkScheduleVO;
|
||||
}
|
||||
|
||||
|
||||
-28
@@ -112,9 +112,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
@Override//标准物质标准物质管理列表
|
||||
public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryRMVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) {
|
||||
Integer reagentCategory = 1;
|
||||
// if (warning != null && warning == 2) {
|
||||
// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory);
|
||||
// }
|
||||
IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory);
|
||||
return reagentConsumableInventoryVOPage;
|
||||
}
|
||||
@@ -122,9 +119,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
@Override//试剂耗材管理列表
|
||||
public IPage<ReagentConsumableInventoryVO> getReagentConsumableInventoryREVOList(IPage<ReagentConsumableInventory> page, Integer warning, String keywords) {
|
||||
Integer reagentCategory = 0;
|
||||
// if (warning != null && warning == 2) {
|
||||
// return this.getReagentConsumableInventoryWarningPage((Page) page, reagentCategory);
|
||||
// }
|
||||
IPage<ReagentConsumableInventoryVO> reagentConsumableInventoryVOPage = baseMapper.getReagentConsumableInventoryVOPage(page, warning, keywords, reagentCategory);
|
||||
return reagentConsumableInventoryVOPage;
|
||||
}
|
||||
@@ -142,23 +136,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
return reagentConsumableInventoryVOIPage;
|
||||
} 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//入库增加库存
|
||||
@@ -172,7 +149,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
|
||||
one.setTotalQuantity(one.getTotalQuantity() + quantity);
|
||||
|
||||
|
||||
if (this.updateById(one)) {
|
||||
|
||||
return one;
|
||||
@@ -444,12 +420,10 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
public String buildCodeLabelContent(String id) {
|
||||
//录入二维码信息
|
||||
ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(id);
|
||||
|
||||
referenceMaterialServiceById.setCode(referenceMaterialServiceById.getNumber());
|
||||
referenceMaterialService.updateById(referenceMaterialServiceById);
|
||||
|
||||
if (referenceMaterialServiceById == null) {
|
||||
|
||||
throw new RuntimeException(String.format("请先入库后再进行打印条码"));
|
||||
}
|
||||
//获取打印信息
|
||||
@@ -465,13 +439,11 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
|
||||
referenceMaterial.setTime("到期:" + byId1.getExpirationDate());
|
||||
data.put("referenceMaterial", referenceMaterial);
|
||||
String templateFileName = "标准物质标签模板.vm";
|
||||
|
||||
return remoteTemplate2htmlService.getHtml(templateFileName, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printSolutionTag(String id) {
|
||||
|
||||
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("standardReserveSolution", standardReserveSolutionVOById);
|
||||
|
||||
+35
-20
@@ -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<ReferenceMaterialM
|
||||
@Autowired
|
||||
private StandardMaterialApprovalFormService standardMaterialApprovalFormService;
|
||||
|
||||
/**
|
||||
* 通过批次ID查询标准物质
|
||||
*
|
||||
* @param batchDetailsId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ReferenceMaterialVO> getReferenceMaterialVOList(String batchDetailsId){
|
||||
|
||||
public List<ReferenceMaterialVO> getReferenceMaterialVOList(String batchDetailsId) {
|
||||
LambdaQueryWrapper<ReferenceMaterial> referenceMaterialLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId,batchDetailsId);
|
||||
|
||||
referenceMaterialLambdaQueryWrapper.eq(ReferenceMaterial::getBatchDetailsId, batchDetailsId);
|
||||
List<ReferenceMaterial> list = this.list(referenceMaterialLambdaQueryWrapper);
|
||||
|
||||
List<ReferenceMaterialVO> 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<ReferenceMaterialM
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReferenceMaterialVO> getReferenceMaterialList(){
|
||||
|
||||
public List<ReferenceMaterialVO> getReferenceMaterialList() {
|
||||
List<ReferenceMaterialVO> 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<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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+13
-62
@@ -112,15 +112,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
BeanUtils.copyProperties(form, vo);
|
||||
//查询出签收物品明细,将明细添加至签收记录VO
|
||||
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);
|
||||
return vo;
|
||||
}
|
||||
@@ -145,6 +136,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
warehousingRecordFormDTO.getBoxId().isEmpty()) {
|
||||
throw new RuntimeException(String.format("请选择存放位置后再进行提交"));
|
||||
}
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
|
||||
|
||||
String latticeId = warehousingRecordFormDTO.getLatticeId();//格子ID
|
||||
String boxId = warehousingRecordFormDTO.getBoxId();//柜子ID
|
||||
@@ -180,9 +172,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
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();//创建库存对象
|
||||
BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);//拷贝信息
|
||||
reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase());
|
||||
@@ -199,8 +191,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
}
|
||||
reagentConsumablesService.updateById(reagentConsumables);
|
||||
BatchDetails batchDetails = new BatchDetails();//创建批次信息
|
||||
int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
|
||||
|
||||
BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);//拷贝批次信息
|
||||
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
|
||||
batchDetails.setServiceStatus(1);//状态 1为正常
|
||||
@@ -223,7 +213,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());//关联签收批次
|
||||
|
||||
if (!reagentConsumables.getCategory().equals("标准物质")) {
|
||||
|
||||
ReagentConsumableStash reagentConsumableStash = new ReagentConsumableStash();
|
||||
BeanUtils.copyProperties(reagentConsumables, reagentConsumableStash);
|
||||
reagentConsumableStash.setId(IdWorker.get32UUID().toUpperCase());
|
||||
@@ -259,23 +248,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
//更新格子信息(标准物质传入对象ID)
|
||||
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
|
||||
//生成编号
|
||||
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-";
|
||||
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);
|
||||
referenceMaterial.setNumber(referenceMaterialService.createNo(reagentConsumables.getAlias(),location));
|
||||
referenceMaterialService.save(referenceMaterial);
|
||||
}
|
||||
}
|
||||
@@ -299,7 +272,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
} else {
|
||||
batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
|
||||
}
|
||||
batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId());
|
||||
batchDetails.setReagentConsumableInventoryId(oldReagentConsumableInventory.getReagentConsumableInventoryId());
|
||||
batchDetails.setQuantity(quantity);
|
||||
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());
|
||||
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
|
||||
@@ -327,10 +300,9 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
reagentConsumableStashService.updateById(reagentConsumableStash);
|
||||
}
|
||||
}
|
||||
int year = Calendar.getInstance().get(Calendar.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())
|
||||
.like("batch", years));
|
||||
//如果没有批次信心,则默认为1
|
||||
@@ -342,18 +314,18 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
}
|
||||
if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) {
|
||||
//更新格子信息(试剂耗材传入类ID)
|
||||
reagentConsumableInventoryService.updateCabinet(batchDetails.getLatticeId(), one.getReagentConsumableInventoryId(), 1);
|
||||
reagentConsumableInventoryService.updateCabinet(batchDetails.getLatticeId(), oldReagentConsumableInventory.getReagentConsumableInventoryId(), 1);
|
||||
}
|
||||
one.setTotalQuantity(one.getTotalQuantity() + batchDetails.getQuantity());
|
||||
one.setWarningValue(warehousingRecordFormDTO.getWarningValue());
|
||||
oldReagentConsumableInventory.setTotalQuantity(oldReagentConsumableInventory.getTotalQuantity() + batchDetails.getQuantity());
|
||||
oldReagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue());
|
||||
|
||||
if (reagentConsumables.getCategory().equals("标准物质")) {
|
||||
for (int j = 0; j < batchDetails.getQuantity(); j++) {
|
||||
ReferenceMaterial referenceMaterial = new ReferenceMaterial();
|
||||
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
|
||||
referenceMaterial.setReagentConsumableId(one.getReagentConsumableId());
|
||||
referenceMaterial.setReagentConsumableId(oldReagentConsumableInventory.getReagentConsumableId());
|
||||
referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());
|
||||
referenceMaterial.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId());
|
||||
referenceMaterial.setReagentConsumableInventoryId(oldReagentConsumableInventory.getReagentConsumableInventoryId());
|
||||
referenceMaterial.setStatus(0);
|
||||
referenceMaterial.setLocation(warehousingRecordFormDTO.getLocation());
|
||||
referenceMaterial.setLatticeId(warehousingRecordFormDTO.getLatticeId());
|
||||
@@ -365,28 +337,12 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
|
||||
//更新格子信息(试剂耗材传入类ID)
|
||||
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
|
||||
//生成编号
|
||||
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-";
|
||||
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);
|
||||
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 ServiceImpl<WarehousingRec
|
||||
|
||||
//遍历采购内容,判断试剂耗材是否入库完毕
|
||||
for (WarehousingContent warehousingContentFull : list) {
|
||||
|
||||
if (warehousingContentFull.getWarehousingQuantity() == warehousingContentFull.getTotalQuantity()) {//签收数量=购买数量
|
||||
|
||||
warehousingContentFull.setStatus(1);//签收成功
|
||||
|
||||
warehousingContentService.updateById(warehousingContentFull);
|
||||
|
||||
if (warehousingContentFull.getAcceptanceRecordFormId() == null) {//如果没有验收记录表,那就创建
|
||||
//首先创建验收集合表
|
||||
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);
|
||||
}
|
||||
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,7 @@
|
||||
rc.standard_value_or_purity,
|
||||
rc.specification_and_model,
|
||||
rc.category,
|
||||
u.`name` as
|
||||
depositor_name
|
||||
u.`name` as depositor_name
|
||||
FROM warehousing_batch_list wb
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user