From dd5a23fb679933942d0ebca583ab91c9cc5fb852 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=B5=B7=E8=88=AA?= <1344638791@qq.com>
Date: Mon, 17 Jul 2023 08:59:35 +0800
Subject: [PATCH] update
---
pom.xml | 5 +
.../AcceptanceRecordFormController.java | 33 +-
.../ReagentConsumableInventoryController.java | 10 +
.../RequisitionRecordController.java | 8 +-
.../reagent/entity/CentralizedRequest.java | 4 +
.../ReagentConsumableInventoryMapper.java | 3 +
.../mapper/RequisitionRecordMapper.java | 2 +-
.../service/AcceptanceRecordFormService.java | 2 +-
.../service/PurchasingPlanService.java | 2 +-
.../ReagentConsumableInventoryService.java | 6 +
.../service/RequisitionRecordService.java | 2 +-
.../impl/AcceptanceRecordFormServiceImpl.java | 190 +++----
.../DeliveryRegistrationFormServiceImpl.java | 24 +-
.../service/impl/PurchaseListServiceImpl.java | 131 ++---
.../impl/PurchasingPlanServiceImpl.java | 471 +++++++-----------
...ReagentConsumableInventoryServiceImpl.java | 120 ++++-
.../impl/RequisitionRecordServiceImpl.java | 33 +-
.../WarehousingRecordFormServiceImpl.java | 309 ++++--------
.../ReagentConsumableInventoryMapper.xml | 14 +-
.../mapper/RequisitionRecordMapper.xml | 2 +-
20 files changed, 608 insertions(+), 763 deletions(-)
diff --git a/pom.xml b/pom.xml
index 09b05d9..1513f72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -177,6 +177,11 @@
2022.10.11-snapshots
+
+ digital.laboratory.platform
+ dlp-common-seata
+ 2022.10.11-snapshots
+
digital.laboratory.platform
diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/AcceptanceRecordFormController.java b/src/main/java/digital/laboratory/platform/reagent/controller/AcceptanceRecordFormController.java
index e161401..ce4c89f 100644
--- a/src/main/java/digital/laboratory/platform/reagent/controller/AcceptanceRecordFormController.java
+++ b/src/main/java/digital/laboratory/platform/reagent/controller/AcceptanceRecordFormController.java
@@ -83,22 +83,22 @@ public class AcceptanceRecordFormController {
public R getById(String acceptanceRecordFormId, String rid, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
+ //通过标准物质ID查询该标准物质类的验收记录
if (rid != null) {
- ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(rid);
- BatchDetails byId = batchDetailsService.getById(referenceMaterialServiceById.getBatchDetailsId());
- WarehousingBatchList byId1 = warehousingBatchListService.getById(byId.getWarehousingBatchListId());
- WarehousingContent byId2 = warehousingContentService.getById(byId1.getWarehousingContentId());
- AcceptanceRecordFormVO acceptanceRecordFormVO = acceptanceRecordFormService.getAcceptanceRecordFormVO(byId2.getAcceptanceRecordFormId());
+ //只能从标准物质ID——》逐级查询出验收记录ID
+ AcceptanceRecordFormVO acceptanceRecordFormVO =
+ acceptanceRecordFormService.getAcceptanceRecordFormVO
+ (warehousingContentService.getById
+ (warehousingBatchListService.getById
+ (batchDetailsService.getById
+ (referenceMaterialService.getById(rid)).getWarehousingBatchListId()).getWarehousingContentId()).getAcceptanceRecordFormId());
if (acceptanceRecordFormVO.getStatus() == 6) {
return R.ok(acceptanceRecordFormVO);
} else return R.failed(null);
}
-
AcceptanceRecordFormVO acceptanceRecordFormVO = acceptanceRecordFormService.getAcceptanceRecordFormVO(acceptanceRecordFormId);
return R.ok(acceptanceRecordFormVO);
- //return R.ok(acceptanceRecordFormService.getById(acceptanceRecordFormId));
}
/**
@@ -114,7 +114,11 @@ public class AcceptanceRecordFormController {
public R> getAcceptanceRecordFormPage(Page page, Integer status, String reagentConsumableName, @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") LocalDate startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd") LocalDate endTime, HttpServletRequest theHttpServletRequest, String acceptanceSignForId) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
+ /*查询参数
+ * 标准物质名称
+ * 验收时间
+ * 验收状态
+ * */
IPage acceptanceRecordFormVOPage = acceptanceRecordFormService.getAcceptanceRecordFormVOPage(page, Wrappers.query()
.like(StrUtil.isNotBlank(reagentConsumableName), "reagent_consumable_name", reagentConsumableName)
.ge(startTime != null, "create_time", startTime)
@@ -123,7 +127,6 @@ public class AcceptanceRecordFormController {
.orderByDesc("create_time")
.eq("acceptance_sign_for_id", acceptanceSignForId));
return R.ok(acceptanceRecordFormVOPage);
-// return R.ok(acceptanceRecordFormService.page(page, Wrappers.query(acceptanceRecordForm)));
}
@@ -140,9 +143,7 @@ public class AcceptanceRecordFormController {
public R postAddObject(@RequestBody AcceptanceRecordFormDTO acceptanceRecordFormDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.commitForm(acceptanceRecordFormDTO, dlpUser);
-
if (acceptanceRecordForm != null) {
return R.ok(acceptanceRecordForm, "保存成功");
} else return R.failed("保存失败");
@@ -162,9 +163,7 @@ public class AcceptanceRecordFormController {
public R culkCommit(@RequestBody List acceptanceRecordFormDTOList, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
acceptanceRecordFormService.culkCommit(acceptanceRecordFormDTOList, dlpUser);
-
return R.ok("批量验收成功");
}
@@ -182,8 +181,6 @@ public class AcceptanceRecordFormController {
public R primaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
-
if (acceptanceRecordFormService.primaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功");
} else return R.failed("审核失败");
@@ -202,8 +199,6 @@ public class AcceptanceRecordFormController {
public R secondaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
-
if (acceptanceRecordFormService.secondaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功");
} else return R.failed("审核失败");
@@ -222,8 +217,6 @@ public class AcceptanceRecordFormController {
public R threeLevelAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
-
-
if (acceptanceRecordFormService.threeLevelAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功");
} else return R.failed("审核失败");
diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java
index c337a52..ac1ac6b 100644
--- a/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java
+++ b/src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java
@@ -10,6 +10,7 @@ import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.oss.service.OssFile;
+import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.entity.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial;
import digital.laboratory.platform.reagent.service.ReagentConsumableInventoryService;
@@ -365,5 +366,14 @@ public class ReagentConsumableInventoryController {
return R.ok(reagentConsumableInventoryService.getUserList());
}
+ @PostMapping("inventory/entry")
+ public R inventoryEntry(@RequestBody List reagentConsumableInventoryDTOList, HttpServletResponse httpServletResponse) {
+
+ reagentConsumableInventoryService.inventoryEntry(reagentConsumableInventoryDTOList);
+
+ return R.ok("导入成功");
+
+ }
+
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/controller/RequisitionRecordController.java b/src/main/java/digital/laboratory/platform/reagent/controller/RequisitionRecordController.java
index 74c96dc..6d93946 100644
--- a/src/main/java/digital/laboratory/platform/reagent/controller/RequisitionRecordController.java
+++ b/src/main/java/digital/laboratory/platform/reagent/controller/RequisitionRecordController.java
@@ -54,19 +54,19 @@ public class RequisitionRecordController {
@SysLog("试剂耗材领用申请表打印")
@PostMapping("/print")
@PreAuthorize("@pms.hasPermission('reagent_application_for_use_print')")
- public void bizGetPDFInventory(String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
+ public void bizGetPDFInventory(String []idList, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) {
System.out.println("bizApplyWord.................");
Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
- List voList = requisitionRecordService.getRequisitionRecordVO(id);
+ List voList = requisitionRecordService.getRequisitionRecordVO(idList);
if (voList.isEmpty()) {
throw new RuntimeException("未查询到相关信息");
}
-
- String applyFileName = "试剂耗材领用记录表-" + id;
+ String id = IdWorker.get32UUID().toUpperCase();
+ String applyFileName = "试剂耗材领用记录表-"+id ;
String pdfFilePath = "document" + "/" + "requisitionRecord" + "/" + id + "/" + applyFileName + ".pdf";
try {
diff --git a/src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java b/src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java
index ffee270..928575d 100644
--- a/src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java
+++ b/src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java
@@ -62,12 +62,16 @@ public class CentralizedRequest extends BaseEntity {
@ApiModelProperty(value = "申请人名称")
private String applicantName;
+ @ApiModelProperty(value = "审核结果")
private boolean auditResult;
+ @ApiModelProperty(value = "审核意见")
private String auditOpinion;
+ @ApiModelProperty(value = "审核人ID")
private String auditId;
+ @ApiModelProperty(value = "审核时间")
private LocalDateTime auditTime;
/**
diff --git a/src/main/java/digital/laboratory/platform/reagent/mapper/ReagentConsumableInventoryMapper.java b/src/main/java/digital/laboratory/platform/reagent/mapper/ReagentConsumableInventoryMapper.java
index f0706ee..b8048f0 100644
--- a/src/main/java/digital/laboratory/platform/reagent/mapper/ReagentConsumableInventoryMapper.java
+++ b/src/main/java/digital/laboratory/platform/reagent/mapper/ReagentConsumableInventoryMapper.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
+import digital.laboratory.platform.reagent.entity.Cabinetcell;
import digital.laboratory.platform.reagent.entity.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO;
@@ -26,4 +27,6 @@ public interface ReagentConsumableInventoryMapper extends BaseMapper getReagentConsumableInventoryFullVOPage (IPagepage, @Param(Constants.WRAPPER) QueryWrapper qw);
List getUserList();
+
+ Cabinetcell getCabinetCell(String location);
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/mapper/RequisitionRecordMapper.java b/src/main/java/digital/laboratory/platform/reagent/mapper/RequisitionRecordMapper.java
index e002dfe..a7ef839 100644
--- a/src/main/java/digital/laboratory/platform/reagent/mapper/RequisitionRecordMapper.java
+++ b/src/main/java/digital/laboratory/platform/reagent/mapper/RequisitionRecordMapper.java
@@ -22,6 +22,6 @@ public interface RequisitionRecordMapper extends BaseMapper {
IPage getRequisitionRecordVOPage (IPage page, @Param(Constants.WRAPPER) QueryWrapper qw);
- List getRequisitionRecordVO (String id);
+ RequisitionRecordVO getRequisitionRecordVO (String id);
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/AcceptanceRecordFormService.java b/src/main/java/digital/laboratory/platform/reagent/service/AcceptanceRecordFormService.java
index 6ce047d..0c84720 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/AcceptanceRecordFormService.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/AcceptanceRecordFormService.java
@@ -32,7 +32,7 @@ public interface AcceptanceRecordFormService extends IService getAcceptanceRecordFormVOPage(IPage page, QueryWrapperqw);
- IPage getAcceptanceRecordFormVORecordPage(IPage page);
+// IPage getAcceptanceRecordFormVORecordPage(IPage page);
AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId);
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/PurchasingPlanService.java b/src/main/java/digital/laboratory/platform/reagent/service/PurchasingPlanService.java
index ad41ac8..ece5861 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/PurchasingPlanService.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/PurchasingPlanService.java
@@ -34,7 +34,7 @@ public interface PurchasingPlanService extends IService {
@Transactional
PurchasingPlanVO addById(List purchasingPlanDTOList, DLPUser user);
- ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO);
+// ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO);
ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO);
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java
index a1f0624..b58a196 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java
@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.entity.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO;
import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO;
import digital.laboratory.platform.reagent.vo.UserVO;
+import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -53,4 +55,8 @@ public interface ReagentConsumableInventoryService extends IService getUserList();
+
+ @Transactional
+//盘点导入,需提供柜子系统数据
+ void inventoryEntry(List reagentConsumableInventoryDTOList);
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/RequisitionRecordService.java b/src/main/java/digital/laboratory/platform/reagent/service/RequisitionRecordService.java
index 138530d..405ce46 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/RequisitionRecordService.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/RequisitionRecordService.java
@@ -23,7 +23,7 @@ public interface RequisitionRecordService extends IService {
IPage getRequisitionRecordVOPage(IPage page, QueryWrapper qw);
- List getRequisitionRecordVO(String id);
+ List getRequisitionRecordVO(String [] idList);
void rquisitionRecordTablePDF(List voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception;
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java
index 816aa6f..85d3e93 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java
@@ -74,18 +74,17 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl acceptanceRecordFormDTOList, DLPUser dlpUser) {
for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) {
-
+ //调用单个提交方法
AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser);
}
}
- @Override
+ @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);
@@ -150,6 +149,7 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl getAcceptanceRecordFormVOPage(IPage page, QueryWrapper qw) {
- IPage acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);
+ IPage acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表
List records = acceptanceRecordFormVOPage.getRecords();
-
+ //添加试剂耗材信息至VO
for (AcceptanceRecordFormVO record : records) {
ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId());
@@ -206,39 +202,39 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl getAcceptanceRecordFormVORecordPage(IPage page) {
-
- LambdaQueryWrapper acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
-
- List list = this.list(acceptanceRecordFormLambdaQueryWrapper);
-
- ArrayList acceptanceRecordFormVOS = new ArrayList<>();
-
- if (list.size() != 0) {
-
- for (AcceptanceRecordForm acceptanceRecordForm : list) {
-
- AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId());
-
- acceptanceRecordFormVOS.add(acceptanceRecordFormVO);
- }
- }
- PageUtils pageUtils = new PageUtils();
-
- Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS);
-
- return pages;
- }
+// @Override
+// public IPage getAcceptanceRecordFormVORecordPage(IPage page) {
+//
+// LambdaQueryWrapper acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
+//
+// acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
+//
+// List list = this.list(acceptanceRecordFormLambdaQueryWrapper);
+//
+// ArrayList acceptanceRecordFormVOS = new ArrayList<>();
+//
+// if (list.size() != 0) {
+//
+// for (AcceptanceRecordForm acceptanceRecordForm : list) {
+//
+// AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId());
+//
+// acceptanceRecordFormVOS.add(acceptanceRecordFormVO);
+// }
+// }
+// PageUtils pageUtils = new PageUtils();
+//
+// Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS);
+//
+// return pages;
+// }
@Override
public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) {
- AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);
+ AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);//查询单个验收记录表
- ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());
+ ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());//查询试剂耗材信息
acceptanceRecordFormVO.setReagentConsumables(byId);
@@ -248,31 +244,29 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
- List uuId = acceptanceRecordFormAuditDTO.getUuId();
-
- List acceptanceRecordForms = new ArrayList<>();
+ List acceptanceRecordForms = new ArrayList<>();//验收记录表集合
- for (String s : uuId) {
+ for (String id : uuId) {
- AcceptanceRecordForm byId = this.getById(s);
+ AcceptanceRecordForm byId = this.getById(id);
if (byId.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
- byId.setPrimaryAuditorId(dlpUser.getId());
- byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());
- byId.setAuditTimeOfPrimary(LocalDateTime.now());
- byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());
+ byId.setPrimaryAuditorId(dlpUser.getId());//审核人ID
+ byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
+ byId.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间
+ byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
- byId.setStatus(2);
- } else byId.setStatus(-2);
+ byId.setStatus(2);//审核成功状态
+ } else byId.setStatus(-2);//审核失败状态
acceptanceRecordForms.add(byId);
-
}
-
if (this.updateBatchById(acceptanceRecordForms)) {
return true;
} else throw new RuntimeException(String.format("审核失败"));
@@ -282,26 +276,25 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
+ List acceptanceRecordForms = new ArrayList<>();//验收记录表集合
- List uuId = acceptanceRecordFormAuditDTO.getUuId();
- List acceptanceRecordForms = new ArrayList<>();
-
+ for (String id : uuId) {
- for (String s : uuId) {
-
- AcceptanceRecordForm byId = this.getById(s);
+ AcceptanceRecordForm byId = this.getById(id);
if (byId.getStatus() != 2) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
- byId.setSecondaryAuditorId(dlpUser.getId());
- byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());
- byId.setAuditTimeOfSecondary(LocalDateTime.now());
- byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());
+ byId.setSecondaryAuditorId(dlpUser.getId());//审核人ID
+ byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
+ byId.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间
+ byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
- byId.setStatus(3);
- } else byId.setStatus(-3);
+ byId.setStatus(3);//审核成功状态
+ } else byId.setStatus(-3);//审核失败状态
acceptanceRecordForms.add(byId);
}
if (this.updateBatchById(acceptanceRecordForms)) {
@@ -313,78 +306,57 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
+ List acceptanceRecordForms = new ArrayList<>();//验收记录表集合
-
- List uuId = acceptanceRecordFormAuditDTO.getUuId();
- List acceptanceRecordForms = new ArrayList<>();
-
- List stringList = new ArrayList<>();
-
+ List stringList = new ArrayList<>();//用于接收验收集合表ID
for (String s : uuId) {
-
-
AcceptanceRecordForm byId = this.getById(s);
-
- if (!stringList.contains(byId.getAcceptanceSignForId())) {
-
+ if (!stringList.contains(byId.getAcceptanceSignForId())) {//添加验收集合表ID至数组
stringList.add(byId.getAcceptanceSignForId());
-
}
if (byId.getStatus() != 3) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
- byId.setThreeLevelAuditorId(dlpUser.getId());
- byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());
- byId.setAuditTimeOfThreeLevel(LocalDateTime.now());
- byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());
-
- if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
-
- if (byId.getNonconformingItem() != null) {
+ byId.setThreeLevelAuditorId(dlpUser.getId());//审核人ID
+ byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
+ byId.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间
+ byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
+ if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过
+ if (byId.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单
blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId());
}
byId.setStatus(6);
} else byId.setStatus(-4);
acceptanceRecordForms.add(byId);
-
-
}
-
-
if (this.updateBatchById(acceptanceRecordForms)) {
-
-
- //判断是否验收完毕
-
+ //判断是否验收完毕,更改验收集合表状态
for (String s : stringList) {
- AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);
-
- List warehousing_record_form_id = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId()));
-
+ AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);//批量审核的验收记录关联的所有验收集合表
+ //得到签收物品集合
+ List warehousingContentList = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId()));
+ //得到验收集合中的所有验收记录表
List recordFormList = this.list(Wrappers.query().eq("acceptance_sign_for_id", s));
- if (warehousing_record_form_id.size() == recordFormList.size()) {
+ if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表)
int x = 0;
for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) {
- if (acceptanceRecordForm.getStatus() == 6) {
-
+ if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态
x = x + 1;
-
}
}
- if (x == recordFormList.size()) {
-
+ if (x == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成
AcceptanceSignFor byId = acceptanceSignForService.getById(s);
-
byId.setStatus(2);
-
acceptanceSignForService.updateById(byId);
}
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java
index 102c6ac..6cd7ce9 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java
@@ -39,39 +39,28 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ applicationForUse.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId());//关联出库登记表
//得到领用集合
- reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, byId.getId());
-
+ LambdaQueryWrapper reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId());
List list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper);
List outgoingContentsList = new ArrayList<>();
@@ -189,7 +177,7 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId);
-
- BeanUtils.copyProperties(byId, purchaseListVO);
+ PurchaseList purchaseList = this.getById(purchaseListId);
+ List purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId);//采购清单明细
+ BeanUtils.copyProperties(purchaseList, purchaseListVO);//拷贝
for (PurchaseListDetailsVO purchaseListDetailsVO : purchaseListDetailsVOList) {
-
LambdaQueryWrapper supplierInformationLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
+ //赋值供应商名称
if (purchaseListDetailsVO.getSupplierId() != null) {
-
supplierInformationLambdaQueryWrapper.eq(SupplierInformation::getId, purchaseListDetailsVO.getSupplierId());
-
SupplierInformation one = supplierInformationService.getOne(supplierInformationLambdaQueryWrapper);
-
purchaseListDetailsVO.setSupplierName(one.getSupplierName());
}
}
-
purchaseListVO.setPurchaseListDetailsVOS(purchaseListDetailsVOList);
-
return purchaseListVO;
}
@Override
@Transactional
+ //修改采购清单,批量或单个
public void editById(List purchaseListDTOList) {
for (PurchaseListDTO purchaseListDTO : purchaseListDTOList) {
-
- PurchaseListDetails byId = purchaseListDetailsService.getById(purchaseListDTO.getId());
-
- byId.setSupplierId(purchaseListDTO.getSupplierId());
-
- purchaseListDetailsService.updateById(byId);
+ PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId());
+ purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());//只需修改绑定的供应商ID即可
+ purchaseListDetailsService.updateById(purchaseListDetails);
}
}
@@ -141,92 +131,74 @@ public class PurchaseListServiceImpl extends ServiceImplquery()
.eq("purchase_list_id", id));
- PurchasingPlanVO purchasingPlanVO = purchasingPlanService.getPurchasingPlanVO(plan.getPurchasingPlanId());
+ PurchasingPlanVO purchasingPlanVO = purchasingPlanService.getPurchasingPlanVO(plan.getPurchasingPlanId());//采购计划
+ //这个采购计划内的所有集中采购申请
List centralizedRequestList = centralizedRequestService.list(Wrappers.query().eq("purchasing_plan_id", plan.getPurchasingPlanId()));
for (CentralizedRequest centralizedRequest : centralizedRequestList) {
centralizedRequest.setStatus(4);
centralizedRequestService.updateById(centralizedRequest);
}
} else {
- DecentralizedRequest purchase_list_id = decentralizedRequestService.getOne(Wrappers.query()
+ //除了采购计划,就是分散采购申请
+ DecentralizedRequest decentralizedRequest = decentralizedRequestService.getOne(Wrappers.query()
.eq("purchase_list_id", id));
- purchase_list_id.setStatus(6);
- decentralizedRequestService.updateById(purchase_list_id);
+ decentralizedRequest.setStatus(6);
+ decentralizedRequestService.updateById(decentralizedRequest);
}
- purchaseList.setStatus(1);
+ purchaseList.setStatus(1);//提交状态
LambdaQueryWrapper purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getPurchaseListId, purchaseList.getId());
-
- List purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);
+ List purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);//采购清单明细
//创建入库内容集合
List warehousingContentList = new ArrayList<>();
//创建入库记录表
WarehousingRecordForm warehousingRecordForm = new WarehousingRecordForm();
//录入入库记录表信息
warehousingRecordForm.setId(IdWorker.get32UUID().toUpperCase());
-
- warehousingRecordForm.setPurchaseListId(purchaseList.getId());
-
- warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");
-
- warehousingRecordForm.setStatus(0);
+ warehousingRecordForm.setPurchaseListId(purchaseList.getId());//关联采购清单
+ warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");//任务名称,用时间命名
+ warehousingRecordForm.setStatus(0);//初始状态
for (PurchaseListDetails purchaseListDetails : purchaseListDetailsList) {
-
- ReagentConsumables byId = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId());
- ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.query()
- .eq("reagent_consumable_id", byId.getReagentConsumableId()));
+ //得到该试剂耗材的库存情况
+ ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId());
+ ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.query()
+ .eq("reagent_consumable_id", reagentConsumables.getReagentConsumableId()));
WarehousingContent warehousingContent = new WarehousingContent();
-
-
- //完善入库内容信息
+ //完善入库明细内容信息
warehousingContent.setId(IdWorker.get32UUID().toUpperCase());
+ warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//试剂耗材名称
+ warehousingContent.setTotalQuantity(purchaseListDetails.getPurchaseQuantity());//采购数量
+ warehousingContent.setReagentConsumableId(purchaseListDetails.getReagentConsumableId());//试剂耗材ID
+ warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());//关联入库表
+ warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());//供应商ID
+ warehousingContent.setWarehousingQuantity(0);//初始状态
+ if (reagentConsumables.getCode()!=null){
+ warehousingContent.setCode(reagentConsumables.getCode());//物品编码
+ }
+ warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());//关联采购清单明细
- warehousingContent.setReagentConsumableName(byId.getReagentConsumableName());
-
- warehousingContent.setTotalQuantity(purchaseListDetails.getPurchaseQuantity());
-
- warehousingContent.setReagentConsumableId(purchaseListDetails.getReagentConsumableId());
-
- warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());
-
- warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());
-
- warehousingContent.setWarehousingQuantity(0);
-
- warehousingContent.setCode(byId.getCode());
-
- warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());
-
- if (one != null) {
- List batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId())
+ if (reagentConsumableInventory != null) {//如果仓库存在该试剂耗材
+ //所有批次信息
+ List batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", reagentConsumableInventory.getReagentConsumableInventoryId())
.orderByDesc("create_time"));
- warehousingContent.setWarningValue(one.getWarningValue());
+ warehousingContent.setWarningValue(reagentConsumableInventory.getWarningValue());
+ //如果存在批次信息,则提供上次位置信息,以便用户存放物品
if (batchDetailsList.size() != 0 && batchDetailsList != null) {
-
- warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation());
- warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId());
- warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());
+ warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation());//位置信息
+ warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId());//柜子ID
+ warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());//格子ID
}
}
- LambdaQueryWrapper catalogueDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- catalogueDetailsLambdaQueryWrapper.eq(CatalogueDetails::getReagentConsumableId, warehousingContent.getReagentConsumableId());
-
- List list = catalogueDetailsService.list(catalogueDetailsLambdaQueryWrapper);
-
warehousingContentList.add(warehousingContent);
}
-
if (this.updateById(purchaseList) & warehousingRecordFormService.save(warehousingRecordForm)
& warehousingContentService.saveBatch(warehousingContentList)) {
return purchaseList;
@@ -239,22 +211,14 @@ public class PurchaseListServiceImpl extends ServiceImpl getPurchaseListVOPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw) {
IPage purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw);
@@ -262,5 +226,4 @@ public class PurchaseListServiceImpl extends ServiceImpl implements PurchasingPlanService {
@Autowired
private ProcurementContentService procurementContentService;
@@ -57,13 +57,13 @@ public class PurchasingPlanServiceImpl extends ServiceImpl getPurchasingPlanVOPage(IPage page, QueryWrapper qw) {
IPage purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw);
return purchasingPlanVOPage;
}
- @Override//列表
+ @Override//采购计划集合
public List getPurchasingPlanVOList(QueryWrapper qw) {
return baseMapper.getPurchasingPlanVOList(qw);
}
@@ -72,16 +72,11 @@ public class PurchasingPlanServiceImpl extends ServiceImpl procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);
-
+ List procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);//将采购计划明细Set至采购计划VO
purchasingPlanVO.setProcurementContentVOList(procurementContentVOList);
-
return purchasingPlanVO;
}
@@ -89,144 +84,102 @@ public class PurchasingPlanServiceImpl extends ServiceImpl purchasingPlanDTOList, DLPUser user) {
- PurchasingPlan purchasingPlan = new PurchasingPlan();
-
+ PurchasingPlan purchasingPlan = new PurchasingPlan();//创建采购计划
purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase());
-
- purchasingPlan.setCreateId(user.getId());
-
- purchasingPlan.setStatus(0);
-
- purchasingPlan.setCreateName(user.getName());
-
+ purchasingPlan.setCreateId(user.getId());//创建人ID
+ purchasingPlan.setStatus(0);//状态
+ purchasingPlan.setCreateName(user.getName());//创建人名称
List list = new ArrayList<>();//需要整合的集合
-
boolean flag = true;
for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) {
//将列入计划的集中采购申请状态变为3
- String detailsOfCentralizedId = purchasingPlanDTO.getDetailsOfCentralizedId();
-
- DetailsOfCentralized byId2 = detailsOfCentralizedService.getById(detailsOfCentralizedId);
-
- CentralizedRequest byId3 = requestService.getById(byId2.getCentralizedRequestId());
-
- byId3.setStatus(3);
+ CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId());
+ centralizedRequest.setStatus(3);
+ centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
+ requestService.updateById(centralizedRequest);
- byId3.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
-
- requestService.updateById(byId3);
+ DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
+ ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
flag = true;
-//
- //合并相同的采购内容
+ //合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
if (list.size() != 0) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) {
- ReagentConsumables byId1 = reagentConsumablesService.getById(list.get(i).getReagentConsumableId());
-
- list.get(i).setUnitPrice(byId1.getUnitPrice());
+ list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
//Set采购数量
- list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());
-
- list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());
+ list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());//合并之前的数量加上被合并对象的数量
+ list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());//计算小计
- DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
-
- byId.setQuantityPurchased(byId.getNumberOfApplications());
-
- byId.setProcurementContentId(list.get(i).getProcurementContentId());
-
- detailsOfCentralizedService.updateById(byId);
+ //添加采购申请明细的采购数量
+ detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
+ detailsOfCentralized.setProcurementContentId(list.get(i).getProcurementContentId());
+ detailsOfCentralizedService.updateById(detailsOfCentralized);
+ //被合并后,改变flag,进入下一个循环
flag = false;
-
}
}
+ //无需合并的采购计划明细
if (flag) {
- ProcurementContent procurementContent = new ProcurementContent();
-
- BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
-
+ ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
+ BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
+ procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
+ procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications());//赋值采购数量
+ detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());//赋值采购数量
+ procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());//单价
+ procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());//小计
+ detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());//采购申请明细关联采购计划明细
- procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
-
- procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications());
-
- DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
-
- byId.setQuantityPurchased(byId.getNumberOfApplications());
-
- ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId());
-
- procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
-
- procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
-
- byId.setProcurementContentId(procurementContent.getProcurementContentId());
-
- detailsOfCentralizedService.updateById(byId);
-
- list.add(procurementContent);
+ detailsOfCentralizedService.updateById(detailsOfCentralized);
+ list.add(procurementContent);//将计划明细添加至集合
}
- } else {
+ } else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
ProcurementContent procurementContent = new ProcurementContent();
-
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
-
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
-
byId.setQuantityPurchased(byId.getNumberOfApplications());
-
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
-
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
-
procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
-
- ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId());
-
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
-
procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice());
-
byId.setProcurementContentId(procurementContent.getProcurementContentId());
-
detailsOfCentralizedService.updateById(byId);
-
list.add(procurementContent);
}
}
if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) {
- calculatedAmount(purchasingPlan.getPurchasingPlanId());
- PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());
+ calculatedAmount(purchasingPlan.getPurchasingPlanId());//计算经费预算
+ PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());//获取VO
return purchasingPlanVO;
} else throw new RuntimeException(String.format("保存失败"));
}
- @Override
- public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
-
- ProcurementContent procurementContent = new ProcurementContent();
-
- BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
-
- if (procurementContentService.save(procurementContent)) {
- return procurementContent;
- } else {
- return null;
- }
- }
+// @Override//新增明细
+// public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
+//
+// ProcurementContent procurementContent = new ProcurementContent();
+//
+// BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
+//
+// if (procurementContentService.save(procurementContent)) {
+// return procurementContent;
+// } else {
+// return null;
+// }
+// }
@Override
- @Transactional
+ @Transactional//修改采购计划明细(已废弃)
public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) {
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());
@@ -254,80 +207,58 @@ public class PurchasingPlanServiceImpl extends ServiceImpl detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, procurementContentId);
-
- List list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
-
+ ProcurementContent procurementContent = procurementContentService.getById(procurementContentId);//采购计划明细
+ //该采购计划明细关联的集中采购申请明细
+ List list = detailsOfCentralizedService.list(Wrappers.query().eq("procurement_content_id", procurementContentId));
for (DetailsOfCentralized detailsOfCentralized : list) {
-
- detailsOfCentralized.setQuantityPurchased(0);
+ detailsOfCentralized.setQuantityPurchased(0);//采购申请明细的采购数量
}
- PurchasingPlan purchasingPlan = this.getById(byId.getPurchasingPlanId());
+ PurchasingPlan purchasingPlan = this.getById(procurementContent.getPurchasingPlanId());//采购计划
- if (this.getById(byId.getPurchasingPlanId()).getStatus() == 0
+ if (this.getById(procurementContent.getPurchasingPlanId()).getStatus() == 0
&& detailsOfCentralizedService.updateBatchById(list) && procurementContentService.removeById(procurementContentId)) {
- LambdaQueryWrapper procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
-
- List list1 = procurementContentService.list(procurementContentLambdaQueryWrapper);
-
- if (list1.size() == 0) {
-
+ List procurementContentList = procurementContentService.list(Wrappers.query().eq("purchasing_plan_id", purchasingPlan.getPurchasingPlanId()));
+ //如果采购计划的明细全部被删除,则自动删除这个采购计划
+ if (procurementContentList.size() == 0) {
this.removeById(purchasingPlan);
-
return true;
}
- calculatedAmount(byId.getPurchasingPlanId());
-
+ calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
return true;
} else {
return null;
@@ -337,114 +268,96 @@ public class PurchasingPlanServiceImpl extends ServiceImpl detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, byId.getProcurementContentId());
-
- List list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
+ procurementContent.setReplacementReagentConsumableId(replacementReagentConsumableId);//换货试剂耗材ID
+ procurementContent.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());//换货数量
+ procurementContent.setReplacementPrice(purchasingPlanDTO.getReplacementPrice());//换货单价
+ procurementContent.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());//换货备注
+ procurementContent.setSupplierId(purchasingPlanDTO.getSupplierId());//换货供应商ID
+ //关联这个采购计划明细的所有采购申请明细
+ List list = detailsOfCentralizedService.list(Wrappers.query().eq("procurement_content_id", procurementContent.getProcurementContentId()));
LambdaQueryWrapper purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, byId.getProcurementContentId());
-
- PurchaseListDetails one = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);
+ purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, procurementContent.getProcurementContentId());
+ PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);//查询是否有采购清单
//如果存在采购清单,则需修改清单信息
- if (one != null) {
-
+ if (purchaseListDetails != null) {
LambdaQueryWrapper warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, purchaseListDetails.getId());
- warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, one.getId());
-
- one.setSupplierId(purchasingPlanDTO.getSupplierId());
- one.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());
- one.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());
+ purchaseListDetails.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
+ purchaseListDetails.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
+ purchaseListDetails.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
- purchaseListDetailsService.updateById(one);
+ purchaseListDetailsService.updateById(purchaseListDetails);
- WarehousingContent one1 = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper);
+ WarehousingContent warehousingContent = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper);
//若存在入库信息,则需修改入库记录
- if (one1 != null) {
-
- if (one1.getWarehousingQuantity() == 0) {
-
- one1.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());
- one1.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());
- one1.setSupplierId(purchasingPlanDTO.getSupplierId());
- ReagentConsumables byId1 = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId());
- one1.setReagentConsumableName(byId1.getReagentConsumableName());
- warehousingContentService.updateById(one1);
+ if (warehousingContent != null) {
+
+ if (warehousingContent.getWarehousingQuantity() == 0) {
+ warehousingContent.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
+ warehousingContent.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
+ warehousingContent.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
+ ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId());
+ warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//采购试剂耗材名称
+ warehousingContentService.updateById(warehousingContent);
} else {
-
+ //如果已入库,则不能换货
throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理"));
}
}
-
}
-
+ //将换货信息补充至每一个集中采购申请明细
for (DetailsOfCentralized detailsOfCentralized : list) {
-
detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId);
detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());
detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());
-
detailsOfCentralizedService.updateById(detailsOfCentralized);
}
- //将换货信息补充至集中采购申请明细
-
-
- if (procurementContentService.updateById(byId)) {
-
- return byId;
+ if (procurementContentService.updateById(procurementContent)) {
+ return procurementContent;
} else throw new RuntimeException(String.format("换货失败"));
}
@Override
public PurchasingPlan commitById(String purchasingPlanId) {
-
- PurchasingPlan byId = this.getById(purchasingPlanId);
- //若是审核审批不通过时的提交,则需清空原有的审核审批信息
- if (byId.getStatus()==-4){
- byId.setAuditOpinionOfPrimary("");
- byId.setAuditResultOfPrimary(false);
- byId.setPrimaryAuditorId("");
- byId.setAuditTimeOfPrimary(null);
+ PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);
+ //若是审核审批不通过时提交,则需清空原有的审核审批信息
+ //审核不通过
+ if (purchasingPlan.getStatus() == -4) {
+ purchasingPlan.setAuditOpinionOfPrimary("");
+ purchasingPlan.setAuditResultOfPrimary(false);
+ purchasingPlan.setPrimaryAuditorId("");
+ purchasingPlan.setAuditTimeOfPrimary(null);
}
- if (byId.getStatus()==-5){
- byId.setAuditOpinionOfPrimary("");
- byId.setAuditResultOfPrimary(false);
- byId.setPrimaryAuditorId("");
- byId.setAuditTimeOfPrimary(null);
- byId.setApproverId("");
- byId.setApprovalOpinion("");
- byId.setApprovalResult(false);
- byId.setApprovalTime(null);
+ //审批不通过
+ if (purchasingPlan.getStatus() == -5) {
+ purchasingPlan.setAuditOpinionOfPrimary("");
+ purchasingPlan.setAuditResultOfPrimary(false);
+ purchasingPlan.setPrimaryAuditorId("");
+ purchasingPlan.setAuditTimeOfPrimary(null);
+ purchasingPlan.setApproverId("");
+ purchasingPlan.setApprovalOpinion("");
+ purchasingPlan.setApprovalResult(false);
+ purchasingPlan.setApprovalTime(null);
}
- byId.setStatus(1);
- byId.setCommitTime(LocalDateTime.now());
-
- if (this.updateById(byId)) {
- calculatedAmount(byId.getPurchasingPlanId());
- return byId;
+ purchasingPlan.setStatus(1);
+ purchasingPlan.setCommitTime(LocalDateTime.now());//
+ if (this.updateById(purchasingPlan)) {
+ calculatedAmount(purchasingPlan.getPurchasingPlanId());
+ return purchasingPlan;
} else throw new RuntimeException(String.format("提交失败"));
}
-
- @Override
+ @Override//审核采购计划
public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) {
PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId());
@@ -452,20 +365,16 @@ public class PurchasingPlanServiceImpl extends ServiceImpl procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
+ List list = procurementContentService.list(procurementContentLambdaQueryWrapper);//采购计划明细
- List list = procurementContentService.list(procurementContentLambdaQueryWrapper);
-
- PurchaseListDTO purchaseListDTO = new PurchaseListDTO();
-
- PurchaseList purchaseList = new PurchaseList();
+ PurchaseList purchaseList = new PurchaseList();//创建采购清单
purchaseList.setId(IdWorker.get32UUID().toUpperCase());
- purchaseList.setName(DateTime.now() + "采购清单");
- purchaseList.setStatus(0);
- purchaseList.setType("采购计划");
- purchaseList.setCreateBy(purchasingPlan.getCreateBy());
-
+ purchaseList.setName(DateTime.now() + "采购清单");//清单名称
+ purchaseList.setStatus(0);//状态
+ purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划
+ purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人
purchaseListService.save(purchaseList);
-
- purchasingPlan.setPurchaseListId(purchaseList.getId());
+ purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单
for (ProcurementContent procurementContent : list) {
- PurchaseListDetails purchaseListDetails = new PurchaseListDetails();
-
- purchaseListDetails.setPurchaseListId(purchaseList.getId());
- purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());
- purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());
+ PurchaseListDetails purchaseListDetails = new PurchaseListDetails();//采购清单明细
+ purchaseListDetails.setPurchaseListId(purchaseList.getId());//关联采购清单
+ purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());//采购数量
+ purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());//采购试剂耗材ID
purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase());
- purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());
-
+ purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());//关联采购计划明细
purchaseListDetailsService.save(purchaseListDetails);
}
} else {
-
- purchasingPlan.setStatus(-5);
+ purchasingPlan.setStatus(-5);//审核不通过
}
-
if (this.updateById(purchasingPlan)) {
return purchasingPlan;
} else {
@@ -541,51 +434,45 @@ public class PurchasingPlanServiceImpl extends ServiceImpl procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
-
- List list = procurementContentService.list(procurementContentLambdaQueryWrapper);
-
+ List list = procurementContentService.list(procurementContentLambdaQueryWrapper);//这个采购计划内的所有采购计划明细
double x = 0;
+ //计算每个采购计划明细的小计(单价*采购数量)
for (
ProcurementContent procurementContent : list) {
-
x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice();
}
- purchasingPlan.setAppropriationBudget(x);
+ purchasingPlan.setAppropriationBudget(x);//经费预算
if (this.updateById(purchasingPlan)) {
return purchasingPlan;
} else throw new RuntimeException(String.format("计算失败"));
}
- @Override
- public ReplacementVO getReplacementVO(String id){
-
- ProcurementContent byId = procurementContentService.getById(id);
-
- ReplacementVO replacementVO = new ReplacementVO();
+ @Override//查看换货信息
+ public ReplacementVO getReplacementVO(String id) {
- if (byId.getReplacementQuantity()!=null&&byId.getReplacementPrice()!=null&&byId.getReplacementRemark()!=null
- &&byId.getReplacementReagentConsumableId()!=null&&byId.getSupplierId()!=null){
+ ProcurementContent procurementContent = procurementContentService.getById(id);//采购计划明细
+ ReplacementVO replacementVO = new ReplacementVO();//换货VO
- replacementVO.setReplacementQuantity(byId.getReplacementQuantity());
- replacementVO.setReplacementRemark(byId.getReplacementRemark());
- replacementVO.setReplacementPrice(byId.getReplacementPrice());
- replacementVO.setReplacementReagentConsumableId(byId.getReplacementReagentConsumableId());
- replacementVO.setSupplierId(byId.getSupplierId());
+ //判断换货信息是否充分
+ if (procurementContent.getReplacementQuantity() != null && procurementContent.getReplacementPrice() != null && procurementContent.getReplacementRemark() != null
+ && procurementContent.getReplacementReagentConsumableId() != null && procurementContent.getSupplierId() != null) {
- SupplierInformation byId1 = supplierInformationService.getById(byId.getSupplierId());
-
- replacementVO.setSupplierName(byId1.getSupplierName());
-
- ReagentConsumables byId2 = reagentConsumablesService.getById(byId.getReplacementReagentConsumableId());
-
- replacementVO.setReagentConsumables(byId2);}
+ SupplierInformation supplierInformation = supplierInformationService.getById(procurementContent.getSupplierId());//供应商
+ ReagentConsumables reagentConsumables = reagentConsumablesService.getById(procurementContent.getReplacementReagentConsumableId());//试剂耗材信息
+ replacementVO.setReplacementQuantity(procurementContent.getReplacementQuantity());//换货数量
+ replacementVO.setReplacementRemark(procurementContent.getReplacementRemark());//换货备注
+ replacementVO.setReplacementPrice(procurementContent.getReplacementPrice());//换货单价
+ replacementVO.setReplacementReagentConsumableId(procurementContent.getReplacementReagentConsumableId());//换货试剂耗材ID
+ replacementVO.setSupplierId(procurementContent.getSupplierId());//换货供应商ID
+ replacementVO.setSupplierName(supplierInformation.getSupplierName());//换货供应商名称
+ replacementVO.setReagentConsumables(reagentConsumables);//换货试剂耗材信息
+ }
return replacementVO;
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java
index 1c4effc..b19cb73 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java
@@ -5,6 +5,7 @@ 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.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -15,22 +16,28 @@ import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile;
+import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.utils.PageUtils;
import digital.laboratory.platform.reagent.entity.*;
import digital.laboratory.platform.reagent.mapper.ReagentConsumableInventoryMapper;
import digital.laboratory.platform.reagent.service.*;
-import digital.laboratory.platform.reagent.utils.QRCodeUtils;
import digital.laboratory.platform.reagent.vo.*;
+import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData;
+import digital.laboratory.platform.sys.feign.RemoteCabinetService;
import feign.Response;
+import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.util.*;
/**
@@ -68,6 +75,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getAllList(Integer current, Integer size, QueryWrapper qw,Integer status,String number) {
+ public Page getAllList(Integer current, Integer size, QueryWrapper qw, Integer status, String number) {
//如果扫码
- if (StrUtil.isNotBlank(number)){
+ if (StrUtil.isNotBlank(number)) {
ReferenceMaterial referenceMaterial = referenceMaterialService.getOne(Wrappers.query().eq("number", number));
- if (referenceMaterial!=null) {
+ if (referenceMaterial != null) {
- ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId());
+ ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId());
- List reagentConsumableInventoryFullVOS = new ArrayList<>();
+ List reagentConsumableInventoryFullVOS = new ArrayList<>();
- reagentConsumableInventoryFullVOS.add(byCode);
+ reagentConsumableInventoryFullVOS.add(byCode);
- PageUtils pageUtils = new PageUtils();
+ PageUtils pageUtils = new PageUtils();
- Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOS);
+ Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOS);
- return pages;
+ return pages;
- }}
+ }
+ }
// List list = referenceMaterialService.list(qw);
//
// List reagentConsumableInventoryFullVOList = new ArrayList<>();
@@ -368,7 +379,8 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl getUserList(){
+ public List getUserList() {
return baseMapper.getUserList();
}
+
+ @Override
+ @GlobalTransactional//盘点导入,需提供柜子系统数据
+ public void inventoryEntry(List reagentConsumableInventoryDTOList) {
+ for (ReagentConsumableInventoryDTO reagentConsumableInventoryDTO : reagentConsumableInventoryDTOList) {
+ ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();
+ BeanUtils.copyProperties(reagentConsumableInventoryDTO, reagentConsumableInventory);
+ reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase());
+ reagentConsumableInventory.setWarningValue(1);
+
+ BatchDetails batchDetails = new BatchDetails();
+
+ batchDetails.setServiceStatus(1);
+ batchDetails.setQuantity(reagentConsumableInventoryDTO.getTotalQuantity());
+ batchDetails.setBatch("2023-1");
+
+ batchDetails.setSupplierId(reagentConsumableInventoryDTO.getSupplierId());
+ //如果没有生产日期/到期时间,就自动生成
+ if (reagentConsumableInventoryDTO.getDateOfProduction() != null) {
+ batchDetails.setDateOfProduction(reagentConsumableInventoryDTO.getDateOfProduction());
+ } else {
+ batchDetails.setDateOfProduction(LocalDate.now());
+ }
+ if (reagentConsumableInventoryDTO.getExpirationDate() != null) {
+ batchDetails.setExpirationDate(reagentConsumableInventoryDTO.getExpirationDate());
+ } else {
+ batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
+ }
+ Cabinetcell cabinetCell = baseMapper.getCabinetCell(reagentConsumableInventoryDTO.getLocation());
+
+ ArrayList cellAndStoreSupplyDataArrayList = new ArrayList<>();//柜子数组
+ CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData();
+ cellAndStoreSupplyData.setCellStatus("1");
+ cellAndStoreSupplyData.setCellId(cabinetCell.getId());
+ ArrayList arrayList = new ArrayList<>();
+ arrayList.add(reagentConsumableInventory.getReagentConsumableInventoryId());
+ cellAndStoreSupplyData.setStoreSupplyList(arrayList);
+ cellAndStoreSupplyDataArrayList.add(cellAndStoreSupplyData);
+ remoteCabinetService.takeOrSaveGoodsFromCabinet(cellAndStoreSupplyDataArrayList, 1);
+
+ //获取柜子信息
+ batchDetails.setLatticeId(cabinetCell.getId());
+ batchDetails.setBoxId(cabinetCell.getCabinetId());
+ batchDetails.setLocation(reagentConsumableInventoryDTO.getRoomNo() + "-" + reagentConsumableInventoryDTO.getLocation());
+ batchDetails.setPurchaseTime(LocalDateTime.now());
+ batchDetails.setBatchNumber("/");
+ batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
+ batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());
+ ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(reagentConsumableInventory);
+ reagentConsumableInventory.setReagentConsumableId(reagentConsumables.getReagentConsumableId());
+
+ //导入标准物质
+ if (reagentConsumableInventoryDTO.getCategory().equals("标准物质")) {
+ ReferenceMaterial referenceMaterial = new ReferenceMaterial();
+ referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId());
+ referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());
+ referenceMaterial.setLocation(reagentConsumableInventoryDTO.getLocation());
+ referenceMaterial.setStatus(0);
+ referenceMaterial.setLatticeId(cabinetCell.getId());
+ referenceMaterial.setBoxId(cabinetCell.getCabinetId());
+ Calendar instance = Calendar.getInstance();
+ int year = instance.get(Calendar.YEAR);
+ String roomNo = reagentConsumableInventoryDTO.getRoomNo();
+ String substring = roomNo.substring(0, 1);
+ referenceMaterial.setNumber(reagentConsumableInventoryDTO.getAlias() + "-" + year + "-" + substring + "-1");//自动生成编号
+ referenceMaterial.setCode(referenceMaterial.getNumber());
+ referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());
+ referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
+ referenceMaterialService.save(referenceMaterial);
+
+ }
+ this.save(reagentConsumableInventory);
+ batchDetailsService.save(batchDetails);
+
+
+// remoteCabinetService.updateCabinet(reagentConsumableInventoryDTO.getLatticeId(), reagentConsumableInventory.getReagentConsumableInventoryId(), "1");
+
+ }
+ }
+
}
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/RequisitionRecordServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/RequisitionRecordServiceImpl.java
index 0c8cf2f..e782a05 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/impl/RequisitionRecordServiceImpl.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/RequisitionRecordServiceImpl.java
@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.time.LocalDateTime;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
@@ -59,8 +60,9 @@ public class RequisitionRecordServiceImpl extends ServiceImpl getRequisitionRecordVOPage(IPage page, QueryWrapper qw){
+ public IPage getRequisitionRecordVOPage(IPage page, QueryWrapper qw) {
IPage requisitionRecordVOPage = baseMapper.getRequisitionRecordVOPage(page, qw);
@@ -92,19 +94,18 @@ public class RequisitionRecordServiceImpl extends ServiceImpl getRequisitionRecordVO(String id){
-
- ApplicationForUse byId = applicationForUseService.getById(id);
-
- String deliveryRegistrationFormId = byId.getDeliveryRegistrationFormId();
+ public List getRequisitionRecordVO(String[] idList) {
- List requisitionRecordVO = baseMapper.getRequisitionRecordVO(deliveryRegistrationFormId);
-
- return requisitionRecordVO;
+ List requisitionRecordVOS = new ArrayList<>();
+ for (String id : idList) {
+ RequisitionRecordVO requisitionRecordVO = baseMapper.getRequisitionRecordVO(id);
+ requisitionRecordVOS.add(requisitionRecordVO);
+ }
+ return requisitionRecordVOS;
}
@Override
- public void rquisitionRecordTablePDF(List voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
+ public void rquisitionRecordTablePDF(List voList, String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
System.out.println("RequisitionRecordTablePDF.................");
@@ -112,7 +113,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl() {{
put("voList", voList);
- put("year",year);
+ put("year", year);
}}
);
bis.close();
diff --git a/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java b/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java
index 3a0d340..0a1c905 100644
--- a/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java
+++ b/src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar;
@@ -52,7 +53,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl warehousingContentVOList = warehousingContentService.getWarehousingContentVOList(warehousingFormId);
-
- warehousingRecordFormVO.setWarehousingContentVOList(warehousingContentVOList);
-
+ //查询出签收物品明细,将明细添加至签收记录VO
+ warehousingRecordFormVO.setWarehousingContentVOList(warehousingContentService.getWarehousingContentVOList(warehousingFormId));
return warehousingRecordFormVO;
}
@@ -114,153 +108,119 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl warehousingBatchListLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ Integer quantity = warehousingRecordFormDTO.getQuantity() * Integer.valueOf(reagentConsumables.getPackagedCopies());//入库数量=购买数量x包装份数
- warehousingBatchListLambdaQueryWrapper.eq(WarehousingBatchList::getWarehousingContentId, warehousingBatchList.getWarehousingContentId());
- //通过判断签收内容表里的签收批次表数量,进行批次字段的赋值
- warehousingBatchList.setBatch(warehousingBatchListService.list(warehousingBatchListLambdaQueryWrapper).size() + 1);
+ //判断采购数量与签收数量
+ if (warehousingContent.getWarehousingQuantity() > warehousingContent.getTotalQuantity()) {
+ throw new RuntimeException(String.format("入库数量不能大于采购数量"));
+ }
- WarehousingContent byId = warehousingContentService.getById(warehousingBatchList.getWarehousingContentId());
+ warehousingBatchList.setBatch(warehousingBatchListService.list(Wrappers.query().eq("warehousing_content_id", warehousingBatchList.getWarehousingContentId())).size() + 1);
- byId.setLastStorageLocation(warehousingRecordFormDTO.getLocation());
- byId.setBoxId(warehousingRecordFormDTO.getBoxId());
- byId.setLatticeId(warehousingRecordFormDTO.getLatticeId());
- byId.setWarehousingQuantity(byId.getWarehousingQuantity() + warehousingBatchList.getQuantity());
+ warehousingContent.setLastStorageLocation(warehousingRecordFormDTO.getLocation());//记录存放位置信息,以便下次签收同样物品时可以回显位置信息
+ warehousingContent.setBoxId(boxId);//柜子ID
+ warehousingContent.setLatticeId(latticeId);//格子ID
- if (warehousingRecordFormDTO.getCode() != null) {
+ warehousingContent.setWarehousingQuantity(warehousingContent.getWarehousingQuantity() + warehousingBatchList.getQuantity());//修改签收数量
- byId.setCode(warehousingRecordFormDTO.getCode());
- }
-
- //判断采购数量与签收数量
- if (byId.getWarehousingQuantity() > byId.getTotalQuantity()) {
- throw new RuntimeException(String.format("入库数量不能大于采购数量"));
+ if (warehousingRecordFormDTO.getCode() != null) {//如果填入物品编码,则记录,以便下次签收回显
+ warehousingContent.setCode(warehousingRecordFormDTO.getCode());
}
-
- ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.query().eq("reagent_consumable_id", byId.getReagentConsumableId()));
+ ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.query().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId()));
//录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息
if (one == null) {
- ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();
-
- LambdaQueryWrapper reagentConsumablesLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();//创建库存对象
- reagentConsumablesLambdaQueryWrapper.eq(ReagentConsumables::getReagentConsumableId, byId.getReagentConsumableId());
- ReagentConsumables reagentConsumables = reagentConsumablesService.getOne(reagentConsumablesLambdaQueryWrapper);
-
- BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);
+ BeanUtils.copyProperties(reagentConsumables, reagentConsumableInventory);//拷贝信息
reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase());
- reagentConsumableInventory.setStatus(1);
+ reagentConsumableInventory.setStatus(1);//状态 1为正常
reagentConsumableInventory.setCreateTime(LocalDateTime.now());
reagentConsumableInventory.setUpdateTime(LocalDateTime.now());
- reagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue());
+ reagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue());//预警值
//如果供应商未提供物品编码,则需在入库时扫描标签录入编码
if (warehousingRecordFormDTO.getCode() != null) {
reagentConsumableInventory.setCode(warehousingRecordFormDTO.getCode());
reagentConsumables.setCode(warehousingRecordFormDTO.getCode());
reagentConsumablesService.updateById(reagentConsumables);
-
}
+ BatchDetails batchDetails = new BatchDetails();//创建批次信息
- BatchDetails batchDetails = new BatchDetails();
-
- Calendar calendar = Calendar.getInstance();
-
- int year = calendar.get(Calendar.YEAR);
+ int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
- BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);
+ BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);//拷贝批次信息
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
- batchDetails.setServiceStatus(1);
- batchDetails.setPurchaseTime(LocalDateTime.now());
- batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());
- batchDetails.setSupplierId(byId.getSupplierId());
- batchDetails.setBatch(year + "-" + 1);
- batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
- batchDetails.setQuantity(warehousingRecordFormDTO.getQuantity() * Integer.valueOf(reagentConsumables.getPackagedCopies()));
- batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());
-
- warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
-
- if (batchDetails.getQuantity() == null) {
- batchDetails.setQuantity(0);
+ batchDetails.setServiceStatus(1);//状态 1为正常
+ batchDetails.setPurchaseTime(LocalDateTime.now());//购买时间
+ batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());//关联库存物品ID
+ batchDetails.setSupplierId(warehousingContent.getSupplierId());//供应商ID
+ batchDetails.setBatch(year + "-" + 1);//由于是第一次入库该物品,所以批次肯定为1
+ batchDetails.setLatticeId(latticeId);//赋值位置信息
+ batchDetails.setLocation(location);
+ batchDetails.setBoxId(boxId);
+ //如果未填写存储期限,则默认为可以一直存储
+ if (warehousingRecordFormDTO.getExpirationDate() != null) {
+ batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
+ } else {
+ batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
}
+ batchDetails.setQuantity(quantity); //录入数量
+ batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());//关联签收批次
+ warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());//关联签收批次
if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) {
//更新格子信息(试剂耗材传入类ID)
- remoteCabinetService.updateCabinet(latticeId, byId.getReagentConsumableId(), "1");
- batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
- batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
- batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
- }
-
- if (reagentConsumableInventory.getTotalQuantity() == null) {
-
- reagentConsumableInventory.setTotalQuantity(0);
+ remoteCabinetService.updateCabinet(latticeId, warehousingContent.getReagentConsumableId(), "1");
}
+ reagentConsumableInventory.setTotalQuantity(quantity);//数量
- reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() + batchDetails.getQuantity());
-
- //如果是标准物质,则赋值编号
+ //如果是标准物质,则需生成编号
if (reagentConsumables.getCategory().equals("标准物质")) {
-
- batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
- batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
- batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
-
+ //需生成对应购买数量的标准物质以及编号
for (int j = 0; j < batchDetails.getQuantity(); j++) {
-
ReferenceMaterial referenceMaterial = new ReferenceMaterial();
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
- referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId());
- referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());
- referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());
- referenceMaterial.setStatus(0);
- referenceMaterial.setLocation(warehousingRecordFormDTO.getLocation());
- referenceMaterial.setLatticeId(warehousingRecordFormDTO.getLatticeId());
- referenceMaterial.setCustodianName(warehousingRecordFormDTO.getCustodianName());
- referenceMaterial.setBoxId(warehousingRecordFormDTO.getBoxId());
-
-
+ referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId());//试剂耗材ID
+ referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());//批次ID
+ referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());//库存物品ID
+ referenceMaterial.setStatus(0);//状态 0为正常
+ referenceMaterial.setLocation(location);
+ referenceMaterial.setLatticeId(latticeId);
+ referenceMaterial.setBoxId(boxId);
//更新格子信息(标准物质传入对象ID)
remoteCabinetService.updateCabinet(latticeId, referenceMaterial.getId(), "1");
-
- String location = warehousingRecordFormDTO.getLocation();
-
+ //生成编号
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-";
-
List list = referenceMaterialService.list(Wrappers.query()
.likeRight("number", prefix)
.orderByDesc("number"));
-
int newNo = 1;
-
if ((list != null) && (list.size() > 0)) {
ReferenceMaterial referenceMaterial1 = list.get(0);
String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix);
@@ -273,56 +233,46 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl reagentConsumablesLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- reagentConsumablesLambdaQueryWrapper.eq(ReagentConsumables::getReagentConsumableId, byId.getReagentConsumableId());
-
- ReagentConsumables reagentConsumables = reagentConsumablesService.getOne(reagentConsumablesLambdaQueryWrapper);
-
BatchDetails batchDetails = new BatchDetails();
-
BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);
-
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
batchDetails.setServiceStatus(1);
batchDetails.setPurchaseTime(LocalDateTime.now());
- batchDetails.setSupplierId(byId.getSupplierId());
- batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
+ batchDetails.setSupplierId(warehousingContent.getSupplierId());
+ //如果未填写存储期限,则默认为可以一直存储
+ if (warehousingRecordFormDTO.getExpirationDate() != null) {
+ batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
+ } else {
+ batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
+ }
batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId());
- batchDetails.setQuantity(warehousingRecordFormDTO.getQuantity() * Integer.valueOf(one.getPackagedCopies()));
+ batchDetails.setQuantity(quantity);
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
+ batchDetails.setLocation(location);
+ batchDetails.setLatticeId(latticeId);
+ batchDetails.setBoxId(boxId);
+ int year = Calendar.getInstance().get(Calendar.YEAR);
- Calendar calendar = Calendar.getInstance();
-
- int year = calendar.get(Calendar.YEAR);
-
- Integer years = Integer.valueOf(year);
-
-
+ Integer years = Integer.valueOf(year);//进行包装,方便运算
+ //查询相同年份相同供应商相同物品的所有批次信息
List batchDetailsList = batchDetailsService.list(Wrappers.query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId())
- .eq("supplier_id", byId.getSupplierId())
+ .eq("supplier_id", warehousingContent.getSupplierId())
.like("batch", years));
-
+ //如果没有批次信心,则默认为1
if (batchDetailsList.size() == 0) {
batchDetails.setBatch(year + "-" + 1);
} else {
@@ -330,23 +280,14 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl list = referenceMaterialService.list(Wrappers.query()
.likeRight("number", prefix)
.orderByDesc("number"));
-
int newNo = 1;
-
if ((list != null) && (list.size() > 0)) {
ReferenceMaterial referenceMaterial1 = list.get(0);
String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix);
@@ -383,7 +318,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
-
- String warehousingRecordFormId = byId.getWarehousingRecordFormId();
-
- warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getWarehousingRecordFormId, warehousingRecordFormId);
-
- List list = warehousingContentService.list(warehousingContentLambdaQueryWrapper);
-
+ String warehousingRecordFormId = warehousingContent.getWarehousingRecordFormId();
+ List list = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id",warehousingRecordFormId));
WarehousingRecordForm warehousingRecordForm = this.getById(warehousingRecordFormId);
- PurchaseList purchaseList = purchaseListService.getById(purchaseListDetailsService.getById(byId.getPurchaseListDetailsId()).getPurchaseListId());
+ PurchaseList purchaseList = purchaseListService.getById(purchaseListDetailsService.getById(warehousingContent.getPurchaseListDetailsId()).getPurchaseListId());//查询采购清单
+ int i = 0;
//遍历采购内容,判断试剂耗材是否入库完毕
- for (WarehousingContent warehousingContent : list) {
-
- if (warehousingContent.getWarehousingQuantity() == warehousingContent.getTotalQuantity()) {
+ for (WarehousingContent warehousingContentFull : list) {
- warehousingContent.setStatus(1);
+ if (warehousingContentFull.getWarehousingQuantity() == warehousingContentFull.getTotalQuantity()) {//签收数量=购买数量
- warehousingContentService.updateById(warehousingContent);
+ warehousingContentFull.setStatus(1);//签收成功
- if (warehousingContent.getAcceptanceRecordFormId() == null) {
+ warehousingContentService.updateById(warehousingContentFull);
+ if (warehousingContentFull.getAcceptanceRecordFormId() == null) {//如果没有验收记录表,那就创建
+ //首先创建验收集合表
AcceptanceSignFor acceptanceSignForServiceOne = acceptanceSignForService.getOne(Wrappers.query().eq("warehousing_record_form_id", warehousingRecordFormId));
-
+ //首次创建
if (acceptanceSignForServiceOne == null) {
-
AcceptanceSignFor acceptanceSignFor = new AcceptanceSignFor();
-
acceptanceSignFor.setWarehousingRecordFormId(warehousingRecordFormId);
acceptanceSignFor.setId(IdWorker.get32UUID().toUpperCase());
acceptanceSignFor.setQuantity(list.size());
@@ -435,76 +363,62 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl supplierInformations = new ArrayList<>();
-
+ //判断该清单所有试剂耗材是否入库完成,若入库完成,则需生成供应商评价表
+ if (i == list.size()) {//如果签收完毕
+ List supplierInformations = new ArrayList<>();//供应商集合
//创建供应商评价表
/*
通过循环签收内容,获得所有的供应商列表
为每一个供应商创建一个评价表
*/
- for (WarehousingContent warehousingContent : list) {
-
- SupplierInformation supplierInformation = supplierInformationService.getById(warehousingContent.getSupplierId());
-
+ for (WarehousingContent warehousingContentFull : list) {//遍历签收物品明细
+ SupplierInformation supplierInformation = supplierInformationService.getById(warehousingContentFull.getSupplierId());//供应商
if (!supplierInformations.contains(supplierInformation)) {
- supplierInformations.add(supplierInformation);
- EvaluationForm evaluationForm = evaluationFormService.addForm(supplierInformation.getId());
- warehousingContent.setEvaluationFormId(evaluationForm.getId());
- provideServicesOrSuppliesService.addById(evaluationForm.getId(), warehousingContent.getReagentConsumableId());
+ supplierInformations.add(supplierInformation);//将所有供应商添加至集合
+ EvaluationForm evaluationForm = evaluationFormService.addForm(supplierInformation.getId());//创建供应商评价表
+ warehousingContentFull.setEvaluationFormId(evaluationForm.getId());//关联供应商与签收明细
+ provideServicesOrSuppliesService.addById(evaluationForm.getId(), warehousingContentFull.getReagentConsumableId());//创建供应商提供物品信息
} else {
+ //如果是相同供应商的物品
LambdaQueryWrapper evaluationFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluationFormLambdaQueryWrapper.eq(EvaluationForm::getSupplierInformationId, supplierInformation.getId())
.orderByDesc(EvaluationForm::getCreateTime);
-
List list1 = evaluationFormService.list(evaluationFormLambdaQueryWrapper);
-
- provideServicesOrSuppliesService.addById(list1.get(0).getId(), warehousingContent.getReagentConsumableId());
+ provideServicesOrSuppliesService.addById(list1.get(0).getId(), warehousingContentFull.getReagentConsumableId());//为最新创建的评价表添加物品信息
}
}
-
- warehousingRecordForm.setStatus(2);
-
-
+ warehousingRecordForm.setStatus(2);//改变签收单状态
} else {
warehousingRecordForm.setStatus(1);
}
-
this.updateById(warehousingRecordForm);
-
- WarehousingRecordFormVO warehousingRecordFormVO = this.getWarehousingRecordFormVO(warehousingRecordFormId);
-
+ WarehousingRecordFormVO warehousingRecordFormVO = this.getWarehousingRecordFormVO(warehousingRecordFormId);//签收单VO
return warehousingRecordFormVO;
}
@Override
public IPage getWarehousingRecordFormVOPage(Page page, QueryWrapper qw) {
- IPage warehousingRecordFormVOPage = baseMapper.getWarehousingRecordFormVOPage(page, qw);
+ IPage warehousingRecordFormVOPage = baseMapper.getWarehousingRecordFormVOPage(page, qw);//查询签收单列表
List records = warehousingRecordFormVOPage.getRecords();
for (WarehousingRecordFormVO record : records) {
List warehousingContents = warehousingContentService.list(Wrappers.query().eq("warehousing_record_form_id", record.getId()));
-
+ //计算签收(购买)物品总数与已签收数量
for (WarehousingContent warehousingContent : warehousingContents) {
-
Integer warehousingQuantity = warehousingContent.getWarehousingQuantity();
Integer totalQuantity = warehousingContent.getTotalQuantity();
if (record.getWarehousingQuantity() == null & record.getQuantityPurchased() == null) {
@@ -514,14 +428,11 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl
select *
- from reagent_consumable_inventory
- ${ew.customSqlSegment}
+ from reagent_consumable_inventory ${ew.customSqlSegment}