main
杨海航 2 years ago
parent d2dfbac2f4
commit dd5a23fb67
  1. 5
      pom.xml
  2. 33
      src/main/java/digital/laboratory/platform/reagent/controller/AcceptanceRecordFormController.java
  3. 10
      src/main/java/digital/laboratory/platform/reagent/controller/ReagentConsumableInventoryController.java
  4. 8
      src/main/java/digital/laboratory/platform/reagent/controller/RequisitionRecordController.java
  5. 4
      src/main/java/digital/laboratory/platform/reagent/entity/CentralizedRequest.java
  6. 3
      src/main/java/digital/laboratory/platform/reagent/mapper/ReagentConsumableInventoryMapper.java
  7. 2
      src/main/java/digital/laboratory/platform/reagent/mapper/RequisitionRecordMapper.java
  8. 2
      src/main/java/digital/laboratory/platform/reagent/service/AcceptanceRecordFormService.java
  9. 2
      src/main/java/digital/laboratory/platform/reagent/service/PurchasingPlanService.java
  10. 6
      src/main/java/digital/laboratory/platform/reagent/service/ReagentConsumableInventoryService.java
  11. 2
      src/main/java/digital/laboratory/platform/reagent/service/RequisitionRecordService.java
  12. 190
      src/main/java/digital/laboratory/platform/reagent/service/impl/AcceptanceRecordFormServiceImpl.java
  13. 24
      src/main/java/digital/laboratory/platform/reagent/service/impl/DeliveryRegistrationFormServiceImpl.java
  14. 131
      src/main/java/digital/laboratory/platform/reagent/service/impl/PurchaseListServiceImpl.java
  15. 477
      src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java
  16. 108
      src/main/java/digital/laboratory/platform/reagent/service/impl/ReagentConsumableInventoryServiceImpl.java
  17. 33
      src/main/java/digital/laboratory/platform/reagent/service/impl/RequisitionRecordServiceImpl.java
  18. 305
      src/main/java/digital/laboratory/platform/reagent/service/impl/WarehousingRecordFormServiceImpl.java
  19. 14
      src/main/resources/mapper/ReagentConsumableInventoryMapper.xml
  20. 2
      src/main/resources/mapper/RequisitionRecordMapper.xml

@ -177,6 +177,11 @@
<version>2022.10.11-snapshots</version> <version>2022.10.11-snapshots</version>
</dependency> </dependency>
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-seata</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!-- 业务数据的依赖 --> <!-- 业务数据的依赖 -->
<dependency> <dependency>
<groupId>digital.laboratory.platform</groupId> <groupId>digital.laboratory.platform</groupId>

@ -83,22 +83,22 @@ public class AcceptanceRecordFormController {
public R<AcceptanceRecordFormVO> getById(String acceptanceRecordFormId, String rid, HttpServletRequest theHttpServletRequest) { public R<AcceptanceRecordFormVO> getById(String acceptanceRecordFormId, String rid, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
//通过标准物质ID查询该标准物质类的验收记录
if (rid != null) { if (rid != null) {
ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(rid); //只能从标准物质ID——》逐级查询出验收记录ID
BatchDetails byId = batchDetailsService.getById(referenceMaterialServiceById.getBatchDetailsId()); AcceptanceRecordFormVO acceptanceRecordFormVO =
WarehousingBatchList byId1 = warehousingBatchListService.getById(byId.getWarehousingBatchListId()); acceptanceRecordFormService.getAcceptanceRecordFormVO
WarehousingContent byId2 = warehousingContentService.getById(byId1.getWarehousingContentId()); (warehousingContentService.getById
AcceptanceRecordFormVO acceptanceRecordFormVO = acceptanceRecordFormService.getAcceptanceRecordFormVO(byId2.getAcceptanceRecordFormId()); (warehousingBatchListService.getById
(batchDetailsService.getById
(referenceMaterialService.getById(rid)).getWarehousingBatchListId()).getWarehousingContentId()).getAcceptanceRecordFormId());
if (acceptanceRecordFormVO.getStatus() == 6) { if (acceptanceRecordFormVO.getStatus() == 6) {
return R.ok(acceptanceRecordFormVO); return R.ok(acceptanceRecordFormVO);
} else return R.failed(null); } else return R.failed(null);
} }
AcceptanceRecordFormVO acceptanceRecordFormVO = acceptanceRecordFormService.getAcceptanceRecordFormVO(acceptanceRecordFormId); AcceptanceRecordFormVO acceptanceRecordFormVO = acceptanceRecordFormService.getAcceptanceRecordFormVO(acceptanceRecordFormId);
return R.ok(acceptanceRecordFormVO); return R.ok(acceptanceRecordFormVO);
//return R.ok(acceptanceRecordFormService.getById(acceptanceRecordFormId));
} }
/** /**
@ -114,7 +114,11 @@ public class AcceptanceRecordFormController {
public R<IPage<AcceptanceRecordFormVO>> getAcceptanceRecordFormPage(Page<AcceptanceRecordForm> 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) { public R<IPage<AcceptanceRecordFormVO>> getAcceptanceRecordFormPage(Page<AcceptanceRecordForm> 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(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
/*查询参数
* 标准物质名称
* 验收时间
* 验收状态
* */
IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = acceptanceRecordFormService.getAcceptanceRecordFormVOPage(page, Wrappers.<AcceptanceRecordForm>query() IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = acceptanceRecordFormService.getAcceptanceRecordFormVOPage(page, Wrappers.<AcceptanceRecordForm>query()
.like(StrUtil.isNotBlank(reagentConsumableName), "reagent_consumable_name", reagentConsumableName) .like(StrUtil.isNotBlank(reagentConsumableName), "reagent_consumable_name", reagentConsumableName)
.ge(startTime != null, "create_time", startTime) .ge(startTime != null, "create_time", startTime)
@ -123,7 +127,6 @@ public class AcceptanceRecordFormController {
.orderByDesc("create_time") .orderByDesc("create_time")
.eq("acceptance_sign_for_id", acceptanceSignForId)); .eq("acceptance_sign_for_id", acceptanceSignForId));
return R.ok(acceptanceRecordFormVOPage); return R.ok(acceptanceRecordFormVOPage);
// return R.ok(acceptanceRecordFormService.page(page, Wrappers.query(acceptanceRecordForm)));
} }
@ -140,9 +143,7 @@ public class AcceptanceRecordFormController {
public R<AcceptanceRecordForm> postAddObject(@RequestBody AcceptanceRecordFormDTO acceptanceRecordFormDTO, HttpServletRequest theHttpServletRequest) { public R<AcceptanceRecordForm> postAddObject(@RequestBody AcceptanceRecordFormDTO acceptanceRecordFormDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.commitForm(acceptanceRecordFormDTO, dlpUser); AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.commitForm(acceptanceRecordFormDTO, dlpUser);
if (acceptanceRecordForm != null) { if (acceptanceRecordForm != null) {
return R.ok(acceptanceRecordForm, "保存成功"); return R.ok(acceptanceRecordForm, "保存成功");
} else return R.failed("保存失败"); } else return R.failed("保存失败");
@ -162,9 +163,7 @@ public class AcceptanceRecordFormController {
public R<String> culkCommit(@RequestBody List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, HttpServletRequest theHttpServletRequest) { public R<String> culkCommit(@RequestBody List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
acceptanceRecordFormService.culkCommit(acceptanceRecordFormDTOList, dlpUser); acceptanceRecordFormService.culkCommit(acceptanceRecordFormDTOList, dlpUser);
return R.ok("批量验收成功"); return R.ok("批量验收成功");
} }
@ -182,8 +181,6 @@ public class AcceptanceRecordFormController {
public R<String> primaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) { public R<String> primaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (acceptanceRecordFormService.primaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) { if (acceptanceRecordFormService.primaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功"); return R.ok("审核成功");
} else return R.failed("审核失败"); } else return R.failed("审核失败");
@ -202,8 +199,6 @@ public class AcceptanceRecordFormController {
public R<String> secondaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) { public R<String> secondaryAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (acceptanceRecordFormService.secondaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) { if (acceptanceRecordFormService.secondaryAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功"); return R.ok("审核成功");
} else return R.failed("审核失败"); } else return R.failed("审核失败");
@ -222,8 +217,6 @@ public class AcceptanceRecordFormController {
public R<String> threeLevelAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) { public R<String> threeLevelAudit(@RequestBody AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, HttpServletRequest theHttpServletRequest) {
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
if (acceptanceRecordFormService.threeLevelAudit(acceptanceRecordFormAuditDTO, dlpUser)) { if (acceptanceRecordFormService.threeLevelAudit(acceptanceRecordFormAuditDTO, dlpUser)) {
return R.ok("审核成功"); return R.ok("审核成功");
} else return R.failed("审核失败"); } else return R.failed("审核失败");

@ -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.log.annotation.SysLog;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.common.oss.service.OssFile; 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.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial; import digital.laboratory.platform.reagent.entity.ReferenceMaterial;
import digital.laboratory.platform.reagent.service.ReagentConsumableInventoryService; import digital.laboratory.platform.reagent.service.ReagentConsumableInventoryService;
@ -365,5 +366,14 @@ public class ReagentConsumableInventoryController {
return R.ok(reagentConsumableInventoryService.getUserList()); return R.ok(reagentConsumableInventoryService.getUserList());
} }
@PostMapping("inventory/entry")
public R<String> inventoryEntry(@RequestBody List<ReagentConsumableInventoryDTO> reagentConsumableInventoryDTOList, HttpServletResponse httpServletResponse) {
reagentConsumableInventoryService.inventoryEntry(reagentConsumableInventoryDTOList);
return R.ok("导入成功");
}
} }

@ -54,19 +54,19 @@ public class RequisitionRecordController {
@SysLog("试剂耗材领用申请表打印") @SysLog("试剂耗材领用申请表打印")
@PostMapping("/print") @PostMapping("/print")
@PreAuthorize("@pms.hasPermission('reagent_application_for_use_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................."); System.out.println("bizApplyWord.................");
Principal principal = theHttpServletRequest.getUserPrincipal(); Principal principal = theHttpServletRequest.getUserPrincipal();
DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal(); DLPUser dlpUser = (DLPUser) ((OAuth2Authentication) principal).getUserAuthentication().getPrincipal();
List<RequisitionRecordVO> voList = requisitionRecordService.getRequisitionRecordVO(id); List<RequisitionRecordVO> voList = requisitionRecordService.getRequisitionRecordVO(idList);
if (voList.isEmpty()) { if (voList.isEmpty()) {
throw new RuntimeException("未查询到相关信息"); throw new RuntimeException("未查询到相关信息");
} }
String id = IdWorker.get32UUID().toUpperCase();
String applyFileName = "试剂耗材领用记录表-" + id; String applyFileName = "试剂耗材领用记录表-"+id ;
String pdfFilePath = "document" + "/" + "requisitionRecord" + "/" + id + "/" + applyFileName + ".pdf"; String pdfFilePath = "document" + "/" + "requisitionRecord" + "/" + id + "/" + applyFileName + ".pdf";
try { try {

@ -62,12 +62,16 @@ public class CentralizedRequest extends BaseEntity {
@ApiModelProperty(value = "申请人名称") @ApiModelProperty(value = "申请人名称")
private String applicantName; private String applicantName;
@ApiModelProperty(value = "审核结果")
private boolean auditResult; private boolean auditResult;
@ApiModelProperty(value = "审核意见")
private String auditOpinion; private String auditOpinion;
@ApiModelProperty(value = "审核人ID")
private String auditId; private String auditId;
@ApiModelProperty(value = "审核时间")
private LocalDateTime auditTime; private LocalDateTime auditTime;
/** /**

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; 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.entity.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO; import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO; import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO;
@ -26,4 +27,6 @@ public interface ReagentConsumableInventoryMapper extends BaseMapper<ReagentCons
IPage<ReagentConsumableInventoryFullVO> getReagentConsumableInventoryFullVOPage (IPage<ReagentConsumableInventory>page, @Param(Constants.WRAPPER) QueryWrapper<ReagentConsumableInventory> qw); IPage<ReagentConsumableInventoryFullVO> getReagentConsumableInventoryFullVOPage (IPage<ReagentConsumableInventory>page, @Param(Constants.WRAPPER) QueryWrapper<ReagentConsumableInventory> qw);
List<UserVO> getUserList(); List<UserVO> getUserList();
Cabinetcell getCabinetCell(String location);
} }

@ -22,6 +22,6 @@ public interface RequisitionRecordMapper extends BaseMapper<RequisitionRecord> {
IPage<RequisitionRecordVO> getRequisitionRecordVOPage (IPage<RequisitionRecord> page, @Param(Constants.WRAPPER) QueryWrapper<RequisitionRecord> qw); IPage<RequisitionRecordVO> getRequisitionRecordVOPage (IPage<RequisitionRecord> page, @Param(Constants.WRAPPER) QueryWrapper<RequisitionRecord> qw);
List<RequisitionRecordVO> getRequisitionRecordVO (String id); RequisitionRecordVO getRequisitionRecordVO (String id);
} }

@ -32,7 +32,7 @@ public interface AcceptanceRecordFormService extends IService<AcceptanceRecordFo
IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm>qw); IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm>qw);
IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page); // IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page);
AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId); AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId);

@ -34,7 +34,7 @@ public interface PurchasingPlanService extends IService<PurchasingPlan> {
@Transactional @Transactional
PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user); PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user);
ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO); // ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO);
ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO); ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO);

@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial; import digital.laboratory.platform.reagent.entity.ReferenceMaterial;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO; import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO; import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO;
import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO; import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO;
import digital.laboratory.platform.reagent.vo.UserVO; import digital.laboratory.platform.reagent.vo.UserVO;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -53,4 +55,8 @@ public interface ReagentConsumableInventoryService extends IService<ReagentConsu
String printSolutionTag(String id); String printSolutionTag(String id);
List<UserVO> getUserList(); List<UserVO> getUserList();
@Transactional
//盘点导入,需提供柜子系统数据
void inventoryEntry(List<ReagentConsumableInventoryDTO> reagentConsumableInventoryDTOList);
} }

@ -23,7 +23,7 @@ public interface RequisitionRecordService extends IService<RequisitionRecord> {
IPage<RequisitionRecordVO> getRequisitionRecordVOPage(IPage<RequisitionRecord> page, QueryWrapper<RequisitionRecord> qw); IPage<RequisitionRecordVO> getRequisitionRecordVOPage(IPage<RequisitionRecord> page, QueryWrapper<RequisitionRecord> qw);
List<RequisitionRecordVO> getRequisitionRecordVO(String id); List<RequisitionRecordVO> getRequisitionRecordVO(String [] idList);
void rquisitionRecordTablePDF(List<RequisitionRecordVO> voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception; void rquisitionRecordTablePDF(List<RequisitionRecordVO> voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception;
} }

@ -74,18 +74,17 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
public void culkCommit(List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, DLPUser dlpUser) { public void culkCommit(List<AcceptanceRecordFormDTO> acceptanceRecordFormDTOList, DLPUser dlpUser) {
for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) { for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) {
//调用单个提交方法
AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser); AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser);
} }
} }
@Override @Override//提交验收记录表
public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) { public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) {
AcceptanceRecordForm byId = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId()); AcceptanceRecordForm byId = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId());
//将审核审批信息清空 //验收记录状态为-2,代表验收审核不通过后重新提交,需置空原有审核信息
if (byId.getStatus() == -2) { if (byId.getStatus() == -2) {
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
byId.setUserName(dlpUser.getName()); byId.setUserName(dlpUser.getName());
byId.setAuditResultOfPrimary(false); byId.setAuditResultOfPrimary(false);
@ -150,6 +149,7 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
throw new RuntimeException(String.format("重新提交失败")); throw new RuntimeException(String.format("重新提交失败"));
} }
} }
//正常提交
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId); BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
byId.setUserName(dlpUser.getName()); byId.setUserName(dlpUser.getName());
byId.setCommitTime(LocalDateTime.now()); byId.setCommitTime(LocalDateTime.now());
@ -159,7 +159,7 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
if (this.updateById(byId)) { if (this.updateById(byId)) {
return byId; return byId;
} else { } else {
throw new RuntimeException(String.format("保存失败")); throw new RuntimeException(String.format("提交失败"));
} }
} }
@ -169,18 +169,14 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
AcceptanceRecordForm acceptanceRecordForm = new AcceptanceRecordForm(); AcceptanceRecordForm acceptanceRecordForm = new AcceptanceRecordForm();
acceptanceRecordForm.setId(IdWorker.get32UUID().toUpperCase()); acceptanceRecordForm.setId(IdWorker.get32UUID().toUpperCase());
acceptanceRecordForm.setSupplierId(supplierId);//供应商ID
acceptanceRecordForm.setSupplierId(supplierId); acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);//验收分类ID
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);//验收试剂耗材ID
acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);
ReagentConsumables byId = reagentConsumablesService.getById(reagentConsumableId); ReagentConsumables byId = reagentConsumablesService.getById(reagentConsumableId);
//将物品名称赋值给验收记录表
acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());
acceptanceRecordForm.setStatus(0); acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());//将物品名称赋值给验收记录表
acceptanceRecordForm.setStatus(0);//初始化状态
if ((this.save(acceptanceRecordForm))) { if ((this.save(acceptanceRecordForm))) {
@ -192,10 +188,10 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override @Override
public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm> qw) { public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVOPage(IPage<AcceptanceRecordForm> page, QueryWrapper<AcceptanceRecordForm> qw) {
IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw); IPage<AcceptanceRecordFormVO> acceptanceRecordFormVOPage = baseMapper.getAcceptanceRecordFormVOPage(page, qw);//获取验收记录列表
List<AcceptanceRecordFormVO> records = acceptanceRecordFormVOPage.getRecords(); List<AcceptanceRecordFormVO> records = acceptanceRecordFormVOPage.getRecords();
//添加试剂耗材信息至VO
for (AcceptanceRecordFormVO record : records) { for (AcceptanceRecordFormVO record : records) {
ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId()); ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId());
@ -206,39 +202,39 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
} }
@Override // @Override
public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page) { // public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page) {
//
LambdaQueryWrapper<AcceptanceRecordForm> acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<AcceptanceRecordForm> acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
//
acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4); // acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
//
List<AcceptanceRecordForm> list = this.list(acceptanceRecordFormLambdaQueryWrapper); // List<AcceptanceRecordForm> list = this.list(acceptanceRecordFormLambdaQueryWrapper);
//
ArrayList<AcceptanceRecordFormVO> acceptanceRecordFormVOS = new ArrayList<>(); // ArrayList<AcceptanceRecordFormVO> acceptanceRecordFormVOS = new ArrayList<>();
//
if (list.size() != 0) { // if (list.size() != 0) {
//
for (AcceptanceRecordForm acceptanceRecordForm : list) { // for (AcceptanceRecordForm acceptanceRecordForm : list) {
//
AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId()); // AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId());
//
acceptanceRecordFormVOS.add(acceptanceRecordFormVO); // acceptanceRecordFormVOS.add(acceptanceRecordFormVO);
} // }
} // }
PageUtils pageUtils = new PageUtils(); // PageUtils pageUtils = new PageUtils();
//
Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS); // Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS);
//
return pages; // return pages;
} // }
@Override @Override
public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) { 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); acceptanceRecordFormVO.setReagentConsumables(byId);
@ -248,31 +244,29 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//一级审核 @Override//一级审核
@Transactional @Transactional
public boolean primaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) { public boolean primaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId(); List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>(); for (String id : uuId) {
for (String s : uuId) { AcceptanceRecordForm byId = this.getById(id);
AcceptanceRecordForm byId = this.getById(s);
if (byId.getStatus() != 1) { if (byId.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setPrimaryAuditorId(dlpUser.getId()); byId.setPrimaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion()); byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfPrimary(LocalDateTime.now()); byId.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult()); byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(2); byId.setStatus(2);//审核成功状态
} else byId.setStatus(-2); } else byId.setStatus(-2);//审核失败状态
acceptanceRecordForms.add(byId); acceptanceRecordForms.add(byId);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
return true; return true;
} else throw new RuntimeException(String.format("审核失败")); } else throw new RuntimeException(String.format("审核失败"));
@ -282,26 +276,25 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//二级审核 @Override//二级审核
@Transactional @Transactional
public boolean secondaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) { public boolean secondaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId(); for (String id : uuId) {
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();
AcceptanceRecordForm byId = this.getById(id);
for (String s : uuId) {
AcceptanceRecordForm byId = this.getById(s);
if (byId.getStatus() != 2) { if (byId.getStatus() != 2) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setSecondaryAuditorId(dlpUser.getId()); byId.setSecondaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion()); byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfSecondary(LocalDateTime.now()); byId.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult()); byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) { if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(3); byId.setStatus(3);//审核成功状态
} else byId.setStatus(-3); } else byId.setStatus(-3);//审核失败状态
acceptanceRecordForms.add(byId); acceptanceRecordForms.add(byId);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
@ -313,78 +306,57 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//三级审核 @Override//三级审核
@Transactional @Transactional
public boolean threeLevelAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) { public boolean threeLevelAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
List<String> stringList = new ArrayList<>();//用于接收验收集合表ID
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();
List<String> stringList = new ArrayList<>();
for (String s : uuId) { for (String s : uuId) {
AcceptanceRecordForm byId = this.getById(s); AcceptanceRecordForm byId = this.getById(s);
if (!stringList.contains(byId.getAcceptanceSignForId())) {//添加验收集合表ID至数组
if (!stringList.contains(byId.getAcceptanceSignForId())) {
stringList.add(byId.getAcceptanceSignForId()); stringList.add(byId.getAcceptanceSignForId());
} }
if (byId.getStatus() != 3) { if (byId.getStatus() != 3) {
throw new RuntimeException(String.format("当前状态不能审核")); throw new RuntimeException(String.format("当前状态不能审核"));
} }
byId.setThreeLevelAuditorId(dlpUser.getId()); byId.setThreeLevelAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion()); byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfThreeLevel(LocalDateTime.now()); byId.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间
byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult()); byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
if (byId.getNonconformingItem() != null) {
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过
if (byId.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单
blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId()); blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId());
} }
byId.setStatus(6); byId.setStatus(6);
} else byId.setStatus(-4); } else byId.setStatus(-4);
acceptanceRecordForms.add(byId); acceptanceRecordForms.add(byId);
} }
if (this.updateBatchById(acceptanceRecordForms)) { if (this.updateBatchById(acceptanceRecordForms)) {
//判断是否验收完毕,更改验收集合表状态
//判断是否验收完毕
for (String s : stringList) { for (String s : stringList) {
AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s); AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);//批量审核的验收记录关联的所有验收集合表
//得到签收物品集合
List<WarehousingContent> warehousing_record_form_id = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId())); List<WarehousingContent> warehousingContentList = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId()));
//得到验收集合中的所有验收记录表
List<AcceptanceRecordForm> recordFormList = this.list(Wrappers.<AcceptanceRecordForm>query().eq("acceptance_sign_for_id", s)); List<AcceptanceRecordForm> recordFormList = this.list(Wrappers.<AcceptanceRecordForm>query().eq("acceptance_sign_for_id", s));
if (warehousing_record_form_id.size() == recordFormList.size()) { if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表)
int x = 0; int x = 0;
for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) { for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) {
if (acceptanceRecordForm.getStatus() == 6) { if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态
x = x + 1; x = x + 1;
} }
} }
if (x == recordFormList.size()) { if (x == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成
AcceptanceSignFor byId = acceptanceSignForService.getById(s); AcceptanceSignFor byId = acceptanceSignForService.getById(s);
byId.setStatus(2); byId.setStatus(2);
acceptanceSignForService.updateById(byId); acceptanceSignForService.updateById(byId);
} }
} }

@ -39,39 +39,28 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl<DeliveryReg
@Autowired @Autowired
private ApplicationForUseService applicationForUseService; private ApplicationForUseService applicationForUseService;
@Autowired @Autowired
private ReagentConsumablesSetService reagentConsumablesSetService; private ReagentConsumablesSetService reagentConsumablesSetService;
@Autowired @Autowired
private ReagentConsumablesService reagentConsumablesService; private ReagentConsumablesService reagentConsumablesService;
@Autowired @Autowired
private OutgoingContentsService outgoingContentsService; private OutgoingContentsService outgoingContentsService;
@Autowired @Autowired
private ComplianceCheckService complianceCheckService; private ComplianceCheckService complianceCheckService;
@Autowired @Autowired
private StandardMaterialApplicationService standardMaterialApplicationService; private StandardMaterialApplicationService standardMaterialApplicationService;
@Autowired @Autowired
private RequisitionRecordService requisitionRecordService; private RequisitionRecordService requisitionRecordService;
@Autowired @Autowired
private ReagentConsumableInventoryService reagentConsumableInventoryService; private ReagentConsumableInventoryService reagentConsumableInventoryService;
@Autowired @Autowired
private SolutionUseFormService solutionUseFormService; private SolutionUseFormService solutionUseFormService;
@Autowired @Autowired
private ReferenceMaterialService referenceMaterialService; private ReferenceMaterialService referenceMaterialService;
@Autowired @Autowired
private BatchDetailsService batchDetailsService; private BatchDetailsService batchDetailsService;
@Autowired @Autowired
private StandardReserveSolutionService standardReserveSolutionService; private StandardReserveSolutionService standardReserveSolutionService;
@Autowired @Autowired
private SupplierInformationService supplierInformationService; private SupplierInformationService supplierInformationService;
@ -83,19 +72,18 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl<DeliveryReg
@Transactional//创建出库任务 @Transactional//创建出库任务
public DeliveryRegistrationForm addFrom(String applicationForUseId) { public DeliveryRegistrationForm addFrom(String applicationForUseId) {
ApplicationForUse byId = applicationForUseService.getById(applicationForUseId); ApplicationForUse applicationForUse = applicationForUseService.getById(applicationForUseId);//领用申请表
//创建出库登记表 //创建出库登记表
DeliveryRegistrationForm deliveryRegistrationForm = new DeliveryRegistrationForm(); DeliveryRegistrationForm deliveryRegistrationForm = new DeliveryRegistrationForm();
deliveryRegistrationForm.setId(IdWorker.get32UUID().toUpperCase()); deliveryRegistrationForm.setId(IdWorker.get32UUID().toUpperCase());
deliveryRegistrationForm.setOutgoingApplicantId(byId.getRecipientId()); deliveryRegistrationForm.setOutgoingApplicantId(applicationForUse.getRecipientId());//领用人~出库申请人
deliveryRegistrationForm.setStatus(0); deliveryRegistrationForm.setStatus(0);
byId.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId());
LambdaQueryWrapper<ReagentConsumablesSet> reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>(); applicationForUse.setDeliveryRegistrationFormId(deliveryRegistrationForm.getId());//关联出库登记表
//得到领用集合 //得到领用集合
reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, byId.getId()); LambdaQueryWrapper<ReagentConsumablesSet> reagentConsumablesSetLambdaQueryWrapper = new LambdaQueryWrapper<>();
reagentConsumablesSetLambdaQueryWrapper.eq(ReagentConsumablesSet::getApplicationForUseId, applicationForUse.getId());
List<ReagentConsumablesSet> list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper); List<ReagentConsumablesSet> list = reagentConsumablesSetService.list(reagentConsumablesSetLambdaQueryWrapper);
List<OutgoingContents> outgoingContentsList = new ArrayList<>(); List<OutgoingContents> outgoingContentsList = new ArrayList<>();
@ -189,7 +177,7 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl<DeliveryReg
} }
} }
if (this.save(deliveryRegistrationForm) && outgoingContentsService.saveBatch(outgoingContentsList) & if (this.save(deliveryRegistrationForm) && outgoingContentsService.saveBatch(outgoingContentsList) &
applicationForUseService.updateById(byId)) { applicationForUseService.updateById(applicationForUse)) {
return deliveryRegistrationForm; return deliveryRegistrationForm;
} else throw new RuntimeException(String.format("创建出库任务失败")); } else throw new RuntimeException(String.format("创建出库任务失败"));

@ -94,44 +94,34 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
@Override//通过ID查找清单 @Override//通过ID查找清单
public PurchaseListVO getPurchaseList(String purchaseListId) { public PurchaseListVO getPurchaseList(String purchaseListId) {
PurchaseListVO purchaseListVO = new PurchaseListVO(); PurchaseListVO purchaseListVO = new PurchaseListVO();//采购清单VO
PurchaseList byId = this.getById(purchaseListId); PurchaseList purchaseList = this.getById(purchaseListId);
List<PurchaseListDetailsVO> purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId);//采购清单明细
List<PurchaseListDetailsVO> purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId); BeanUtils.copyProperties(purchaseList, purchaseListVO);//拷贝
BeanUtils.copyProperties(byId, purchaseListVO);
for (PurchaseListDetailsVO purchaseListDetailsVO : purchaseListDetailsVOList) { for (PurchaseListDetailsVO purchaseListDetailsVO : purchaseListDetailsVOList) {
LambdaQueryWrapper<SupplierInformation> supplierInformationLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SupplierInformation> supplierInformationLambdaQueryWrapper = new LambdaQueryWrapper<>();
//赋值供应商名称
if (purchaseListDetailsVO.getSupplierId() != null) { if (purchaseListDetailsVO.getSupplierId() != null) {
supplierInformationLambdaQueryWrapper.eq(SupplierInformation::getId, purchaseListDetailsVO.getSupplierId()); supplierInformationLambdaQueryWrapper.eq(SupplierInformation::getId, purchaseListDetailsVO.getSupplierId());
SupplierInformation one = supplierInformationService.getOne(supplierInformationLambdaQueryWrapper); SupplierInformation one = supplierInformationService.getOne(supplierInformationLambdaQueryWrapper);
purchaseListDetailsVO.setSupplierName(one.getSupplierName()); purchaseListDetailsVO.setSupplierName(one.getSupplierName());
} }
} }
purchaseListVO.setPurchaseListDetailsVOS(purchaseListDetailsVOList); purchaseListVO.setPurchaseListDetailsVOS(purchaseListDetailsVOList);
return purchaseListVO; return purchaseListVO;
} }
@Override @Override
@Transactional @Transactional
//修改采购清单,批量或单个
public void editById(List<PurchaseListDTO> purchaseListDTOList) { public void editById(List<PurchaseListDTO> purchaseListDTOList) {
for (PurchaseListDTO purchaseListDTO : purchaseListDTOList) { for (PurchaseListDTO purchaseListDTO : purchaseListDTOList) {
PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId());
PurchaseListDetails byId = purchaseListDetailsService.getById(purchaseListDTO.getId()); purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());//只需修改绑定的供应商ID即可
purchaseListDetailsService.updateById(purchaseListDetails);
byId.setSupplierId(purchaseListDTO.getSupplierId());
purchaseListDetailsService.updateById(byId);
} }
} }
@ -141,92 +131,74 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
PurchaseList purchaseList = this.getById(id); PurchaseList purchaseList = this.getById(id);
//将集中采购与分散采购申请的状态改变 //将集中采购与分散采购申请的状态改变
if (purchaseList.getType().equals("采购计划")) { if (purchaseList.getType().equals("采购计划")) {//区分类别,以便查找对应的采购申请
PurchasingPlan plan = purchasingPlanService.getOne(Wrappers.<PurchasingPlan>query() PurchasingPlan plan = purchasingPlanService.getOne(Wrappers.<PurchasingPlan>query()
.eq("purchase_list_id", id)); .eq("purchase_list_id", id));
PurchasingPlanVO purchasingPlanVO = purchasingPlanService.getPurchasingPlanVO(plan.getPurchasingPlanId()); PurchasingPlanVO purchasingPlanVO = purchasingPlanService.getPurchasingPlanVO(plan.getPurchasingPlanId());//采购计划
//这个采购计划内的所有集中采购申请
List<CentralizedRequest> centralizedRequestList = centralizedRequestService.list(Wrappers.<CentralizedRequest>query().eq("purchasing_plan_id", plan.getPurchasingPlanId())); List<CentralizedRequest> centralizedRequestList = centralizedRequestService.list(Wrappers.<CentralizedRequest>query().eq("purchasing_plan_id", plan.getPurchasingPlanId()));
for (CentralizedRequest centralizedRequest : centralizedRequestList) { for (CentralizedRequest centralizedRequest : centralizedRequestList) {
centralizedRequest.setStatus(4); centralizedRequest.setStatus(4);
centralizedRequestService.updateById(centralizedRequest); centralizedRequestService.updateById(centralizedRequest);
} }
} else { } else {
DecentralizedRequest purchase_list_id = decentralizedRequestService.getOne(Wrappers.<DecentralizedRequest>query() //除了采购计划,就是分散采购申请
DecentralizedRequest decentralizedRequest = decentralizedRequestService.getOne(Wrappers.<DecentralizedRequest>query()
.eq("purchase_list_id", id)); .eq("purchase_list_id", id));
purchase_list_id.setStatus(6); decentralizedRequest.setStatus(6);
decentralizedRequestService.updateById(purchase_list_id); decentralizedRequestService.updateById(decentralizedRequest);
} }
purchaseList.setStatus(1); purchaseList.setStatus(1);//提交状态
LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getPurchaseListId, purchaseList.getId()); purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getPurchaseListId, purchaseList.getId());
List<PurchaseListDetails> purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);//采购清单明细
List<PurchaseListDetails> purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);
//创建入库内容集合 //创建入库内容集合
List<WarehousingContent> warehousingContentList = new ArrayList<>(); List<WarehousingContent> warehousingContentList = new ArrayList<>();
//创建入库记录表 //创建入库记录表
WarehousingRecordForm warehousingRecordForm = new WarehousingRecordForm(); WarehousingRecordForm warehousingRecordForm = new WarehousingRecordForm();
//录入入库记录表信息 //录入入库记录表信息
warehousingRecordForm.setId(IdWorker.get32UUID().toUpperCase()); warehousingRecordForm.setId(IdWorker.get32UUID().toUpperCase());
warehousingRecordForm.setPurchaseListId(purchaseList.getId());//关联采购清单
warehousingRecordForm.setPurchaseListId(purchaseList.getId()); warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");//任务名称,用时间命名
warehousingRecordForm.setStatus(0);//初始状态
warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");
warehousingRecordForm.setStatus(0);
for (PurchaseListDetails purchaseListDetails : purchaseListDetailsList) { for (PurchaseListDetails purchaseListDetails : purchaseListDetailsList) {
//得到该试剂耗材的库存情况
ReagentConsumables byId = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId()); ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId());
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query() ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query()
.eq("reagent_consumable_id", byId.getReagentConsumableId())); .eq("reagent_consumable_id", reagentConsumables.getReagentConsumableId()));
WarehousingContent warehousingContent = new WarehousingContent(); WarehousingContent warehousingContent = new WarehousingContent();
//完善入库明细内容信息
//完善入库内容信息
warehousingContent.setId(IdWorker.get32UUID().toUpperCase()); 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()); if (reagentConsumableInventory != null) {//如果仓库存在该试剂耗材
//所有批次信息
warehousingContent.setTotalQuantity(purchaseListDetails.getPurchaseQuantity()); List<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", reagentConsumableInventory.getReagentConsumableInventoryId())
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<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId())
.orderByDesc("create_time")); .orderByDesc("create_time"));
warehousingContent.setWarningValue(one.getWarningValue()); warehousingContent.setWarningValue(reagentConsumableInventory.getWarningValue());
//如果存在批次信息,则提供上次位置信息,以便用户存放物品
if (batchDetailsList.size() != 0 && batchDetailsList != null) { if (batchDetailsList.size() != 0 && batchDetailsList != null) {
warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation());//位置信息
warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation()); warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId());//柜子ID
warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId()); warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());//格子ID
warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());
} }
} }
LambdaQueryWrapper<CatalogueDetails> catalogueDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
catalogueDetailsLambdaQueryWrapper.eq(CatalogueDetails::getReagentConsumableId, warehousingContent.getReagentConsumableId());
List<CatalogueDetails> list = catalogueDetailsService.list(catalogueDetailsLambdaQueryWrapper);
warehousingContentList.add(warehousingContent); warehousingContentList.add(warehousingContent);
} }
if (this.updateById(purchaseList) & warehousingRecordFormService.save(warehousingRecordForm) if (this.updateById(purchaseList) & warehousingRecordFormService.save(warehousingRecordForm)
& warehousingContentService.saveBatch(warehousingContentList)) { & warehousingContentService.saveBatch(warehousingContentList)) {
return purchaseList; return purchaseList;
@ -239,22 +211,14 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
@Override//录入采购清单明细 @Override//录入采购清单明细
public PurchaseListDetailsVO addDetails(PurchaseListDTO purchaseListDTO) { public PurchaseListDetailsVO addDetails(PurchaseListDTO purchaseListDTO) {
String purchaseListId = purchaseListDTO.getPurchaseListId();
PurchaseList byId = this.getById(purchaseListId);
PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId()); PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId());
purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());//供应商ID
purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());
purchaseListDetailsService.updateById(purchaseListDetails); purchaseListDetailsService.updateById(purchaseListDetails);
PurchaseListDetailsVO purchaseListDetailsVO = purchaseListDetailsService.getPurchaseListDetailsVO(purchaseListDetails.getId());//返回更新后的数据
PurchaseListDetailsVO purchaseListDetailsVO = purchaseListDetailsService.getPurchaseListDetailsVO(purchaseListDetails.getId());
return purchaseListDetailsVO; return purchaseListDetailsVO;
} }
@Override @Override//分页查询采购清单列表
public IPage<PurchaseListPageVO> getPurchaseListVOPage(IPage<PurchaseList> page, @Param(Constants.WRAPPER) QueryWrapper<PurchaseList> qw) { public IPage<PurchaseListPageVO> getPurchaseListVOPage(IPage<PurchaseList> page, @Param(Constants.WRAPPER) QueryWrapper<PurchaseList> qw) {
IPage<PurchaseListPageVO> purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw); IPage<PurchaseListPageVO> purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw);
@ -262,5 +226,4 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
return purchaseListVOPage; return purchaseListVOPage;
} }
} }

@ -5,10 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser; import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.reagent.dto.AuditAndApproveDTO; import digital.laboratory.platform.reagent.dto.AuditAndApproveDTO;
import digital.laboratory.platform.reagent.dto.PurchaseListDTO;
import digital.laboratory.platform.reagent.dto.PurchasingPlanDTO; import digital.laboratory.platform.reagent.dto.PurchasingPlanDTO;
import digital.laboratory.platform.reagent.entity.*; import digital.laboratory.platform.reagent.entity.*;
import digital.laboratory.platform.reagent.mapper.PurchasingPlanMapper; import digital.laboratory.platform.reagent.mapper.PurchasingPlanMapper;
@ -20,7 +20,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -32,6 +31,7 @@ import java.util.List;
* @describe (采购计划) 服务实现类 * @describe (采购计划) 服务实现类
*/ */
@Service @Service
@SuppressWarnings("all")
public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, PurchasingPlan> implements PurchasingPlanService { public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, PurchasingPlan> implements PurchasingPlanService {
@Autowired @Autowired
private ProcurementContentService procurementContentService; private ProcurementContentService procurementContentService;
@ -57,13 +57,13 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Autowired @Autowired
private SupplierInformationService supplierInformationService; private SupplierInformationService supplierInformationService;
@Override//分页 @Override//分页查询
public IPage<PurchasingPlanVO> getPurchasingPlanVOPage(IPage<PurchasingPlan> page, QueryWrapper<PurchasingPlan> qw) { public IPage<PurchasingPlanVO> getPurchasingPlanVOPage(IPage<PurchasingPlan> page, QueryWrapper<PurchasingPlan> qw) {
IPage<PurchasingPlanVO> purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw); IPage<PurchasingPlanVO> purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw);
return purchasingPlanVOPage; return purchasingPlanVOPage;
} }
@Override//列表 @Override//采购计划集合
public List<PurchasingPlanVO> getPurchasingPlanVOList(QueryWrapper<PurchasingPlan> qw) { public List<PurchasingPlanVO> getPurchasingPlanVOList(QueryWrapper<PurchasingPlan> qw) {
return baseMapper.getPurchasingPlanVOList(qw); return baseMapper.getPurchasingPlanVOList(qw);
} }
@ -72,16 +72,11 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
public PurchasingPlanVO getPurchasingPlanVO(String purchasingPlanId) { public PurchasingPlanVO getPurchasingPlanVO(String purchasingPlanId) {
PurchasingPlanVO purchasingPlanVO = baseMapper.getPurchasingPlanVO(purchasingPlanId); PurchasingPlanVO purchasingPlanVO = baseMapper.getPurchasingPlanVO(purchasingPlanId);
if (purchasingPlanVO == null) { if (purchasingPlanVO == null) {
throw new RuntimeException(String.format("信息不存在")); throw new RuntimeException(String.format("信息不存在"));
} }
List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);//将采购计划明细Set至采购计划VO
List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);
purchasingPlanVO.setProcurementContentVOList(procurementContentVOList); purchasingPlanVO.setProcurementContentVOList(procurementContentVOList);
return purchasingPlanVO; return purchasingPlanVO;
} }
@ -89,144 +84,102 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Override//创建计划 @Override//创建计划
public PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user) { public PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user) {
PurchasingPlan purchasingPlan = new PurchasingPlan(); PurchasingPlan purchasingPlan = new PurchasingPlan();//创建采购计划
purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase()); purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase());
purchasingPlan.setCreateId(user.getId());//创建人ID
purchasingPlan.setCreateId(user.getId()); purchasingPlan.setStatus(0);//状态
purchasingPlan.setCreateName(user.getName());//创建人名称
purchasingPlan.setStatus(0);
purchasingPlan.setCreateName(user.getName());
List<ProcurementContent> list = new ArrayList<>();//需要整合的集合 List<ProcurementContent> list = new ArrayList<>();//需要整合的集合
boolean flag = true; boolean flag = true;
for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) { for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) {
//将列入计划的集中采购申请状态变为3 //将列入计划的集中采购申请状态变为3
String detailsOfCentralizedId = purchasingPlanDTO.getDetailsOfCentralizedId(); CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId());
centralizedRequest.setStatus(3);
DetailsOfCentralized byId2 = detailsOfCentralizedService.getById(detailsOfCentralizedId); centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
requestService.updateById(centralizedRequest);
CentralizedRequest byId3 = requestService.getById(byId2.getCentralizedRequestId());
byId3.setStatus(3); DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
byId3.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
requestService.updateById(byId3);
flag = true; flag = true;
// //合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
//合并相同的采购内容
if (list.size() != 0) { if (list.size() != 0) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) { if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) {
ReagentConsumables byId1 = reagentConsumablesService.getById(list.get(i).getReagentConsumableId()); list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
list.get(i).setUnitPrice(byId1.getUnitPrice());
//Set采购数量 //Set采购数量
list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications()); 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).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; flag = false;
} }
} }
//无需合并的采购计划明细
if (flag) { if (flag) {
ProcurementContent procurementContent = new ProcurementContent(); ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); 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()); detailsOfCentralizedService.updateById(detailsOfCentralized);
list.add(procurementContent);//将计划明细添加至集合
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);
} }
} else { } else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
ProcurementContent procurementContent = new ProcurementContent(); ProcurementContent procurementContent = new ProcurementContent();
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
byId.setQuantityPurchased(byId.getNumberOfApplications()); byId.setQuantityPurchased(byId.getNumberOfApplications());
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase()); procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId()); procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications()); procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId());
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice()); procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice()); procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice());
byId.setProcurementContentId(procurementContent.getProcurementContentId()); byId.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralizedService.updateById(byId); detailsOfCentralizedService.updateById(byId);
list.add(procurementContent); list.add(procurementContent);
} }
} }
if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) { if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) {
calculatedAmount(purchasingPlan.getPurchasingPlanId()); calculatedAmount(purchasingPlan.getPurchasingPlanId());//计算经费预算
PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId()); PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());//获取VO
return purchasingPlanVO; return purchasingPlanVO;
} else throw new RuntimeException(String.format("保存失败")); } else throw new RuntimeException(String.format("保存失败"));
} }
@Override // @Override//新增明细
public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) { // public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
//
ProcurementContent procurementContent = new ProcurementContent(); // ProcurementContent procurementContent = new ProcurementContent();
//
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent); // BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
//
if (procurementContentService.save(procurementContent)) { // if (procurementContentService.save(procurementContent)) {
return procurementContent; // return procurementContent;
} else { // } else {
return null; // return null;
} // }
} // }
@Override @Override
@Transactional @Transactional//修改采购计划明细(已废弃)
public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) { public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) {
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());
@ -254,80 +207,58 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
} }
@Override//修改整合的采购计划明细中的申请明细 @Override//修改整合的采购计划明细中的采购申请明细
public ProcurementContent editDetails(PurchasingPlanDTO purchasingPlanDTO) { public ProcurementContent editDetails(PurchasingPlanDTO purchasingPlanDTO) {
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId()); ProcurementContent procurementContent = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());//得到计划明细
byId.setUnitPrice(purchasingPlanDTO.getUnitPrice()); procurementContent.setUnitPrice(purchasingPlanDTO.getUnitPrice());//得到修改的明细单价
PurchasingPlan purchasingPlan = this.getById(byId.getPurchasingPlanId()); PurchasingPlan purchasingPlan = this.getById(procurementContent.getPurchasingPlanId());//查询出采购计划
DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()); DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//获取修改的对应的采购申请明细
if (detailsOfCentralized.getQuantityPurchased() == null) { if (detailsOfCentralized.getQuantityPurchased() == null) {
//原本合并总数量-采购申请明细数量+采购申请明细修改后的数量
procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased());
byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased()); } else {//原本合并总数量-采购申请修改后的采购数量+修改数量
procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() - detailsOfCentralized.getQuantityPurchased() + purchasingPlanDTO.getQuantityPurchased());
} else {
byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getQuantityPurchased() + purchasingPlanDTO.getQuantityPurchased());
} }
procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());//计算小计
detailsOfCentralized.setQuantityPurchased(purchasingPlanDTO.getQuantityPurchased());//赋值采购实际数量
detailsOfCentralized.setDetailsRemark(purchasingPlanDTO.getPlanRemark());//修改备注
byId.setSubtotal(byId.getUnitPrice() * byId.getQuantityPurchased()); if (procurementContentService.updateById(procurementContent) && detailsOfCentralizedService.updateById(detailsOfCentralized)) {
calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
detailsOfCentralized.setQuantityPurchased(purchasingPlanDTO.getQuantityPurchased()); return procurementContent;
detailsOfCentralized.setDetailsRemark(purchasingPlanDTO.getPlanRemark());
calculatedAmount(byId.getPurchasingPlanId());
if (procurementContentService.updateById(byId) && detailsOfCentralizedService.updateById(detailsOfCentralized)) {
calculatedAmount(byId.getPurchasingPlanId());
return byId;
} else throw new RuntimeException(String.format("修改失败")); } else throw new RuntimeException(String.format("修改失败"));
} }
@Override @Override
@Transactional @Transactional//删除一条计划明细
public Boolean delContentById(String procurementContentId) { public Boolean delContentById(String procurementContentId) {
ProcurementContent byId = procurementContentService.getById(procurementContentId); ProcurementContent procurementContent = procurementContentService.getById(procurementContentId);//采购计划明细
//该采购计划明细关联的集中采购申请明细
LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>(); List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContentId));
detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, procurementContentId);
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
for (DetailsOfCentralized detailsOfCentralized : list) { 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)) { && detailsOfCentralizedService.updateBatchById(list) && procurementContentService.removeById(procurementContentId)) {
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); List<ProcurementContent> procurementContentList = procurementContentService.list(Wrappers.<ProcurementContent>query().eq("purchasing_plan_id", purchasingPlan.getPurchasingPlanId()));
//如果采购计划的明细全部被删除,则自动删除这个采购计划
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); if (procurementContentList.size() == 0) {
List<ProcurementContent> list1 = procurementContentService.list(procurementContentLambdaQueryWrapper);
if (list1.size() == 0) {
this.removeById(purchasingPlan); this.removeById(purchasingPlan);
return true; return true;
} }
calculatedAmount(byId.getPurchasingPlanId()); calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
return true; return true;
} else { } else {
return null; return null;
@ -337,114 +268,96 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Override//换货 @Override//换货
public ProcurementContent replacementById(PurchasingPlanDTO purchasingPlanDTO) { public ProcurementContent replacementById(PurchasingPlanDTO purchasingPlanDTO) {
String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId(); String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId();//换货试剂耗材ID
ProcurementContent procurementContent = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());//采购计划明细
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());
//将换货信息补充至采购计划明细 //将换货信息补充至采购计划明细
byId.setReplacementReagentConsumableId(replacementReagentConsumableId); procurementContent.setReplacementReagentConsumableId(replacementReagentConsumableId);//换货试剂耗材ID
byId.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity()); procurementContent.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());//换货数量
byId.setReplacementPrice(purchasingPlanDTO.getReplacementPrice()); procurementContent.setReplacementPrice(purchasingPlanDTO.getReplacementPrice());//换货单价
byId.setReplacementRemark(purchasingPlanDTO.getReplacementRemark()); procurementContent.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());//换货备注
byId.setSupplierId(purchasingPlanDTO.getSupplierId()); procurementContent.setSupplierId(purchasingPlanDTO.getSupplierId());//换货供应商ID
//关联这个采购计划明细的所有采购申请明细
LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>(); List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContent.getProcurementContentId()));
detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, byId.getProcurementContentId());
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, procurementContent.getProcurementContentId());
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, byId.getProcurementContentId()); PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);//查询是否有采购清单
PurchaseListDetails one = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);
//如果存在采购清单,则需修改清单信息 //如果存在采购清单,则需修改清单信息
if (one != null) { if (purchaseListDetails != null) {
LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, purchaseListDetails.getId());
warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, one.getId()); purchaseListDetails.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
purchaseListDetails.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
one.setSupplierId(purchasingPlanDTO.getSupplierId()); purchaseListDetails.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
one.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());
one.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());
purchaseListDetailsService.updateById(one); purchaseListDetailsService.updateById(purchaseListDetails);
WarehousingContent one1 = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper); WarehousingContent warehousingContent = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper);
//若存在入库信息,则需修改入库记录 //若存在入库信息,则需修改入库记录
if (one1 != null) { if (warehousingContent != null) {
if (one1.getWarehousingQuantity() == 0) { if (warehousingContent.getWarehousingQuantity() == 0) {
warehousingContent.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
one1.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId()); warehousingContent.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
one1.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity()); warehousingContent.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
one1.setSupplierId(purchasingPlanDTO.getSupplierId()); ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId());
ReagentConsumables byId1 = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId()); warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//采购试剂耗材名称
one1.setReagentConsumableName(byId1.getReagentConsumableName()); warehousingContentService.updateById(warehousingContent);
warehousingContentService.updateById(one1);
} else { } else {
//如果已入库,则不能换货
throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理")); throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理"));
} }
} }
} }
//将换货信息补充至每一个集中采购申请明细
for (DetailsOfCentralized detailsOfCentralized : list) { for (DetailsOfCentralized detailsOfCentralized : list) {
detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId); detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId);
detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity()); detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());
detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark()); detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());
detailsOfCentralizedService.updateById(detailsOfCentralized); detailsOfCentralizedService.updateById(detailsOfCentralized);
} }
//将换货信息补充至集中采购申请明细
if (procurementContentService.updateById(byId)) {
return byId;
if (procurementContentService.updateById(procurementContent)) {
return procurementContent;
} else throw new RuntimeException(String.format("换货失败")); } else throw new RuntimeException(String.format("换货失败"));
} }
@Override @Override
public PurchasingPlan commitById(String purchasingPlanId) { public PurchasingPlan commitById(String purchasingPlanId) {
PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);
PurchasingPlan byId = this.getById(purchasingPlanId); //若是审核审批不通过时提交,则需清空原有的审核审批信息
//若是审核审批不通过时的提交,则需清空原有的审核审批信息 //审核不通过
if (byId.getStatus()==-4){ if (purchasingPlan.getStatus() == -4) {
byId.setAuditOpinionOfPrimary(""); purchasingPlan.setAuditOpinionOfPrimary("");
byId.setAuditResultOfPrimary(false); purchasingPlan.setAuditResultOfPrimary(false);
byId.setPrimaryAuditorId(""); purchasingPlan.setPrimaryAuditorId("");
byId.setAuditTimeOfPrimary(null); purchasingPlan.setAuditTimeOfPrimary(null);
} }
if (byId.getStatus()==-5){ //审批不通过
byId.setAuditOpinionOfPrimary(""); if (purchasingPlan.getStatus() == -5) {
byId.setAuditResultOfPrimary(false); purchasingPlan.setAuditOpinionOfPrimary("");
byId.setPrimaryAuditorId(""); purchasingPlan.setAuditResultOfPrimary(false);
byId.setAuditTimeOfPrimary(null); purchasingPlan.setPrimaryAuditorId("");
byId.setApproverId(""); purchasingPlan.setAuditTimeOfPrimary(null);
byId.setApprovalOpinion(""); purchasingPlan.setApproverId("");
byId.setApprovalResult(false); purchasingPlan.setApprovalOpinion("");
byId.setApprovalTime(null); purchasingPlan.setApprovalResult(false);
} purchasingPlan.setApprovalTime(null);
}
byId.setStatus(1);
byId.setCommitTime(LocalDateTime.now()); purchasingPlan.setStatus(1);
purchasingPlan.setCommitTime(LocalDateTime.now());//
if (this.updateById(byId)) { if (this.updateById(purchasingPlan)) {
calculatedAmount(byId.getPurchasingPlanId()); calculatedAmount(purchasingPlan.getPurchasingPlanId());
return byId; return purchasingPlan;
} else throw new RuntimeException(String.format("提交失败")); } else throw new RuntimeException(String.format("提交失败"));
} }
@Override//审核采购计划
@Override
public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) {
PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId());
@ -452,20 +365,16 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
if (purchasingPlan.getStatus() != 1) { if (purchasingPlan.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不可审核")); throw new RuntimeException(String.format("当前状态不可审核"));
} }
purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult()); purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult());//审核结果
purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion());//审核意见
purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion()); purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间
purchasingPlan.setPrimaryAuditorId(dlpUser.getId());//审核人ID
purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now());
purchasingPlan.setPrimaryAuditorId(dlpUser.getId());
if (auditAndApproveDto.getAuditResult() == true) { if (auditAndApproveDto.getAuditResult() == true) {
purchasingPlan.setStatus(4); purchasingPlan.setStatus(4);//审核通过
} else { } else {
purchasingPlan.setStatus(-4); purchasingPlan.setStatus(-4);//审核不通过
} }
if (this.updateById(purchasingPlan)) { if (this.updateById(purchasingPlan)) {
return purchasingPlan; return purchasingPlan;
} else { } else {
@ -473,7 +382,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
} }
} }
@Override @Override//审批采购计划
public PurchasingPlan approveById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) { public PurchasingPlan approveById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) {
PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId()); PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId());
@ -481,56 +390,40 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
if (purchasingPlan.getStatus() != 4) { if (purchasingPlan.getStatus() != 4) {
throw new RuntimeException(String.format("当前状态不可审批")); throw new RuntimeException(String.format("当前状态不可审批"));
} }
purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult());//审批结果
purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion());//审批意见
purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult()); purchasingPlan.setApprovalTime(LocalDateTime.now());//审批时间
purchasingPlan.setApproverId(dlpUser.getId());//审批人ID
purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion());
purchasingPlan.setApprovalTime(LocalDateTime.now());
purchasingPlan.setApproverId(dlpUser.getId());
//审批通过则创建采购清单 //审批通过则创建采购清单
if (auditAndApproveDto.getApproveResult() == true) { if (auditAndApproveDto.getApproveResult() == true) {
purchasingPlan.setStatus(5); purchasingPlan.setStatus(5);//审批通过
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//采购计划明细
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper); PurchaseList purchaseList = new PurchaseList();//创建采购清单
PurchaseListDTO purchaseListDTO = new PurchaseListDTO();
PurchaseList purchaseList = new PurchaseList();
purchaseList.setId(IdWorker.get32UUID().toUpperCase()); purchaseList.setId(IdWorker.get32UUID().toUpperCase());
purchaseList.setName(DateTime.now() + "采购清单"); purchaseList.setName(DateTime.now() + "采购清单");//清单名称
purchaseList.setStatus(0); purchaseList.setStatus(0);//状态
purchaseList.setType("采购计划"); purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划
purchaseList.setCreateBy(purchasingPlan.getCreateBy()); purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人
purchaseListService.save(purchaseList); purchaseListService.save(purchaseList);
purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单
purchasingPlan.setPurchaseListId(purchaseList.getId());
for (ProcurementContent procurementContent : list) { for (ProcurementContent procurementContent : list) {
PurchaseListDetails purchaseListDetails = new PurchaseListDetails(); PurchaseListDetails purchaseListDetails = new PurchaseListDetails();//采购清单明细
purchaseListDetails.setPurchaseListId(purchaseList.getId());//关联采购清单
purchaseListDetails.setPurchaseListId(purchaseList.getId()); purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());//采购数量
purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased()); purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());//采购试剂耗材ID
purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());
purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase()); purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase());
purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId()); purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());//关联采购计划明细
purchaseListDetailsService.save(purchaseListDetails); purchaseListDetailsService.save(purchaseListDetails);
} }
} else { } else {
purchasingPlan.setStatus(-5);//审核不通过
purchasingPlan.setStatus(-5);
} }
if (this.updateById(purchasingPlan)) { if (this.updateById(purchasingPlan)) {
return purchasingPlan; return purchasingPlan;
} else { } else {
@ -541,51 +434,45 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
//计算经费预算方法 //计算经费预算方法
public PurchasingPlan calculatedAmount(String purchasingPlanId) { public PurchasingPlan calculatedAmount(String purchasingPlanId) {
PurchasingPlan purchasingPlan = this.getById(purchasingPlanId); PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);//采购计划
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId()); procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//这个采购计划内的所有采购计划明细
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);
double x = 0; double x = 0;
//计算每个采购计划明细的小计(单价*采购数量)
for ( for (
ProcurementContent procurementContent : list) { ProcurementContent procurementContent : list) {
x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice(); x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice();
} }
purchasingPlan.setAppropriationBudget(x); purchasingPlan.setAppropriationBudget(x);//经费预算
if (this.updateById(purchasingPlan)) { if (this.updateById(purchasingPlan)) {
return purchasingPlan; return purchasingPlan;
} else throw new RuntimeException(String.format("计算失败")); } else throw new RuntimeException(String.format("计算失败"));
} }
@Override @Override//查看换货信息
public ReplacementVO getReplacementVO(String id){ public ReplacementVO getReplacementVO(String id) {
ProcurementContent byId = procurementContentService.getById(id);
ReplacementVO replacementVO = new ReplacementVO(); ProcurementContent procurementContent = procurementContentService.getById(id);//采购计划明细
ReplacementVO replacementVO = new ReplacementVO();//换货VO
if (byId.getReplacementQuantity()!=null&&byId.getReplacementPrice()!=null&&byId.getReplacementRemark()!=null //判断换货信息是否充分
&&byId.getReplacementReagentConsumableId()!=null&&byId.getSupplierId()!=null){ if (procurementContent.getReplacementQuantity() != null && procurementContent.getReplacementPrice() != null && procurementContent.getReplacementRemark() != null
&& procurementContent.getReplacementReagentConsumableId() != null && procurementContent.getSupplierId() != null) {
replacementVO.setReplacementQuantity(byId.getReplacementQuantity()); SupplierInformation supplierInformation = supplierInformationService.getById(procurementContent.getSupplierId());//供应商
replacementVO.setReplacementRemark(byId.getReplacementRemark()); ReagentConsumables reagentConsumables = reagentConsumablesService.getById(procurementContent.getReplacementReagentConsumableId());//试剂耗材信息
replacementVO.setReplacementPrice(byId.getReplacementPrice());
replacementVO.setReplacementReagentConsumableId(byId.getReplacementReagentConsumableId());
replacementVO.setSupplierId(byId.getSupplierId());
SupplierInformation byId1 = supplierInformationService.getById(byId.getSupplierId());
replacementVO.setSupplierName(byId1.getSupplierName());
ReagentConsumables byId2 = reagentConsumablesService.getById(byId.getReplacementReagentConsumableId());
replacementVO.setReagentConsumables(byId2);}
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; return replacementVO;
} }

@ -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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.RemoteTemplate2htmlService;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService; import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile; import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.utils.PageUtils; import digital.laboratory.platform.reagent.utils.PageUtils;
import digital.laboratory.platform.reagent.entity.*; import digital.laboratory.platform.reagent.entity.*;
import digital.laboratory.platform.reagent.mapper.ReagentConsumableInventoryMapper; import digital.laboratory.platform.reagent.mapper.ReagentConsumableInventoryMapper;
import digital.laboratory.platform.reagent.service.*; import digital.laboratory.platform.reagent.service.*;
import digital.laboratory.platform.reagent.utils.QRCodeUtils;
import digital.laboratory.platform.reagent.vo.*; import digital.laboratory.platform.reagent.vo.*;
import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData;
import digital.laboratory.platform.sys.feign.RemoteCabinetService;
import feign.Response; import feign.Response;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile; import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
/** /**
@ -68,6 +75,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@Autowired @Autowired
private InstructionBookService instructionBookService; private InstructionBookService instructionBookService;
@Autowired
private RemoteCabinetService remoteCabinetService;
@Autowired @Autowired
private OssFile ossFile; private OssFile ossFile;
@ -218,13 +228,13 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@Override//分页查询标准物质 @Override//分页查询标准物质
public Page<ReagentConsumableInventoryFullVO> getAllList(Integer current, Integer size, QueryWrapper<ReagentConsumableInventory> qw,Integer status,String number) { public Page<ReagentConsumableInventoryFullVO> getAllList(Integer current, Integer size, QueryWrapper<ReagentConsumableInventory> qw, Integer status, String number) {
//如果扫码 //如果扫码
if (StrUtil.isNotBlank(number)){ if (StrUtil.isNotBlank(number)) {
ReferenceMaterial referenceMaterial = referenceMaterialService.getOne(Wrappers.<ReferenceMaterial>query().eq("number", number)); ReferenceMaterial referenceMaterial = referenceMaterialService.getOne(Wrappers.<ReferenceMaterial>query().eq("number", number));
if (referenceMaterial!=null) { if (referenceMaterial != null) {
ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId()); ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId());
@ -238,7 +248,8 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
return pages; return pages;
}} }
}
// List<ReferenceMaterial> list = referenceMaterialService.list(qw); // List<ReferenceMaterial> list = referenceMaterialService.list(qw);
// //
// List<ReagentConsumableInventoryFullVO> reagentConsumableInventoryFullVOList = new ArrayList<>(); // List<ReagentConsumableInventoryFullVO> reagentConsumableInventoryFullVOList = new ArrayList<>();
@ -368,7 +379,8 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOList); Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOList);
return pages;} return pages;
}
@Override//通过ID,获取标准物质所有信息 @Override//通过ID,获取标准物质所有信息
@ -621,7 +633,7 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
BeanUtils.copyProperties(referenceMaterialServiceById, referenceMaterial); BeanUtils.copyProperties(referenceMaterialServiceById, referenceMaterial);
//完善打印信息 //完善打印信息
referenceMaterial.setReferenceMaterialName(byId.getReagentConsumableName()); referenceMaterial.setReferenceMaterialName(byId.getReagentConsumableName());
referenceMaterial.setTime("到期:"+byId1.getExpirationDate()); referenceMaterial.setTime("到期:" + byId1.getExpirationDate());
data.put("referenceMaterial", referenceMaterial); data.put("referenceMaterial", referenceMaterial);
String templateFileName = "标准物质标签模板.vm"; String templateFileName = "标准物质标签模板.vm";
@ -639,8 +651,88 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
} }
@Override @Override
public List<UserVO> getUserList(){ public List<UserVO> getUserList() {
return baseMapper.getUserList(); return baseMapper.getUserList();
} }
@Override
@GlobalTransactional//盘点导入,需提供柜子系统数据
public void inventoryEntry(List<ReagentConsumableInventoryDTO> 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<CellAndStoreSupplyData> cellAndStoreSupplyDataArrayList = new ArrayList<>();//柜子数组
CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData();
cellAndStoreSupplyData.setCellStatus("1");
cellAndStoreSupplyData.setCellId(cabinetCell.getId());
ArrayList<String> 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");
}
}
} }

@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -59,8 +60,9 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
@Autowired @Autowired
private OssFile ossFile; private OssFile ossFile;
@Override @Override
public RequisitionRecord addRecord(OutgoingContents outgoingContents){ public RequisitionRecord addRecord(OutgoingContents outgoingContents) {
RequisitionRecord requisitionRecord = new RequisitionRecord(); RequisitionRecord requisitionRecord = new RequisitionRecord();
@ -74,15 +76,15 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
requisitionRecord.setSpecificationAndModel(byId.getSpecificationAndModel()); requisitionRecord.setSpecificationAndModel(byId.getSpecificationAndModel());
requisitionRecord.setReagentConsumableName(byId.getReagentConsumableName()); requisitionRecord.setReagentConsumableName(byId.getReagentConsumableName());
if (this.save(requisitionRecord)){ if (this.save(requisitionRecord)) {
return requisitionRecord; return requisitionRecord;
}else throw new RuntimeException(String.format("试剂耗材领用记录表创建失败")); } else throw new RuntimeException(String.format("试剂耗材领用记录表创建失败"));
} }
@Override @Override
public IPage<RequisitionRecordVO> getRequisitionRecordVOPage(IPage<RequisitionRecord> page, QueryWrapper<RequisitionRecord> qw){ public IPage<RequisitionRecordVO> getRequisitionRecordVOPage(IPage<RequisitionRecord> page, QueryWrapper<RequisitionRecord> qw) {
IPage<RequisitionRecordVO> requisitionRecordVOPage = baseMapper.getRequisitionRecordVOPage(page, qw); IPage<RequisitionRecordVO> requisitionRecordVOPage = baseMapper.getRequisitionRecordVOPage(page, qw);
@ -92,19 +94,18 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
} }
@Override @Override
public List<RequisitionRecordVO> getRequisitionRecordVO(String id){ public List<RequisitionRecordVO> getRequisitionRecordVO(String[] idList) {
ApplicationForUse byId = applicationForUseService.getById(id);
String deliveryRegistrationFormId = byId.getDeliveryRegistrationFormId();
List<RequisitionRecordVO> requisitionRecordVO = baseMapper.getRequisitionRecordVO(deliveryRegistrationFormId); List<RequisitionRecordVO> requisitionRecordVOS = new ArrayList<>();
for (String id : idList) {
return requisitionRecordVO; RequisitionRecordVO requisitionRecordVO = baseMapper.getRequisitionRecordVO(id);
requisitionRecordVOS.add(requisitionRecordVO);
}
return requisitionRecordVOS;
} }
@Override @Override
public void rquisitionRecordTablePDF(List<RequisitionRecordVO> voList,String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception { public void rquisitionRecordTablePDF(List<RequisitionRecordVO> voList, String id, HttpServletRequest theHttpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
System.out.println("RequisitionRecordTablePDF................."); System.out.println("RequisitionRecordTablePDF.................");
@ -112,7 +113,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
//----------------------------- //-----------------------------
// 生成 word 版本的 采购目录 // 生成 word 版本的 采购目录
String applyFileName = "试剂耗材领用记录表-"+id; String applyFileName = "试剂耗材领用记录表-" + id;
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet("template" + "/" + "试剂耗材领用记录表模板.docx", bos); ossFile.fileGet("template" + "/" + "试剂耗材领用记录表模板.docx", bos);
@ -129,7 +130,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
LocalDateTime dateOfClaim = requisitionRecordVO.getDateOfClaim(); LocalDateTime dateOfClaim = requisitionRecordVO.getDateOfClaim();
requisitionRecordVO.setDateOfClaims(LocalDateTimeUtil.format(dateOfClaim,"yyyy年MM月dd日")); requisitionRecordVO.setDateOfClaims(LocalDateTimeUtil.format(dateOfClaim, "yyyy年MM月dd日"));
requisitionRecordVO.setI(x); requisitionRecordVO.setI(x);
@ -147,7 +148,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
XWPFTemplate template = XWPFTemplate.compile(bis, config).render( XWPFTemplate template = XWPFTemplate.compile(bis, config).render(
new HashMap<String, Object>() {{ new HashMap<String, Object>() {{
put("voList", voList); put("voList", voList);
put("year",year); put("year", year);
}} }}
); );
bis.close(); bis.close();

@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -52,7 +53,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
@Autowired @Autowired
private RemoteCabinetService remoteCabinetService; private RemoteCabinetService remoteCabinetService;
@Autowired @Autowired
private BatchDetailsService batchDetailsService; private BatchDetailsService batchDetailsService;
@ -90,7 +90,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
@Autowired @Autowired
private PurchaseListService purchaseListService; private PurchaseListService purchaseListService;
@Autowired @Autowired
private AcceptanceSignForService acceptanceSignForService; private AcceptanceSignForService acceptanceSignForService;
@ -98,15 +97,10 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
public WarehousingRecordFormVO getWarehousingRecordFormVO(String warehousingFormId) { public WarehousingRecordFormVO getWarehousingRecordFormVO(String warehousingFormId) {
WarehousingRecordForm byId = this.getById(warehousingFormId); WarehousingRecordForm byId = this.getById(warehousingFormId);
WarehousingRecordFormVO warehousingRecordFormVO = new WarehousingRecordFormVO(); WarehousingRecordFormVO warehousingRecordFormVO = new WarehousingRecordFormVO();
BeanUtils.copyProperties(byId, warehousingRecordFormVO); BeanUtils.copyProperties(byId, warehousingRecordFormVO);
//查询出签收物品明细,将明细添加至签收记录VO
List<WarehousingContentVO> warehousingContentVOList = warehousingContentService.getWarehousingContentVOList(warehousingFormId); warehousingRecordFormVO.setWarehousingContentVOList(warehousingContentService.getWarehousingContentVOList(warehousingFormId));
warehousingRecordFormVO.setWarehousingContentVOList(warehousingContentVOList);
return warehousingRecordFormVO; return warehousingRecordFormVO;
} }
@ -114,153 +108,119 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
@Transactional @Transactional
@Override//录入入库明细 @Override//录入入库明细
public WarehousingRecordFormVO addFormById(WarehousingRecordFormDTO warehousingRecordFormDTO, DLPUser dlpUser) { public WarehousingRecordFormVO addFormById(WarehousingRecordFormDTO warehousingRecordFormDTO, DLPUser dlpUser) {
//必须选择存放位置才能入库
if (warehousingRecordFormDTO.getLatticeId().isEmpty() & warehousingRecordFormDTO.getLocation().isEmpty() & if (warehousingRecordFormDTO.getLatticeId().isEmpty() & warehousingRecordFormDTO.getLocation().isEmpty() &
warehousingRecordFormDTO.getBoxId().isEmpty()) { warehousingRecordFormDTO.getBoxId().isEmpty()) {
throw new RuntimeException(String.format("请选择存放位置后再进行提交")); throw new RuntimeException(String.format("请选择存放位置后再进行提交"));
} }
boolean flag = true;
int i = 0;
String latticeId = warehousingRecordFormDTO.getLatticeId();
//录入签收批次信息
WarehousingBatchList warehousingBatchList = new WarehousingBatchList();
String latticeId = warehousingRecordFormDTO.getLatticeId();//格子ID
String boxId = warehousingRecordFormDTO.getBoxId();//柜子ID
String location = warehousingRecordFormDTO.getLocation();//位置信息
//建立签收物品批次信息
WarehousingBatchList warehousingBatchList = new WarehousingBatchList();
BeanUtils.copyProperties(warehousingRecordFormDTO, warehousingBatchList); BeanUtils.copyProperties(warehousingRecordFormDTO, warehousingBatchList);
warehousingBatchList.setId(IdWorker.get32UUID().toUpperCase()); warehousingBatchList.setId(IdWorker.get32UUID().toUpperCase());
warehousingBatchList.setDepositorId(dlpUser.getId());//签收人
warehousingBatchList.setDateOfReceipt(LocalDateTime.now());//签收日期
warehousingBatchList.setLocation(location);//位置信息
warehousingBatchList.setDepositorId(dlpUser.getId()); WarehousingContent warehousingContent = warehousingContentService.getById(warehousingBatchList.getWarehousingContentId());//签收内容对象
warehousingBatchList.setDateOfReceipt(LocalDateTime.now());
warehousingBatchList.setLocation(warehousingRecordFormDTO.getLocation());
LambdaQueryWrapper<WarehousingBatchList> warehousingBatchListLambdaQueryWrapper = new LambdaQueryWrapper<>(); ReagentConsumables reagentConsumables = reagentConsumablesService.getById(warehousingContent.getReagentConsumableId());//得到试剂耗材对象
warehousingBatchListLambdaQueryWrapper.eq(WarehousingBatchList::getWarehousingContentId, warehousingBatchList.getWarehousingContentId()); Integer quantity = warehousingRecordFormDTO.getQuantity() * Integer.valueOf(reagentConsumables.getPackagedCopies());//入库数量=购买数量x包装份数
//通过判断签收内容表里的签收批次表数量,进行批次字段的赋值
warehousingBatchList.setBatch(warehousingBatchListService.list(warehousingBatchListLambdaQueryWrapper).size() + 1);
WarehousingContent byId = warehousingContentService.getById(warehousingBatchList.getWarehousingContentId()); //判断采购数量与签收数量
if (warehousingContent.getWarehousingQuantity() > warehousingContent.getTotalQuantity()) {
throw new RuntimeException(String.format("入库数量不能大于采购数量"));
}
byId.setLastStorageLocation(warehousingRecordFormDTO.getLocation()); warehousingBatchList.setBatch(warehousingBatchListService.list(Wrappers.<WarehousingBatchList>query().eq("warehousing_content_id", warehousingBatchList.getWarehousingContentId())).size() + 1);
byId.setBoxId(warehousingRecordFormDTO.getBoxId());
byId.setLatticeId(warehousingRecordFormDTO.getLatticeId());
byId.setWarehousingQuantity(byId.getWarehousingQuantity() + warehousingBatchList.getQuantity());
if (warehousingRecordFormDTO.getCode() != null) { warehousingContent.setLastStorageLocation(warehousingRecordFormDTO.getLocation());//记录存放位置信息,以便下次签收同样物品时可以回显位置信息
warehousingContent.setBoxId(boxId);//柜子ID
warehousingContent.setLatticeId(latticeId);//格子ID
byId.setCode(warehousingRecordFormDTO.getCode()); warehousingContent.setWarehousingQuantity(warehousingContent.getWarehousingQuantity() + warehousingBatchList.getQuantity());//修改签收数量
}
//判断采购数量与签收数量 if (warehousingRecordFormDTO.getCode() != null) {//如果填入物品编码,则记录,以便下次签收回显
if (byId.getWarehousingQuantity() > byId.getTotalQuantity()) { warehousingContent.setCode(warehousingRecordFormDTO.getCode());
throw new RuntimeException(String.format("入库数量不能大于采购数量"));
} }
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query().eq("reagent_consumable_id", warehousingContent.getReagentConsumableId()));
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query().eq("reagent_consumable_id", byId.getReagentConsumableId()));
//录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息 //录入仓库批次信息,若仓库不存在该物品,则新增该物品的库存信息
if (one == null) { if (one == null) {
ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory(); ReagentConsumableInventory reagentConsumableInventory = new ReagentConsumableInventory();//创建库存对象
LambdaQueryWrapper<ReagentConsumables> reagentConsumablesLambdaQueryWrapper = new LambdaQueryWrapper<>();
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.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase());
reagentConsumableInventory.setStatus(1); reagentConsumableInventory.setStatus(1);//状态 1为正常
reagentConsumableInventory.setCreateTime(LocalDateTime.now()); reagentConsumableInventory.setCreateTime(LocalDateTime.now());
reagentConsumableInventory.setUpdateTime(LocalDateTime.now()); reagentConsumableInventory.setUpdateTime(LocalDateTime.now());
reagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue()); reagentConsumableInventory.setWarningValue(warehousingRecordFormDTO.getWarningValue());//预警值
//如果供应商未提供物品编码,则需在入库时扫描标签录入编码 //如果供应商未提供物品编码,则需在入库时扫描标签录入编码
if (warehousingRecordFormDTO.getCode() != null) { if (warehousingRecordFormDTO.getCode() != null) {
reagentConsumableInventory.setCode(warehousingRecordFormDTO.getCode()); reagentConsumableInventory.setCode(warehousingRecordFormDTO.getCode());
reagentConsumables.setCode(warehousingRecordFormDTO.getCode()); reagentConsumables.setCode(warehousingRecordFormDTO.getCode());
reagentConsumablesService.updateById(reagentConsumables); reagentConsumablesService.updateById(reagentConsumables);
} }
BatchDetails batchDetails = new BatchDetails();//创建批次信息
BatchDetails batchDetails = new BatchDetails(); int year = Calendar.getInstance().get(Calendar.YEAR);//获取当前年
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails); BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);//拷贝批次信息
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase()); batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
batchDetails.setServiceStatus(1); batchDetails.setServiceStatus(1);//状态 1为正常
batchDetails.setPurchaseTime(LocalDateTime.now()); batchDetails.setPurchaseTime(LocalDateTime.now());//购买时间
batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId()); batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());//关联库存物品ID
batchDetails.setSupplierId(byId.getSupplierId()); batchDetails.setSupplierId(warehousingContent.getSupplierId());//供应商ID
batchDetails.setBatch(year + "-" + 1); batchDetails.setBatch(year + "-" + 1);//由于是第一次入库该物品,所以批次肯定为1
batchDetails.setLatticeId(latticeId);//赋值位置信息
batchDetails.setLocation(location);
batchDetails.setBoxId(boxId);
//如果未填写存储期限,则默认为可以一直存储
if (warehousingRecordFormDTO.getExpirationDate() != null) {
batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate()); batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
batchDetails.setQuantity(warehousingRecordFormDTO.getQuantity() * Integer.valueOf(reagentConsumables.getPackagedCopies())); } else {
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId()); batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
if (batchDetails.getQuantity() == null) {
batchDetails.setQuantity(0);
} }
batchDetails.setQuantity(quantity); //录入数量
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());//关联签收批次
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());//关联签收批次
if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) { if (reagentConsumables.getCategory().equals("试剂") | reagentConsumables.getCategory().equals("耗材")) {
//更新格子信息(试剂耗材传入类ID) //更新格子信息(试剂耗材传入类ID)
remoteCabinetService.updateCabinet(latticeId, byId.getReagentConsumableId(), "1"); remoteCabinetService.updateCabinet(latticeId, warehousingContent.getReagentConsumableId(), "1");
batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
}
if (reagentConsumableInventory.getTotalQuantity() == null) {
reagentConsumableInventory.setTotalQuantity(0);
} }
reagentConsumableInventory.setTotalQuantity(quantity);//数量
reagentConsumableInventory.setTotalQuantity(reagentConsumableInventory.getTotalQuantity() + batchDetails.getQuantity()); //如果是标准物质,则需生成编号
//如果是标准物质,则赋值编号
if (reagentConsumables.getCategory().equals("标准物质")) { if (reagentConsumables.getCategory().equals("标准物质")) {
//需生成对应购买数量的标准物质以及编号
batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
for (int j = 0; j < batchDetails.getQuantity(); j++) { for (int j = 0; j < batchDetails.getQuantity(); j++) {
ReferenceMaterial referenceMaterial = new ReferenceMaterial(); ReferenceMaterial referenceMaterial = new ReferenceMaterial();
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId());//试剂耗材ID
referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId()); referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId());//批次ID
referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId()); referenceMaterial.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId());//库存物品ID
referenceMaterial.setStatus(0); referenceMaterial.setStatus(0);//状态 0为正常
referenceMaterial.setLocation(warehousingRecordFormDTO.getLocation()); referenceMaterial.setLocation(location);
referenceMaterial.setLatticeId(warehousingRecordFormDTO.getLatticeId()); referenceMaterial.setLatticeId(latticeId);
referenceMaterial.setCustodianName(warehousingRecordFormDTO.getCustodianName()); referenceMaterial.setBoxId(boxId);
referenceMaterial.setBoxId(warehousingRecordFormDTO.getBoxId());
//更新格子信息(标准物质传入对象ID) //更新格子信息(标准物质传入对象ID)
remoteCabinetService.updateCabinet(latticeId, referenceMaterial.getId(), "1"); remoteCabinetService.updateCabinet(latticeId, referenceMaterial.getId(), "1");
//生成编号
String location = warehousingRecordFormDTO.getLocation();
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-"; String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-";
List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>query() List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>query()
.likeRight("number", prefix) .likeRight("number", prefix)
.orderByDesc("number")); .orderByDesc("number"));
int newNo = 1; int newNo = 1;
if ((list != null) && (list.size() > 0)) { if ((list != null) && (list.size() > 0)) {
ReferenceMaterial referenceMaterial1 = list.get(0); ReferenceMaterial referenceMaterial1 = list.get(0);
String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix); String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix);
@ -273,56 +233,46 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} }
} }
referenceMaterial.setNumber(prefix + String.format("%03d", newNo)); referenceMaterial.setNumber(prefix + String.format("%03d", newNo));
referenceMaterialService.save(referenceMaterial); referenceMaterialService.save(referenceMaterial);
} }
} }
reagentConsumableInventoryService.save(reagentConsumableInventory); reagentConsumableInventoryService.save(reagentConsumableInventory);
batchDetailsService.save(batchDetails); batchDetailsService.save(batchDetails);
} else { } else {
//如果仓库存在该物品 //如果仓库存在该物品
if (warehousingRecordFormDTO.getCode() != null) { if (warehousingRecordFormDTO.getCode() != null) {
one.setCode(warehousingRecordFormDTO.getCode()); one.setCode(warehousingRecordFormDTO.getCode());
ReagentConsumables byId1 = reagentConsumablesService.getById(one.getReagentConsumableId()); reagentConsumables.setCode(warehousingContent.getCode());
byId1.setCode(warehousingRecordFormDTO.getCode()); reagentConsumablesService.updateById(reagentConsumables);
reagentConsumablesService.updateById(byId1);
} }
LambdaQueryWrapper<ReagentConsumables> reagentConsumablesLambdaQueryWrapper = new LambdaQueryWrapper<>();
reagentConsumablesLambdaQueryWrapper.eq(ReagentConsumables::getReagentConsumableId, byId.getReagentConsumableId());
ReagentConsumables reagentConsumables = reagentConsumablesService.getOne(reagentConsumablesLambdaQueryWrapper);
BatchDetails batchDetails = new BatchDetails(); BatchDetails batchDetails = new BatchDetails();
BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails); BeanUtils.copyProperties(warehousingRecordFormDTO, batchDetails);
batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase()); batchDetails.setBatchDetailsId(IdWorker.get32UUID().toUpperCase());
batchDetails.setServiceStatus(1); batchDetails.setServiceStatus(1);
batchDetails.setPurchaseTime(LocalDateTime.now()); batchDetails.setPurchaseTime(LocalDateTime.now());
batchDetails.setSupplierId(byId.getSupplierId()); batchDetails.setSupplierId(warehousingContent.getSupplierId());
//如果未填写存储期限,则默认为可以一直存储
if (warehousingRecordFormDTO.getExpirationDate() != null) {
batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate()); batchDetails.setExpirationDate(warehousingRecordFormDTO.getExpirationDate());
} else {
batchDetails.setExpirationDate(LocalDate.now().plusYears(99));
}
batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId()); batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId());
batchDetails.setQuantity(warehousingRecordFormDTO.getQuantity() * Integer.valueOf(one.getPackagedCopies())); batchDetails.setQuantity(quantity);
batchDetails.setWarehousingBatchListId(warehousingBatchList.getId()); batchDetails.setWarehousingBatchListId(warehousingBatchList.getId());
warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId()); warehousingBatchList.setBatchId(batchDetails.getBatchDetailsId());
batchDetails.setLocation(location);
batchDetails.setLatticeId(latticeId);
batchDetails.setBoxId(boxId);
int year = Calendar.getInstance().get(Calendar.YEAR);
Calendar calendar = Calendar.getInstance(); Integer years = Integer.valueOf(year);//进行包装,方便运算
//查询相同年份相同供应商相同物品的所有批次信息
int year = calendar.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", one.getReagentConsumableInventoryId())
.eq("supplier_id", byId.getSupplierId()) .eq("supplier_id", warehousingContent.getSupplierId())
.like("batch", years)); .like("batch", years));
//如果没有批次信心,则默认为1
if (batchDetailsList.size() == 0) { if (batchDetailsList.size() == 0) {
batchDetails.setBatch(year + "-" + 1); batchDetails.setBatch(year + "-" + 1);
} else { } else {
@ -330,23 +280,14 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
batchDetails.setBatch(year + "-" + x); batchDetails.setBatch(year + "-" + x);
} }
if (one.getCategory().equals("试剂") | one.getCategory().equals("耗材")) { if (one.getCategory().equals("试剂") | one.getCategory().equals("耗材")) {
batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
//更新格子信息(试剂耗材传入类ID) //更新格子信息(试剂耗材传入类ID)
remoteCabinetService.updateCabinet(latticeId, byId.getReagentConsumableId(), "1"); remoteCabinetService.updateCabinet(latticeId, warehousingContent.getReagentConsumableId(), "1");
} }
one.setTotalQuantity(one.getTotalQuantity() + batchDetails.getQuantity()); one.setTotalQuantity(one.getTotalQuantity() + batchDetails.getQuantity());
one.setWarningValue(warehousingRecordFormDTO.getWarningValue()); one.setWarningValue(warehousingRecordFormDTO.getWarningValue());
if (one.getCategory().equals("标准物质")) { if (one.getCategory().equals("标准物质")) {
batchDetails.setLocation(warehousingRecordFormDTO.getLocation());
batchDetails.setLatticeId(warehousingRecordFormDTO.getLatticeId());
batchDetails.setBoxId(warehousingRecordFormDTO.getBoxId());
for (int j = 0; j < batchDetails.getQuantity(); j++) { for (int j = 0; j < batchDetails.getQuantity(); j++) {
ReferenceMaterial referenceMaterial = new ReferenceMaterial(); ReferenceMaterial referenceMaterial = new ReferenceMaterial();
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
referenceMaterial.setReagentConsumableId(one.getReagentConsumableId()); referenceMaterial.setReagentConsumableId(one.getReagentConsumableId());
@ -358,19 +299,13 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
referenceMaterial.setBoxId(warehousingRecordFormDTO.getBoxId()); referenceMaterial.setBoxId(warehousingRecordFormDTO.getBoxId());
referenceMaterial.setCustodianName(warehousingRecordFormDTO.getCustodianName()); referenceMaterial.setCustodianName(warehousingRecordFormDTO.getCustodianName());
//更新格子信息(试剂耗材传入类ID) //更新格子信息(试剂耗材传入类ID)
remoteCabinetService.updateCabinet(latticeId, referenceMaterial.getId(), "1"); remoteCabinetService.updateCabinet(latticeId, referenceMaterial.getId(), "1");
//生成编号
String location = warehousingRecordFormDTO.getLocation();
String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-"; String prefix = reagentConsumables.getAlias() + "-" + year + "-" + location.charAt(1) + "-";
List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>query() List<ReferenceMaterial> list = referenceMaterialService.list(Wrappers.<ReferenceMaterial>query()
.likeRight("number", prefix) .likeRight("number", prefix)
.orderByDesc("number")); .orderByDesc("number"));
int newNo = 1; int newNo = 1;
if ((list != null) && (list.size() > 0)) { if ((list != null) && (list.size() > 0)) {
ReferenceMaterial referenceMaterial1 = list.get(0); ReferenceMaterial referenceMaterial1 = list.get(0);
String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix); String strMaxNo = StrUtil.removePrefixIgnoreCase(referenceMaterial1.getNumber(), prefix);
@ -383,7 +318,6 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
} }
} }
referenceMaterial.setNumber(prefix + String.format("%03d", newNo)); referenceMaterial.setNumber(prefix + String.format("%03d", newNo));
referenceMaterialService.save(referenceMaterial); referenceMaterialService.save(referenceMaterial);
} }
@ -393,40 +327,34 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
batchDetailsService.save(batchDetails); batchDetailsService.save(batchDetails);
} }
warehousingContentService.updateById(byId);
warehousingContentService.updateById(warehousingContent);
warehousingBatchListService.save(warehousingBatchList); warehousingBatchListService.save(warehousingBatchList);
//至此,签收结束,下面将判断签收单是否完成
LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>(); String warehousingRecordFormId = warehousingContent.getWarehousingRecordFormId();
List<WarehousingContent> list = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id",warehousingRecordFormId));
String warehousingRecordFormId = byId.getWarehousingRecordFormId();
warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getWarehousingRecordFormId, warehousingRecordFormId);
List<WarehousingContent> list = warehousingContentService.list(warehousingContentLambdaQueryWrapper);
WarehousingRecordForm warehousingRecordForm = this.getById(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) { for (WarehousingContent warehousingContentFull : list) {
if (warehousingContent.getWarehousingQuantity() == warehousingContent.getTotalQuantity()) {
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.<AcceptanceSignFor>query().eq("warehousing_record_form_id", warehousingRecordFormId)); AcceptanceSignFor acceptanceSignForServiceOne = acceptanceSignForService.getOne(Wrappers.<AcceptanceSignFor>query().eq("warehousing_record_form_id", warehousingRecordFormId));
//首次创建
if (acceptanceSignForServiceOne == null) { if (acceptanceSignForServiceOne == null) {
AcceptanceSignFor acceptanceSignFor = new AcceptanceSignFor(); AcceptanceSignFor acceptanceSignFor = new AcceptanceSignFor();
acceptanceSignFor.setWarehousingRecordFormId(warehousingRecordFormId); acceptanceSignFor.setWarehousingRecordFormId(warehousingRecordFormId);
acceptanceSignFor.setId(IdWorker.get32UUID().toUpperCase()); acceptanceSignFor.setId(IdWorker.get32UUID().toUpperCase());
acceptanceSignFor.setQuantity(list.size()); acceptanceSignFor.setQuantity(list.size());
@ -435,76 +363,62 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
acceptanceSignForService.save(acceptanceSignFor); acceptanceSignForService.save(acceptanceSignFor);
AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.addForm(warehousingContent.getReagentConsumableId(), warehousingContent.getSupplierId(), acceptanceSignFor.getId()); AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.addForm(warehousingContent.getReagentConsumableId(), warehousingContent.getSupplierId(), acceptanceSignFor.getId());
warehousingContent.setAcceptanceRecordFormId(acceptanceRecordForm.getId()); warehousingContent.setAcceptanceRecordFormId(acceptanceRecordForm.getId());
} else { } else {
AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.addForm(warehousingContent.getReagentConsumableId(), warehousingContent.getSupplierId(), acceptanceSignForServiceOne.getId()); AcceptanceRecordForm acceptanceRecordForm = acceptanceRecordFormService.addForm(warehousingContent.getReagentConsumableId(), warehousingContent.getSupplierId(), acceptanceSignForServiceOne.getId());
warehousingContent.setAcceptanceRecordFormId(acceptanceRecordForm.getId()); warehousingContent.setAcceptanceRecordFormId(acceptanceRecordForm.getId());
} }
warehousingContentService.updateById(warehousingContent); warehousingContentService.updateById(warehousingContent);
} }
i = i + 1; i = i + 1;
} }
} }
//判断该清单所有试剂耗材是否入库完成 //判断该清单所有试剂耗材是否入库完成,若入库完成,则需生成供应商评价表
if (i == list.size()) { if (i == list.size()) {//如果签收完毕
List<SupplierInformation> supplierInformations = new ArrayList<>();//供应商集合
List<SupplierInformation> supplierInformations = new ArrayList<>();
//创建供应商评价表 //创建供应商评价表
/* /*
通过循环签收内容获得所有的供应商列表 通过循环签收内容获得所有的供应商列表
为每一个供应商创建一个评价表 为每一个供应商创建一个评价表
*/ */
for (WarehousingContent warehousingContent : list) { for (WarehousingContent warehousingContentFull : list) {//遍历签收物品明细
SupplierInformation supplierInformation = supplierInformationService.getById(warehousingContentFull.getSupplierId());//供应商
SupplierInformation supplierInformation = supplierInformationService.getById(warehousingContent.getSupplierId());
if (!supplierInformations.contains(supplierInformation)) { if (!supplierInformations.contains(supplierInformation)) {
supplierInformations.add(supplierInformation); supplierInformations.add(supplierInformation);//将所有供应商添加至集合
EvaluationForm evaluationForm = evaluationFormService.addForm(supplierInformation.getId()); EvaluationForm evaluationForm = evaluationFormService.addForm(supplierInformation.getId());//创建供应商评价表
warehousingContent.setEvaluationFormId(evaluationForm.getId()); warehousingContentFull.setEvaluationFormId(evaluationForm.getId());//关联供应商与签收明细
provideServicesOrSuppliesService.addById(evaluationForm.getId(), warehousingContent.getReagentConsumableId()); provideServicesOrSuppliesService.addById(evaluationForm.getId(), warehousingContentFull.getReagentConsumableId());//创建供应商提供物品信息
} else { } else {
//如果是相同供应商的物品
LambdaQueryWrapper<EvaluationForm> evaluationFormLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EvaluationForm> evaluationFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
evaluationFormLambdaQueryWrapper.eq(EvaluationForm::getSupplierInformationId, supplierInformation.getId()) evaluationFormLambdaQueryWrapper.eq(EvaluationForm::getSupplierInformationId, supplierInformation.getId())
.orderByDesc(EvaluationForm::getCreateTime); .orderByDesc(EvaluationForm::getCreateTime);
List<EvaluationForm> list1 = evaluationFormService.list(evaluationFormLambdaQueryWrapper); List<EvaluationForm> list1 = evaluationFormService.list(evaluationFormLambdaQueryWrapper);
provideServicesOrSuppliesService.addById(list1.get(0).getId(), warehousingContentFull.getReagentConsumableId());//为最新创建的评价表添加物品信息
provideServicesOrSuppliesService.addById(list1.get(0).getId(), warehousingContent.getReagentConsumableId());
} }
} }
warehousingRecordForm.setStatus(2);//改变签收单状态
warehousingRecordForm.setStatus(2);
} else { } else {
warehousingRecordForm.setStatus(1); warehousingRecordForm.setStatus(1);
} }
this.updateById(warehousingRecordForm); this.updateById(warehousingRecordForm);
WarehousingRecordFormVO warehousingRecordFormVO = this.getWarehousingRecordFormVO(warehousingRecordFormId);//签收单VO
WarehousingRecordFormVO warehousingRecordFormVO = this.getWarehousingRecordFormVO(warehousingRecordFormId);
return warehousingRecordFormVO; return warehousingRecordFormVO;
} }
@Override @Override
public IPage<WarehousingRecordFormVO> getWarehousingRecordFormVOPage(Page<WarehousingRecordForm> page, QueryWrapper<WarehousingRecordForm> qw) { public IPage<WarehousingRecordFormVO> getWarehousingRecordFormVOPage(Page<WarehousingRecordForm> page, QueryWrapper<WarehousingRecordForm> qw) {
IPage<WarehousingRecordFormVO> warehousingRecordFormVOPage = baseMapper.getWarehousingRecordFormVOPage(page, qw); IPage<WarehousingRecordFormVO> warehousingRecordFormVOPage = baseMapper.getWarehousingRecordFormVOPage(page, qw);//查询签收单列表
List<WarehousingRecordFormVO> records = warehousingRecordFormVOPage.getRecords(); List<WarehousingRecordFormVO> records = warehousingRecordFormVOPage.getRecords();
for (WarehousingRecordFormVO record : records) { for (WarehousingRecordFormVO record : records) {
List<WarehousingContent> warehousingContents = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", record.getId())); List<WarehousingContent> warehousingContents = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", record.getId()));
//计算签收(购买)物品总数与已签收数量
for (WarehousingContent warehousingContent : warehousingContents) { for (WarehousingContent warehousingContent : warehousingContents) {
Integer warehousingQuantity = warehousingContent.getWarehousingQuantity(); Integer warehousingQuantity = warehousingContent.getWarehousingQuantity();
Integer totalQuantity = warehousingContent.getTotalQuantity(); Integer totalQuantity = warehousingContent.getTotalQuantity();
if (record.getWarehousingQuantity() == null & record.getQuantityPurchased() == null) { if (record.getWarehousingQuantity() == null & record.getQuantityPurchased() == null) {
@ -514,14 +428,11 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
record.setWarehousingQuantity(record.getWarehousingQuantity() + warehousingQuantity); record.setWarehousingQuantity(record.getWarehousingQuantity() + warehousingQuantity);
record.setQuantityPurchased(record.getQuantityPurchased() + totalQuantity); record.setQuantityPurchased(record.getQuantityPurchased() + totalQuantity);
} }
} }
return warehousingRecordFormVOPage; return warehousingRecordFormVOPage;
} }
} }

@ -47,8 +47,7 @@
<select id="getReagentConsumableInventoryFullVOPage" <select id="getReagentConsumableInventoryFullVOPage"
resultType="digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO"> resultType="digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO">
select * select *
from reagent_consumable_inventory from reagent_consumable_inventory ${ew.customSqlSegment}
${ew.customSqlSegment}
</select> </select>
<select id="getReagentConsumableInventoryVOPage" resultMap="reagentConsumableInventoryVO" <select id="getReagentConsumableInventoryVOPage" resultMap="reagentConsumableInventoryVO"
@ -61,4 +60,15 @@
SELECT * SELECT *
FROM dlp_base.sys_user user FROM dlp_base.sys_user user
</select> </select>
<select id="getRoomInfo" resultType="digital.laboratory.platform.reagent.entity.Cabinetcell">
SELECT id FROM b_cabinet WHERE room_no = #{roomNo}
</select>
<select id="getCabinetCell" resultType="digital.laboratory.platform.reagent.entity.Cabinetcell">
SELECT *
FROM dlp_cabinet.b_cabinetcell
WHERE cabinet_Id in (SELECT id FROM dlp_cabinet.b_cabinet WHERE room_no = '707')
and location = #{location}
</select>
</mapper> </mapper>

@ -48,6 +48,6 @@
WHERE user.user_id=rr.recipient_id WHERE user.user_id=rr.recipient_id
) AS recipient_name ) AS recipient_name
FROM requisition_record rr FROM requisition_record rr
WHERE rr.id = #{id} WHERE rr.requisition_record_id = #{id}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save