This commit is contained in:
2023-09-03 10:22:54 +08:00
parent 8ca6996d82
commit 989fa753af
17 changed files with 108 additions and 40 deletions
@@ -392,14 +392,14 @@ public class ReagentConsumableInventoryController {
}
// @PostMapping("org")
// public R<List<OrgFullVO>> getOrgList(HttpServletResponse httpServletResponse) {
//
// List<OrgFullVO> orgList = reagentConsumableInventoryService.getOrgList();
//
// return R.ok(orgList);
//
// }
@PostMapping("org")
public R<List<OrgFullVO>> getOrgList(HttpServletResponse httpServletResponse) {
List<OrgFullVO> orgList = reagentConsumableInventoryService.getOrgList();
return R.ok(orgList);
}
}
@@ -11,12 +11,14 @@ 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.BalanceWeighingDTO;
import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO;
import digital.laboratory.platform.reagent.entity.CatalogueDetails;
import digital.laboratory.platform.reagent.entity.StandardMaterialApplication;
import digital.laboratory.platform.reagent.service.StandardMaterialApplicationService;
import digital.laboratory.platform.reagent.vo.PurchaseCatalogueVO;
import digital.laboratory.platform.reagent.vo.StandardMaterialApplicationVO;
import digital.laboratory.platform.sys.feign.RemoteReagentConsumableService;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
@@ -53,7 +55,6 @@ import java.util.List;
public class StandardMaterialApplicationController {
private final StandardMaterialApplicationService standardMaterialApplicationService;
private final OssFile ossFile;
/**
@@ -260,6 +261,15 @@ public class StandardMaterialApplicationController {
e.printStackTrace();
}
}
@ApiOperation(value = "天平称量后记录标准物质使用数量", notes = "天平称量后记录标准物质使用数量")
@SysLog("天平称量后记录标准物质使用数量")
@PutMapping("/weighing")
public R<String> getWeighingMass(@RequestBody List<BalanceWeighingDTO> balanceWeighingDTOList) {
boolean weighingMass = standardMaterialApplicationService.getWeighingMass(balanceWeighingDTOList);
if (weighingMass) {
return R.ok("称量成功");
} else return R.failed("称量失败");
}
}
@@ -0,0 +1,16 @@
package digital.laboratory.platform.reagent.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class BalanceWeighingDTO {
@ApiModelProperty(value = "标准物质ID")
private String referenceMaterialId;
@ApiModelProperty(value = "称重质量")
private BigDecimal weighingMass;
}
@@ -9,7 +9,7 @@ public class StandardMaterialApplicationDTO {
private String standardMaterialApplicationId;
@ApiModelProperty(value = "使用数量")
private String purposeAndQuantity;
private Double purposeAndQuantity;
@ApiModelProperty(value = "格子id")
private String latticeId;
@@ -65,4 +65,7 @@ public class WarehousingRecordFormDTO {
@ApiModelProperty(value="柜子ID")
private String boxId;
@ApiModelProperty(value="标准物质质量")
private Double referenceMaterialMass;
}
@@ -65,4 +65,7 @@ public class ReferenceMaterial extends BaseEntity {
@ApiModelProperty(value="标准物质名称")
private String reagentConsumableName;
@ApiModelProperty(value = "质量(有可能为重量、有可能为体积)")
private Double mass;
}
@@ -63,7 +63,7 @@ public class StandardMaterialApplication extends BaseEntity {
* (使用数量)
*/
@ApiModelProperty(value="(使用数量)")
private String purposeAndQuantity;
private Double purposeAndQuantity;
/**
* (领用人ID)
@@ -60,5 +60,7 @@ public interface ReagentConsumableInventoryService extends IService<ReagentConsu
//更新柜子系统方法,柜子ID、物品ID、入库OR出库 (opCode 1 or -1)
void updateCabinet(String latticeId, String itemId, int opCode);
List<OrgFullVO> getOrgList();
// List<OrgFullVO> getOrgList();
}
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.reagent.dto.BalanceWeighingDTO;
import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO;
import digital.laboratory.platform.reagent.entity.StandardMaterialApplication;
import digital.laboratory.platform.reagent.vo.StandardMaterialApplicationVO;
@@ -35,4 +36,7 @@ public interface StandardMaterialApplicationService extends IService<StandardMat
StandardMaterialApplicationVO getStandardMaterialApplicationVO(String id
);
// 天平称量
boolean getWeighingMass(List<BalanceWeighingDTO> balanceWeighingDTOList);
}
@@ -243,7 +243,7 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl<DeliveryReg
standardMaterialApplications.add(standardMaterialApplication);
if (outgoingContentsDTO.getOutboundUse() == 2) {//已用完,无需归还
standardMaterialApplication.setStatus(-1);
standardMaterialApplication.setPurposeAndQuantity(outgoingContents.getQuantity().toString());
standardMaterialApplication.setPurposeAndQuantity(outgoingContents.getQuantity().doubleValue());
} else {
standardMaterialApplication.setStatus(0);
}
@@ -291,7 +291,7 @@ public class DeliveryRegistrationFormServiceImpl extends ServiceImpl<DeliveryReg
standardMaterialApplication.setReferenceSubstanceName(reference_id.getSolutionName());
if (outgoingContentsDTO.getOutboundUse() == 2) {
standardMaterialApplication.setPurposeAndQuantity(outgoingContents.getQuantity().toString());
standardMaterialApplication.setPurposeAndQuantity(outgoingContents.getQuantity().doubleValue());
standardMaterialApplication.setStatus(1);
} else {
standardMaterialApplication.setStatus(0);
@@ -732,23 +732,23 @@ public class ReagentConsumableInventoryServiceImpl extends ServiceImpl<ReagentCo
}
// @Override
// public List<OrgFullVO> getOrgList() {
//
// List<OrgVO> orgList = baseMapper.getOrgList();
// ArrayList<OrgFullVO> orgFullVOS = new ArrayList<>();
// for (OrgVO orgVO : orgList) {
// if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("county")) {
// OrgFullVO orgFullVO = new OrgFullVO();
// orgFullVO.setUsername("X" + orgVO.getAreaCode());
// String[] roles = {"10015", "10020"};
// orgFullVO.setRoleIds(roles);
// orgFullVO.setPassword("123456");
// orgFullVO.setOrgId(orgVO.getOrgId());
// orgFullVOS.add(orgFullVO);
// }
//
// }
// return orgFullVOS;
// }
@Override
public List<OrgFullVO> getOrgList() {
List<OrgVO> orgList = baseMapper.getOrgList();
ArrayList<OrgFullVO> orgFullVOS = new ArrayList<>();
for (OrgVO orgVO : orgList) {
if (orgVO.getOrgType() != null && orgVO.getOrgType().equals("county")) {
OrgFullVO orgFullVO = new OrgFullVO();
orgFullVO.setUsername("X" + orgVO.getAreaCode());
String[] roles = {"10010","10015", "10020","10130","23020","23030"};
orgFullVO.setRoleIds(roles);
orgFullVO.setPassword("123456");
orgFullVO.setOrgId(orgVO.getOrgId());
orgFullVO.setGender(1);
orgFullVOS.add(orgFullVO);
}
}
return orgFullVOS;
}
}
@@ -5,7 +5,6 @@ import cn.hutool.core.io.IoUtil;
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.Constants;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deepoove.poi.XWPFTemplate;
@@ -13,6 +12,7 @@ import com.deepoove.poi.config.Configure;
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
import digital.laboratory.platform.common.feign.RemoteWord2PDFService;
import digital.laboratory.platform.common.oss.service.OssFile;
import digital.laboratory.platform.reagent.dto.BalanceWeighingDTO;
import digital.laboratory.platform.reagent.dto.StandardMaterialApplicationDTO;
import digital.laboratory.platform.reagent.entity.*;
import digital.laboratory.platform.reagent.mapper.StandardMaterialApplicationMapper;
@@ -24,11 +24,9 @@ import feign.Response;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.ibatis.annotations.Param;
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;
@@ -97,6 +95,7 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl<Standard
referenceMaterial.setLocation(standardMaterialApplicationDTO.getLocation());
referenceMaterial.setLocation(standardMaterialApplicationDTO.getLocation());
referenceMaterial.setBoxId(standardMaterialApplicationDTO.getBoxId());
referenceMaterial.setMass(referenceMaterial.getMass() - standardMaterialApplicationDTO.getPurposeAndQuantity());
//若无需归还,则证明标准物质/标准储备溶液已经使用完毕,删除记录即可
if (standardMaterialApplicationDTO.getOutOfUse()) {
@@ -142,7 +141,7 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl<Standard
SolutionUseForm one = solutionUseFormService.getOne(solutionUseFormLambdaQueryWrapper);
//如果是标准储备溶液,则需补充完善标准储备溶液使用记录表的使用数量
if (one != null) {
one.setQuantityUsed(byId.getPurposeAndQuantity());
one.setQuantityUsed(byId.getPurposeAndQuantity().toString());
solutionUseFormService.updateById(one);
}
//
@@ -210,10 +209,10 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl<Standard
standardMaterialApplicationVO.setDateOfReturns(LocalDateTimeUtil.format(standardMaterialApplicationVO.getDateOfReturn(), "yyyy年MM月dd日"));
standardMaterialApplicationVO.setIndex(x.toString());
if (standardMaterialApplicationVO.getPurpose() == 0) {
standardMaterialApplicationVO.setPurposeAndQuantity("案件," + standardMaterialApplicationVO.getPurposeAndQuantity());
standardMaterialApplicationVO.setPrintPurposeAndQuantity("案件," + standardMaterialApplicationVO.getPurposeAndQuantity());
} else {
standardMaterialApplicationVO.setPurposeAndQuantity("科研," + standardMaterialApplicationVO.getPurposeAndQuantity());
standardMaterialApplicationVO.setPrintPurposeAndQuantity("其他," + standardMaterialApplicationVO.getPurposeAndQuantity());
}
x++;
}
@@ -292,7 +291,30 @@ public class StandardMaterialApplicationServiceImpl extends ServiceImpl<Standard
return standardMaterialApplicationVO;
}
// 天平称量
@Override
@GlobalTransactional
public boolean getWeighingMass(List<BalanceWeighingDTO> balanceWeighingDTOList) {
String referenceMaterialId = balanceWeighingDTOList.get(0).getReferenceMaterialId();
List<StandardMaterialApplication> standardMaterialApplications = this.list(Wrappers.<StandardMaterialApplication>query().eq("reference_material_id", referenceMaterialId).orderByDesc("create_time"));
if (standardMaterialApplications == null && standardMaterialApplications.size() == 0) {
throw new RuntimeException(String.format("未查询到该标准物质的领用登记表!"));
}
StandardMaterialApplication standardMaterialApplication = standardMaterialApplications.get(0);
//依次记录称量结果
for (BalanceWeighingDTO balanceWeighingDTO : balanceWeighingDTOList) {
if (standardMaterialApplication.getPurposeAndQuantity() == 0) {
standardMaterialApplication.setPurposeAndQuantity(balanceWeighingDTO.getWeighingMass().doubleValue());
} else {
standardMaterialApplication.setPurposeAndQuantity(standardMaterialApplication.getPurposeAndQuantity() + balanceWeighingDTO.getWeighingMass().doubleValue());
}
}
return this.updateById(standardMaterialApplication);
}
}
@@ -163,6 +163,7 @@ public class StandardReserveSolutionServiceImpl extends ServiceImpl<StandardRese
//创建标准储备溶液对象
ReferenceMaterial referenceMaterial = new ReferenceMaterial();
referenceMaterial.setMass(standardReserveSolutionDTO.getConstantVolume());
ReferenceMaterial referenceMaterialServiceById = referenceMaterialService.getById(standardReserveSolutionDTO.getReferenceMaterialId());
@@ -230,6 +231,7 @@ public class StandardReserveSolutionServiceImpl extends ServiceImpl<StandardRese
//创建标准溶液对象,并生成编号
referenceMaterial.setStatus(-4);
referenceMaterial.setMass(standardReserveSolutionDTO.getConstantVolume());
referenceMaterial.setId(IdWorker.get32UUID().toUpperCase());
referenceMaterial.setReagentConsumableId(one.getReagentConsumableId());
referenceMaterial.setReagentConsumableInventoryId(one.getReagentConsumableInventoryId());
@@ -247,6 +247,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
referenceMaterial.setLatticeId(latticeId);
referenceMaterial.setBoxId(boxId);
referenceMaterial.setReagentConsumableName(reagentConsumables.getReagentConsumableName());
referenceMaterial.setMass(warehousingRecordFormDTO.getReferenceMaterialMass());
//更新格子信息(标准物质传入对象ID)
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
//生成编号
@@ -354,6 +355,7 @@ public class WarehousingRecordFormServiceImpl extends ServiceImpl<WarehousingRec
referenceMaterial.setBoxId(warehousingRecordFormDTO.getBoxId());
referenceMaterial.setCustodianName(warehousingRecordFormDTO.getCustodianName());
referenceMaterial.setReagentConsumableName(reagentConsumables.getReagentConsumableName());
referenceMaterial.setMass(warehousingRecordFormDTO.getReferenceMaterialMass());
//更新格子信息(试剂耗材传入类ID
reagentConsumableInventoryService.updateCabinet(referenceMaterial.getLatticeId(), referenceMaterial.getId(), 1);
//生成编号
@@ -5,8 +5,8 @@ import lombok.Data;
@Data
public class OrgFullVO {
private String orgId;
private String username;
private String password;
private String[] roleIds;
private Integer gender;
}
@@ -48,4 +48,7 @@ public class StandardMaterialApplicationVO extends StandardMaterialApplication {
@ApiModelProperty(value="柜子ID")
private String boxId;
@ApiModelProperty(value="打印使用数量与用途")
private String printPurposeAndQuantity;
}
@@ -23,6 +23,7 @@
<result property="fixedResult" column="fixed_result"/>
<result property="serviceStatus" column="service_status"/>
<result property="reagentConsumableName" column="reagent_consumable_name"/>
<result property="mass" column="mass"/>
</resultMap>