Compare commits

...

9 Commits

Author SHA1 Message Date
wxr
a7e82da877 来源品位赋值 2026-02-06 16:58:45 +08:00
wxr
6c90826af3 匹配修改 2026-02-06 15:56:31 +08:00
wxr
600540862a 配料取数及设置修改 2026-02-06 15:04:52 +08:00
shusir
c6f4034685 fix:物料新增入库 2026-02-05 18:02:28 +08:00
wxr
e29c43032c 样品委托提交时参数中配置了默认值,业务参数添加默认值 2026-02-05 17:24:39 +08:00
wxr
83fe91812d 任务分配报错bug修复 2026-02-05 17:18:10 +08:00
shusir
50cfdea28d Merge remote-tracking branch 'origin/test' into test 2026-02-05 08:32:13 +08:00
wxr
7d8a5c1e88 荧光线、分析时间等修改 2026-02-04 19:31:41 +08:00
shusir
d5b40bfba0 feat:准备物料入库接口 2026-02-04 18:03:51 +08:00
43 changed files with 1091 additions and 161 deletions

View File

@@ -182,6 +182,7 @@ public interface ErrorCodeConstants {
ErrorCode MATERIAL_LIFECYCLE_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料通用流程不存在");
ErrorCode MATERIAL_BATCH_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料批次不存在");
ErrorCode MATERIAL_BATCH_GONG_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料批次工段不存在");
ErrorCode MATERIAL_BATCH_ASSIGN_END = new ErrorCode(1_032_160_000, "物料批次已拆分,不可操作");
ErrorCode GONGDUAN_BELONG_MATERIAL_BATCH_NOT_EQUAL = new ErrorCode(1_032_160_000, "工段所属的物料批次不一致");
ErrorCode GONGDUAN_QUANTITY_MATERIAL_BATCH_NOT_EQUAL = new ErrorCode(1_032_160_000, "工段累加数量和批次数量不一致");

View File

@@ -76,7 +76,10 @@ public interface QmsCommonConstant {
/** 已驳回 **/
String REJECTED = "rejected";
/** 已拒绝 **/
String REFUSED = "refused";
/** 作废 **/
String VOID = "void";

View File

@@ -0,0 +1,30 @@
package com.zt.plat.module.qms.business.bus.controller.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class BusinessAssayTaskParameterDataExtendRespVO extends BusinessAssayTaskParameterDataRespVO {
@Schema(description = "检测方法ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29823")
@ExcelProperty("检测方法ID")
private Long configAssayMethodId;
@Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("参数名称")
private String parameterName;
@Schema(description = "参数简称", example = "张三")
@ExcelProperty("参数简称")
private String shortName;
@Schema(description = "参数序号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("参数序号")
private Integer no;
@Schema(description = "键值")
@ExcelProperty("键值")
private String key;
}

View File

@@ -32,6 +32,14 @@ public class BusinessXRFDataPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleTime;
@Schema(description = "样品开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleStartTime;
@Schema(description = "样品结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleEndTime;
@Schema(description = "分析人")
private String assayOperator;

View File

@@ -35,6 +35,14 @@ public class BusinessXRFDataReqVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleTime;
@Schema(description = "样品开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleStartTime;
@Schema(description = "样品结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleEndTime;
@Schema(description = "分析人")
private String assayOperator;

View File

@@ -40,6 +40,14 @@ public class BusinessXRFDataRespVO {
@ExcelProperty("样品时间")
private LocalDateTime sampleTime;
@Schema(description = "样品开始时间")
@ExcelProperty("样品开始时间")
private LocalDateTime sampleStartTime;
@Schema(description = "样品结束时间")
@ExcelProperty("样品结束时间")
private LocalDateTime sampleEndTime;
@Schema(description = "分析人")
@ExcelProperty("分析人")
private String assayOperator;

View File

@@ -34,6 +34,12 @@ public class BusinessXRFDataSaveReqVO {
@Schema(description = "样品时间")
private LocalDateTime sampleTime;
@Schema(description = "样品开始时间")
private LocalDateTime sampleStartTime;
@Schema(description = "样品结束时间")
private LocalDateTime sampleEndTime;
@Schema(description = "分析人")
private String assayOperator;

View File

@@ -2,10 +2,7 @@ package com.zt.plat.module.qms.business.bus.dal.dataobject;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
/**
@@ -64,6 +61,16 @@ public class BusinessXRFDataDO extends BusinessBaseDO {
@TableField("SMP_TM")
private LocalDateTime sampleTime;
/**
* 样品开始时间
*/
@TableField("SMP_STRT_TM")
private LocalDateTime sampleStartTime;
/**
* 样品结束时间
*/
@TableField("SMP_END_TM")
private LocalDateTime sampleEndTime;
/**
* 分析人
*/
@TableField("ASY_OPTR")

View File

@@ -107,5 +107,16 @@ public interface BusinessAssayParameterDataMapper extends BaseMapperX<BusinessAs
.eq(DictionaryProjectDO::getSimpleName, projectSimpleName)
.eq(ConfigAssayMethodProjectParameterDO::getKey, parameterKey));
}
default BusinessAssayParameterDataDO selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(Long businessAssayProjectDataId, String projectSimpleName, String parameterKey) {
return selectJoinOne(BusinessAssayParameterDataDO.class, new MPJLambdaWrapperX<BusinessAssayParameterDataDO>()
.leftJoin(ConfigAssayMethodProjectParameterDO.class, ConfigAssayMethodProjectParameterDO::getId, BusinessAssayParameterDataDO::getConfigAssayMethodProjectParameterId)
.leftJoin(BusinessAssayProjectDataDO.class, BusinessAssayProjectDataDO::getId, BusinessAssayParameterDataDO::getBusinessAssayProjectDataId)
.leftJoin(ConfigAssayMethodProjectDO.class, ConfigAssayMethodProjectDO::getId, BusinessAssayProjectDataDO::getConfigAssayMethodProjectId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.eq(BusinessAssayParameterDataDO::getBusinessAssayProjectDataId, businessAssayProjectDataId)
.eq(DictionaryProjectDO::getSimpleName, projectSimpleName)
.eq(ConfigAssayMethodProjectParameterDO::getKey, parameterKey));
}
}

View File

@@ -107,14 +107,39 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataId(Long businessAssayTaskDataId) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.selectAll(BusinessAssayProjectDataDO.class)
.selectAs(BusinessAssayTaskDataDO::getAssayOperator, BusinessAssayProjectDataExtendRespVO::getAssayOperator)
.selectAs(BusinessAssayTaskDataDO::getRecheckCount, BusinessAssayProjectDataExtendRespVO::getRecheckCount)
.selectAs(BusinessAssayTaskDataDO::getRetestCount, BusinessAssayProjectDataExtendRespVO::getRetestCount)
.selectAs(BusinessAssayTaskDataDO::getBusinessBaseSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessBaseSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubParentSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubSampleId)
.selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName)
.eq(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataId));
}
default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessBaseSampleIdAndConfigAssayMethodId(Long businessBaseSampleId, Long configAssayMethodId) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.selectAll(BusinessAssayProjectDataDO.class)
.selectAs(BusinessAssayTaskDataDO::getAssayOperator, BusinessAssayProjectDataExtendRespVO::getAssayOperator)
.selectAs(BusinessAssayTaskDataDO::getRecheckCount, BusinessAssayProjectDataExtendRespVO::getRecheckCount)
.selectAs(BusinessAssayTaskDataDO::getRetestCount, BusinessAssayProjectDataExtendRespVO::getRetestCount)
.selectAs(BusinessAssayTaskDataDO::getBusinessBaseSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessBaseSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubParentSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubSampleId)
.selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName)
.eq(BusinessAssayTaskDataDO::getBusinessBaseSampleId, businessBaseSampleId)
.eq(BusinessAssayTaskDataDO::getConfigAssayMethodId, configAssayMethodId));
}
default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataIds(List<Long> businessAssayTaskDataIds) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)

View File

@@ -290,6 +290,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
.selectAs(BusinessSubSampleDO::getConfigSubSampleId, BusinessAssayTaskDataExtendRespVO::getConfigSubSampleId)
.in(BusinessSubSampleDO::getSampleAssayCode, sampleAssayCodes)
.eq(ConfigAssayMethodDO::getDictionaryBusinessKey, configAssayMethodDictionaryBusinessKey)
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
@@ -404,6 +405,19 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)
.inSql(BusinessAssayTaskDataDO::getConfigAssayMethodId, inSql));
}
/**
* 根据正样样Id列表及分析方法Key查询分析任务
* @param businessBaseSampleIdList 正样id列表
* @param methodKey 分析方法key
* @return
*/
default List<BusinessAssayTaskDataDO> selectByBusinessBaseSampleIdsAndMethodKey(List<Long> businessBaseSampleIdList, String methodKey) {
String inSql = "SELECT tcam.ID FROM T_CFG_ASY_MTHD tcam WHERE tcam.DELETED = 0 AND tcam.DIC_BSN_KY = '" + methodKey + "'";
return selectList(new LambdaQueryWrapperX<BusinessAssayTaskDataDO>()
.in(BusinessAssayTaskDataDO::getBusinessBaseSampleId, businessBaseSampleIdList)
.inSql(BusinessAssayTaskDataDO::getConfigAssayMethodId, inSql));
}
/**
* 根据子样及分析部门查询分析任务

View File

@@ -61,4 +61,18 @@ public interface BusinessAssayTaskParameterDataMapper extends BaseMapperX<Busine
.orderByAsc(ConfigAssayMethodParameterDO::getSortNo));
}
default List<BusinessAssayTaskParameterDataExtendRespVO> selectExtendByBusinessAssayTaskDataIds(List<Long> businessAssayTaskDataIdList) {
return selectJoinList(BusinessAssayTaskParameterDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskParameterDataDO>()
.leftJoin(ConfigAssayMethodParameterDO.class, ConfigAssayMethodParameterDO::getId, BusinessAssayTaskParameterDataDO::getConfigAssayMethodParameterId)
.selectAll(BusinessAssayTaskParameterDataDO.class)
.selectAs(ConfigAssayMethodParameterDO::getConfigAssayMethodId, BusinessAssayTaskParameterDataExtendRespVO::getConfigAssayMethodId)
.selectAs(ConfigAssayMethodParameterDO::getParameterName, BusinessAssayTaskParameterDataExtendRespVO::getParameterName)
.selectAs(ConfigAssayMethodParameterDO::getShortName, BusinessAssayTaskParameterDataExtendRespVO::getShortName)
.selectAs(ConfigAssayMethodParameterDO::getKey, BusinessAssayTaskParameterDataExtendRespVO::getKey)
.selectAs(ConfigAssayMethodParameterDO::getNo, BusinessAssayTaskParameterDataExtendRespVO::getNo)
.in(BusinessAssayTaskParameterDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIdList)
);
}
}

View File

@@ -54,6 +54,7 @@ import com.zt.plat.module.qms.business.bus.liteflow.slot.SampleEntrustContext;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigAssayMethodProjectExtendRespVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfAdd;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfInfo;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfItem;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
@@ -446,9 +447,11 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
//扩展配置信息
String configInfomation = configSubSampleMethodDO.getConfigInfomation();
List<ConfigSubSampleMethodConfItem> getParamList = null;
if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
ConfigSubSampleMethodConfAdd addAssayTask = configSubSampleMethodConfInfo.getAddAssayTask();
getParamList = configSubSampleMethodConfInfo.getGetParam();
if (addAssayTask != null) {//需要添加任务
List<Long> conditionProjectIdList = addAssayTask.getConditionProjectIdList();
@@ -643,7 +646,24 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
if (getParamList != null) {
List<String> targetParameterList = getParamList.stream().filter(f -> f.getTarget().getProject().contains(configAssayMethodProjectDO.getSimpleName())).map(m -> m.getTarget().getParameter()).collect(Collectors.toList());
String forecastResult = businessSampleEntrustDetailDO.getForecastResult();
if (StringUtils.isNotBlank(forecastResult)) {
JSONArray array = JSON.parseArray(forecastResult);
for (int forecIndex = 0; forecIndex < array.size(); forecIndex++) {
JSONObject item = array.getJSONObject(forecIndex);
if (targetParameterList.contains(item.getString("simpleName"))) {
businessAssayParameterDataDO.setValue(item.getString("value"));
break;
}
}
}
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
@@ -661,7 +681,24 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
if (getParamList != null) {
List<String> targetParameterList = getParamList.stream().filter(f -> f.getTarget().getProject().contains(configAssayMethodProjectDO.getSimpleName())).map(m -> m.getTarget().getParameter()).collect(Collectors.toList());
String forecastResult = businessSampleEntrustDetailDO.getForecastResult();
if (StringUtils.isNotBlank(forecastResult)) {
JSONArray array = JSON.parseArray(forecastResult);
for (int forecIndex = 0; forecIndex < array.size(); forecIndex++) {
JSONObject item = array.getJSONObject(forecIndex);
if (targetParameterList.contains(item.getString("simpleName"))) {
businessAssayParameterDataDO.setValue(item.getString("value"));
break;
}
}
}
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
@@ -904,6 +941,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
@@ -922,6 +962,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO);

View File

@@ -123,6 +123,9 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
@Override
public List<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataList(BusinessAssayTaskDataReqVO reqVO) {
List<BusinessAssayTaskDataExtendRespVO> list = businessAssayTaskDataMapper.selectList(reqVO);
if (CollUtil.isEmpty(list)) {
return list;
}
List<Long> configSubSampleIdList = list.stream().map(m -> m.getConfigSubSampleId()).collect(Collectors.toList());
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, reqVO.getConfigAssayMethodId());
List<Long> businessAssayTaskDataIdList = list.stream().map(m -> m.getId()).collect(Collectors.toList());
@@ -144,8 +147,11 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
List<String> projectList = Arrays.asList(target.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = target.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
if (currentBusinessAssayProjectData == null) {//如果检测项目为空,则跳出当前循环
continue;
}
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && parameter.equals(f.getParameterKey())).findFirst().orElse(null);
if (currentBusinessAssayParameterData != null && StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ingredientInfoBuilder.append(currentBusinessAssayParameterData.getParameterName()).append("").append(currentBusinessAssayParameterData.getValue()).append("");
break;
@@ -166,6 +172,9 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
public PageResult<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataPage(BusinessAssayTaskDataPageReqVO pageReqVO) {
PageResult<BusinessAssayTaskDataExtendRespVO> page = businessAssayTaskDataMapper.selectPage(pageReqVO);
List<BusinessAssayTaskDataExtendRespVO> list = page.getList();
if (CollUtil.isEmpty(list)) {
return page;
}
List<Long> configSubSampleIdList = list.stream().map(m -> m.getConfigSubSampleId()).collect(Collectors.toList());
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, pageReqVO.getConfigAssayMethodId());
List<Long> businessAssayTaskDataIdList = list.stream().map(m -> m.getId()).collect(Collectors.toList());
@@ -187,8 +196,11 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
List<String> projectList = Arrays.asList(target.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = target.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
if (currentBusinessAssayProjectData == null) {//如果检测项目为空,则跳出当前循环
continue;
}
BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && parameter.equals(f.getParameterKey())).findFirst().orElse(null);
if (currentBusinessAssayParameterData != null && StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ingredientInfoBuilder.append(currentBusinessAssayParameterData.getParameterName()).append("").append(currentBusinessAssayParameterData.getValue()).append("");
break;

View File

@@ -290,7 +290,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
// value = value + "(" + businessAssayProjectDataExtendRespVO.getValue() + "x" + businessAssayProjectDataExtendRespVO.getCoefficient().setScale(3, RoundingMode.HALF_EVEN).toPlainString()+ ")";
// }
// businessSubSampleAssessmentMap.put(businessAssayProjectDataExtendRespVO.getBusinessAssayTaskDataId() + ";" + businessAssayProjectDataExtendRespVO.getBusinessSubSampleId() + ";" + businessAssayProjectDataExtendRespVO.getRecheckCount(), value);
businessSubSampleAssessmentMap.put(businessAssayProjectDataExtendRespVO.getBusinessAssayTaskDataId() + ";" + businessAssayProjectDataExtendRespVO.getBusinessSubSampleId() + ";" + businessAssayProjectDataExtendRespVO.getRecheckCount(), businessAssayProjectDataExtendRespVO.getValue());
businessSubSampleAssessmentMap.put(businessAssayProjectDataExtendRespVO.getBusinessAssayTaskDataId() + ";" + businessAssayProjectDataExtendRespVO.getBusinessSubSampleId() + ";" + businessAssayProjectDataExtendRespVO.getRecheckCount(), businessAssayProjectDataExtendRespVO.getValueAfter());
}
dataList.add(businessSubSampleAssessmentMap);
}

View File

@@ -666,11 +666,11 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String targetParameter = target.getParameter();
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(businessAssayTaskDataDO.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO == null) {
throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误");
}
// if (businessAssayParameterDataDO == null) {
// throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误");
// }
if (StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {
if (businessAssayParameterDataDO != null && StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {
//1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
//2 查询样品大类
@@ -679,20 +679,22 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//查询当前批次的第一个商检分析样
BusinessSampleEntrustDetailDO currBatchFirstBusinessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectCurrBatchFirstByBusinessBaseSampleIdAndBaseSampleDictionaryBusinessKey(businessAssayTaskDataDO.getBusinessBaseSampleId(), QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE);
List<BusinessSubParentSampleDO> currBusinessSubParentSampleDOList = businessSubParentSampleMapper.selectByBusinessBaseSampleId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId());
List<Long> currBusinessSubParentSampleIdList = currBusinessSubParentSampleDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(currBusinessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId(), configMethodId);
BusinessAssayProjectDataExtendRespVO sourceBusinessAssayProjectDataExtendRespVO = businessAssayProjectDataExtendList.stream().filter(f -> sourceProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (sourceBusinessAssayProjectDataExtendRespVO != null && StringUtils.isNotBlank(sourceBusinessAssayProjectDataExtendRespVO.getValue())) {
businessAssayParameterDataDO.setValue(sourceBusinessAssayProjectDataExtendRespVO.getValue());
}
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前样品的其他分析方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
// List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
// List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
// BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(businessAssayTaskDataDO.getBusinessBaseSampleId(), configMethodId);
BusinessAssayProjectDataExtendRespVO sourceBusinessAssayProjectDataExtendRespVO = businessAssayProjectDataExtendList.stream().filter(f -> sourceProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (sourceBusinessAssayProjectDataExtendRespVO != null && StringUtils.isNotBlank(sourceBusinessAssayProjectDataExtendRespVO.getValue())) {
businessAssayParameterDataDO.setValue(sourceBusinessAssayProjectDataExtendRespVO.getValue());
}
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询来样品位
@@ -720,11 +722,13 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayParameterDataDO.setValue(forecastValue);
} else {
//查询当前样品的其他方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) {
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
// List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
// List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
// BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(businessAssayTaskDataDO.getBusinessBaseSampleId(), configMethodId);
BusinessAssayProjectDataExtendRespVO sourceBusinessAssayProjectDataExtendRespVO = businessAssayProjectDataExtendList.stream().filter(f -> sourceProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (sourceBusinessAssayProjectDataExtendRespVO != null && StringUtils.isNotBlank(sourceBusinessAssayProjectDataExtendRespVO.getValue())) {
businessAssayParameterDataDO.setValue(sourceBusinessAssayProjectDataExtendRespVO.getValue());
}
}
@@ -1289,35 +1293,114 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodDOList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, businessAssayTaskDO.getConfigAssayMethodId());
//循环任务,赋值
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : businessAssayTaskDataExtendList) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodDOList.stream().filter(f -> f.getConfigBaseSampleId().equals(businessAssayTaskData.getConfigSubSampleId()) && f.getConfigAssayMethodId().equals(businessAssayTaskData.getConfigAssayMethodId())).findFirst().orElse(null);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : businessAssayTaskDataExtendList) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodDOList.stream().filter(f -> f.getConfigSubSampleId().equals(businessAssayTaskData.getConfigSubSampleId()) && f.getConfigAssayMethodId().equals(businessAssayTaskData.getConfigAssayMethodId())).findFirst().orElse(null);
String configInfomation = configSubSampleMethod.getConfigInfomation();
if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
List<ConfigSubSampleMethodConfItem> setParamList = configSubSampleMethodConfInfo.getSetParam();
String methodKey = setParamList.stream().map(m -> m.getTarget().getMethodKey()).distinct().findFirst().orElse(null);
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && f.getSimpleName().equals(targetProject)).findFirst().orElse(null);
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
if (CollUtil.isNotEmpty(setParamList)) {//参数不为空,则设置
//方法key
String methodKey = setParamList.stream().map(m -> m.getTarget().getMethodKey()).distinct().findFirst().orElse(null);
//1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId());
//2 查询样品大类
BaseSampleDO baseSampleDO = baseSampleMapper.selectById(businessSampleEntrustDetailDO.getBaseSampleId());
//3 判断样品大类类型
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//委托登记Id
Long businessSampleEntrustRegistrationId = businessSampleEntrustDetailDO.getBusinessSampleEntrustRegistrationId();
//查询委托登记明细
List<BusinessSampleEntrustDetailDO> businessSampleEntrustDetailList = businessSampleEntrustDetailMapper.selectByBusinessSampleEntrustRegistrationId(businessSampleEntrustRegistrationId);
//获取主样Id列表
List<Long> businessBaseSampleIdList = businessSampleEntrustDetailList.stream().map(m -> m.getBusinessBaseSampleId()).collect(Collectors.toList());
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessBaseSampleIdsAndMethodKey(businessBaseSampleIdList, methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null && StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {//值为空,才赋值
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
}
}
}

View File

@@ -7,6 +7,7 @@ import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO;
@@ -29,35 +30,28 @@ import java.util.List;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 入库")
@Tag(name = "管理后台 - 物料入库")
@RestController
@RequestMapping("/t/material-inventory-inbound")
@RequestMapping("/qms/resource/material-inventory-inbound")
@Validated
@DeptDataPermissionIgnore(enable = "true")
public class MaterialInventoryInboundController implements BusinessControllerMarker {
@Resource
private MaterialInventoryInboundService materialInventoryInboundService;
@PostMapping("/create")
@Operation(summary = "创建入库")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:create')")
@PostMapping("/add")
@Operation(summary = "物料入库")
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:create')")
public CommonResult<MaterialInventoryInboundRespVO> createMaterialInventoryInbound(@Valid @RequestBody MaterialInventoryInboundSaveReqVO createReqVO) {
return success(materialInventoryInboundService.createMaterialInventoryInbound(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新入库")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:update')")
public CommonResult<Boolean> updateMaterialInventoryInbound(@Valid @RequestBody MaterialInventoryInboundSaveReqVO updateReqVO) {
materialInventoryInboundService.updateMaterialInventoryInbound(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除入库")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:delete')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInbound(@RequestParam("id") Long id) {
materialInventoryInboundService.deleteMaterialInventoryInbound(id);
return success(true);
@@ -66,7 +60,7 @@ public class MaterialInventoryInboundController implements BusinessControllerMar
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除入库")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:delete')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInboundList(@RequestBody BatchDeleteReqVO req) {
materialInventoryInboundService.deleteMaterialInventoryInboundListByIds(req.getIds());
return success(true);
@@ -75,7 +69,7 @@ public class MaterialInventoryInboundController implements BusinessControllerMar
@GetMapping("/get")
@Operation(summary = "获得入库")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:query')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:query')")
public CommonResult<MaterialInventoryInboundRespVO> getMaterialInventoryInbound(@RequestParam("id") Long id) {
MaterialInventoryInboundDO materialInventoryInbound = materialInventoryInboundService.getMaterialInventoryInbound(id);
return success(BeanUtils.toBean(materialInventoryInbound, MaterialInventoryInboundRespVO.class));
@@ -83,7 +77,7 @@ public class MaterialInventoryInboundController implements BusinessControllerMar
@GetMapping("/page")
@Operation(summary = "获得入库分页")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:query')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:query')")
public CommonResult<PageResult<MaterialInventoryInboundRespVO>> getMaterialInventoryInboundPage(@Valid MaterialInventoryInboundPageReqVO pageReqVO) {
PageResult<MaterialInventoryInboundDO> pageResult = materialInventoryInboundService.getMaterialInventoryInboundPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundRespVO.class));
@@ -91,7 +85,7 @@ public class MaterialInventoryInboundController implements BusinessControllerMar
@GetMapping("/export-excel")
@Operation(summary = "导出入库 Excel")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound:export')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryInboundExcel(@Valid MaterialInventoryInboundPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {

View File

@@ -31,7 +31,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 入库明细,验收入库、盘盈入库等")
@RestController
@RequestMapping("/t/material-inventory-inbound-detail")
@RequestMapping("/qms/resource/material-inventory-inbound-detail")
@Validated
public class MaterialInventoryInboundDetailController implements BusinessControllerMarker {
@@ -41,14 +41,14 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@PostMapping("/create")
@Operation(summary = "创建入库明细,验收入库、盘盈入库等")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:create')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:create')")
public CommonResult<MaterialInventoryInboundDetailRespVO> createMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO createReqVO) {
return success(materialInventoryInboundDetailService.createMaterialInventoryInboundDetail(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新入库明细,验收入库、盘盈入库等")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:update')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:update')")
public CommonResult<Boolean> updateMaterialInventoryInboundDetail(@Valid @RequestBody MaterialInventoryInboundDetailSaveReqVO updateReqVO) {
materialInventoryInboundDetailService.updateMaterialInventoryInboundDetail(updateReqVO);
return success(true);
@@ -57,7 +57,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@DeleteMapping("/delete")
@Operation(summary = "删除入库明细,验收入库、盘盈入库等")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:delete')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInboundDetail(@RequestParam("id") Long id) {
materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetail(id);
return success(true);
@@ -66,7 +66,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除入库明细,验收入库、盘盈入库等")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:delete')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:delete')")
public CommonResult<Boolean> deleteMaterialInventoryInboundDetailList(@RequestBody BatchDeleteReqVO req) {
materialInventoryInboundDetailService.deleteMaterialInventoryInboundDetailListByIds(req.getIds());
return success(true);
@@ -75,7 +75,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@GetMapping("/get")
@Operation(summary = "获得入库明细,验收入库、盘盈入库等")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:query')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
public CommonResult<MaterialInventoryInboundDetailRespVO> getMaterialInventoryInboundDetail(@RequestParam("id") Long id) {
MaterialInventoryInboundDetailDO materialInventoryInboundDetail = materialInventoryInboundDetailService.getMaterialInventoryInboundDetail(id);
return success(BeanUtils.toBean(materialInventoryInboundDetail, MaterialInventoryInboundDetailRespVO.class));
@@ -83,7 +83,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@GetMapping("/page")
@Operation(summary = "获得入库明细,验收入库、盘盈入库等分页")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:query')")
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
public CommonResult<PageResult<MaterialInventoryInboundDetailRespVO>> getMaterialInventoryInboundDetailPage(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) {
PageResult<MaterialInventoryInboundDetailDO> pageResult = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundDetailRespVO.class));
@@ -91,7 +91,7 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
@GetMapping("/export-excel")
@Operation(summary = "导出入库明细,验收入库、盘盈入库等 Excel")
@PreAuthorize("@ss.hasPermission('t:material-inventory-inbound-detail:export')")
@PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialInventoryInboundDetailExcel(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {

View File

@@ -25,6 +25,9 @@ public class MaterialBatchPageReqVO extends PageParam {
@Schema(description = "是否只需要工段")
private Boolean onlyGong = false;
@Schema(description = "true-已处理false-未处理")
private Boolean treatment = false;
@Schema(description = "批次编号")
private String batchNo;

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
@@ -48,6 +49,10 @@ public class MaterialBatchRespVO {
@ExcelProperty("总数量")
private BigDecimal inboundQuantity;
@Schema(description = "已入库数量")
@ExcelProperty("已入库数量")
private BigDecimal inboundEndQuantity;
@Schema(description = "存放位置描述")
@ExcelProperty("存放位置描述")
private String location;

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
@@ -26,6 +27,9 @@ public class MaterialInfomationPageReqVO extends PageParam {
@Schema(description = "编码")
private String code;
@Schema(description = "名称")
private String name;
@Schema(description = "技术参数")
private String parameter;

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
@@ -33,6 +34,10 @@ public class MaterialInfomationRespVO {
@ExcelProperty("编码")
private String code;
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
@Schema(description = "技术参数")
@ExcelProperty("技术参数")
private String parameter;

View File

@@ -1,9 +1,7 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -27,6 +25,9 @@ public class MaterialInfomationSaveReqVO {
@Schema(description = "编码")
private String code;
@Schema(description = "名称")
private String name;
@Schema(description = "技术参数")
private String parameter;

View File

@@ -24,10 +24,16 @@ public class MaterialInventoryInboundDetailRespVO {
@ExcelProperty("批次id")
private Long batchId;
// 物料名称
// 批次编号
@Schema(description = "批次工段id", example = "1454")
@ExcelProperty("批次工段id")
private Long batchGongduanId;
// 工段名
@Schema(description = "物料实例ID", example = "17457")
@ExcelProperty("物料实例ID")
private Long materialInfomationId;

View File

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 入库 Response VO")
@@ -48,6 +49,26 @@ public class MaterialInventoryInboundRespVO {
@ExcelProperty("申请时间")
private LocalDateTime applyTime;
@Schema(description = "监督人,危化品才有")
@ExcelProperty("监督人,危化品才有")
private String superviseUser;
@Schema(description = "监督人id危化品才有")
@ExcelProperty("监督人id危化品才有")
private Long superviseUserId;
@Schema(description = "批次工段id")
@ExcelProperty("批次工段id")
private Long gongduanId;
@Schema(description = "入库数量")
@ExcelProperty("入库数量")
private BigDecimal quantity;
@Schema(description = "库位id")
@ExcelProperty("库位id")
private Long locationId;
@Schema(description = "流程实例id", example = "16660")
@ExcelProperty("流程实例id")
private String flowInstanceId;

View File

@@ -1,8 +1,10 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 入库新增/修改 Request VO")
@@ -36,6 +38,22 @@ public class MaterialInventoryInboundSaveReqVO {
@Schema(description = "申请时间")
private LocalDateTime applyTime;
@Schema(description = "监督人,危化品才有")
private String superviseUser;
@Schema(description = "监督人id危化品才有")
private Long superviseUserId;
@Schema(description = "批次工段id")
private Long gongduanId;
@Schema(description = "入库数量")
@Min(value = 0, message = "入库数量不能小于0")
private BigDecimal quantity;
@Schema(description = "库位id")
private Long locationId;
@Schema(description = "流程实例id", example = "16660")
private String flowInstanceId;

View File

@@ -3,6 +3,7 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -97,6 +98,7 @@ public class MaterialProductRespVO {
@Schema(description = "开封后保质期是否变化,1-是0-否")
@ExcelProperty("开封后保质期是否变化,1-是0-否")
@Dict(dicCode = "yes_or_no")
private Integer openDueFlag;
@Schema(description = "开封后保质期(天)")
@@ -133,6 +135,7 @@ public class MaterialProductRespVO {
@Schema(description = "是否进行库存预警,1-是0-否")
@ExcelProperty("是否进行库存预警,1-是0-否")
@Dict(dicCode = "yes_or_no")
private Integer InventoryAlarmFlag;
@Schema(description = "库存预警区间,json格式配置")

View File

@@ -53,6 +53,11 @@ public class MaterialBatchDO extends BusinessBaseDO {
@TableField("INB_QTY")
private BigDecimal inboundQuantity;
/**
* 已入库数量
*/
@TableField("INB_END_QTY")
private BigDecimal inboundEndQuantity;
/**
* 存放位置描述
*/
@TableField("LOC")

View File

@@ -46,17 +46,57 @@ public class MaterialInfomationDO extends BusinessBaseDO {
* 存放位置
*/
@TableField("LOC_ID")
private String locationId;
private Long locationId;
/**
* 工段id
*/
@TableField("GONG_ID")
private Long gongduanId;
/**
* 编码
*/
@TableField("CD")
private String code;
/**
* 名称
*/
@TableField("NAME")
private String name;
/**
* 型号
*/
@TableField("MDL_NO")
private String modelNo;
/**
* 规格
*/
@TableField("SPEC")
private String specification;
/**
* 技术参数
*/
@TableField("PRM")
private String parameter;
/**
* 制造商
*/
@TableField("MFR")
private String manufacturer;
/**
* 单位
*/
@TableField("UNT")
private String unit;
/**
* 保质期(天)
*/
@TableField("DUE")
private Integer due;
/**
* 开封后保质期(天)
*/
@TableField("OPN_DUE_AFT")
private Integer openDueAfter;
/**
* 上架状态,0-未上架1-已上架
*/
@@ -107,6 +147,11 @@ public class MaterialInfomationDO extends BusinessBaseDO {
*/
@TableField("OPN_DT")
private LocalDateTime openDate;
/**
* 生产日期
*/
@TableField("MFR_DT")
private LocalDate manufacturerDate;
/**
* 到期日期
*/

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 入库 DO
@@ -70,6 +71,31 @@ public class MaterialInventoryInboundDO extends BusinessBaseDO {
*/
@TableField("APL_TM")
private LocalDateTime applyTime;
/**
* 监督人,危化品才有
*/
@TableField("SUPR_USER")
private String superviseUser;
/**
* 监督人id危化品才有
*/
@TableField("SUPR_USER_ID")
private Long superviseUserId;
/**
* 批次工段id
*/
@TableField("GONG_ID")
private Long gongduanId;
/**
* 入库数量
*/
@TableField("QTY")
private BigDecimal quantity;
/**
* 库位id
*/
@TableField("LOC_ID")
private Long locationId;
/**
* 流程实例id
*/

View File

@@ -8,6 +8,7 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
@@ -74,6 +75,42 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
default PageResult<MaterialBatchRespVO> selectGongPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long visitDeptId = null;
if (loginUser != null) {
visitDeptId = loginUser.getVisitDeptId();
}
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
.selectAll(MaterialBatchDO.class)
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate)
.selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialBatchDO::getParentId)
// 只查询工段
.ne(MaterialBatchDO::getParentId, 0)
.eq(MaterialBatchDO::getSubmitStatus, 1)
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.DELETED = 0")
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
.likeIfExists(MaterialBatchDO::getLocation, reqVO.getLocation())
.likeIfExists(MaterialBatchDO::getSupplierId, reqVO.getSupplierId())
.eqIfExists(MaterialBatchDO::getAssignDepartmentId, reqVO.getAssignDepartmentId())
.likeIfExists(MaterialBatchDO::getAssignDepartmentName, reqVO.getAssignDepartmentName())
.eqIfExists(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.eqIfExists(MaterialBatchDO::getAssayFlag, reqVO.getAssayFlag())
.eqIfExists(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus())
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark())
.orderByDesc(MaterialBatchDO::getParentId);
return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper);
}
default PageResult<MaterialBatchRespVO> selectAcceptedGongPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long visitDeptId = null;
@@ -85,19 +122,22 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.selectAs("batch.MFR_DT", MaterialBatchDO::getManufacturerDate)
.selectAs("batch.DUE_DT", MaterialBatchDO::getDueDate)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialBatchDO::getParentId)
// 只查询工段
.ne(MaterialBatchDO::getParentId, 0)
.eq(MaterialBatchDO::getSubmitStatus, 1)
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.id AND ld.DELETED = 0")
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
.eq(MaterialBatchDO::getAcceptanceStatus, QmsCommonConstant.COMPLETED)
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
.likeIfExists(MaterialBatchDO::getLocation, reqVO.getLocation())
.likeIfExists(MaterialBatchDO::getSupplierId, reqVO.getSupplierId())
// .betweenIfPresent(MaterialBatchDO::getManufacturerDate, reqVO.getManufacturerDate())
// .betweenIfPresent(MaterialBatchDO::getDueDate, reqVO.getDueDate())
// .betweenIfPresent(MaterialBatchDO::getManufacturerDate, reqVO.getManufacturerDate())
// .betweenIfPresent(MaterialBatchDO::getDueDate, reqVO.getDueDate())
.eqIfExists(MaterialBatchDO::getAssignDepartmentId, reqVO.getAssignDepartmentId())
.likeIfExists(MaterialBatchDO::getAssignDepartmentName, reqVO.getAssignDepartmentName())
.eqIfExists(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
@@ -105,8 +145,12 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.eqIfExists(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus())
.eqIfExists(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfExists(MaterialBatchDO::getRemark, reqVO.getRemark())
// .betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialBatchDO::getId);
// 已处理
.le(reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity)
// 未处理
.gt(!reqVO.getTreatment(), MaterialBatchDO::getInboundQuantity, MaterialBatchDO::getInboundEndQuantity)
// .between(reqVO.getCreateTime() != null && reqVO.getCreateTime().length == 2, MaterialBatchDO::getCreateTime, reqVO.getCreateTime()[0], reqVO.getCreateTime()[1])
.orderByDesc(MaterialBatchDO::getParentId);
return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper);
}

View File

@@ -124,4 +124,19 @@ public interface MaterialBatchService {
* @return 分页数据
*/
PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(@Valid MaterialBatchPageReqVO pageReqVO);
/**
* 更新批次工段入库数量
*
* @param gongDO 批次工段信息
*/
void updateMaterialBatchInbEndQty(MaterialBatchDO gongDO);
/**
* 更新批次工段验收状态
*
* @param lfcId 流程id
* @param status 验收状态
*/
void updateMaterialBatchAcceptStatusByLfcId(Long lfcId, String status);
}

View File

@@ -6,10 +6,12 @@ import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.core.code.SequenceUtil;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchSaveReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper;
import jakarta.annotation.Resource;
@@ -43,7 +45,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Autowired
private MaterialProductService materialProductService;
private final String sequenceKey = "QMS_MATERIAL_BATCH_NO";
@Autowired
private MaterialLifecycleDetailService materialLifecycleDetailService;
private final String batchSequenceKey = "QMS_MATERIAL_BATCH_NO";
@Override
public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) {
@@ -51,7 +56,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class);
// 批次编号
mtrlBat.setBatchNo(sequenceUtil.genCode(sequenceKey));
mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey));
mtrlBat.setParentId(0L);
materialBatchMapper.insert(mtrlBat);
@@ -265,21 +270,46 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Override
public PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
// 需要排除已经被选择的工段
Long pdtId = pageReqVO.getProductId();
PageResult<MaterialBatchRespVO> pageResult;
if (pdtId == null) {
pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of());
} else {
if (QmsCommonConstant.COMPLETED.equals(pageReqVO.getAcceptanceStatus())) {
// 用于入库
if (pdtId == null) {
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
}
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
pageResult = materialBatchMapper.selectGongPage(pageReqVO, List.of());
} else {
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
pageResult = materialBatchMapper.selectGongPage(pageReqVO, pdtIds);
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
}
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, pdtIds);
}
return pageResult;
// 用于验收
// 需要排除已经被选择的工段
if (pdtId == null) {
return materialBatchMapper.selectGongPage(pageReqVO, List.of());
}
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
return materialBatchMapper.selectGongPage(pageReqVO, List.of());
}
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
return materialBatchMapper.selectGongPage(pageReqVO, pdtIds);
}
@Override
public void updateMaterialBatchInbEndQty(MaterialBatchDO gongDO) {
materialBatchMapper.updateById(gongDO);
}
@Override
public void updateMaterialBatchAcceptStatusByLfcId(Long lfcId, String status) {
List<MaterialLifecycleDetailDO> detailList = materialLifecycleDetailService.getDetailListByLfcId(lfcId);
if (CollUtil.isEmpty(detailList)) return;
List<Long> gongIds = detailList.stream().map(MaterialLifecycleDetailDO::getBatchGongduanId).toList();
if (CollUtil.isEmpty(gongIds)) return;
MaterialBatchDO updateEntity = new MaterialBatchDO().setAcceptanceStatus(status);
materialBatchMapper.update(updateEntity, Wrappers.lambdaQuery(MaterialBatchDO.class)
.in(MaterialBatchDO::getId, gongIds));
}
/**

View File

@@ -68,4 +68,11 @@ public interface MaterialInfomationService {
* @return 大类id-库存数量
*/
Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds);
/**
* 批量保存物料实例
*
* @param infomationDOS 物料实例
*/
void saveBatch(List<MaterialInfomationDO> infomationDOS);
}

View File

@@ -107,4 +107,9 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
));
}
@Override
public void saveBatch(List<MaterialInfomationDO> infomationDOS) {
materialInfomationMapper.insertBatch(infomationDOS);
}
}

View File

@@ -61,4 +61,10 @@ public interface MaterialInventoryInboundDetailService {
*/
PageResult<MaterialInventoryInboundDetailDO> getMaterialInventoryInboundDetailPage(MaterialInventoryInboundDetailPageReqVO pageReqVO);
/**
* 批量保存入库明细
*
* @param detailList 入库明细
*/
void saveBatch(List<MaterialInventoryInboundDetailDO> detailList);
}

View File

@@ -86,4 +86,9 @@ public class MaterialInventoryInboundDetailServiceImpl implements MaterialInvent
return materialInventoryInboundDetailMapper.selectPage(pageReqVO);
}
@Override
public void saveBatch(List<MaterialInventoryInboundDetailDO> detailList) {
materialInventoryInboundDetailMapper.insertBatch(detailList);
}
}

View File

@@ -1,21 +1,34 @@
package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.core.code.SequenceUtil;
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundSaveReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INVENTORY_INBOUND_NOT_EXISTS;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
import static com.zt.plat.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS;
/**
@@ -30,13 +43,106 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb
@Resource
private MaterialInventoryInboundMapper materialInventoryInboundMapper;
@Autowired
private MaterialLifecycleDetailService materialLifecycleDetailService;
@Autowired
private MaterialBatchService materialBatchService;
@Autowired
private MaterialProductService materialProductService;
@Autowired
private SequenceUtil sequenceUtil;
@Autowired
private MaterialInfomationService materialInfomationService;
@Autowired
private MaterialInventoryInboundDetailService materialInventoryInboundDetailService;
private final String infSequenceKey = "QMS_MATERIAL_INF_NO";
@Transactional
@Override
public MaterialInventoryInboundRespVO createMaterialInventoryInbound(MaterialInventoryInboundSaveReqVO createReqVO) {
// 插入
MaterialInventoryInboundDO materialInventoryInbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class);
materialInventoryInboundMapper.insert(materialInventoryInbound);
Long gongduanId = createReqVO.getGongduanId();
BigDecimal reqQuantity = createReqVO.getQuantity();
if (reqQuantity.compareTo(BigDecimal.ZERO) <= 0) throw new ServiceException(1_032_160_000, "入库数量不能小于等于0");
MaterialBatchDO gongDO = materialBatchService.getMaterialBatch(gongduanId);
if (gongDO == null) throw exception(MATERIAL_BATCH_GONG_NOT_EXISTS);
// 1.检查工段是否已经验收
if (!QmsCommonConstant.COMPLETED.equals(gongDO.getAcceptanceStatus()))
throw new ServiceException(1_032_160_000, "工段未验收,不能入库");
// 2.入库数量不大于批次工段数量
if (reqQuantity.compareTo(gongDO.getInboundQuantity()) > 0) throw new ServiceException(1_032_160_000, "入库数量不能大于批次工段数量");
// TODO 这儿应该调整为去物料实例统计出此工段的入库数量
List<MaterialInventoryInboundDO> inboundDOS = materialInventoryInboundMapper.selectList(Wrappers.lambdaQuery(MaterialInventoryInboundDO.class)
.eq(MaterialInventoryInboundDO::getGongduanId, gongduanId));
if (CollUtil.isNotEmpty(inboundDOS)) {
BigDecimal totalQuantity = reqQuantity;
for (MaterialInventoryInboundDO inboundDO : inboundDOS) {
totalQuantity = totalQuantity.add(inboundDO.getQuantity());
}
if (totalQuantity.compareTo(gongDO.getInboundQuantity()) > 0) throw new ServiceException(1_032_160_000, "入库数量不能大于批次工段数量");
}
// 3.保存入库记录
MaterialInventoryInboundDO inbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (loginUser == null) throw exception(USER_NOT_EXISTS);
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
inbound.setApplyUser(loginUserNickname).setApplyUserId(loginUser.getId())
.setApplyDepartment(loginUser.getVisitDeptName()).setApplyDepartmentId(loginUser.getVisitDeptId())
.setApplyTime(LocalDateTime.now())
.setRemark(gongDO.getRemark());
materialInventoryInboundMapper.insert(inbound);
// 4.生成物料实例
Long productId = gongDO.getProductId();
MaterialProductDO product = materialProductService.getMaterialProduct(productId);
if (product == null || !DataTypeConstant.DATA_TYPE_DATA.equals(product.getNodeType()))
throw exception(MATERIAL_PRODUCT_NOT_EXISTS);
Long batchId = gongDO.getParentId();
MaterialBatchDO batch = materialBatchService.getMaterialBatch(batchId);
if (batch == null || batch.getParentId() != 0) throw exception(MATERIAL_BATCH_NOT_EXISTS);
List<MaterialInfomationDO> infomationDOS = new ArrayList<>();
for (int i = 0; i < reqQuantity.intValue(); i++) {
MaterialInfomationDO infomationDO = new MaterialInfomationDO();
infomationDO
.setProductId(productId).setBatchId(batchId)
.setLocationId(createReqVO.getLocationId())
.setGongduanId(gongduanId)
.setSpecification(product.getSpecification()).setModelNo(product.getModelNo())
.setParameter(product.getParameter())
.setManufacturer(product.getManufacturer()).setUnit(product.getUnit())
.setDue(product.getDue()).setOpenDueAfter(product.getOpenDueAfter())
.setPublishStatus(0)
.setUsageStatus(0)
.setOpenStatus(0)
.setManufacturerDate(batch.getManufacturerDate()).setExpirationDate(batch.getDueDate());
// 生成编号
String code = sequenceUtil.genCode(infSequenceKey);
infomationDO.setCode(code);
infomationDOS.add(infomationDO);
}
materialInfomationService.saveBatch(infomationDOS);
// 5.保存入库明细
List<MaterialInventoryInboundDetailDO> detailList = new ArrayList<>();
for (MaterialInfomationDO infomationDO : infomationDOS) {
MaterialInventoryInboundDetailDO detail = new MaterialInventoryInboundDetailDO();
detail
.setInboundId(inbound.getId())
.setBatchId(batchId)
.setBatchGongduanId(gongduanId)
.setMaterialInfomationId(infomationDO.getId())
.setInboundUserName(loginUserNickname)
.setInboundUserId(loginUser.getId())
.setInboundDepartmentName(loginUser.getVisitDeptName())
.setInboundDepartmentId(loginUser.getVisitDeptId())
.setInboundTime(inbound.getApplyTime());
detailList.add(detail);
}
materialInventoryInboundDetailService.saveBatch(detailList);
// 更新工段已入库数量
gongDO.setInboundEndQuantity(gongDO.getInboundEndQuantity().add(reqQuantity));
materialBatchService.updateMaterialBatchInbEndQty(gongDO);
// 返回
return BeanUtils.toBean(materialInventoryInbound, MaterialInventoryInboundRespVO.class);
return BeanUtils.toBean(inbound, MaterialInventoryInboundRespVO.class);
}
@Override

View File

@@ -88,5 +88,28 @@ public interface MaterialLifecycleDetailService {
* @param id 流程id
* @return 明细列表
*/
List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id);
List<MaterialLifecycleDetailRespVO> getDetailListWithPdtInfoByLfcId(Long id);
/**
* 根据工段id 获取流程明细数据
* @param gongduanId 工段id
* @return 明细数据
*/
MaterialLifecycleDetailDO getMaterialLifecycleDetailByGongId(Long gongduanId);
/**
* 更新流程明细状态
*
* @param lfcId 流程id
* @param status 状态
*/
void updateDetailTreatStatusByLfcId(Long lfcId, String status);
/**
* 根据流程id 获取流程明细数据
*
* @param lfcId 流程id
* @return 明细列表
*/
List<MaterialLifecycleDetailDO> getDetailListByLfcId(Long lfcId);
}

View File

@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.enums.QmsBpmConstant;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO;
@@ -107,9 +109,34 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta
}
@Override
public List<MaterialLifecycleDetailRespVO> getMaterialLifecycleDetailListByLfcId(Long id) {
public List<MaterialLifecycleDetailRespVO> getDetailListWithPdtInfoByLfcId(Long id) {
return materialLifecycleDetailMapper.selectListWithPdtBatInfo(id);
}
@Override
public MaterialLifecycleDetailDO getMaterialLifecycleDetailByGongId(Long gongduanId) {
List<MaterialLifecycleDetailDO> detailDOS = materialLifecycleDetailMapper.selectList(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
.eq(MaterialLifecycleDetailDO::getBatchGongduanId, gongduanId)
.last("limit 1"));
if (CollUtil.isEmpty(detailDOS)) return null;
return detailDOS.get(0);
}
@Override
public void updateDetailTreatStatusByLfcId(Long lfcId, String status) {
boolean isCompleted = QmsCommonConstant.COMPLETED.equals(status);
MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isCompleted ? 1 : 0);
materialLifecycleDetailMapper.update(detailUpdate, Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
.eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId));
}
@Override
public List<MaterialLifecycleDetailDO> getDetailListByLfcId(Long lfcId) {
return materialLifecycleDetailMapper.selectList(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
.eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId));
}
}

View File

@@ -3,6 +3,7 @@ package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.CommonResult;
@@ -17,6 +18,8 @@ import com.zt.plat.module.bpm.api.task.dto.BpmTaskApproveReqDTO;
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
import com.zt.plat.module.qms.enums.QmsBpmConstant;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
@@ -70,6 +73,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
@Autowired
private BpmProcessInstanceApi bpmProcessInstanceApi;
@Autowired
private DataKeyCheckService dataKeyCheckService;
@Transactional
@Override
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
@@ -114,7 +120,7 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
MaterialLifecycleDetailDO detailDO = new MaterialLifecycleDetailDO();
detailDO.setLifecycleId(mtrlLfc.getId())
.setProductId(gong.getProductId()).setBatchId(gong.getParentId())
.setBatchGongduanId(gong.getId())
.setBatchGongduanId(gong.getId()).setBusinessType(mtrlLfc.getBusinessType())
.setAssayFlag(gong.getAssayFlag())
.setTreatmentStatus(0);
return detailDO;
@@ -202,7 +208,7 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
if (lifecycleDO == null) return null;
MaterialLifecycleRespVO respVO = BeanUtils.toBean(lifecycleDO, MaterialLifecycleRespVO.class);
// 获取明细
List<MaterialLifecycleDetailRespVO> detailRespVOS = materialLifecycleDetailService.getMaterialLifecycleDetailListByLfcId(id);
List<MaterialLifecycleDetailRespVO> detailRespVOS = materialLifecycleDetailService.getDetailListWithPdtInfoByLfcId(id);
respVO.setDetailList(detailRespVOS);
return respVO;
}
@@ -276,19 +282,18 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId()))
.setVariables(variables);
// switch (lifecycleDO.getBusinessType()) {
// case "验收":
// reqDTO.setProcessDefinitionKey("MATERIAL_ACCEPTANCE_FLOW_KEY");
// break;
// case "退换货":
// reqDTO.setProcessDefinitionKey("MATERIAL_RETURN_EXCHANGE_FLOW_KEY");
// break;
// case "配置申请":
// reqDTO.setProcessDefinitionKey("MATERIAL_CONFIG_APPLY_FLOW_KEY");
// break;
// }
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_COMMON");
// TODO 流程key根据业务类型动态获取
switch (lifecycleDO.getBusinessType()) {
case "验收":
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_ACCEPTANCE");
break;
case "退换货":
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_RETURN_EXCHANGE");
break;
case "配置申请":
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_CONFIG_APPLY");
break;
}
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
@@ -307,36 +312,73 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
*/
@Override
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
log.info("物料流程回调信息:{}", reqDTO.toString());
/*
QmsBpmDTO(
processInstanceId=042585c1-00e3-11f1-9df0-005056c00001,
businessKey=2018618104343769090,
variables={
"_FLOWABLE_SKIP_EXPRESSION_ENABLED":true,
"processInstanceId":"042585c1-00e3-11f1-9df0-005056c00001",
"nrOfActiveInstances":1,
"bpmFieldExtensions":[],
"PROCESS_STATUS":1,
"currentActivityInsId":"043c904a-00e3-11f1-9df0-005056c00001",
"bpmCallbackBean":"materialLifecycleService",
"applyDepartment":"检验检测管理中心",
"Activity_0tp833v_assignees":["2008359763063820290"],
"loopCounter":0,
"applyUserId":"2008359763063820290",
"nrOfInstances":1,
"PROCESS_START_USER_ID":"2008359763063820290",
"applyUser":"云铜检验管理员",
"Activity_0tp833v_assignee":"2008359763063820290",
"applyDepartmentId":170,
"applyTime":"2026-02-03 17:30:44",
"mainId":"2018618104343769090",
"bpmCallbackActivityId":"Activity_0tp833v",
"nrOfCompletedInstances":1
},
state=)
*/
// 变更流程状态
return null;
log.debug("物料流程回调信息:{}", reqDTO.toString());
JSONObject variables = reqDTO.getVariables();
String processInsId = reqDTO.getProcessInstanceId();
String currentActivityInsId = variables.getString(QmsBpmConstant.BPM_CUR_ACTIVITY_INS_ID);
String returnFlag = variables.getString(QmsBpmConstant.BPM_REJECT_TO_FIRST_FLAG);
// 同一个节点需要避免重复处理
String checkKey = currentActivityInsId;
if(StrUtil.isEmpty(currentActivityInsId))
checkKey = processInsId + "-create";
if("1".equals(returnFlag))
checkKey += "-reject";
try{
dataKeyCheckService.create(checkKey, this.getClass().getName());
} catch (Exception e){
log.error("checkKey 重复key={}", checkKey);
return CommonResult.success(new JSONObject());
}
// 流程状态处理 1-提交(含退回) 3-拒绝 4-取消流程
String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS);
String businessKey = reqDTO.getBusinessKey();
JSONArray fieldExtensions = new JSONArray();
if(variables.containsKey(QmsBpmConstant.BPM_FIELD_EXTENSIONS)){
fieldExtensions = variables.getJSONArray(QmsBpmConstant.BPM_FIELD_EXTENSIONS);
}
MaterialLifecycleDO entity = materialLifecycleMapper.selectById(Long.valueOf(businessKey));
// String currentActivityId = variables.getString(QmsBpmConstant.BPM_CALLBACK_ACTIVITY_ID);
// 检查是否最后一个节点
boolean lastActivityFlag = false;
boolean firstActivityFlag = false;
if(!fieldExtensions.isEmpty()){
for(int i = 0; i < fieldExtensions.size(); i++){
JSONObject fieldExtension = fieldExtensions.getJSONObject(i);
if(fieldExtension.getString("fieldName").equalsIgnoreCase(QmsBpmConstant.BPM_LAST_ACTIVITY_FLAG)){
lastActivityFlag = true;
}
if(fieldExtension.getString("fieldName").equalsIgnoreCase(QmsBpmConstant.BPM_FIRST_ACTIVITY_FLAG)){
firstActivityFlag = true;
}
}
}
// 根据流程状态处理业务数据
if(("1").equals(returnFlag)){
// 驳回。流程需要配置退回到发起节点
entity.setFlowStatus(QmsCommonConstant.REJECTED);
} else if("3".equals(PROCESS_STATUS)){
// 拒绝
entity.setFlowStatus(QmsCommonConstant.REFUSED);
} else if("4".equals(PROCESS_STATUS)){
// 作废
entity.setFlowStatus(QmsCommonConstant.VOID);
} else if("1".equals(PROCESS_STATUS) || "2".equals(PROCESS_STATUS)){
// 通过
if(firstActivityFlag)
// 驳回后重新提交
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
if(lastActivityFlag) {
// 结束审批
entity.setFlowStatus(QmsCommonConstant.COMPLETED);
// 更新明细处理状态
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED);
// 更新批次工段验收状态
materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED);
}
}
materialLifecycleMapper.updateById(entity);
return CommonResult.success(new JSONObject());
}
}

View File

@@ -54,6 +54,26 @@ public class XRFDeviceSampleReqVO implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "样品时间")
private LocalDateTime sampleTime;
/**
* 样品开始时间
*/
@JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化(响应)
@JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化(请求)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "样品开始时间")
private LocalDateTime sampleStartTime;
/**
* 样品结束时间
*/
@JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化(响应)
@JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化(请求)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "样品结束时间")
private LocalDateTime sampleEndTime;
/**
* 分析人

View File

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -14,32 +15,48 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskParameterDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleEntrustDetailDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessXRFDataDO;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayParameterDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayProjectDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskParameterDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCCoefficientDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCCoefficientParameterDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCManagementDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCManagementProjectDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSampleEntrustDetailMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessXRFDataMapper;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfInfo;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfItem;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfPoint;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFConversionRateDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFLineDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFProjectDO;
import com.zt.plat.module.qms.business.config.dal.mapper.BaseSampleMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFConversionRateMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFLineMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFProjectMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.*;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@@ -59,15 +76,30 @@ public class XRFDataServiceImpl implements XRFDataService {
@Resource
private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper;
@Resource
private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
@Resource
private BusinessXRFDataMapper businessXRFDataMapper;
@Resource
private BaseSampleMapper baseSampleMapper;
@Resource
private BusinessSampleEntrustDetailMapper businessSampleEntrustDetailMapper;
@Resource
private BusinessAssayTaskDataMapper businessAssayTaskDataMapper;
@Resource
private BusinessAssayTaskParameterDataMapper businessAssayTaskParameterDataMapper;
@Resource
private BusinessAssayProjectDataMapper businessAssayProjectDataMapper;
@Resource
private BusinessAssayParameterDataMapper businessAssayParameterDataMapper;
@Resource
private BusinessQCManagementDataMapper businessQCManagementDataMapper;
@@ -120,6 +152,14 @@ public class XRFDataServiceImpl implements XRFDataService {
//根据样品编号及分析方法类型,获取检测任务数据
List<BusinessAssayTaskDataExtendRespVO> businessAssayTaskDataList = businessAssayTaskDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf");
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//获取检测参数
List<BusinessAssayTaskParameterDataExtendRespVO> businessAssayTaskParameterDataExtendList = new ArrayList<>();
if (CollUtil.isNotEmpty(businessAssayTaskDataIdList)) {
businessAssayTaskParameterDataExtendList = businessAssayTaskParameterDataMapper.selectExtendByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
}
//管理样和标准样
List<BusinessQCManagementDataDO> businessQCManagementDataList = businessQCManagementDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf");
@@ -128,7 +168,11 @@ public class XRFDataServiceImpl implements XRFDataService {
// List<BusinessQCCoefficientDataDO> businessQCCoefficientDataList = businessQCCoefficientDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf");
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = new ArrayList<>();
List<BusinessAssayTaskParameterDataDO> businessAssayTaskParameterDataList = new ArrayList<>();
List<BusinessAssayProjectDataDO> busElementValueList = new ArrayList<>();
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataList = new ArrayList<>();
List<BusinessQCManagementProjectDataDO> busQcManageElementValueList = new ArrayList<>();
// List<BusinessQCCoefficientParameterDataDO> busQccParameterValueList = new ArrayList<>();
List<BusinessXRFDataDO> busYgDataList = new ArrayList<>();
@@ -149,6 +193,8 @@ public class XRFDataServiceImpl implements XRFDataService {
busYgData.setXRFSampleId(ygDeviceSample.getSampleId());
busYgData.setSampleCode(ygDeviceSample.getSampleCode());
busYgData.setSampleTime(ygDeviceSample.getSampleTime());
busYgData.setSampleStartTime(ygDeviceSample.getSampleStartTime());
busYgData.setSampleEndTime(ygDeviceSample.getSampleEndTime());
busYgData.setAssayOperator(ygDeviceSample.getAssayOper());
busYgData.setIsCheckCreate(ygDeviceSample.getIsCheck() ? 1 : 0);
@@ -162,9 +208,28 @@ public class XRFDataServiceImpl implements XRFDataService {
//处理匹配
//a. 分析样
List<BusinessAssayProjectDataExtendRespVO> tempBusElementValueList = new ArrayList<>();
List<BusinessAssayTaskDataExtendRespVO> currBusinessAssayTaskDataList = businessAssayTaskDataList.stream().filter(f -> ygDeviceSample.getSampleCode().equals(f.getSampleAssayCode())).collect(Collectors.toList());
List<BusinessAssayTaskDataExtendRespVO> currBusinessAssayTaskDataList = businessAssayTaskDataList.stream().filter(f -> ygDeviceSample.getSampleCode().equals(f.getSampleAssayCode())).collect(Collectors.toList());//平行样情况,是列表
if (currBusinessAssayTaskDataList != null && currBusinessAssayTaskDataList.size() > 0) {
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : currBusinessAssayTaskDataList) {
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : currBusinessAssayTaskDataList) {
//处理任务参数
List<BusinessAssayTaskParameterDataExtendRespVO> currBusinessAssayTaskParameterDataExtendList = businessAssayTaskParameterDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId())).collect(Collectors.toList());
for (BusinessAssayTaskParameterDataExtendRespVO currBusinessAssayTaskParameterDataExtend : currBusinessAssayTaskParameterDataExtendList) {
switch (currBusinessAssayTaskParameterDataExtend.getKey()) {
case "lineName":
currBusinessAssayTaskParameterDataExtend.setValue(busYgData.getLineName());
businessAssayTaskParameterDataList.add(BeanUtils.toBean(currBusinessAssayTaskParameterDataExtend, BusinessAssayTaskParameterDataDO.class));
break;
case "sampleStartTime":
currBusinessAssayTaskParameterDataExtend.setValue(DateUtil.formatLocalDateTime(busYgData.getSampleStartTime()));
businessAssayTaskParameterDataList.add(BeanUtils.toBean(currBusinessAssayTaskParameterDataExtend, BusinessAssayTaskParameterDataDO.class));
break;
case "sampleEndTime":
currBusinessAssayTaskParameterDataExtend.setValue(DateUtil.formatLocalDateTime(busYgData.getSampleEndTime()));
businessAssayTaskParameterDataList.add(BeanUtils.toBean(currBusinessAssayTaskParameterDataExtend, BusinessAssayTaskParameterDataDO.class));
break;
}
}
List<BusinessAssayProjectDataExtendRespVO> busElementValues = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskData.getId());
tempBusElementValueList.addAll(busElementValues);
}
@@ -295,6 +360,121 @@ public class XRFDataServiceImpl implements XRFDataService {
if (currBusinessAssayTaskDataList != null && currBusinessAssayTaskDataList.size() > 0) {
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : currBusinessAssayTaskDataList) {
//查询当前子样方法配置
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodMapper.selectByConfigSubSampleIdAndConfigAssayMethodId(businessAssayTaskData.getConfigSubSampleId(), businessAssayTaskData.getConfigAssayMethodId());
//扩展配置
String configInfomation = configSubSampleMethod.getConfigInfomation();
if (StringUtils.isNotBlank(configInfomation)) {
//解析配置
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
//当前要设置到的参数
List<ConfigSubSampleMethodConfItem> setParamList = configSubSampleMethodConfInfo.getSetParam();
if (CollUtil.isNotEmpty(setParamList)) {//参数不为空,则设置
//方法key
String methodKey = setParamList.stream().map(m -> m.getTarget().getMethodKey()).distinct().findFirst().orElse(null);
//1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId());
//2 查询样品大类
BaseSampleDO baseSampleDO = baseSampleMapper.selectById(businessSampleEntrustDetailDO.getBaseSampleId());
//3 判断样品大类类型
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//委托登记Id
Long businessSampleEntrustRegistrationId = businessSampleEntrustDetailDO.getBusinessSampleEntrustRegistrationId();
//查询委托登记明细
List<BusinessSampleEntrustDetailDO> businessSampleEntrustDetailList = businessSampleEntrustDetailMapper.selectByBusinessSampleEntrustRegistrationId(businessSampleEntrustRegistrationId);
//获取主样Id列表
List<Long> businessBaseSampleIdList = businessSampleEntrustDetailList.stream().map(m -> m.getBusinessBaseSampleId()).collect(Collectors.toList());
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessBaseSampleIdsAndMethodKey(businessBaseSampleIdList, methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = tempBusElementValueList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = tempBusElementValueList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null) {
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
} else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询当前分析方法下对应的任务
List<BusinessAssayTaskDataDO> targetBusinessAssayTaskDataList = businessAssayTaskDataMapper.selectByBusinessSubSampleIdAndMethodKey(businessAssayTaskData.getBusinessSubSampleId(), methodKey);
List<Long> targetBusinessAssayTaskDataIdList = targetBusinessAssayTaskDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> targetBusinessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(targetBusinessAssayTaskDataIdList);
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : setParamList) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = tempBusElementValueList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskData.getId()) && project.equals(f.getSimpleName())).findFirst().orElse(null);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
for (BusinessAssayTaskDataDO targetBusinessAssayTaskData : targetBusinessAssayTaskDataList) {
List<String> targetProjectList = Arrays.asList(target.getProject().split(","));
String targetParameter = target.getParameter();
for (String targetProject : targetProjectList) {
BusinessAssayProjectDataExtendRespVO targetBusinessAssayProjectData = targetBusinessAssayProjectDataExtendList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(targetBusinessAssayTaskData.getId()) && targetProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (targetBusinessAssayProjectData == null) {
continue;
}
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIdAndProjectSimpleNameAndParameterKey(targetBusinessAssayProjectData.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO != null && StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {//值为空,才赋值
businessAssayParameterDataDO.setValue(currentBusinessAssayProjectData.getValue());
updateBusinessAssayParameterDataList.add(businessAssayParameterDataDO);
}
}
}
}
}
}
}
busYgData.setIsMatched(QmsCommonConstant.YES);
busYgData.setBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId());
busYgData.setBusinessSubParentSampleId(businessAssayTaskData.getBusinessSubParentSampleId());
@@ -326,11 +506,22 @@ public class XRFDataServiceImpl implements XRFDataService {
//保存荧光数据
businessXRFDataMapper.insertBatch(busYgDataList);
//更新任务参数
if (businessAssayTaskParameterDataList.size() > 0) {
businessAssayTaskParameterDataMapper.updateBatch(businessAssayTaskParameterDataList);
}
//更新分析结果
if (busElementValueList.size() > 0) {
businessAssayProjectDataMapper.updateBatch(busElementValueList);
}
//更新检测项目参数
if (updateBusinessAssayParameterDataList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataList);
}
//荧光管理样和标准样
if (busQcManageElementValueList.size() > 0) {
businessQCManagementProjectDataMapper.updateBatch(busQcManageElementValueList);