|
|
|
@ -18,6 +18,7 @@ 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.IntegerUtils; |
|
|
|
|
import digital.laboratory.platform.reagent.utils.PageUtils; |
|
|
|
|
import digital.laboratory.platform.reagent.entity.*; |
|
|
|
|
import digital.laboratory.platform.reagent.mapper.ReagentConsumableInventoryMapper; |
|
|
|
@ -82,6 +83,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
@Autowired |
|
|
|
|
private ReagentConsumableStashService reagentConsumableStashService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private StandardMaterialApplicationService standardMaterialApplicationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private OssFile ossFile; |
|
|
|
@ -320,6 +324,7 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
reagentConsumableInventoryFullVO.setValidityPeriod(one1.getValidityPeriod()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return reagentConsumableInventoryFullVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -539,7 +544,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
|
|
|
|
|
StandardReserveSolutionVO standardReserveSolutionVOById = standardReserveSolutionService.getStandardReserveSolutionVOById(id); |
|
|
|
|
Map<String, Object> data = new HashMap<>(); |
|
|
|
|
standardReserveSolutionVOById.setConfigurationDatePrint(String.format("%.4",standardReserveSolutionVOById.getConfigurationDatePrint())); |
|
|
|
|
data.put("standardReserveSolution", standardReserveSolutionVOById); |
|
|
|
|
String templateFileName = "标准储备溶液标签模板.vm"; |
|
|
|
|
return remoteTemplate2htmlService.getHtml(templateFileName, data); |
|
|
|
@ -554,7 +558,16 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
@Override |
|
|
|
|
@Transactional//盘点导入,需提供柜子系统数据
|
|
|
|
|
public void inventoryEntry(List<ReagentConsumableInventoryDTO> reagentConsumableInventoryDTOList) { |
|
|
|
|
|
|
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
|
int year = instance.get(Calendar.YEAR); |
|
|
|
|
|
|
|
|
|
IntegerUtils integerUtils = new IntegerUtils(); |
|
|
|
|
for (ReagentConsumableInventoryDTO reagentConsumableInventoryDTO : reagentConsumableInventoryDTOList) { |
|
|
|
|
Integer copies = integerUtils.getInteger(reagentConsumableInventoryDTO.getPackagedCopies()); |
|
|
|
|
Integer quantity = reagentConsumableInventoryDTO.getTotalQuantity() * copies; |
|
|
|
|
SupplierInformation supplier = supplierInformationService.getOne(Wrappers.<SupplierInformation>query().eq("supplier_name", reagentConsumableInventoryDTO.getSupplierName())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String location = "F" + reagentConsumableInventoryDTO.getRoomNo().charAt(0) + "-" + reagentConsumableInventoryDTO.getRoomNo() + "_试剂柜-" + reagentConsumableInventoryDTO |
|
|
|
|
.getLocation().charAt(0) + "_" + reagentConsumableInventoryDTO.getLocation(); |
|
|
|
@ -574,15 +587,21 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
.eq(StrUtil.isNotBlank(reagentConsumableInventoryDTO.getDeviationOrUncertainty()), "deviation_or_uncertainty", reagentConsumableInventoryDTO.getDeviationOrUncertainty()) |
|
|
|
|
.eq(StrUtil.isNotBlank(reagentConsumableInventoryDTO.getMinimumUnit()), "minimum_unit", reagentConsumableInventoryDTO.getMinimumUnit()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BatchDetails batchDetails = new BatchDetails(); |
|
|
|
|
|
|
|
|
|
batchDetails.setServiceStatus(1); |
|
|
|
|
batchDetails.setQuantity(reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
batchDetails.setBatch("2023-1"); |
|
|
|
|
batchDetails.setQuantity(quantity); |
|
|
|
|
batchDetails.setBatch(year + "-1"); |
|
|
|
|
if (supplier == null) { |
|
|
|
|
SupplierInformation supplierInformation = new SupplierInformation(); |
|
|
|
|
supplierInformation.setSupplierName(reagentConsumableInventoryDTO.getSupplierName()); |
|
|
|
|
supplierInformation.setAcceptableCondition("合格"); |
|
|
|
|
supplierInformation.setId(IdWorker.get32UUID()); |
|
|
|
|
supplierInformationService.save(supplierInformation); |
|
|
|
|
batchDetails.setSupplierId(supplierInformation.getId()); |
|
|
|
|
|
|
|
|
|
batchDetails.setSupplierId(reagentConsumableInventoryDTO.getSupplierId()); |
|
|
|
|
} else { |
|
|
|
|
batchDetails.setSupplierId(supplier.getId()); |
|
|
|
|
} |
|
|
|
|
//如果没有生产日期/到期时间,就自动生成
|
|
|
|
|
if (reagentConsumableInventoryDTO.getDateOfProduction() != null) { |
|
|
|
|
batchDetails.setDateOfProduction(reagentConsumableInventoryDTO.getDateOfProduction()); |
|
|
|
@ -594,7 +613,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
} else { |
|
|
|
|
batchDetails.setExpirationDate(LocalDate.now().plusYears(99)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
R<CabinetCell> cabinetCellR = remoteCabinetService.queryCellByRoomNoAndLocation(reagentConsumableInventoryDTO.getRoomNo(), reagentConsumableInventoryDTO.getLocation()); |
|
|
|
|
CabinetCell cabinetCell = cabinetCellR.getData(); |
|
|
|
|
batchDetails.setLatticeId(cabinetCell.getId()); |
|
|
|
@ -609,33 +627,29 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
if (batchDetailsList != null & batchDetailsList.size() > 0) { |
|
|
|
|
int x = batchDetailsList.size() + 1; |
|
|
|
|
batchDetails.setBatch("2023-" + x); |
|
|
|
|
one.setTotalQuantity(one.getTotalQuantity() + reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
one.setTotalQuantity(one.getTotalQuantity() + quantity); |
|
|
|
|
this.updateById(one); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
batchDetails.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId()); |
|
|
|
|
ReagentConsumables reagentConsumables = reagentConsumablesService.getById(one.getReagentConsumableId()); |
|
|
|
|
|
|
|
|
|
if (!one.getCategory().equals("标准物质")) { |
|
|
|
|
ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getOne(Wrappers.<ReagentConsumableStash>query() |
|
|
|
|
.eq("room_no", reagentConsumableInventoryDTO.getRoomNo()) |
|
|
|
|
.eq("reagent_consumable_id", reagentConsumables.getReagentConsumableId())); |
|
|
|
|
|
|
|
|
|
if (reagentConsumableStash != null) { |
|
|
|
|
reagentConsumableStash.setTotalQuantity(reagentConsumableStash.getTotalQuantity() + reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
reagentConsumableStash.setTotalQuantity(reagentConsumableStash.getTotalQuantity() + quantity); |
|
|
|
|
batchDetails.setReagentConsumableStashId(reagentConsumableStash.getId()); |
|
|
|
|
reagentConsumableStashService.updateById(reagentConsumableStash); |
|
|
|
|
} else { |
|
|
|
|
ReagentConsumableStash consumableStash = new ReagentConsumableStash(); |
|
|
|
|
BeanUtils.copyProperties(reagentConsumableInventoryDTO, consumableStash); |
|
|
|
|
consumableStash.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
consumableStash.setTotalQuantity(reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
consumableStash.setTotalQuantity(quantity); |
|
|
|
|
consumableStash.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
|
batchDetails.setReagentConsumableStashId(consumableStash.getId()); |
|
|
|
|
reagentConsumableStashService.save(consumableStash); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (reagentConsumableInventoryDTO.getCategory().equals("标准物质")) { |
|
|
|
|
ReferenceMaterial referenceMaterial = new ReferenceMaterial(); |
|
|
|
|
referenceMaterial.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
@ -644,14 +658,14 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
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(); |
|
|
|
|
referenceMaterial.setNumber(reagentConsumableInventoryDTO.getAlias() + "-" + year + "-" + roomNo.charAt(0) + "-1");//自动生成编号
|
|
|
|
|
referenceMaterial.setCode(referenceMaterial.getNumber()); |
|
|
|
|
referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId()); |
|
|
|
|
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
referenceMaterial.setReagentConsumableName(reagentConsumableInventoryDTO.getReagentConsumableName()); |
|
|
|
|
referenceMaterial.setMass(reagentConsumableInventoryDTO.getMass()); |
|
|
|
|
referenceMaterial.setReferenceMaterialUnit(reagentConsumableInventoryDTO.getReferenceMaterialUnit()); |
|
|
|
|
referenceMaterialService.save(referenceMaterial); |
|
|
|
|
this.updateCabinet(cabinetCell.getId(), referenceMaterial.getId(), 1); |
|
|
|
|
} |
|
|
|
@ -663,12 +677,21 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
reagentConsumableInventory.setReagentConsumableInventoryId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
reagentConsumableInventory.setWarningValue(1); |
|
|
|
|
if (reagentConsumableInventoryDTO.getSpecificationAndModel().equals("/")) { |
|
|
|
|
reagentConsumableInventory.setSpecificationAndModel(""); |
|
|
|
|
if (reagentConsumableInventoryDTO.getPackages() != null) { |
|
|
|
|
reagentConsumableInventory.setSpecificationAndModel(reagentConsumableInventoryDTO.getPackages()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (reagentConsumableInventoryDTO.getPackages() != null) { |
|
|
|
|
reagentConsumableInventory.setSpecificationAndModel(reagentConsumableInventoryDTO.getSpecificationAndModel() + "," + reagentConsumableInventoryDTO.getPackages()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (reagentConsumableInventoryDTO.getPackages() != null) { |
|
|
|
|
reagentConsumableInventory.setSpecificationAndModel(reagentConsumableInventory.getSpecificationAndModel() + "," + reagentConsumableInventoryDTO.getPackages()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
batchDetails.setReagentConsumableInventoryId(reagentConsumableInventory.getReagentConsumableInventoryId()); |
|
|
|
|
ReagentConsumables reagentConsumables = reagentConsumablesService.addReagentConsumables(reagentConsumableInventory); |
|
|
|
|
reagentConsumableInventory.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
|
reagentConsumableInventory.setTotalQuantity(quantity); |
|
|
|
|
this.save(reagentConsumableInventory); |
|
|
|
|
this.updateCabinet(cabinetCell.getId(), reagentConsumables.getReagentConsumableId(), 1); |
|
|
|
|
|
|
|
|
@ -676,16 +699,15 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
ReagentConsumableStash reagentConsumableStash = reagentConsumableStashService.getOne(Wrappers.<ReagentConsumableStash>query() |
|
|
|
|
.eq("room_no", reagentConsumableInventoryDTO.getRoomNo()) |
|
|
|
|
.eq("reagent_consumable_id", reagentConsumables.getReagentConsumableId())); |
|
|
|
|
|
|
|
|
|
if (reagentConsumableStash != null) { |
|
|
|
|
reagentConsumableStash.setTotalQuantity(reagentConsumableStash.getTotalQuantity() + reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
reagentConsumableStash.setTotalQuantity(reagentConsumableStash.getTotalQuantity() + quantity); |
|
|
|
|
batchDetails.setReagentConsumableStashId(reagentConsumableStash.getId()); |
|
|
|
|
reagentConsumableStashService.updateById(reagentConsumableStash); |
|
|
|
|
} else { |
|
|
|
|
ReagentConsumableStash consumableStash = new ReagentConsumableStash(); |
|
|
|
|
BeanUtils.copyProperties(reagentConsumableInventoryDTO, consumableStash); |
|
|
|
|
consumableStash.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
consumableStash.setTotalQuantity(reagentConsumableInventoryDTO.getTotalQuantity()); |
|
|
|
|
consumableStash.setTotalQuantity(quantity); |
|
|
|
|
consumableStash.setReagentConsumableId(reagentConsumables.getReagentConsumableId()); |
|
|
|
|
batchDetails.setReagentConsumableStashId(consumableStash.getId()); |
|
|
|
|
reagentConsumableStashService.save(consumableStash); |
|
|
|
@ -700,13 +722,13 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
referenceMaterial.setLatticeId(cabinetCell.getId()); |
|
|
|
|
referenceMaterial.setBoxId(cabinetCell.getCabinetId()); |
|
|
|
|
referenceMaterial.setReagentConsumableName(reagentConsumableInventoryDTO.getReagentConsumableName()); |
|
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
|
int year = instance.get(Calendar.YEAR); |
|
|
|
|
String roomNo = reagentConsumableInventoryDTO.getRoomNo(); |
|
|
|
|
referenceMaterial.setNumber(reagentConsumableInventoryDTO.getAlias() + "-" + year + "-" + roomNo.charAt(0) + "-1");//自动生成编号
|
|
|
|
|
referenceMaterial.setCode(referenceMaterial.getNumber()); |
|
|
|
|
referenceMaterial.setBatchDetailsId(batchDetails.getBatchDetailsId()); |
|
|
|
|
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase()); |
|
|
|
|
referenceMaterial.setMass(reagentConsumableInventoryDTO.getMass()); |
|
|
|
|
referenceMaterial.setReferenceMaterialUnit(reagentConsumableInventoryDTO.getReferenceMaterialUnit()); |
|
|
|
|
referenceMaterialService.save(referenceMaterial); |
|
|
|
|
this.updateCabinet(cabinetCell.getId(), referenceMaterial.getId(), 1); |
|
|
|
|
} |
|
|
|
@ -719,7 +741,6 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
@Override |
|
|
|
|
//更新柜子系统方法,柜子ID、物品ID、入库OR出库 (opCode 1 or -1)
|
|
|
|
|
public void updateCabinet(String latticeId, String itemId, int opCode) { |
|
|
|
|
|
|
|
|
|
ArrayList<CellAndStoreSupplyData> cellAndStoreSupplyDataArrayList = new ArrayList<>();//柜子数组
|
|
|
|
|
CellAndStoreSupplyData cellAndStoreSupplyData = new CellAndStoreSupplyData(); |
|
|
|
|
cellAndStoreSupplyData.setCellStatus("1"); |
|
|
|
@ -738,9 +759,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
List<OrgVO> orgList = baseMapper.getOrgList(); |
|
|
|
|
ArrayList<OrgFullVO> orgFullVOS = new ArrayList<>(); |
|
|
|
|
for (OrgVO orgVO : orgList) { |
|
|
|
|
if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("county")) { |
|
|
|
|
if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("province") && !(orgVO.getAddress().substring(0, 2).equals("陕西"))) { |
|
|
|
|
OrgFullVO orgFullVO = new OrgFullVO(); |
|
|
|
|
orgFullVO.setUsername("X" + orgVO.getAreaCode()); |
|
|
|
|
orgFullVO.setUsername("P" + orgVO.getAreaCode()); |
|
|
|
|
String[] roles = {"10010", "10015", "10020", "10130", "23020", "23030"}; |
|
|
|
|
orgFullVO.setRoleIds(roles); |
|
|
|
|
orgFullVO.setPassword("123456"); |
|
|
|
@ -748,7 +769,9 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo |
|
|
|
|
orgFullVO.setGender(1); |
|
|
|
|
orgFullVOS.add(orgFullVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
System.out.println("总个数" + orgFullVOS.size()); |
|
|
|
|
return orgFullVOS; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|