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. 471
      src/main/java/digital/laboratory/platform/reagent/service/impl/PurchasingPlanServiceImpl.java
  16. 120
      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. 309
      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>
</dependency>
<dependency>
<groupId>digital.laboratory.platform</groupId>
<artifactId>dlp-common-seata</artifactId>
<version>2022.10.11-snapshots</version>
</dependency>
<!-- 业务数据的依赖 -->
<dependency>
<groupId>digital.laboratory.platform</groupId>

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

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

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

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

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

@ -34,7 +34,7 @@ public interface PurchasingPlanService extends IService<PurchasingPlan> {
@Transactional
PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user);
ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO);
// ProcurementContent addContent(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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.entity.ReagentConsumableInventory;
import digital.laboratory.platform.reagent.entity.ReferenceMaterial;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO;
import digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryVO;
import digital.laboratory.platform.reagent.vo.ReferenceMaterialVO;
import digital.laboratory.platform.reagent.vo.UserVO;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -53,4 +55,8 @@ public interface ReagentConsumableInventoryService extends IService<ReagentConsu
String printSolutionTag(String id);
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);
List<RequisitionRecordVO> getRequisitionRecordVO(String id);
List<RequisitionRecordVO> getRequisitionRecordVO(String [] idList);
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) {
for (AcceptanceRecordFormDTO acceptanceRecordFormDTO : acceptanceRecordFormDTOList) {
//调用单个提交方法
AcceptanceRecordForm acceptanceRecordForm = this.commitForm(acceptanceRecordFormDTO, dlpUser);
}
}
@Override
@Override//提交验收记录表
public AcceptanceRecordForm commitForm(AcceptanceRecordFormDTO acceptanceRecordFormDTO, DLPUser dlpUser) {
AcceptanceRecordForm byId = this.getById(acceptanceRecordFormDTO.getAcceptanceRecordFormId());
//将审核审批信息清空
//验收记录状态为-2,代表验收审核不通过后重新提交,需置空原有审核信息
if (byId.getStatus() == -2) {
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
byId.setUserName(dlpUser.getName());
byId.setAuditResultOfPrimary(false);
@ -150,6 +149,7 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
throw new RuntimeException(String.format("重新提交失败"));
}
}
//正常提交
BeanUtils.copyProperties(acceptanceRecordFormDTO, byId);
byId.setUserName(dlpUser.getName());
byId.setCommitTime(LocalDateTime.now());
@ -159,7 +159,7 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
if (this.updateById(byId)) {
return byId;
} 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.setId(IdWorker.get32UUID().toUpperCase());
acceptanceRecordForm.setSupplierId(supplierId);
acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);
acceptanceRecordForm.setSupplierId(supplierId);//供应商ID
acceptanceRecordForm.setAcceptanceSignForId(acceptanceSignForId);//验收分类ID
acceptanceRecordForm.setReagentConsumableId(reagentConsumableId);//验收试剂耗材ID
ReagentConsumables byId = reagentConsumablesService.getById(reagentConsumableId);
//将物品名称赋值给验收记录表
acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());
acceptanceRecordForm.setStatus(0);
acceptanceRecordForm.setReagentConsumableName(byId.getReagentConsumableName());//将物品名称赋值给验收记录表
acceptanceRecordForm.setStatus(0);//初始化状态
if ((this.save(acceptanceRecordForm))) {
@ -192,10 +188,10 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override
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();
//添加试剂耗材信息至VO
for (AcceptanceRecordFormVO record : records) {
ReagentConsumables byId = reagentConsumablesService.getById(record.getReagentConsumableId());
@ -206,39 +202,39 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
}
@Override
public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page) {
LambdaQueryWrapper<AcceptanceRecordForm> acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
List<AcceptanceRecordForm> list = this.list(acceptanceRecordFormLambdaQueryWrapper);
ArrayList<AcceptanceRecordFormVO> acceptanceRecordFormVOS = new ArrayList<>();
if (list.size() != 0) {
for (AcceptanceRecordForm acceptanceRecordForm : list) {
AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId());
acceptanceRecordFormVOS.add(acceptanceRecordFormVO);
}
}
PageUtils pageUtils = new PageUtils();
Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS);
return pages;
}
// @Override
// public IPage<AcceptanceRecordFormVO> getAcceptanceRecordFormVORecordPage(IPage<AcceptanceRecordForm> page) {
//
// LambdaQueryWrapper<AcceptanceRecordForm> acceptanceRecordFormLambdaQueryWrapper = new LambdaQueryWrapper<>();
//
// acceptanceRecordFormLambdaQueryWrapper.eq(AcceptanceRecordForm::getStatus, 4);
//
// List<AcceptanceRecordForm> list = this.list(acceptanceRecordFormLambdaQueryWrapper);
//
// ArrayList<AcceptanceRecordFormVO> acceptanceRecordFormVOS = new ArrayList<>();
//
// if (list.size() != 0) {
//
// for (AcceptanceRecordForm acceptanceRecordForm : list) {
//
// AcceptanceRecordFormVO acceptanceRecordFormVO = this.getAcceptanceRecordFormVO(acceptanceRecordForm.getId());
//
// acceptanceRecordFormVOS.add(acceptanceRecordFormVO);
// }
// }
// PageUtils pageUtils = new PageUtils();
//
// Page pages = pageUtils.getPages((int) page.getPages(), (int) page.getSize(), acceptanceRecordFormVOS);
//
// return pages;
// }
@Override
public AcceptanceRecordFormVO getAcceptanceRecordFormVO(String acceptanceRecordFormId) {
AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);
AcceptanceRecordFormVO acceptanceRecordFormVO = baseMapper.getAcceptanceRecordFormVO(acceptanceRecordFormId);//查询单个验收记录表
ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());
ReagentConsumables byId = reagentConsumablesService.getById(acceptanceRecordFormVO.getReagentConsumableId());//查询试剂耗材信息
acceptanceRecordFormVO.setReagentConsumables(byId);
@ -248,31 +244,29 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//一级审核
@Transactional
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 s : uuId) {
for (String id : uuId) {
AcceptanceRecordForm byId = this.getById(s);
AcceptanceRecordForm byId = this.getById(id);
if (byId.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
byId.setPrimaryAuditorId(dlpUser.getId());
byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());
byId.setAuditTimeOfPrimary(LocalDateTime.now());
byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());
byId.setPrimaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfPrimary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfPrimary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(2);
} else byId.setStatus(-2);
byId.setStatus(2);//审核成功状态
} else byId.setStatus(-2);//审核失败状态
acceptanceRecordForms.add(byId);
}
if (this.updateBatchById(acceptanceRecordForms)) {
return true;
} else throw new RuntimeException(String.format("审核失败"));
@ -282,26 +276,25 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//二级审核
@Transactional
public boolean secondaryAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();
for (String id : uuId) {
for (String s : uuId) {
AcceptanceRecordForm byId = this.getById(s);
AcceptanceRecordForm byId = this.getById(id);
if (byId.getStatus() != 2) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
byId.setSecondaryAuditorId(dlpUser.getId());
byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());
byId.setAuditTimeOfSecondary(LocalDateTime.now());
byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());
byId.setSecondaryAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfSecondary(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfSecondary(LocalDateTime.now());//审核时间,默认为接口执行时间
byId.setAuditResultOfSecondary(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
byId.setStatus(3);
} else byId.setStatus(-3);
byId.setStatus(3);//审核成功状态
} else byId.setStatus(-3);//审核失败状态
acceptanceRecordForms.add(byId);
}
if (this.updateBatchById(acceptanceRecordForms)) {
@ -313,78 +306,57 @@ public class AcceptanceRecordFormServiceImpl extends ServiceImpl<AcceptanceRecor
@Override//三级审核
@Transactional
public boolean threeLevelAudit(AcceptanceRecordFormAuditDTO acceptanceRecordFormAuditDTO, DLPUser dlpUser) {
//批量审核
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();//验收记录ID数组
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();//验收记录表集合
List<String> uuId = acceptanceRecordFormAuditDTO.getUuId();
List<AcceptanceRecordForm> acceptanceRecordForms = new ArrayList<>();
List<String> stringList = new ArrayList<>();
List<String> stringList = new ArrayList<>();//用于接收验收集合表ID
for (String s : uuId) {
AcceptanceRecordForm byId = this.getById(s);
if (!stringList.contains(byId.getAcceptanceSignForId())) {
if (!stringList.contains(byId.getAcceptanceSignForId())) {//添加验收集合表ID至数组
stringList.add(byId.getAcceptanceSignForId());
}
if (byId.getStatus() != 3) {
throw new RuntimeException(String.format("当前状态不能审核"));
}
byId.setThreeLevelAuditorId(dlpUser.getId());
byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());
byId.setAuditTimeOfThreeLevel(LocalDateTime.now());
byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {
if (byId.getNonconformingItem() != null) {
byId.setThreeLevelAuditorId(dlpUser.getId());//审核人ID
byId.setAuditOpinionOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditOpinion());//审核意见
byId.setAuditTimeOfThreeLevel(LocalDateTime.now());//审核时间
byId.setAuditResultOfThreeLevel(acceptanceRecordFormAuditDTO.getAuditResult());//审核结果
if (acceptanceRecordFormAuditDTO.getAuditResult() == true) {//审核通过
if (byId.getNonconformingItem() != null) {//验收不合格项目不为空,会写入供应商黑名单
blacklistService.addListById2(byId.getReagentConsumableId(), byId.getSupplierId());
}
byId.setStatus(6);
} else byId.setStatus(-4);
acceptanceRecordForms.add(byId);
}
if (this.updateBatchById(acceptanceRecordForms)) {
//判断是否验收完毕
//判断是否验收完毕,更改验收集合表状态
for (String s : stringList) {
AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);
List<WarehousingContent> warehousing_record_form_id = warehousingContentService.list(Wrappers.<WarehousingContent>query().eq("warehousing_record_form_id", warehousingRecordFormService.getById(acceptanceSignFor.getWarehousingRecordFormId()).getId()));
AcceptanceSignFor acceptanceSignFor = acceptanceSignForService.getById(s);//批量审核的验收记录关联的所有验收集合表
//得到签收物品集合
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));
if (warehousing_record_form_id.size() == recordFormList.size()) {
if (warehousingContentList.size() == recordFormList.size()) {//判断是否签收完毕(签收完成一条物品,才会生成一个验收记录表)
int x = 0;
for (AcceptanceRecordForm acceptanceRecordForm : recordFormList) {
if (acceptanceRecordForm.getStatus() == 6) {
if (acceptanceRecordForm.getStatus() == 6) {//验收审核通过的状态
x = x + 1;
}
}
if (x == recordFormList.size()) {
if (x == recordFormList.size()) {//验收审核通过的数量==总验收数量,验收集合项目完成
AcceptanceSignFor byId = acceptanceSignForService.getById(s);
byId.setStatus(2);
acceptanceSignForService.updateById(byId);
}
}

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

@ -94,44 +94,34 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
@Override//通过ID查找清单
public PurchaseListVO getPurchaseList(String purchaseListId) {
PurchaseListVO purchaseListVO = new PurchaseListVO();
PurchaseListVO purchaseListVO = new PurchaseListVO();//采购清单VO
PurchaseList byId = this.getById(purchaseListId);
List<PurchaseListDetailsVO> purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId);
BeanUtils.copyProperties(byId, purchaseListVO);
PurchaseList purchaseList = this.getById(purchaseListId);
List<PurchaseListDetailsVO> purchaseListDetailsVOList = purchaseListDetailsService.getPurchaseListDetailsVOList(purchaseListId);//采购清单明细
BeanUtils.copyProperties(purchaseList, purchaseListVO);//拷贝
for (PurchaseListDetailsVO purchaseListDetailsVO : purchaseListDetailsVOList) {
LambdaQueryWrapper<SupplierInformation> supplierInformationLambdaQueryWrapper = new LambdaQueryWrapper<>();
//赋值供应商名称
if (purchaseListDetailsVO.getSupplierId() != null) {
supplierInformationLambdaQueryWrapper.eq(SupplierInformation::getId, purchaseListDetailsVO.getSupplierId());
SupplierInformation one = supplierInformationService.getOne(supplierInformationLambdaQueryWrapper);
purchaseListDetailsVO.setSupplierName(one.getSupplierName());
}
}
purchaseListVO.setPurchaseListDetailsVOS(purchaseListDetailsVOList);
return purchaseListVO;
}
@Override
@Transactional
//修改采购清单,批量或单个
public void editById(List<PurchaseListDTO> purchaseListDTOList) {
for (PurchaseListDTO purchaseListDTO : purchaseListDTOList) {
PurchaseListDetails byId = purchaseListDetailsService.getById(purchaseListDTO.getId());
byId.setSupplierId(purchaseListDTO.getSupplierId());
purchaseListDetailsService.updateById(byId);
PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId());
purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());//只需修改绑定的供应商ID即可
purchaseListDetailsService.updateById(purchaseListDetails);
}
}
@ -141,92 +131,74 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
PurchaseList purchaseList = this.getById(id);
//将集中采购与分散采购申请的状态改变
if (purchaseList.getType().equals("采购计划")) {
if (purchaseList.getType().equals("采购计划")) {//区分类别,以便查找对应的采购申请
PurchasingPlan plan = purchasingPlanService.getOne(Wrappers.<PurchasingPlan>query()
.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()));
for (CentralizedRequest centralizedRequest : centralizedRequestList) {
centralizedRequest.setStatus(4);
centralizedRequestService.updateById(centralizedRequest);
}
} else {
DecentralizedRequest purchase_list_id = decentralizedRequestService.getOne(Wrappers.<DecentralizedRequest>query()
//除了采购计划,就是分散采购申请
DecentralizedRequest decentralizedRequest = decentralizedRequestService.getOne(Wrappers.<DecentralizedRequest>query()
.eq("purchase_list_id", id));
purchase_list_id.setStatus(6);
decentralizedRequestService.updateById(purchase_list_id);
decentralizedRequest.setStatus(6);
decentralizedRequestService.updateById(decentralizedRequest);
}
purchaseList.setStatus(1);
purchaseList.setStatus(1);//提交状态
LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getPurchaseListId, purchaseList.getId());
List<PurchaseListDetails> purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);
List<PurchaseListDetails> purchaseListDetailsList = purchaseListDetailsService.list(purchaseListDetailsLambdaQueryWrapper);//采购清单明细
//创建入库内容集合
List<WarehousingContent> warehousingContentList = new ArrayList<>();
//创建入库记录表
WarehousingRecordForm warehousingRecordForm = new WarehousingRecordForm();
//录入入库记录表信息
warehousingRecordForm.setId(IdWorker.get32UUID().toUpperCase());
warehousingRecordForm.setPurchaseListId(purchaseList.getId());
warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");
warehousingRecordForm.setStatus(0);
warehousingRecordForm.setPurchaseListId(purchaseList.getId());//关联采购清单
warehousingRecordForm.setPurchaseNumber(LocalDate.now() + "入库任务");//任务名称,用时间命名
warehousingRecordForm.setStatus(0);//初始状态
for (PurchaseListDetails purchaseListDetails : purchaseListDetailsList) {
ReagentConsumables byId = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId());
ReagentConsumableInventory one = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query()
.eq("reagent_consumable_id", byId.getReagentConsumableId()));
//得到该试剂耗材的库存情况
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchaseListDetails.getReagentConsumableId());
ReagentConsumableInventory reagentConsumableInventory = reagentConsumableInventoryService.getOne(Wrappers.<ReagentConsumableInventory>query()
.eq("reagent_consumable_id", reagentConsumables.getReagentConsumableId()));
WarehousingContent warehousingContent = new WarehousingContent();
//完善入库内容信息
//完善入库明细内容信息
warehousingContent.setId(IdWorker.get32UUID().toUpperCase());
warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//试剂耗材名称
warehousingContent.setTotalQuantity(purchaseListDetails.getPurchaseQuantity());//采购数量
warehousingContent.setReagentConsumableId(purchaseListDetails.getReagentConsumableId());//试剂耗材ID
warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());//关联入库表
warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());//供应商ID
warehousingContent.setWarehousingQuantity(0);//初始状态
if (reagentConsumables.getCode()!=null){
warehousingContent.setCode(reagentConsumables.getCode());//物品编码
}
warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());//关联采购清单明细
warehousingContent.setReagentConsumableName(byId.getReagentConsumableName());
warehousingContent.setTotalQuantity(purchaseListDetails.getPurchaseQuantity());
warehousingContent.setReagentConsumableId(purchaseListDetails.getReagentConsumableId());
warehousingContent.setWarehousingRecordFormId(warehousingRecordForm.getId());
warehousingContent.setSupplierId(purchaseListDetails.getSupplierId());
warehousingContent.setWarehousingQuantity(0);
warehousingContent.setCode(byId.getCode());
warehousingContent.setPurchaseListDetailsId(purchaseListDetails.getId());
if (one != null) {
List<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", one.getReagentConsumableInventoryId())
if (reagentConsumableInventory != null) {//如果仓库存在该试剂耗材
//所有批次信息
List<BatchDetails> batchDetailsList = batchDetailsService.list(Wrappers.<BatchDetails>query().eq("reagent_consumable_inventory_id", reagentConsumableInventory.getReagentConsumableInventoryId())
.orderByDesc("create_time"));
warehousingContent.setWarningValue(one.getWarningValue());
warehousingContent.setWarningValue(reagentConsumableInventory.getWarningValue());
//如果存在批次信息,则提供上次位置信息,以便用户存放物品
if (batchDetailsList.size() != 0 && batchDetailsList != null) {
warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation());
warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId());
warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());
warehousingContent.setLastStorageLocation(batchDetailsList.get(0).getLocation());//位置信息
warehousingContent.setBoxId(batchDetailsList.get(0).getBoxId());//柜子ID
warehousingContent.setLatticeId(batchDetailsList.get(0).getLatticeId());//格子ID
}
}
LambdaQueryWrapper<CatalogueDetails> catalogueDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
catalogueDetailsLambdaQueryWrapper.eq(CatalogueDetails::getReagentConsumableId, warehousingContent.getReagentConsumableId());
List<CatalogueDetails> list = catalogueDetailsService.list(catalogueDetailsLambdaQueryWrapper);
warehousingContentList.add(warehousingContent);
}
if (this.updateById(purchaseList) & warehousingRecordFormService.save(warehousingRecordForm)
& warehousingContentService.saveBatch(warehousingContentList)) {
return purchaseList;
@ -239,22 +211,14 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
@Override//录入采购清单明细
public PurchaseListDetailsVO addDetails(PurchaseListDTO purchaseListDTO) {
String purchaseListId = purchaseListDTO.getPurchaseListId();
PurchaseList byId = this.getById(purchaseListId);
PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getById(purchaseListDTO.getId());
purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());
purchaseListDetails.setSupplierId(purchaseListDTO.getSupplierId());//供应商ID
purchaseListDetailsService.updateById(purchaseListDetails);
PurchaseListDetailsVO purchaseListDetailsVO = purchaseListDetailsService.getPurchaseListDetailsVO(purchaseListDetails.getId());
PurchaseListDetailsVO purchaseListDetailsVO = purchaseListDetailsService.getPurchaseListDetailsVO(purchaseListDetails.getId());//返回更新后的数据
return purchaseListDetailsVO;
}
@Override
@Override//分页查询采购清单列表
public IPage<PurchaseListPageVO> getPurchaseListVOPage(IPage<PurchaseList> page, @Param(Constants.WRAPPER) QueryWrapper<PurchaseList> qw) {
IPage<PurchaseListPageVO> purchaseListVOPage = baseMapper.getPurchaseListVOPage(page, qw);
@ -262,5 +226,4 @@ public class PurchaseListServiceImpl extends ServiceImpl<PurchaseListMapper, Pur
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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
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.entity.*;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -32,6 +31,7 @@ import java.util.List;
* @describe (采购计划) 服务实现类
*/
@Service
@SuppressWarnings("all")
public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper, PurchasingPlan> implements PurchasingPlanService {
@Autowired
private ProcurementContentService procurementContentService;
@ -57,13 +57,13 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Autowired
private SupplierInformationService supplierInformationService;
@Override//分页
@Override//分页查询
public IPage<PurchasingPlanVO> getPurchasingPlanVOPage(IPage<PurchasingPlan> page, QueryWrapper<PurchasingPlan> qw) {
IPage<PurchasingPlanVO> purchasingPlanVOPage = baseMapper.getPurchasingPlanVOPage(page, qw);
return purchasingPlanVOPage;
}
@Override//列表
@Override//采购计划集合
public List<PurchasingPlanVO> getPurchasingPlanVOList(QueryWrapper<PurchasingPlan> qw) {
return baseMapper.getPurchasingPlanVOList(qw);
}
@ -72,16 +72,11 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
public PurchasingPlanVO getPurchasingPlanVO(String purchasingPlanId) {
PurchasingPlanVO purchasingPlanVO = baseMapper.getPurchasingPlanVO(purchasingPlanId);
if (purchasingPlanVO == null) {
throw new RuntimeException(String.format("信息不存在"));
}
List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);
List<ProcurementContentVO> procurementContentVOList = procurementContentService.getProcurementContentVOList(purchasingPlanId);//将采购计划明细Set至采购计划VO
purchasingPlanVO.setProcurementContentVOList(procurementContentVOList);
return purchasingPlanVO;
}
@ -89,144 +84,102 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Override//创建计划
public PurchasingPlanVO addById(List<PurchasingPlanDTO> purchasingPlanDTOList, DLPUser user) {
PurchasingPlan purchasingPlan = new PurchasingPlan();
PurchasingPlan purchasingPlan = new PurchasingPlan();//创建采购计划
purchasingPlan.setPurchasingPlanId(IdWorker.get32UUID().toUpperCase());
purchasingPlan.setCreateId(user.getId());
purchasingPlan.setStatus(0);
purchasingPlan.setCreateName(user.getName());
purchasingPlan.setCreateId(user.getId());//创建人ID
purchasingPlan.setStatus(0);//状态
purchasingPlan.setCreateName(user.getName());//创建人名称
List<ProcurementContent> list = new ArrayList<>();//需要整合的集合
boolean flag = true;
for (PurchasingPlanDTO purchasingPlanDTO : purchasingPlanDTOList) {
//将列入计划的集中采购申请状态变为3
String detailsOfCentralizedId = purchasingPlanDTO.getDetailsOfCentralizedId();
DetailsOfCentralized byId2 = detailsOfCentralizedService.getById(detailsOfCentralizedId);
CentralizedRequest byId3 = requestService.getById(byId2.getCentralizedRequestId());
byId3.setStatus(3);
CentralizedRequest centralizedRequest = requestService.getById(detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId()).getCentralizedRequestId());
centralizedRequest.setStatus(3);
centralizedRequest.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
requestService.updateById(centralizedRequest);
byId3.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
requestService.updateById(byId3);
DetailsOfCentralized detailsOfCentralized = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());//集中采购申请明细
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(detailsOfCentralized.getReagentConsumableId());//试剂耗材信息
flag = true;
//
//合并相同的采购内容
//合并相同的采购内容,若存在相同的采购物品,则无需创建计划明细,将采购申请明细与该计划明细关联即可
if (list.size() != 0) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getReagentConsumableId().equals(purchasingPlanDTO.getReagentConsumableId())) {
ReagentConsumables byId1 = reagentConsumablesService.getById(list.get(i).getReagentConsumableId());
list.get(i).setUnitPrice(byId1.getUnitPrice());
list.get(i).setUnitPrice(reagentConsumables.getUnitPrice());//获取单价
//Set采购数量
list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());
list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());
list.get(i).setQuantityPurchased(list.get(i).getQuantityPurchased() + purchasingPlanDTO.getNumberOfApplications());//合并之前的数量加上被合并对象的数量
list.get(i).setSubtotal(list.get(i).getQuantityPurchased() * list.get(i).getUnitPrice());//计算小计
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
byId.setQuantityPurchased(byId.getNumberOfApplications());
byId.setProcurementContentId(list.get(i).getProcurementContentId());
detailsOfCentralizedService.updateById(byId);
//添加采购申请明细的采购数量
detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());
detailsOfCentralized.setProcurementContentId(list.get(i).getProcurementContentId());
detailsOfCentralizedService.updateById(detailsOfCentralized);
//被合并后,改变flag,进入下一个循环
flag = false;
}
}
//无需合并的采购计划明细
if (flag) {
ProcurementContent procurementContent = new ProcurementContent();
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
ProcurementContent procurementContent = new ProcurementContent();//新建计划明细
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);//拷贝
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());//关联计划ID
procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications());//赋值采购数量
detailsOfCentralized.setQuantityPurchased(detailsOfCentralized.getNumberOfApplications());//赋值采购数量
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());//单价
procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());//小计
detailsOfCentralized.setProcurementContentId(procurementContent.getProcurementContentId());//采购申请明细关联采购计划明细
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
procurementContent.setQuantityPurchased(purchasingPlanDTO.getNumberOfApplications());
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
byId.setQuantityPurchased(byId.getNumberOfApplications());
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId());
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
procurementContent.setSubtotal(procurementContent.getUnitPrice() * procurementContent.getQuantityPurchased());
byId.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralizedService.updateById(byId);
list.add(procurementContent);
detailsOfCentralizedService.updateById(detailsOfCentralized);
list.add(procurementContent);//将计划明细添加至集合
}
} else {
} else {//对于首次循环,List一定为空,故执行下列语句,且只会执行一次
ProcurementContent procurementContent = new ProcurementContent();
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
DetailsOfCentralized byId = detailsOfCentralizedService.getById(purchasingPlanDTO.getDetailsOfCentralizedId());
byId.setQuantityPurchased(byId.getNumberOfApplications());
procurementContent.setProcurementContentId(IdWorker.get32UUID().toUpperCase());
procurementContent.setPurchasingPlanId(purchasingPlan.getPurchasingPlanId());
procurementContent.setQuantityPurchased(procurementContent.getNumberOfApplications());
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(byId.getReagentConsumableId());
procurementContent.setUnitPrice(reagentConsumables.getUnitPrice());
procurementContent.setSubtotal(procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice());
byId.setProcurementContentId(procurementContent.getProcurementContentId());
detailsOfCentralizedService.updateById(byId);
list.add(procurementContent);
}
}
if (this.save(purchasingPlan) & procurementContentService.saveBatch(list)) {
calculatedAmount(purchasingPlan.getPurchasingPlanId());
PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());
calculatedAmount(purchasingPlan.getPurchasingPlanId());//计算经费预算
PurchasingPlanVO purchasingPlanVO = this.getPurchasingPlanVO(purchasingPlan.getPurchasingPlanId());//获取VO
return purchasingPlanVO;
} else throw new RuntimeException(String.format("保存失败"));
}
@Override
public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
ProcurementContent procurementContent = new ProcurementContent();
BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
if (procurementContentService.save(procurementContent)) {
return procurementContent;
} else {
return null;
}
}
// @Override//新增明细
// public ProcurementContent addContent(PurchasingPlanDTO purchasingPlanDTO) {
//
// ProcurementContent procurementContent = new ProcurementContent();
//
// BeanUtils.copyProperties(purchasingPlanDTO, procurementContent);
//
// if (procurementContentService.save(procurementContent)) {
// return procurementContent;
// } else {
// return null;
// }
// }
@Override
@Transactional
@Transactional//修改采购计划明细(已废弃)
public ProcurementContent editById(PurchasingPlanDTO purchasingPlanDTO) {
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());
@ -254,80 +207,58 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
}
@Override//修改整合的采购计划明细中的申请明细
@Override//修改整合的采购计划明细中的采购申请明细
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) {
//原本合并总数量-采购申请明细数量+采购申请明细修改后的数量
procurementContent.setQuantityPurchased(procurementContent.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased());
byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getNumberOfApplications() + purchasingPlanDTO.getQuantityPurchased());
} else {
byId.setQuantityPurchased(byId.getQuantityPurchased() - detailsOfCentralized.getQuantityPurchased() + purchasingPlanDTO.getQuantityPurchased());
} else {//原本合并总数量-采购申请修改后的采购数量+修改数量
procurementContent.setQuantityPurchased(procurementContent.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());
detailsOfCentralized.setQuantityPurchased(purchasingPlanDTO.getQuantityPurchased());
detailsOfCentralized.setDetailsRemark(purchasingPlanDTO.getPlanRemark());
calculatedAmount(byId.getPurchasingPlanId());
if (procurementContentService.updateById(byId) && detailsOfCentralizedService.updateById(detailsOfCentralized)) {
calculatedAmount(byId.getPurchasingPlanId());
return byId;
if (procurementContentService.updateById(procurementContent) && detailsOfCentralizedService.updateById(detailsOfCentralized)) {
calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
return procurementContent;
} else throw new RuntimeException(String.format("修改失败"));
}
@Override
@Transactional
@Transactional//删除一条计划明细
public Boolean delContentById(String procurementContentId) {
ProcurementContent byId = procurementContentService.getById(procurementContentId);
LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>();
detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, procurementContentId);
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
ProcurementContent procurementContent = procurementContentService.getById(procurementContentId);//采购计划明细
//该采购计划明细关联的集中采购申请明细
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContentId));
for (DetailsOfCentralized detailsOfCentralized : list) {
detailsOfCentralized.setQuantityPurchased(0);
detailsOfCentralized.setQuantityPurchased(0);//采购申请明细的采购数量
}
PurchasingPlan purchasingPlan = this.getById(byId.getPurchasingPlanId());
PurchasingPlan purchasingPlan = this.getById(procurementContent.getPurchasingPlanId());//采购计划
if (this.getById(byId.getPurchasingPlanId()).getStatus() == 0
if (this.getById(procurementContent.getPurchasingPlanId()).getStatus() == 0
&& detailsOfCentralizedService.updateBatchById(list) && procurementContentService.removeById(procurementContentId)) {
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
List<ProcurementContent> list1 = procurementContentService.list(procurementContentLambdaQueryWrapper);
if (list1.size() == 0) {
List<ProcurementContent> procurementContentList = procurementContentService.list(Wrappers.<ProcurementContent>query().eq("purchasing_plan_id", purchasingPlan.getPurchasingPlanId()));
//如果采购计划的明细全部被删除,则自动删除这个采购计划
if (procurementContentList.size() == 0) {
this.removeById(purchasingPlan);
return true;
}
calculatedAmount(byId.getPurchasingPlanId());
calculatedAmount(procurementContent.getPurchasingPlanId());//计算经费预算
return true;
} else {
return null;
@ -337,114 +268,96 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
@Override//换货
public ProcurementContent replacementById(PurchasingPlanDTO purchasingPlanDTO) {
String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId();
ProcurementContent byId = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());
String replacementReagentConsumableId = purchasingPlanDTO.getReplacementReagentConsumableId();//换货试剂耗材ID
ProcurementContent procurementContent = procurementContentService.getById(purchasingPlanDTO.getProcurementContentId());//采购计划明细
//将换货信息补充至采购计划明细
byId.setReplacementReagentConsumableId(replacementReagentConsumableId);
byId.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());
byId.setReplacementPrice(purchasingPlanDTO.getReplacementPrice());
byId.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());
byId.setSupplierId(purchasingPlanDTO.getSupplierId());
LambdaQueryWrapper<DetailsOfCentralized> detailsOfCentralizedLambdaQueryWrapper = new LambdaQueryWrapper<>();
detailsOfCentralizedLambdaQueryWrapper.eq(DetailsOfCentralized::getProcurementContentId, byId.getProcurementContentId());
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(detailsOfCentralizedLambdaQueryWrapper);
procurementContent.setReplacementReagentConsumableId(replacementReagentConsumableId);//换货试剂耗材ID
procurementContent.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());//换货数量
procurementContent.setReplacementPrice(purchasingPlanDTO.getReplacementPrice());//换货单价
procurementContent.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());//换货备注
procurementContent.setSupplierId(purchasingPlanDTO.getSupplierId());//换货供应商ID
//关联这个采购计划明细的所有采购申请明细
List<DetailsOfCentralized> list = detailsOfCentralizedService.list(Wrappers.<DetailsOfCentralized>query().eq("procurement_content_id", procurementContent.getProcurementContentId()));
LambdaQueryWrapper<PurchaseListDetails> purchaseListDetailsLambdaQueryWrapper = new LambdaQueryWrapper<>();
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, byId.getProcurementContentId());
PurchaseListDetails one = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);
purchaseListDetailsLambdaQueryWrapper.eq(PurchaseListDetails::getProcurementContentId, procurementContent.getProcurementContentId());
PurchaseListDetails purchaseListDetails = purchaseListDetailsService.getOne(purchaseListDetailsLambdaQueryWrapper);//查询是否有采购清单
//如果存在采购清单,则需修改清单信息
if (one != null) {
if (purchaseListDetails != null) {
LambdaQueryWrapper<WarehousingContent> warehousingContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, purchaseListDetails.getId());
warehousingContentLambdaQueryWrapper.eq(WarehousingContent::getPurchaseListDetailsId, one.getId());
one.setSupplierId(purchasingPlanDTO.getSupplierId());
one.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());
one.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());
purchaseListDetails.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
purchaseListDetails.setPurchaseQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
purchaseListDetails.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
purchaseListDetailsService.updateById(one);
purchaseListDetailsService.updateById(purchaseListDetails);
WarehousingContent one1 = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper);
WarehousingContent warehousingContent = warehousingContentService.getOne(warehousingContentLambdaQueryWrapper);
//若存在入库信息,则需修改入库记录
if (one1 != null) {
if (one1.getWarehousingQuantity() == 0) {
one1.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());
one1.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());
one1.setSupplierId(purchasingPlanDTO.getSupplierId());
ReagentConsumables byId1 = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId());
one1.setReagentConsumableName(byId1.getReagentConsumableName());
warehousingContentService.updateById(one1);
if (warehousingContent != null) {
if (warehousingContent.getWarehousingQuantity() == 0) {
warehousingContent.setReagentConsumableId(purchasingPlanDTO.getReplacementReagentConsumableId());//采购试剂耗材ID
warehousingContent.setTotalQuantity(purchasingPlanDTO.getReplacementQuantity());//采购数量
warehousingContent.setSupplierId(purchasingPlanDTO.getSupplierId());//供应商ID
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(purchasingPlanDTO.getReplacementReagentConsumableId());
warehousingContent.setReagentConsumableName(reagentConsumables.getReagentConsumableName());//采购试剂耗材名称
warehousingContentService.updateById(warehousingContent);
} else {
//如果已入库,则不能换货
throw new RuntimeException(String.format("该物品已被签收入库,无法进行换货处理"));
}
}
}
//将换货信息补充至每一个集中采购申请明细
for (DetailsOfCentralized detailsOfCentralized : list) {
detailsOfCentralized.setReplacementReagentConsumableId(replacementReagentConsumableId);
detailsOfCentralized.setReplacementQuantity(purchasingPlanDTO.getReplacementQuantity());
detailsOfCentralized.setReplacementRemark(purchasingPlanDTO.getReplacementRemark());
detailsOfCentralizedService.updateById(detailsOfCentralized);
}
//将换货信息补充至集中采购申请明细
if (procurementContentService.updateById(byId)) {
return byId;
if (procurementContentService.updateById(procurementContent)) {
return procurementContent;
} else throw new RuntimeException(String.format("换货失败"));
}
@Override
public PurchasingPlan commitById(String purchasingPlanId) {
PurchasingPlan byId = this.getById(purchasingPlanId);
//若是审核审批不通过时的提交,则需清空原有的审核审批信息
if (byId.getStatus()==-4){
byId.setAuditOpinionOfPrimary("");
byId.setAuditResultOfPrimary(false);
byId.setPrimaryAuditorId("");
byId.setAuditTimeOfPrimary(null);
PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);
//若是审核审批不通过时提交,则需清空原有的审核审批信息
//审核不通过
if (purchasingPlan.getStatus() == -4) {
purchasingPlan.setAuditOpinionOfPrimary("");
purchasingPlan.setAuditResultOfPrimary(false);
purchasingPlan.setPrimaryAuditorId("");
purchasingPlan.setAuditTimeOfPrimary(null);
}
if (byId.getStatus()==-5){
byId.setAuditOpinionOfPrimary("");
byId.setAuditResultOfPrimary(false);
byId.setPrimaryAuditorId("");
byId.setAuditTimeOfPrimary(null);
byId.setApproverId("");
byId.setApprovalOpinion("");
byId.setApprovalResult(false);
byId.setApprovalTime(null);
//审批不通过
if (purchasingPlan.getStatus() == -5) {
purchasingPlan.setAuditOpinionOfPrimary("");
purchasingPlan.setAuditResultOfPrimary(false);
purchasingPlan.setPrimaryAuditorId("");
purchasingPlan.setAuditTimeOfPrimary(null);
purchasingPlan.setApproverId("");
purchasingPlan.setApprovalOpinion("");
purchasingPlan.setApprovalResult(false);
purchasingPlan.setApprovalTime(null);
}
byId.setStatus(1);
byId.setCommitTime(LocalDateTime.now());
if (this.updateById(byId)) {
calculatedAmount(byId.getPurchasingPlanId());
return byId;
purchasingPlan.setStatus(1);
purchasingPlan.setCommitTime(LocalDateTime.now());//
if (this.updateById(purchasingPlan)) {
calculatedAmount(purchasingPlan.getPurchasingPlanId());
return purchasingPlan;
} else throw new RuntimeException(String.format("提交失败"));
}
@Override
@Override//审核采购计划
public PurchasingPlan auditById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) {
PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId());
@ -452,20 +365,16 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
if (purchasingPlan.getStatus() != 1) {
throw new RuntimeException(String.format("当前状态不可审核"));
}
purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult());
purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion());
purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now());
purchasingPlan.setPrimaryAuditorId(dlpUser.getId());
purchasingPlan.setAuditResultOfPrimary(auditAndApproveDto.getAuditResult());//审核结果
purchasingPlan.setAuditOpinionOfPrimary(auditAndApproveDto.getAuditOpinion());//审核意见
purchasingPlan.setAuditTimeOfPrimary(LocalDateTime.now());//审核时间
purchasingPlan.setPrimaryAuditorId(dlpUser.getId());//审核人ID
if (auditAndApproveDto.getAuditResult() == true) {
purchasingPlan.setStatus(4);
purchasingPlan.setStatus(4);//审核通过
} else {
purchasingPlan.setStatus(-4);
purchasingPlan.setStatus(-4);//审核不通过
}
if (this.updateById(purchasingPlan)) {
return purchasingPlan;
} else {
@ -473,7 +382,7 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
}
}
@Override
@Override//审批采购计划
public PurchasingPlan approveById(AuditAndApproveDTO auditAndApproveDto, DLPUser dlpUser) {
PurchasingPlan purchasingPlan = this.getById(auditAndApproveDto.getUuId());
@ -481,56 +390,40 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
if (purchasingPlan.getStatus() != 4) {
throw new RuntimeException(String.format("当前状态不可审批"));
}
purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult());
purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion());
purchasingPlan.setApprovalTime(LocalDateTime.now());
purchasingPlan.setApproverId(dlpUser.getId());
purchasingPlan.setApprovalResult(auditAndApproveDto.getApproveResult());//审批结果
purchasingPlan.setApprovalOpinion(auditAndApproveDto.getApproveOpinion());//审批意见
purchasingPlan.setApprovalTime(LocalDateTime.now());//审批时间
purchasingPlan.setApproverId(dlpUser.getId());//审批人ID
//审批通过则创建采购清单
if (auditAndApproveDto.getApproveResult() == true) {
purchasingPlan.setStatus(5);
purchasingPlan.setStatus(5);//审批通过
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//采购计划明细
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);
PurchaseListDTO purchaseListDTO = new PurchaseListDTO();
PurchaseList purchaseList = new PurchaseList();
PurchaseList purchaseList = new PurchaseList();//创建采购清单
purchaseList.setId(IdWorker.get32UUID().toUpperCase());
purchaseList.setName(DateTime.now() + "采购清单");
purchaseList.setStatus(0);
purchaseList.setType("采购计划");
purchaseList.setCreateBy(purchasingPlan.getCreateBy());
purchaseList.setName(DateTime.now() + "采购清单");//清单名称
purchaseList.setStatus(0);//状态
purchaseList.setType("采购计划");//清单类型,区分分散采购申请和采购计划
purchaseList.setCreateBy(purchasingPlan.getCreateBy());//清单创建人
purchaseListService.save(purchaseList);
purchasingPlan.setPurchaseListId(purchaseList.getId());
purchasingPlan.setPurchaseListId(purchaseList.getId());//关联采购清单
for (ProcurementContent procurementContent : list) {
PurchaseListDetails purchaseListDetails = new PurchaseListDetails();
purchaseListDetails.setPurchaseListId(purchaseList.getId());
purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());
purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());
PurchaseListDetails purchaseListDetails = new PurchaseListDetails();//采购清单明细
purchaseListDetails.setPurchaseListId(purchaseList.getId());//关联采购清单
purchaseListDetails.setPurchaseQuantity(procurementContent.getQuantityPurchased());//采购数量
purchaseListDetails.setReagentConsumableId(procurementContent.getReagentConsumableId());//采购试剂耗材ID
purchaseListDetails.setId(IdWorker.get32UUID().toUpperCase());
purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());
purchaseListDetails.setProcurementContentId(procurementContent.getProcurementContentId());//关联采购计划明细
purchaseListDetailsService.save(purchaseListDetails);
}
} else {
purchasingPlan.setStatus(-5);
purchasingPlan.setStatus(-5);//审核不通过
}
if (this.updateById(purchasingPlan)) {
return purchasingPlan;
} else {
@ -541,51 +434,45 @@ public class PurchasingPlanServiceImpl extends ServiceImpl<PurchasingPlanMapper,
//计算经费预算方法
public PurchasingPlan calculatedAmount(String purchasingPlanId) {
PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);
PurchasingPlan purchasingPlan = this.getById(purchasingPlanId);//采购计划
LambdaQueryWrapper<ProcurementContent> procurementContentLambdaQueryWrapper = new LambdaQueryWrapper<>();
procurementContentLambdaQueryWrapper.eq(ProcurementContent::getPurchasingPlanId, purchasingPlan.getPurchasingPlanId());
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);
List<ProcurementContent> list = procurementContentService.list(procurementContentLambdaQueryWrapper);//这个采购计划内的所有采购计划明细
double x = 0;
//计算每个采购计划明细的小计(单价*采购数量)
for (
ProcurementContent procurementContent : list) {
x = x + procurementContent.getQuantityPurchased() * procurementContent.getUnitPrice();
}
purchasingPlan.setAppropriationBudget(x);
purchasingPlan.setAppropriationBudget(x);//经费预算
if (this.updateById(purchasingPlan)) {
return purchasingPlan;
} else throw new RuntimeException(String.format("计算失败"));
}
@Override
public ReplacementVO getReplacementVO(String id){
ProcurementContent byId = procurementContentService.getById(id);
ReplacementVO replacementVO = new ReplacementVO();
@Override//查看换货信息
public ReplacementVO getReplacementVO(String id) {
if (byId.getReplacementQuantity()!=null&&byId.getReplacementPrice()!=null&&byId.getReplacementRemark()!=null
&&byId.getReplacementReagentConsumableId()!=null&&byId.getSupplierId()!=null){
ProcurementContent procurementContent = procurementContentService.getById(id);//采购计划明细
ReplacementVO replacementVO = new ReplacementVO();//换货VO
replacementVO.setReplacementQuantity(byId.getReplacementQuantity());
replacementVO.setReplacementRemark(byId.getReplacementRemark());
replacementVO.setReplacementPrice(byId.getReplacementPrice());
replacementVO.setReplacementReagentConsumableId(byId.getReplacementReagentConsumableId());
replacementVO.setSupplierId(byId.getSupplierId());
//判断换货信息是否充分
if (procurementContent.getReplacementQuantity() != null && procurementContent.getReplacementPrice() != null && procurementContent.getReplacementRemark() != null
&& procurementContent.getReplacementReagentConsumableId() != null && procurementContent.getSupplierId() != null) {
SupplierInformation byId1 = supplierInformationService.getById(byId.getSupplierId());
replacementVO.setSupplierName(byId1.getSupplierName());
ReagentConsumables byId2 = reagentConsumablesService.getById(byId.getReplacementReagentConsumableId());
replacementVO.setReagentConsumables(byId2);}
SupplierInformation supplierInformation = supplierInformationService.getById(procurementContent.getSupplierId());//供应商
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(procurementContent.getReplacementReagentConsumableId());//试剂耗材信息
replacementVO.setReplacementQuantity(procurementContent.getReplacementQuantity());//换货数量
replacementVO.setReplacementRemark(procurementContent.getReplacementRemark());//换货备注
replacementVO.setReplacementPrice(procurementContent.getReplacementPrice());//换货单价
replacementVO.setReplacementReagentConsumableId(procurementContent.getReplacementReagentConsumableId());//换货试剂耗材ID
replacementVO.setSupplierId(procurementContent.getSupplierId());//换货供应商ID
replacementVO.setSupplierName(supplierInformation.getSupplierName());//换货供应商名称
replacementVO.setReagentConsumables(reagentConsumables);//换货试剂耗材信息
}
return replacementVO;
}

@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -15,22 +16,28 @@ import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import digital.laboratory.platform.common.feign.RemoteTemplate2htmlService;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.reagent.dto.ReagentConsumableInventoryDTO;
import digital.laboratory.platform.reagent.utils.PageUtils;
import digital.laboratory.platform.reagent.entity.*;
import digital.laboratory.platform.reagent.mapper.ReagentConsumableInventoryMapper;
import digital.laboratory.platform.reagent.service.*;
import digital.laboratory.platform.reagent.utils.QRCodeUtils;
import digital.laboratory.platform.reagent.vo.*;
import digital.laboratory.platform.sys.entity.CellAndStoreSupplyData;
import digital.laboratory.platform.sys.feign.RemoteCabinetService;
import feign.Response;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
/**
@ -68,6 +75,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@Autowired
private InstructionBookService instructionBookService;
@Autowired
private RemoteCabinetService remoteCabinetService;
@Autowired
private OssFile ossFile;
@ -218,27 +228,28 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
@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));
if (referenceMaterial!=null) {
if (referenceMaterial != null) {
ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId());
ReagentConsumableInventoryFullVO byCode = this.getByCode(referenceMaterial.getId());
List<ReagentConsumableInventoryFullVO> reagentConsumableInventoryFullVOS = new ArrayList<>();
List<ReagentConsumableInventoryFullVO> reagentConsumableInventoryFullVOS = new ArrayList<>();
reagentConsumableInventoryFullVOS.add(byCode);
reagentConsumableInventoryFullVOS.add(byCode);
PageUtils pageUtils = new PageUtils();
PageUtils pageUtils = new PageUtils();
Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOS);
Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOS);
return pages;
return pages;
}}
}
}
// List<ReferenceMaterial> list = referenceMaterialService.list(qw);
//
// List<ReagentConsumableInventoryFullVO> reagentConsumableInventoryFullVOList = new ArrayList<>();
@ -368,7 +379,8 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
Page pages = pageUtils.getPages(current, size, reagentConsumableInventoryFullVOList);
return pages;}
return pages;
}
@Override//通过ID,获取标准物质所有信息
@ -621,7 +633,7 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
BeanUtils.copyProperties(referenceMaterialServiceById, referenceMaterial);
//完善打印信息
referenceMaterial.setReferenceMaterialName(byId.getReagentConsumableName());
referenceMaterial.setTime("到期:"+byId1.getExpirationDate());
referenceMaterial.setTime("到期:" + byId1.getExpirationDate());
data.put("referenceMaterial", referenceMaterial);
String templateFileName = "标准物质标签模板.vm";
@ -639,8 +651,88 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
}
@Override
public List<UserVO> getUserList(){
public List<UserVO> 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 java.io.ByteArrayInputStream;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
@ -59,8 +60,9 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
@Autowired
private OssFile ossFile;
@Override
public RequisitionRecord addRecord(OutgoingContents outgoingContents){
public RequisitionRecord addRecord(OutgoingContents outgoingContents) {
RequisitionRecord requisitionRecord = new RequisitionRecord();
@ -74,15 +76,15 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
requisitionRecord.setSpecificationAndModel(byId.getSpecificationAndModel());
requisitionRecord.setReagentConsumableName(byId.getReagentConsumableName());
if (this.save(requisitionRecord)){
if (this.save(requisitionRecord)) {
return requisitionRecord;
}else throw new RuntimeException(String.format("试剂耗材领用记录表创建失败"));
} else throw new RuntimeException(String.format("试剂耗材领用记录表创建失败"));
}
@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);
@ -92,19 +94,18 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
}
@Override
public List<RequisitionRecordVO> getRequisitionRecordVO(String id){
ApplicationForUse byId = applicationForUseService.getById(id);
String deliveryRegistrationFormId = byId.getDeliveryRegistrationFormId();
public List<RequisitionRecordVO> getRequisitionRecordVO(String[] idList) {
List<RequisitionRecordVO> requisitionRecordVO = baseMapper.getRequisitionRecordVO(deliveryRegistrationFormId);
return requisitionRecordVO;
List<RequisitionRecordVO> requisitionRecordVOS = new ArrayList<>();
for (String id : idList) {
RequisitionRecordVO requisitionRecordVO = baseMapper.getRequisitionRecordVO(id);
requisitionRecordVOS.add(requisitionRecordVO);
}
return requisitionRecordVOS;
}
@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.................");
@ -112,7 +113,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
//-----------------------------
// 生成 word 版本的 采购目录
String applyFileName = "试剂耗材领用记录表-"+id;
String applyFileName = "试剂耗材领用记录表-" + id;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ossFile.fileGet("template" + "/" + "试剂耗材领用记录表模板.docx", bos);
@ -129,7 +130,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
LocalDateTime dateOfClaim = requisitionRecordVO.getDateOfClaim();
requisitionRecordVO.setDateOfClaims(LocalDateTimeUtil.format(dateOfClaim,"yyyy年MM月dd日"));
requisitionRecordVO.setDateOfClaims(LocalDateTimeUtil.format(dateOfClaim, "yyyy年MM月dd日"));
requisitionRecordVO.setI(x);
@ -147,7 +148,7 @@ public class RequisitionRecordServiceImpl extends ServiceImpl<RequisitionRecordM
XWPFTemplate template = XWPFTemplate.compile(bis, config).render(
new HashMap<String, Object>() {{
put("voList", voList);
put("year",year);
put("year", year);
}}
);
bis.close();

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

@ -47,8 +47,7 @@
<select id="getReagentConsumableInventoryFullVOPage"
resultType="digital.laboratory.platform.reagent.vo.ReagentConsumableInventoryFullVO">
select *
from reagent_consumable_inventory
${ew.customSqlSegment}
from reagent_consumable_inventory ${ew.customSqlSegment}
</select>
<select id="getReagentConsumableInventoryVOPage" resultMap="reagentConsumableInventoryVO"
@ -61,4 +60,15 @@
SELECT *
FROM dlp_base.sys_user user
</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>

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

Loading…
Cancel
Save