Compare commits

..

24 Commits

Author SHA1 Message Date
shusir
0b2d10e662 fix:物料入库、物料库存相关接口 2026-02-06 18:02:00 +08:00
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
FCL
9014e8bcc8 Merge remote-tracking branch 'origin/test' into test 2026-02-04 18:21:51 +08:00
FCL
fa43a6579a 报告增加属性 2026-02-04 18:07:42 +08:00
shusir
d5b40bfba0 feat:准备物料入库接口 2026-02-04 18:03:51 +08:00
wxr
33b5ec7be5 Merge branch 'test' of https://git.will-way.cn/zgty/zt-qms into test 2026-02-04 16:18:01 +08:00
wxr
5a82d9abd8 任务分配及分析任务提交时配料值赋值 2026-02-04 16:17:51 +08:00
shusir
a96fa0ed9b fix:物料验收流程 2026-02-03 18:02:09 +08:00
shusir
8121c7a97f fix:调整物料验收接口 2026-02-02 18:09:24 +08:00
wxr
a8330ade63 方法变更修改 2026-02-02 17:54:20 +08:00
wxr
e9259122b7 人工配料bug修复 2026-01-31 14:51:58 +08:00
wxr
fbd13f50d4 任务单添加配料方式 2026-01-31 13:43:58 +08:00
shusir
58ab9961c4 feat:物料验收流程接口 2026-01-30 17:16:02 +08:00
wxr
3302a2ee7c 补正系数修改 2026-01-30 16:58:32 +08:00
FCL
1bbfa9a950 Merge remote-tracking branch 'origin/test' into test 2026-01-30 14:57:29 +08:00
FCL
3bf8ee09b7 Merge remote-tracking branch 'origin/test' into test 2026-01-30 14:09:44 +08:00
FCL
4444d9e3c0 fix:报告编制细节修复 2026-01-30 14:09:32 +08:00
95 changed files with 2690 additions and 766 deletions

View File

@@ -182,6 +182,7 @@ public interface ErrorCodeConstants {
ErrorCode MATERIAL_LIFECYCLE_NOT_EXISTS = new ErrorCode(1_032_160_000, "物料通用流程不存在"); 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_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 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_BELONG_MATERIAL_BATCH_NOT_EQUAL = new ErrorCode(1_032_160_000, "工段所属的物料批次不一致");
ErrorCode GONGDUAN_QUANTITY_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

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

View File

@@ -71,6 +71,7 @@ public class SampleAnalysisController implements BusinessControllerMarker {
return success("成功"); return success("成功");
} }
//提交分析
@PostMapping("/submitSampleAnalysisByTaskId") @PostMapping("/submitSampleAnalysisByTaskId")
public CommonResult<?> submitSampleAnalysisByTaskId(Long businessAssayTaskId) { public CommonResult<?> submitSampleAnalysisByTaskId(Long businessAssayTaskId) {
sampleAnalysisService.submitSampleAnalysisByTaskId(businessAssayTaskId); sampleAnalysisService.submitSampleAnalysisByTaskId(businessAssayTaskId);

View File

@@ -25,7 +25,6 @@ import com.zt.plat.module.qms.business.bus.liteflow.param.SampleTaskAssignSample
import com.zt.plat.module.qms.business.bus.service.SampleTaskAssignService; import com.zt.plat.module.qms.business.bus.service.SampleTaskAssignService;
import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO; import com.zt.plat.module.system.api.user.dto.AdminUserRespDTO;
import cn.hutool.core.collection.CollUtil;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;

View File

@@ -17,6 +17,8 @@ public class AssayMethodProjectRespVO {
private String dictionaryProjectShowName; private String dictionaryProjectShowName;
private String assayType;
private Long configAssayMethodId; private Long configAssayMethodId;
private String configAssayMethodName; private String configAssayMethodName;

View File

@@ -9,6 +9,9 @@ public class BusinessAssayProjectDataExtendRespVO extends BusinessAssayProjectDa
@Schema(description = "样品主样ID", example = "23293") @Schema(description = "样品主样ID", example = "23293")
private Long businessBaseSampleId; private Long businessBaseSampleId;
@Schema(description = "主样配置ID")
private Long configBaseSampleId;
@Schema(description = "样品分样ID", example = "15024") @Schema(description = "样品分样ID", example = "15024")
private Long businessSubParentSampleId; private Long businessSubParentSampleId;

View File

@@ -47,6 +47,9 @@ public class BusinessAssayTaskAnalysisSampleAndQcProjectRespVO {
@Schema(description = "是否配料,1-是0-否") @Schema(description = "是否配料,1-是0-否")
private Integer isIngredients; private Integer isIngredients;
@Schema(description = "配料方式,初始状态-initial、自动配料-automatic、人工配料-manual")
private String ingredientsWay;
@Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2") @Schema(description = "配料状态,初始状态-initial、等待配料-in_progress、可提交-allow_submit", example = "2")
private String ingredientsStatus; private String ingredientsStatus;

View File

@@ -21,6 +21,9 @@ public class BusinessAssayTaskDataExtendRespVO extends BusinessAssayTaskDataResp
@Schema(description = "检测方法配置名称及类别") @Schema(description = "检测方法配置名称及类别")
private String configAssayMethodNameAndCategory; private String configAssayMethodNameAndCategory;
@Schema(description = "主样配置id")
private Long configBaseSampleId;
@Schema(description = "子样配置id") @Schema(description = "子样配置id")
private Long configSubSampleId; private Long configSubSampleId;
@@ -41,4 +44,7 @@ public class BusinessAssayTaskDataExtendRespVO extends BusinessAssayTaskDataResp
private Integer asmtIsRecheck; private Integer asmtIsRecheck;
private String asmtReportedStatus; private String asmtReportedStatus;
@Schema(description = "配料信息")
private String ingredientInfo;
} }

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) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleTime; 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 = "分析人") @Schema(description = "分析人")
private String assayOperator; private String assayOperator;

View File

@@ -35,6 +35,14 @@ public class BusinessXRFDataReqVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] sampleTime; 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 = "分析人") @Schema(description = "分析人")
private String assayOperator; private String assayOperator;

View File

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

View File

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

View File

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

View File

@@ -108,4 +108,15 @@ public interface BusinessAssayParameterDataMapper extends BaseMapperX<BusinessAs
.eq(ConfigAssayMethodProjectParameterDO::getKey, parameterKey)); .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

@@ -8,6 +8,7 @@ import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayProjectDataDO; 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.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO; import com.zt.plat.module.qms.business.dic.dal.dataobject.DictionaryProjectDO;
@@ -106,17 +107,43 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataId(Long businessAssayTaskDataId) { default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataId(Long businessAssayTaskDataId) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>() return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId) .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.selectAll(BusinessAssayProjectDataDO.class) .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::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
.selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName) .selectAs(DictionaryProjectDO::getSimpleName, BusinessAssayProjectDataExtendRespVO::getSimpleName)
.selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName) .selectAs(DictionaryProjectDO::getShowName, BusinessAssayProjectDataExtendRespVO::getShowName)
.eq(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataId)); .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) { default List<BusinessAssayProjectDataExtendRespVO> selectByBusinessAssayTaskDataIds(List<Long> businessAssayTaskDataIds) {
return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>() return selectJoinList(BusinessAssayProjectDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayProjectDataDO>()
.leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId) .leftJoin(BusinessAssayTaskDataDO.class, BusinessAssayTaskDataDO::getId, BusinessAssayProjectDataDO::getBusinessAssayTaskDataId)
.leftJoin(BusinessBaseSampleDO.class, BusinessBaseSampleDO::getId, BusinessAssayTaskDataDO::getBusinessBaseSampleId)
.leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId) .leftJoin(DictionaryProjectDO.class, DictionaryProjectDO::getId, BusinessAssayProjectDataDO::getDictionaryProjectId)
.selectAll(BusinessAssayProjectDataDO.class) .selectAll(BusinessAssayProjectDataDO.class)
.selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey) .selectAs(DictionaryProjectDO::getKey, BusinessAssayProjectDataExtendRespVO::getDictionaryProjectKey)
@@ -128,6 +155,7 @@ public interface BusinessAssayProjectDataMapper extends BaseMapperX<BusinessAssa
.selectAs(BusinessAssayTaskDataDO::getBusinessBaseSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessBaseSampleId) .selectAs(BusinessAssayTaskDataDO::getBusinessBaseSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessBaseSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubParentSampleId) .selectAs(BusinessAssayTaskDataDO::getBusinessSubParentSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubParentSampleId)
.selectAs(BusinessAssayTaskDataDO::getBusinessSubSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubSampleId) .selectAs(BusinessAssayTaskDataDO::getBusinessSubSampleId, BusinessAssayProjectDataExtendRespVO::getBusinessSubSampleId)
.selectAs(BusinessBaseSampleDO::getConfigBaseSampleId, BusinessAssayProjectDataExtendRespVO::getConfigBaseSampleId)
.in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIds)); .in(BusinessAssayProjectDataDO::getBusinessAssayTaskDataId, businessAssayTaskDataIds));
} }

View File

@@ -13,6 +13,7 @@ import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataGr
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataPageReqVO; import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataPageReqVO;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataReqVO; import com.zt.plat.module.qms.business.bus.controller.vo.BusinessAssayTaskDataReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAnalysisGroupDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAnalysisGroupDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleAssessmentDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
@@ -289,6 +290,7 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName) .selectAs(BusinessSubSampleDO::getSampleName, BusinessAssayTaskDataExtendRespVO::getSampleName)
.selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode) .selectAs(BusinessSubSampleDO::getSampleCode, BusinessAssayTaskDataExtendRespVO::getSampleCode)
.selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode) .selectAs(BusinessSubSampleDO::getSampleAssayCode, BusinessAssayTaskDataExtendRespVO::getSampleAssayCode)
.selectAs(BusinessSubSampleDO::getConfigSubSampleId, BusinessAssayTaskDataExtendRespVO::getConfigSubSampleId)
.in(BusinessSubSampleDO::getSampleAssayCode, sampleAssayCodes) .in(BusinessSubSampleDO::getSampleAssayCode, sampleAssayCodes)
.eq(ConfigAssayMethodDO::getDictionaryBusinessKey, configAssayMethodDictionaryBusinessKey) .eq(ConfigAssayMethodDO::getDictionaryBusinessKey, configAssayMethodDictionaryBusinessKey)
.eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO)); .eq(BusinessAssayTaskDataDO::getIsReported, QmsCommonConstant.NO));
@@ -366,6 +368,21 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId)); .eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId));
} }
/**
* 根据任务分配单id查询分析任务
* @param businessAssayTaskId 任务分配单id
* @return
*/
default List<BusinessAssayTaskDataExtendRespVO> selectExtendByBusinessAssayTaskId(Long businessAssayTaskId) {
return selectJoinList(BusinessAssayTaskDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessAssayTaskDataDO>()
.leftJoin(BusinessSubSampleDO.class, BusinessSubSampleDO::getId, BusinessAssayTaskDataDO::getBusinessSubSampleId)
.leftJoin(BusinessBaseSampleDO.class, BusinessBaseSampleDO::getId, BusinessAssayTaskDataDO::getBusinessBaseSampleId)
.selectAll(BusinessAssayTaskDataDO.class)
.selectAs(BusinessBaseSampleDO::getConfigBaseSampleId, BusinessAssayTaskDataExtendRespVO::getConfigBaseSampleId)
.selectAs(BusinessSubSampleDO::getConfigSubSampleId, BusinessAssayTaskDataExtendRespVO::getConfigSubSampleId)
.eq(BusinessAssayTaskDataDO::getBusinessAssayTaskId, businessAssayTaskId));
}
/** /**
* 根据子样查询分析任务 * 根据子样查询分析任务
* @param businessSubSampleId 子样id * @param businessSubSampleId 子样id
@@ -376,6 +393,31 @@ public interface BusinessAssayTaskDataMapper extends BaseMapperX<BusinessAssayTa
.eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId)); .eq(BusinessAssayTaskDataDO::getBusinessSubSampleId, businessSubSampleId));
} }
/**
* 根据子样及分析方法Key查询分析任务
* @param businessSubSampleId 子样id
* @param methodKey 分析方法key
* @return
*/
default List<BusinessAssayTaskDataDO> selectByBusinessSubSampleIdAndMethodKey(Long businessSubSampleId, 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>()
.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)); .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.ConfigAssayMethodProjectExtendRespVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfAdd; 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.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.controller.vo.ConfigSubSampleMethodExtendRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
@@ -446,9 +447,11 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
//扩展配置信息 //扩展配置信息
String configInfomation = configSubSampleMethodDO.getConfigInfomation(); String configInfomation = configSubSampleMethodDO.getConfigInfomation();
List<ConfigSubSampleMethodConfItem> getParamList = null;
if (StringUtils.isNotBlank(configInfomation)) { if (StringUtils.isNotBlank(configInfomation)) {
ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class); ConfigSubSampleMethodConfInfo configSubSampleMethodConfInfo = JSON.parseObject(configInfomation, ConfigSubSampleMethodConfInfo.class);
ConfigSubSampleMethodConfAdd addAssayTask = configSubSampleMethodConfInfo.getAddAssayTask(); ConfigSubSampleMethodConfAdd addAssayTask = configSubSampleMethodConfInfo.getAddAssayTask();
getParamList = configSubSampleMethodConfInfo.getGetParam();
if (addAssayTask != null) {//需要添加任务 if (addAssayTask != null) {//需要添加任务
List<Long> conditionProjectIdList = addAssayTask.getConditionProjectIdList(); List<Long> conditionProjectIdList = addAssayTask.getConditionProjectIdList();
@@ -643,7 +646,24 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); 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); businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
} }
@@ -661,7 +681,24 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); 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); businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
} }
@@ -904,6 +941,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO); businessAssayParameterDataDOList.add(businessAssayParameterDataDO);
@@ -922,6 +962,9 @@ public class SampleEntrustGenSampleDataCmp extends NodeComponent {
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId()); businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType()); businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition()); businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
if (StringUtils.isNotBlank(configAssayMethodProjectParameterDO.getDefaultValue())) {
businessAssayParameterDataDO.setValue(configAssayMethodProjectParameterDO.getDefaultValue());
}
businessAssayParameterDataDOList.add(businessAssayParameterDataDO); businessAssayParameterDataDOList.add(businessAssayParameterDataDO);

View File

@@ -1,17 +1,30 @@
package com.zt.plat.module.qms.business.bus.service; package com.zt.plat.module.qms.business.bus.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.controller.vo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.zt.plat.module.qms.business.bus.controller.vo.*; import com.zt.plat.module.qms.business.bus.controller.vo.*;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
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.BusinessAssayTaskDataMapper;
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.mapper.ConfigSubSampleMethodMapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.alibaba.fastjson2.JSON;
import com.zt.plat.framework.common.pojo.PageParam; import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.security.core.LoginUser; import com.zt.plat.framework.security.core.LoginUser;
@@ -35,6 +48,15 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
@Resource @Resource
private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; private BusinessAssayTaskDataMapper businessAssayTaskDataMapper;
@Resource
private BusinessAssayProjectDataMapper businessAssayProjectDataMapper;
@Resource
private BusinessAssayParameterDataMapper businessAssayParameterDataMapper;
@Resource
private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
@Override @Override
public BusinessAssayTaskDataRespVO createBusinessAssayTaskData(BusinessAssayTaskDataSaveReqVO createReqVO) { public BusinessAssayTaskDataRespVO createBusinessAssayTaskData(BusinessAssayTaskDataSaveReqVO createReqVO) {
// 插入 // 插入
@@ -100,12 +122,98 @@ public class BusinessAssayTaskDataServiceImpl implements BusinessAssayTaskDataSe
@Override @Override
public List<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataList(BusinessAssayTaskDataReqVO reqVO) { public List<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataList(BusinessAssayTaskDataReqVO reqVO) {
return businessAssayTaskDataMapper.selectList(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());
//查询检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目参数
List<BusinessAssayParameterDataExtendRespVO> businessAssayParameterDataList = businessAssayParameterDataMapper.selectExtendByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : list) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.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> getParamList = configSubSampleMethodConfInfo.getGetParam();
StringBuilder ingredientInfoBuilder = new StringBuilder();
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : getParamList) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
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()) && 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;
}
}
}
if (ingredientInfoBuilder.length() > 0) {
ingredientInfoBuilder.delete(ingredientInfoBuilder.length() - 1, ingredientInfoBuilder.length());
}
businessAssayTaskData.setIngredientInfo(ingredientInfoBuilder.toString());
}
}
return list;
} }
@Override @Override
public PageResult<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataPage(BusinessAssayTaskDataPageReqVO pageReqVO) { public PageResult<BusinessAssayTaskDataExtendRespVO> getBusinessAssayTaskDataPage(BusinessAssayTaskDataPageReqVO pageReqVO) {
return businessAssayTaskDataMapper.selectPage(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());
//查询检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测项目参数
List<BusinessAssayParameterDataExtendRespVO> businessAssayParameterDataList = businessAssayParameterDataMapper.selectExtendByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : list) {
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.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> getParamList = configSubSampleMethodConfInfo.getGetParam();
StringBuilder ingredientInfoBuilder = new StringBuilder();
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : getParamList) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
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()) && 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;
}
}
}
if (ingredientInfoBuilder.length() > 0) {
ingredientInfoBuilder.delete(ingredientInfoBuilder.length() - 1, ingredientInfoBuilder.length());
}
businessAssayTaskData.setIngredientInfo(ingredientInfoBuilder.toString());
}
}
return page;
} }
} }

View File

@@ -68,10 +68,12 @@ import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleAssessmen
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper; import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessSubSampleMapper;
import com.zt.plat.module.qms.business.config.controller.vo.*; import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectCoefficientDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigRuleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigRuleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleParentMethodDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleParentMethodDO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectAssessmentMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigProjectMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigProjectMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportFieldMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigReportFieldMapper;
@@ -153,6 +155,9 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
@Resource @Resource
private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper; private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper;
@Resource
private ConfigAssayMethodProjectCoefficientMapper configAssayMethodProjectCoefficientMapper;
@Resource @Resource
private ConfigSubSampleMethodMapper configSubSampleMethodMapper; private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
@@ -218,7 +223,15 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskDataExtendRespVO.getId()); List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskDataExtendRespVO.getId());
for (BusinessAssayProjectDataExtendRespVO businessAssayProjectData : businessAssayProjectDataList) { for (BusinessAssayProjectDataExtendRespVO businessAssayProjectData : businessAssayProjectDataList) {
businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName(), businessAssayProjectData.getValue()); // String value = businessAssayProjectData.getValueAfter();
// if (businessAssayProjectData.getCoefficient() != null) {
// value = value + "(" + businessAssayProjectData.getValue() + "x" + businessAssayProjectData.getCoefficient().setScale(3, RoundingMode.HALF_EVEN).toPlainString()+ ")";
// }
// businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName(), value);
businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName(), businessAssayProjectData.getValueAfter());
// businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName(), businessAssayProjectData.getValue());
// businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName() + "_coefficient", businessAssayProjectData.getCoefficient());
// businessAssayTaskDataMap.put(businessAssayProjectData.getSimpleName() + "_after", businessAssayProjectData.getValueAfter());
businessAssayTaskDataMap.put("isNotAssessment_" + businessAssayProjectData.getSimpleName(), businessAssayProjectData.getIsNotAssessment()); businessAssayTaskDataMap.put("isNotAssessment_" + businessAssayProjectData.getSimpleName(), businessAssayProjectData.getIsNotAssessment());
//添加判定状态 //添加判定状态
businessAssayTaskDataMap.put("assessmentStatus", assessmentMap.get("assessmentStatus")); businessAssayTaskDataMap.put("assessmentStatus", assessmentMap.get("assessmentStatus"));
@@ -272,7 +285,12 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
Map<String, Object> businessSubSampleAssessmentMap = BeanUtil.beanToMap(businessSubSampleAssessment); Map<String, Object> businessSubSampleAssessmentMap = BeanUtil.beanToMap(businessSubSampleAssessment);
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataSingleList = businessAssayProjectDataList.stream().filter(f -> f.getDictionaryProjectId().equals(businessSubSampleAssessment.getDictionaryProjectId())).collect(Collectors.toList()); List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataSingleList = businessAssayProjectDataList.stream().filter(f -> f.getDictionaryProjectId().equals(businessSubSampleAssessment.getDictionaryProjectId())).collect(Collectors.toList());
for (BusinessAssayProjectDataExtendRespVO businessAssayProjectDataExtendRespVO : businessAssayProjectDataSingleList) { for (BusinessAssayProjectDataExtendRespVO businessAssayProjectDataExtendRespVO : businessAssayProjectDataSingleList) {
businessSubSampleAssessmentMap.put(businessAssayProjectDataExtendRespVO.getBusinessAssayTaskDataId() + ";" + businessAssayProjectDataExtendRespVO.getBusinessSubSampleId() + ";" + businessAssayProjectDataExtendRespVO.getRecheckCount(), businessAssayProjectDataExtendRespVO.getValue()); // String value = businessAssayProjectDataExtendRespVO.getValueAfter();
// if (businessAssayProjectDataExtendRespVO.getCoefficient() != null) {
// 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.getValueAfter());
} }
dataList.add(businessSubSampleAssessmentMap); dataList.add(businessSubSampleAssessmentMap);
} }
@@ -647,11 +665,6 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
//查询分析任务明细 //查询分析任务明细
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessAssayTaskId(businessAssayTaskId); List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessAssayTaskId(businessAssayTaskId);
// Integer recheckCount = businessAssayTaskDataDOList.get(0).getRetestCount();
// List<Long> businessSubSampleIdList = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleId()).distinct().collect(Collectors.toList());
// List<BusinessSubSampleAssessmentDO> businessSubSampleAssessmentDOList = businessSubSampleAssessmentMapper.selectByBusinessSubSampleIdsAndConfigAssayMethodIdAndRetestCount(businessSubSampleIdList, businessAssayTaskDO.getConfigAssayMethodId(), recheckCount);
//获取任务明细对应的判定id //获取任务明细对应的判定id
List<Long> businessSubSampleAssessmentIdList = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleAssessmentId()).distinct().collect(Collectors.toList()); List<Long> businessSubSampleAssessmentIdList = businessAssayTaskDataDOList.stream().map(m -> m.getBusinessSubSampleAssessmentId()).distinct().collect(Collectors.toList());
//获取子样判定数据 //获取子样判定数据
@@ -734,7 +747,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
// 排序并处理 null // 排序并处理 null
List<BigDecimal> sortedValues = val1.stream() List<BigDecimal> sortedValues = val1.stream()
.map(v -> { .map(v -> {
String val = v.getValue(); String val = v.getValueAfter();//补正后的值
return val == null || val.trim().isEmpty() ? BigDecimal.ZERO : new BigDecimal(val.trim()); return val == null || val.trim().isEmpty() ? BigDecimal.ZERO : new BigDecimal(val.trim());
}) })
.sorted() .sorted()
@@ -825,7 +838,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
businessSubSampleAssessmentProjectDO.setMinimumLimitValue(businessAssayProjectDataDO.getMinimumLimitValue()); businessSubSampleAssessmentProjectDO.setMinimumLimitValue(businessAssayProjectDataDO.getMinimumLimitValue());
businessSubSampleAssessmentProjectDO.setSymbol(businessAssayProjectDataDO.getSymbol()); businessSubSampleAssessmentProjectDO.setSymbol(businessAssayProjectDataDO.getSymbol());
businessSubSampleAssessmentProjectDO.setAssessmentStatus(QmsCommonConstant.NORMAL); businessSubSampleAssessmentProjectDO.setAssessmentStatus(QmsCommonConstant.NORMAL);
businessSubSampleAssessmentProjectDO.setAssessmentValue(businessAssayProjectDataDO.getValue()); businessSubSampleAssessmentProjectDO.setAssessmentValue(businessAssayProjectDataDO.getValueAfter());//修改为赋值补正后的值
} }
@@ -1186,7 +1199,7 @@ public class SampleAnalysisAuditServiceImpl implements SampleAnalysisAuditServic
List<BigDecimal> sortedValues = businessAssayProjectDataDOList.stream() List<BigDecimal> sortedValues = businessAssayProjectDataDOList.stream()
.filter(f -> f.getIsNotAssessment().equals(QmsCommonConstant.NO)) .filter(f -> f.getIsNotAssessment().equals(QmsCommonConstant.NO))
.map(v -> { .map(v -> {
String val = v.getValue(); String val = v.getValueAfter();//设置为补正后的
return val == null || val.trim().isEmpty() ? BigDecimal.ZERO : new BigDecimal(val.trim()); return val == null || val.trim().isEmpty() ? BigDecimal.ZERO : new BigDecimal(val.trim());
}) })
.sorted() .sorted()

View File

@@ -21,7 +21,6 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.zt.plat.framework.common.exception.ServiceException; import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.util.date.DateUtils;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.security.core.LoginUser; import com.zt.plat.framework.security.core.LoginUser;
@@ -85,7 +84,6 @@ import com.zt.plat.module.qms.business.config.dal.dataobject.BaseSampleDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectCoefficientDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectCoefficientDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectRangeDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectRangeDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO;
import com.zt.plat.module.qms.business.config.dal.mapper.BaseSampleMapper; import com.zt.plat.module.qms.business.config.dal.mapper.BaseSampleMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigAssayMethodProjectCoefficientMapper;
@@ -98,9 +96,7 @@ import com.zt.plat.module.qms.common.dic.controller.vo.DictionaryBusinessExtendR
import com.zt.plat.module.qms.common.dic.dal.mapper.DictionaryBusinessMapper; import com.zt.plat.module.qms.common.dic.dal.mapper.DictionaryBusinessMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.module.qms.enums.QmsCommonConstant;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@@ -529,6 +525,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setDataCollectionId(businessAssayTaskDO.getFormDataCollectionId()); businessAssayTaskAnalysisSampleAndQcProjectRespVO.setDataCollectionId(businessAssayTaskDO.getFormDataCollectionId());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setFormValue(businessAssayTaskDO.getFormValue()); businessAssayTaskAnalysisSampleAndQcProjectRespVO.setFormValue(businessAssayTaskDO.getFormValue());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIsIngredients(businessAssayTaskDO.getIsIngredients()); businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIsIngredients(businessAssayTaskDO.getIsIngredients());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIngredientsWay(businessAssayTaskDO.getIngredientsWay());
businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIngredientsStatus(businessAssayTaskDO.getIngredientsStatus()); businessAssayTaskAnalysisSampleAndQcProjectRespVO.setIngredientsStatus(businessAssayTaskDO.getIngredientsStatus());
ConfigAssayMethodDO configAssayMethodDO = configAssayMethodMapper.selectById(businessAssayTaskDO.getConfigAssayMethodId()); ConfigAssayMethodDO configAssayMethodDO = configAssayMethodMapper.selectById(businessAssayTaskDO.getConfigAssayMethodId());
@@ -662,17 +659,18 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
String sourceProject = source.getProject(); String sourceProject = source.getProject();
//String sourceParameter = source.getParameter(); //String sourceParameter = source.getParameter();
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();//目标 ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();//目标
String targetProject = target.getProject();
List<String> projectList = Arrays.asList(target.getProject().split(","));//目标可以有多个
for (String targetProject : projectList) {
String targetParameter = target.getParameter(); String targetParameter = target.getParameter();
BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(businessAssayTaskDataDO.getId(), targetProject, targetParameter); BusinessAssayParameterDataDO businessAssayParameterDataDO = businessAssayParameterDataMapper.selectByBusinessAssayTaskDataIdAndProjectSimpleNameAndParameterKey(businessAssayTaskDataDO.getId(), targetProject, targetParameter);
if (businessAssayParameterDataDO == null) { // if (businessAssayParameterDataDO == null) {
throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误"); // throw new ServiceException(1_032_100_000, "子样检测方法映射配置错误");
} // }
if (StringUtils.isBlank(businessAssayParameterDataDO.getValue())) { if (businessAssayParameterDataDO != null && StringUtils.isBlank(businessAssayParameterDataDO.getValue())) {
//1 查询委托明细 //1 查询委托明细
BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId()); BusinessSampleEntrustDetailDO businessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectByBusinessBaseSampleId(businessAssayTaskDataDO.getBusinessBaseSampleId());
//2 查询样品大类 //2 查询样品大类
@@ -681,20 +679,22 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样 if (QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检分析样
//查询当前批次的第一个商检分析样 //查询当前批次的第一个商检分析样
BusinessSampleEntrustDetailDO currBatchFirstBusinessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectCurrBatchFirstByBusinessBaseSampleIdAndBaseSampleDictionaryBusinessKey(businessAssayTaskDataDO.getBusinessBaseSampleId(), QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE); BusinessSampleEntrustDetailDO currBatchFirstBusinessSampleEntrustDetailDO = businessSampleEntrustDetailMapper.selectCurrBatchFirstByBusinessBaseSampleIdAndBaseSampleDictionaryBusinessKey(businessAssayTaskDataDO.getBusinessBaseSampleId(), QmsCommonConstant.ENTRUST_INSPECTION_ANALYSIS_SAMPLE);
List<BusinessSubParentSampleDO> currBusinessSubParentSampleDOList = businessSubParentSampleMapper.selectByBusinessBaseSampleId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId()); List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(currBatchFirstBusinessSampleEntrustDetailDO.getBusinessBaseSampleId(), configMethodId);
List<Long> currBusinessSubParentSampleIdList = currBusinessSubParentSampleDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(currBusinessSubParentSampleIdList, configMethodId); BusinessAssayProjectDataExtendRespVO sourceBusinessAssayProjectDataExtendRespVO = businessAssayProjectDataExtendList.stream().filter(f -> sourceProject.equals(f.getSimpleName())).findFirst().orElse(null);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null); if (sourceBusinessAssayProjectDataExtendRespVO != null && StringUtils.isNotBlank(sourceBusinessAssayProjectDataExtendRespVO.getValue())) {
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) { businessAssayParameterDataDO.setValue(sourceBusinessAssayProjectDataExtendRespVO.getValue());
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
} }
} else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样 } else if (QmsCommonConstant.ENTRUST_COMPREHENSIVE_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是商检综合样
//查询当前样品的其他分析方法的结果 //查询当前样品的其他分析方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId()); // List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId); // List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null); // BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) { List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(businessAssayTaskDataDO.getBusinessBaseSampleId(), configMethodId);
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue());
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())) {//如果是委检样 } else if (QmsCommonConstant.ENTRUST_COMMISSION_INSPECTION_SAMPLE.equals(baseSampleDO.getDictionaryBusinessKey())) {//如果是委检样
//查询来样品位 //查询来样品位
@@ -722,11 +722,13 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
businessAssayParameterDataDO.setValue(forecastValue); businessAssayParameterDataDO.setValue(forecastValue);
} else { } else {
//查询当前样品的其他方法的结果 //查询当前样品的其他方法的结果
List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId()); // List<Long> businessSubParentSampleIdList = Arrays.asList(businessAssayTaskDataDO.getBusinessSubParentSampleId());
List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId); // List<BusinessSubParentSampleAssessmentProjectExtendRespVO> businessSubParentSampleAssessmentProjectList = businessSubParentSampleAssessmentProjectMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configMethodId);
BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null); // BusinessSubParentSampleAssessmentProjectExtendRespVO businessSubParentSampleAssessmentProject = businessSubParentSampleAssessmentProjectList.stream().filter(f -> f.getSimpleName().equals(sourceProject)).findFirst().orElse(null);
if (businessSubParentSampleAssessmentProject != null && StringUtils.isNotBlank(businessSubParentSampleAssessmentProject.getAssessmentValue())) { List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessBaseSampleIdAndConfigAssayMethodId(businessAssayTaskDataDO.getBusinessBaseSampleId(), configMethodId);
businessAssayParameterDataDO.setValue(businessSubParentSampleAssessmentProject.getAssessmentValue()); BusinessAssayProjectDataExtendRespVO sourceBusinessAssayProjectDataExtendRespVO = businessAssayProjectDataExtendList.stream().filter(f -> sourceProject.equals(f.getSimpleName())).findFirst().orElse(null);
if (sourceBusinessAssayProjectDataExtendRespVO != null && StringUtils.isNotBlank(sourceBusinessAssayProjectDataExtendRespVO.getValue())) {
businessAssayParameterDataDO.setValue(sourceBusinessAssayProjectDataExtendRespVO.getValue());
} }
} }
@@ -743,6 +745,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
} }
} }
} }
}
Map<String, Object> map = new HashedMap<>(); Map<String, Object> map = new HashedMap<>();
@@ -1267,12 +1270,180 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
@Override @Override
public void submitSampleAnalysisByTaskId(Long businessAssayTaskId) { public void submitSampleAnalysisByTaskId(Long businessAssayTaskId) {
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname(); // String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId); BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
businessAssayTaskDO.setTaskAssayStatus(QmsCommonConstant.SUBMITTED); businessAssayTaskDO.setTaskAssayStatus(QmsCommonConstant.SUBMITTED);
businessAssayTaskDO.setAssaySubmitTime(LocalDateTime.now()); businessAssayTaskDO.setAssaySubmitTime(LocalDateTime.now());
businessAssayTaskDO.setFinishStatus(QmsCommonConstant.IN_PROGRESS); businessAssayTaskDO.setFinishStatus(QmsCommonConstant.IN_PROGRESS);
businessAssayTaskDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS); businessAssayTaskDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
//设置参数值
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataList = new ArrayList<>();
List<BusinessAssayTaskDataExtendRespVO> businessAssayTaskDataExtendList = businessAssayTaskDataMapper.selectExtendByBusinessAssayTaskId(businessAssayTaskId);
//查询检测项目
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getId()).collect(Collectors.toList());
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataExtendList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
//子样配置id列表
List<Long> configSubSampleIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
//子样方法配置列表
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodDOList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodId(configSubSampleIdList, businessAssayTaskDO.getConfigAssayMethodId());
//循环任务,赋值
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();
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);
}
}
}
}
}
}
}
}
//补正系数列表
List<ConfigAssayMethodProjectCoefficientDO> configAssayMethodProjectCoefficientList = new ArrayList<>();
if (businessAssayTaskDO.getIsIngredients().equals(QmsCommonConstant.YES) && QmsCommonConstant.MANUAL.equals(businessAssayTaskDO.getIngredientsWay())) {//如果是需要配料,并且是人工配料的
List<Long> configBaseSampleIdList = businessAssayTaskDataExtendList.stream().map(m -> m.getConfigBaseSampleId()).distinct().collect(Collectors.toList());
configAssayMethodProjectCoefficientList = configAssayMethodProjectCoefficientMapper.selectByConfigBaseSampleIds(configBaseSampleIdList);
}
for (BusinessAssayProjectDataExtendRespVO businessAssayProjectDataExtend : businessAssayProjectDataExtendList) {
if (businessAssayTaskDO.getIsIngredients().equals(QmsCommonConstant.YES) && QmsCommonConstant.MANUAL.equals(businessAssayTaskDO.getIngredientsWay())) {
ConfigAssayMethodProjectCoefficientDO configAssayMethodProjectCoefficientDO = configAssayMethodProjectCoefficientList.stream().filter(f ->
businessAssayProjectDataExtend.getConfigBaseSampleId().equals(f.getConfigBaseSampleId())
&& businessAssayTaskDO.getConfigAssayMethodId().equals(f.getConfigAssayMethodId())
&& businessAssayProjectDataExtend.getConfigAssayMethodProjectId().equals(f.getConfigAssayMethodProjectId())
&& new BigDecimal(businessAssayProjectDataExtend.getValue()).compareTo(new BigDecimal(f.getMinimumValue())) > 0
&& new BigDecimal(businessAssayProjectDataExtend.getValue()).compareTo(new BigDecimal(f.getMaximumValue())) <= 0
).findFirst().orElse(null);
if (configAssayMethodProjectCoefficientDO != null) {
businessAssayProjectDataExtend.setConfigAssayMethodProjectCoefficientId(configAssayMethodProjectCoefficientDO.getId());//补正系数的id
businessAssayProjectDataExtend.setCoefficient(configAssayMethodProjectCoefficientDO.getCoefficient());//补正系数
String valueAfter = new BigDecimal(businessAssayProjectDataExtend.getValue()).multiply(configAssayMethodProjectCoefficientDO.getCoefficient()).setScale(businessAssayProjectDataExtend.getDecimalPosition(), RoundingMode.HALF_EVEN).toPlainString();
businessAssayProjectDataExtend.setValueAfter(valueAfter);//补正后的值
} else { //未找到补正系数默认为1
businessAssayProjectDataExtend.setCoefficient(new BigDecimal("1"));
businessAssayProjectDataExtend.setValueAfter(businessAssayProjectDataExtend.getValue());
}
} else {
businessAssayProjectDataExtend.setValueAfter(businessAssayProjectDataExtend.getValue());//不需要配料,补正后的值与补正前一致
}
}
if (businessAssayProjectDataExtendList.size() > 0) {
List<BusinessAssayProjectDataDO> businessAssayProjectDataList = BeanUtils.toBean(businessAssayProjectDataExtendList, BusinessAssayProjectDataDO.class);
businessAssayProjectDataMapper.updateBatch(businessAssayProjectDataList);
}
if (updateBusinessAssayParameterDataList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataList);
}
businessAssayTaskMapper.updateById(businessAssayTaskDO); businessAssayTaskMapper.updateById(businessAssayTaskDO);
} }
@@ -1421,7 +1592,9 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) { for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) {
if (configSubSampleMethodConfItem.getRequired()) { if (configSubSampleMethodConfItem.getRequired()) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource(); ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject();
List<String> projectList = Arrays.asList(source.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = source.getParameter(); String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskDataDO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null); BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(businessAssayTaskDataDO.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); BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
@@ -1430,6 +1603,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
} }
} }
} }
}
} }
} }
@@ -1443,7 +1617,7 @@ public class SampleAnalysisServiceImpl implements SampleAnalysisService {
public void manualIngredients(Long businessAssayTaskId) { public void manualIngredients(Long businessAssayTaskId) {
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId); BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(businessAssayTaskId);
businessAssayTaskDO.setIngredientsWay(QmsCommonConstant.MANUAL);//人工配料 businessAssayTaskDO.setIngredientsWay(QmsCommonConstant.MANUAL);//人工配料
businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS);//表示为允许提交 businessAssayTaskDO.setIngredientsStatus(QmsCommonConstant.ALLOW_SUBMIT);//表示为允许提交
businessAssayTaskMapper.updateById(businessAssayTaskDO); businessAssayTaskMapper.updateById(businessAssayTaskDO);
} }

View File

@@ -3,6 +3,9 @@ package com.zt.plat.module.qms.business.bus.service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -237,6 +240,9 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
//查询子样分析方法及检测项目 //查询子样分析方法及检测项目
// List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigSubSampleIdsAndAssayDepartmentId(configSubSampleIdList, visitDeptId); // List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigSubSampleIdsAndAssayDepartmentId(configSubSampleIdList, visitDeptId);
//根据样品大类,查询所有子样方法
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByBaseSampleId(baseSampleId);
//查询分析方法检测项目 //查询分析方法检测项目
List<AssayMethodProjectRespVO> list = businessAssayProjectDataMapper.selectAssayMethodProjectByBusinessSubSampleIdListAndConfigAssayMethodId(businessSubSampleIdList, configAssayMethodId); List<AssayMethodProjectRespVO> list = businessAssayProjectDataMapper.selectAssayMethodProjectByBusinessSubSampleIdListAndConfigAssayMethodId(businessSubSampleIdList, configAssayMethodId);
@@ -246,9 +252,15 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
for (AssayMethodProjectRespVO assayMethodProject : list) { for (AssayMethodProjectRespVO assayMethodProject : list) {
List<ConfigAssayMethodProjectExtendRespVO> methodList = materialAssayStandardMethodList.stream().filter(f -> assayMethodProject.getDictionaryProjectId().equals(f.getDictionaryProjectId())).map(m -> { List<ConfigAssayMethodProjectExtendRespVO> methodList = materialAssayStandardMethodList.stream().filter(f -> assayMethodProject.getDictionaryProjectId().equals(f.getDictionaryProjectId())).map(m -> {
ConfigSubSampleMethodExtendRespVO configSubSampleMethodExtend = configSubSampleMethodList.stream().filter(f -> m.getConfigAssayMethodId().equals(f.getConfigAssayMethodId())).findFirst().orElse(null);
String assayType = configSubSampleMethodExtend.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
if (m.getIsDualCup().equals(1)) {
assayType = QmsCommonConstant.ASSAY_TYPE_DOUBLE_CUP;
}
ConfigAssayMethodProjectExtendRespVO configAssayMethod = new ConfigAssayMethodProjectExtendRespVO(); ConfigAssayMethodProjectExtendRespVO configAssayMethod = new ConfigAssayMethodProjectExtendRespVO();
configAssayMethod.setConfigAssayMethodId(m.getConfigAssayMethodId()); configAssayMethod.setConfigAssayMethodId(m.getConfigAssayMethodId());
configAssayMethod.setConfigAssayMethodName(m.getConfigAssayMethodName()); configAssayMethod.setConfigAssayMethodName(m.getConfigAssayMethodName());
configAssayMethod.setAssayType(assayType);
configAssayMethod.setConfigAssayMethodNameAndCategory(m.getConfigAssayMethodNameAndCategory()); configAssayMethod.setConfigAssayMethodNameAndCategory(m.getConfigAssayMethodNameAndCategory());
return configAssayMethod; return configAssayMethod;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@@ -258,6 +270,499 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void changeMethod(ChangeAssayMethodReqVO req) {
List<Long> businessSubSampleIdList = req.getBusinessSubSampleIdList();
Long configAssayMethodId = req.getConfigAssayMethodId();
List<AssayMethodProjectRespVO> changeConfigAssayMethodProjectList = req.getChangeConfigAssayMethodProjectList();
// 先按 configAssayMethodId 分组
Map<Long, List<AssayMethodProjectRespVO>> groupedByConfigId = changeConfigAssayMethodProjectList.stream()
.collect(Collectors.groupingBy(AssayMethodProjectRespVO::getConfigAssayMethodId));
// 遍历每个分组,检查 assayType 是否唯一
for (Map.Entry<Long, List<AssayMethodProjectRespVO>> entry : groupedByConfigId.entrySet()) {
List<AssayMethodProjectRespVO> group = entry.getValue();
// 获取该组所有非空的 assayType去重
Set<String> assayTypes = group.stream()
.map(AssayMethodProjectRespVO::getAssayType)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (assayTypes.size() > 1) {
// 取第一个元素的 configAssayMethodNameAndCategory 作为代表(假设同 configId 下名称一致)
String methodName = group.get(0).getConfigAssayMethodNameAndCategory();
if (methodName == null || methodName.trim().isEmpty()) {
methodName = "(未命名)";
}
throw new ServiceException(1_032_050_000,
String.format("检测方法“%s”存在多种分析类型%s请确保同一检测方法仅对应一种分析类型。",
methodName,
assayTypes.stream().sorted().collect(Collectors.joining(", "))
)
);
}
}
List<Long> changeConfigAssayMethodIdList = changeConfigAssayMethodProjectList.stream().map(m -> m.getConfigAssayMethodId()).distinct().collect(Collectors.toList());
LocalDateTime currentDateTime = LocalDateTime.now();
//需要更新的报表数据
List<BusinessAssayReportDataDO> updateBusinessAssayReportDataDOList = new ArrayList<>();
//需要更新的分析任务
List<BusinessAssayTaskDataDO> updateBusinessAssayTaskDataDOList = new ArrayList<>();
//需要更新的分析任务检测项目
List<BusinessAssayProjectDataDO> updateBusinessAssayProjectDataDOList = new ArrayList<>();
//需要更新的分析任务检测项目参数
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataDOList = new ArrayList<>();
//需要更新的子样判定
List<BusinessSubSampleAssessmentDO> updateBusinessSubSampleAssessmentDOList = new ArrayList<>();
//需要更新的分样判定
List<BusinessSubParentSampleAssessmentDO> updateBusinessSubParentSampleAssessmentDOList = new ArrayList<>();
//需要新建的分析任务
List<BusinessAssayTaskDataDO> saveBusinessAssayTaskDataDOList = new ArrayList<>();
//需要新建的分析任务检测项目
List<BusinessAssayProjectDataDO> saveBusinessAssayProjectDataDOList = new ArrayList<>();
//需要新建的分析任务检测项目参数
List<BusinessAssayParameterDataDO> saveBusinessAssayParameterDataDOList = new ArrayList<>();
//需要新建的子样判定
List<BusinessSubSampleAssessmentDO> saveBusinessSubSampleAssessmentDOList = new ArrayList<>();
//需要新建的分样判定
List<BusinessSubParentSampleAssessmentDO> saveBusinessSubParentSampleAssessmentDOList = new ArrayList<>();
//需要删除的分析任务
List<Long> removeAssayTaskDataIdList = new ArrayList<>();
//需要删除的分析任务检测项目
List<Long> removeAssayProjectIdList = new ArrayList<>();
//需要删除的分析任务检测项目参数
List<Long> removeAssayParameterIdList = new ArrayList<>();
//需要删除的子样判定
List<Long> removeSubSampleAssessmentIdList = new ArrayList<>();
//需要删除的分样判定
List<Long> removeSubParentSampleAssessmentIdList = new ArrayList<>();
//查询子样
List<BusinessSubSampleDO> businessSubSampleDOList = businessSubSampleMapper.selectByIds(businessSubSampleIdList);
List<Long> businessBaseSampleIdList = businessSubSampleDOList.stream().map(m -> m.getBusinessBaseSampleId()).distinct().collect(Collectors.toList());
List<Long> businessSubParentSampleIdList = businessSubSampleDOList.stream().map(m -> m.getBusinessSubParentSampleId()).distinct().collect(Collectors.toList());
List<Long> configSubSampleIdList = businessSubSampleDOList.stream().map(m -> m.getConfigSubSampleId()).distinct().collect(Collectors.toList());
//查询检测任务 (通过分样id可以查询双杯样的)
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
boolean disabled = businessAssayTaskDataDOList.stream().anyMatch(m -> m.getIsAssignTasked().equals(QmsCommonConstant.YES));
if (disabled) {
throw new ServiceException(1_032_001_000, "当前样品存在已分配任务,不允许修改分析方法");
}
List<Long> businessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测任务的检测项目
List<BusinessAssayProjectDataExtendRespVO> businessAssayProjectDataList = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataIds(businessAssayTaskDataIdList);
List<Long> businessAssayProjectDataIdList = businessAssayProjectDataList.stream().map(m -> m.getId()).collect(Collectors.toList());
//查询检测任务的检测项目的参数
List<BusinessAssayParameterDataDO> businessAssayParameterDataDOList = businessAssayParameterDataMapper.selectByBusinessAssayProjectDataIds(businessAssayProjectDataIdList);
//查询子样判定 (通过分样id可以查询双杯样的)
List<BusinessSubSampleAssessmentDO> businessSubSampleAssessmentDOList = businessSubSampleAssessmentMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
//查询分样判定
List<BusinessSubParentSampleAssessmentExtendRespVO> businessSubParentSampleAssessmentList = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdsAndConfigAssayMethodId(businessSubParentSampleIdList, configAssayMethodId);
//查询要变更的分析方法配置
List<ConfigAssayMethodDO> configAssayMethodDOList = configAssayMethodMapper.selectByIds(changeConfigAssayMethodIdList);
//分析方法检测项目配置
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectList = configAssayMethodProjectMapper.selectByConfigAssayMethodIds(changeConfigAssayMethodIdList);
//分析方法检测项目参数配置
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterList = configAssayMethodProjectParameterMapper.selectByConfigAssayMethodIds(changeConfigAssayMethodIdList);
//查询要变更的子样及分析方法配置
List<ConfigSubSampleMethodExtendRespVO> configSubSampleMethodList = configSubSampleMethodMapper.selectByConfigSubSampleIdsAndConfigAssayMethodIds(configSubSampleIdList, changeConfigAssayMethodIdList);
//循环分样判定
for (BusinessSubParentSampleAssessmentExtendRespVO businessSubParentSampleAssessment : businessSubParentSampleAssessmentList) {
//循环变更的分析方法
for (Long changeConfigAssayMethodId : changeConfigAssayMethodIdList) {
//如果当前分析方法不等于要变更的方法
if (!businessSubParentSampleAssessment.getConfigAssayMethodId().equals(changeConfigAssayMethodId)) {
//查询是否已有要变更的方法的分样判定
BusinessSubParentSampleAssessmentDO businessSubParentSampleAssessmentDO = businessSubParentSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodIdAndRetestCount(businessSubParentSampleAssessment.getBusinessSubParentSampleId(), changeConfigAssayMethodId, businessSubParentSampleAssessment.getRetestCount());
if (businessSubParentSampleAssessmentDO == null) {//不存在
//根据变更方法过滤出检测项目
List<Long> projectIdList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getDictionaryProjectId()).distinct().collect(Collectors.toList());
//分析类型
String changeAssayType = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getAssayType()).distinct().findFirst().orElse(null);
//查询分析方法
ConfigAssayMethodDO configAssayMethodDO = configAssayMethodDOList.stream().filter(f -> f.getId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//查询子样分析方法
ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleParentId().equals(businessSubParentSampleAssessment.getConfigSubSampleParentId()) && f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
switch (changeAssayType) {//根据前端传入的分析类型,修改子样分析方法中的分析任务数
case QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL: {
configSubSampleMethod.setTaskCount(2);//平行
}
default:
configSubSampleMethod.setTaskCount(1);//单杯
}
//根据任务数判断是平行还是
String assayType = configSubSampleMethod.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
businessSubParentSampleAssessmentDO = new BusinessSubParentSampleAssessmentDO();
businessSubParentSampleAssessmentDO.setId(IdWorker.getId());
businessSubParentSampleAssessmentDO.setBusinessSubParentSampleId(businessSubParentSampleAssessment.getBusinessSubParentSampleId());
businessSubParentSampleAssessmentDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessSubParentSampleAssessmentDO.setAssayType(assayType);
businessSubParentSampleAssessmentDO.setTaskType("常规");
saveBusinessSubParentSampleAssessmentDOList.add(businessSubParentSampleAssessmentDO);
BusinessSubSampleDO businessSubSampleDO = null;
if (!QmsCommonConstant.ASSAY_TYPE_DOUBLE_CUP.equals(businessSubParentSampleAssessment.getAssayType())) {//如果不为双杯样
businessSubSampleDO = businessSubSampleDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).findFirst().orElse(null);
}
//子样判定数据
BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = new BusinessSubSampleAssessmentDO();
businessSubSampleAssessmentDO.setId(IdWorker.getId());
businessSubSampleAssessmentDO.setBusinessBaseSampleId(businessSubParentSampleAssessment.getBusinessBaseSampleId());
businessSubSampleAssessmentDO.setBusinessSubParentSampleId(businessSubParentSampleAssessment.getBusinessSubParentSampleId());
businessSubSampleAssessmentDO.setBusinessSubParentSampleAssessmentId(businessSubParentSampleAssessmentDO.getId());
if (businessSubSampleDO != null) {
businessSubSampleAssessmentDO.setBusinessSubSampleId(businessSubSampleDO.getId());
}
businessSubSampleAssessmentDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessSubSampleAssessmentDO.setAssayType(assayType);
businessSubSampleAssessmentDO.setTaskType("常规");
saveBusinessSubSampleAssessmentDOList.add(businessSubSampleAssessmentDO);
//查询旧的检测项目
List<Long> oldBusinessAssayProjectDataIdList = businessAssayProjectDataList.stream().filter(f -> projectIdList.contains(f.getDictionaryProjectId()) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayProjectIdList.addAll(oldBusinessAssayProjectDataIdList);
List<Long> oldBusinessAssayParameterDataIdList = businessAssayParameterDataDOList.stream().filter(f -> oldBusinessAssayProjectDataIdList.contains(f.getBusinessAssayProjectDataId())).map(m -> m.getId()).collect(Collectors.toList());
removeAssayParameterIdList.addAll(oldBusinessAssayParameterDataIdList);
if (projectIdList.size() == changeConfigAssayMethodProjectList.size()) {
//查询旧的检测任务
List<Long> oldBusinessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayTaskDataIdList.addAll(oldBusinessAssayTaskDataIdList);
//查询旧的子样判定
List<Long> oldBusinessSubSampleAssesmentIdList = businessSubSampleAssessmentDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeSubSampleAssessmentIdList.addAll(oldBusinessSubSampleAssesmentIdList);
//添加到删除列表
removeSubParentSampleAssessmentIdList.add(businessSubParentSampleAssessment.getId());
} else {
List<String> projectShowNameList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).map(m -> m.getDictionaryProjectShowName()).distinct().collect(Collectors.toList());
//查询旧的检测任务
List<BusinessAssayTaskDataDO> oldBusinessAssayTaskDataList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).collect(Collectors.toList());
for (BusinessAssayTaskDataDO oldBusinessAssayTaskData : oldBusinessAssayTaskDataList) {
boolean isAdd = updateBusinessAssayTaskDataDOList.stream().anyMatch(m -> m.getId().equals(oldBusinessAssayTaskData.getId()));
if (!isAdd) {//如果未添加过更新,则修改检测项目并添加更新
oldBusinessAssayTaskData.setAssayProject(CollUtil.join(projectShowNameList, ","));
updateBusinessAssayTaskDataDOList.add(oldBusinessAssayTaskData);
}
}
}
BusinessAssayTaskDataDO oldBusinessAssayTaskDataDO = businessAssayTaskDataDOList.stream().filter(f -> f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).findFirst().orElse(null);
//根据检测方法循环
BusinessAssayTaskDataDO businessAssayTaskDataDO = null;
//根据任务数循环
for (int i = 0; i < configSubSampleMethod.getTaskCount(); i++) {
//子样检测任务
businessAssayTaskDataDO = new BusinessAssayTaskDataDO();
businessAssayTaskDataDO.setId(IdWorker.getId());
businessAssayTaskDataDO.setBusinessBaseSampleId(businessSubSampleDO.getBusinessBaseSampleId());
businessAssayTaskDataDO.setBusinessSubParentSampleId(businessSubSampleDO.getBusinessSubParentSampleId());
businessAssayTaskDataDO.setBusinessSubSampleId(businessSubSampleDO.getId());
businessAssayTaskDataDO.setBusinessSubSampleAssessmentId(businessSubSampleAssessmentDO.getId());//子样判定id
businessAssayTaskDataDO.setConfigAssayMethodId(changeConfigAssayMethodId);
businessAssayTaskDataDO.setAssayType(assayType);
businessAssayTaskDataDO.setTaskType("常规");
businessAssayTaskDataDO.setConfigSampleFlowId(oldBusinessAssayTaskDataDO.getConfigSampleFlowId());
businessAssayTaskDataDO.setSampleFlowNodeKey(oldBusinessAssayTaskDataDO.getSampleFlowNodeKey());
businessAssayTaskDataDO.setSampleFlowNodeTime(currentDateTime);
businessAssayTaskDataDO.setAssayDepartmentId(configAssayMethodDO.getAssayDepartmentId());
businessAssayTaskDataDO.setAssayDepartmentName(configAssayMethodDO.getAssayDepartmentName());
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).collect(Collectors.toList());
StringBuilder assayProjectBuilder = new StringBuilder();
for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) {
//如果当前分析方法的项目不在当前检测项目中,则跳出循环继续
if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) {
continue;
}
assayProjectBuilder.append(configAssayMethodProjectDO.getShowName()).append(",");
//检测项目
BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO();
businessAssayProjectDataDO.setId(IdWorker.getId());
businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId());
businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId());
businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId());
businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType());
businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition());
businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_REPORT);
businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue());
businessAssayProjectDataDO.setIsEnabled(QmsCommonConstant.YES);
businessAssayProjectDataDO.setIsNotAssessment(QmsCommonConstant.NO);
saveBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO);
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList());
for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) {
BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO();
businessAssayParameterDataDO.setId(IdWorker.getId());
businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId());
businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId());
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
saveBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
}
if (assayProjectBuilder.length() > 1) {
assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length());
}
businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString());
saveBusinessAssayTaskDataDOList.add(businessAssayTaskDataDO);
}
} else {//已存在
//分析类型
String changeAssayType = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getAssayType()).distinct().findFirst().orElse(null);
if (!businessSubParentSampleAssessmentDO.getAssayType().equals(changeAssayType)) {
String configAssayMethodNameAndCategory = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getConfigAssayMethodNameAndCategory()).distinct().findFirst().orElse(null);
throw new ServiceException(1_032_001_000, "检测方法“"+configAssayMethodNameAndCategory+"”,存在与当前分析类型不同的分析任务!");
}
//根据变更方法过滤出检测项目
List<Long> projectIdList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).map(m -> m.getDictionaryProjectId()).distinct().collect(Collectors.toList());
//查询分析方法
//ConfigAssayMethodDO configAssayMethodDO = configAssayMethodDOList.stream().filter(f -> f.getId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//查询子样分析方法
//ConfigSubSampleMethodExtendRespVO configSubSampleMethod = configSubSampleMethodList.stream().filter(f -> f.getConfigSubSampleParentId().equals(businessSubParentSampleAssessment.getConfigSubSampleParentId()) && f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).findFirst().orElse(null);
//根据任务数判断是平行还是
//String assayType = configSubSampleMethod.getTaskCount() > 1 ? QmsCommonConstant.ASSAY_TYPE_SINGLE_PARALLEL : QmsCommonConstant.ASSAY_TYPE_SINGLE_CUP;
//查询子样判定
//BusinessSubSampleAssessmentDO businessSubSampleAssessmentDO = businessSubSampleAssessmentMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubParentSampleAssessmentDO.getBusinessSubParentSampleId(), changeConfigAssayMethodId);
//查询旧的检测项目
List<Long> oldBusinessAssayProjectDataIdList = businessAssayProjectDataList.stream().filter(f -> projectIdList.contains(f.getDictionaryProjectId()) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayProjectIdList.addAll(oldBusinessAssayProjectDataIdList);
List<Long> oldBusinessAssayParameterDataIdList = businessAssayParameterDataDOList.stream().filter(f -> oldBusinessAssayProjectDataIdList.contains(f.getBusinessAssayProjectDataId())).map(m -> m.getId()).collect(Collectors.toList());
removeAssayParameterIdList.addAll(oldBusinessAssayParameterDataIdList);
if (projectIdList.size() == changeConfigAssayMethodProjectList.size()) {
//查询旧的检测任务
List<Long> oldBusinessAssayTaskDataIdList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeAssayTaskDataIdList.addAll(oldBusinessAssayTaskDataIdList);
//查询旧的子样判定
List<Long> oldBusinessSubSampleAssesmentIdList = businessSubSampleAssessmentDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).map(m -> m.getId()).collect(Collectors.toList());
//添加到删除列表
removeSubSampleAssessmentIdList.addAll(oldBusinessSubSampleAssesmentIdList);
//添加到删除列表
removeSubParentSampleAssessmentIdList.add(businessSubParentSampleAssessment.getId());
} else {
List<String> projectShowNameList = changeConfigAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId)).map(m -> m.getDictionaryProjectShowName()).distinct().collect(Collectors.toList());
//查询旧的检测任务
List<BusinessAssayTaskDataDO> oldBusinessAssayTaskDataList = businessAssayTaskDataDOList.stream().filter(f -> f.getConfigAssayMethodId().equals(configAssayMethodId) && f.getBusinessSubParentSampleId().equals(businessSubParentSampleAssessment.getBusinessSubParentSampleId())).collect(Collectors.toList());
for (BusinessAssayTaskDataDO oldBusinessAssayTaskData : oldBusinessAssayTaskDataList) {
boolean isAdd = updateBusinessAssayTaskDataDOList.stream().anyMatch(m -> m.getId().equals(oldBusinessAssayTaskData.getId()));
if (!isAdd) {//如果未添加过更新,则修改检测项目并添加更新
oldBusinessAssayTaskData.setAssayProject(CollUtil.join(projectShowNameList, ","));
updateBusinessAssayTaskDataDOList.add(oldBusinessAssayTaskData);
}
}
}
//查询当前存在的分析任务
List<BusinessAssayTaskDataDO> currBusinessAssayTaskDataDOList = businessAssayTaskDataMapper.selectByBusinessSubParentSampleIdAndConfigAssayMethodId(businessSubParentSampleAssessmentDO.getBusinessSubParentSampleId(), changeConfigAssayMethodId);
//当前存在的分析任务循环
for (BusinessAssayTaskDataDO businessAssayTaskDataDO : currBusinessAssayTaskDataDOList) {
List<ConfigAssayMethodProjectExtendRespVO> configAssayMethodProjectDOList = configAssayMethodProjectList.stream().filter(f -> f.getConfigAssayMethodId().equals(changeConfigAssayMethodId)).collect(Collectors.toList());
StringBuilder assayProjectBuilder = new StringBuilder(businessAssayTaskDataDO.getAssayProject());
assayProjectBuilder.append(",");
for (ConfigAssayMethodProjectExtendRespVO configAssayMethodProjectDO : configAssayMethodProjectDOList) {
//如果当前分析方法的项目不在当前检测项目中,则跳出循环继续
if (!projectIdList.contains(configAssayMethodProjectDO.getDictionaryProjectId())) {
continue;
}
assayProjectBuilder.append(configAssayMethodProjectDO.getShowName()).append(",");
//检测项目
BusinessAssayProjectDataDO businessAssayProjectDataDO = new BusinessAssayProjectDataDO();
businessAssayProjectDataDO.setId(IdWorker.getId());
businessAssayProjectDataDO.setBusinessAssayTaskDataId(businessAssayTaskDataDO.getId());
businessAssayProjectDataDO.setConfigAssayMethodProjectId(configAssayMethodProjectDO.getId());
businessAssayProjectDataDO.setDictionaryProjectId(configAssayMethodProjectDO.getDictionaryProjectId());
businessAssayProjectDataDO.setDataType(configAssayMethodProjectDO.getDataType());
businessAssayProjectDataDO.setDecimalPosition(configAssayMethodProjectDO.getDecimalPosition());
businessAssayProjectDataDO.setUsage(QmsCommonConstant.ASSAY_PROJECT_USAGE_REPORT);
businessAssayProjectDataDO.setMinimumLimitValue(configAssayMethodProjectDO.getMinimumLimitValue());
businessAssayProjectDataDO.setIsEnabled(QmsCommonConstant.YES);
businessAssayProjectDataDO.setIsNotAssessment(QmsCommonConstant.NO);
saveBusinessAssayProjectDataDOList.add(businessAssayProjectDataDO);
List<ConfigAssayMethodProjectParameterDO> configAssayMethodProjectParameterDOList = configAssayMethodProjectParameterList.stream().filter(f -> f.getConfigAssayMethodProjectId().equals(configAssayMethodProjectDO.getId())).collect(Collectors.toList());
for (ConfigAssayMethodProjectParameterDO configAssayMethodProjectParameterDO : configAssayMethodProjectParameterDOList) {
BusinessAssayParameterDataDO businessAssayParameterDataDO = new BusinessAssayParameterDataDO();
businessAssayParameterDataDO.setId(IdWorker.getId());
businessAssayParameterDataDO.setConfigAssayMethodProjectParameterId(configAssayMethodProjectParameterDO.getId());
businessAssayParameterDataDO.setBusinessAssayProjectDataId(businessAssayProjectDataDO.getId());
businessAssayParameterDataDO.setDictionaryParameterId(configAssayMethodProjectParameterDO.getDictionaryParameterId());
businessAssayParameterDataDO.setDataType(configAssayMethodProjectParameterDO.getDataType());
businessAssayParameterDataDO.setDecimalPosition(configAssayMethodProjectParameterDO.getDecimalPosition());
saveBusinessAssayParameterDataDOList.add(businessAssayParameterDataDO);
}
}
if (assayProjectBuilder.length() > 1) {
assayProjectBuilder.delete(assayProjectBuilder.length() - 1 , assayProjectBuilder.length());
}
businessAssayTaskDataDO.setAssayProject(assayProjectBuilder.toString());
updateBusinessAssayTaskDataDOList.add(businessAssayTaskDataDO);
}
}
}
}
}
//查询报表数据
List<BusinessAssayReportDataDO> businessAssayReportDataDOList = businessAssayReportDataMapper.selectBytBusinessBaseSampleIds(businessBaseSampleIdList);
for (BusinessAssayReportDataDO businessAssayReportDataDO : businessAssayReportDataDOList) {
String dataSource = businessAssayReportDataDO.getDataSource();
if (dataSource.contains(req.getConfigAssayMethodId().toString())) {//判定是否存在
List<Long> dataSourceList = new ArrayList<>();
String[] dataSourceSplit = dataSource.split(",");
for (int i = 0; i < dataSourceSplit.length; i++) {
dataSourceList.add(Long.parseLong(dataSourceSplit[i]));
}
//移除当前的
dataSourceList.remove(req.getConfigAssayMethodId());
//添加新的
dataSourceList.addAll(changeConfigAssayMethodIdList);
//重新赋值
businessAssayReportDataDO.setDataSource(CollUtil.join(dataSourceList, ","));
//添加到更新列表
updateBusinessAssayReportDataDOList.add(businessAssayReportDataDO);
}
}
//======================== 删除 =====================================================================
if (removeAssayTaskDataIdList.size() > 0) {
businessAssayTaskDataMapper.deleteByIds(removeAssayTaskDataIdList);
}
if (removeAssayProjectIdList.size() > 0) {
businessAssayProjectDataMapper.deleteByIds(removeAssayProjectIdList);
}
if (removeAssayParameterIdList.size() > 0) {
businessAssayParameterDataMapper.deleteByIds(removeAssayParameterIdList);
}
if (removeSubSampleAssessmentIdList.size() > 0) {
businessSubSampleAssessmentMapper.deleteByIds(removeSubSampleAssessmentIdList);
}
if (removeSubParentSampleAssessmentIdList.size() > 0) {
businessSubParentSampleAssessmentMapper.deleteByIds(removeSubParentSampleAssessmentIdList);
}
//======================== 修改 =====================================================================
if (updateBusinessAssayReportDataDOList.size() > 0) {
businessAssayReportDataMapper.updateBatch(updateBusinessAssayReportDataDOList);
}
if (updateBusinessAssayTaskDataDOList.size() > 0) {
businessAssayTaskDataMapper.updateBatch(updateBusinessAssayTaskDataDOList);
}
if (updateBusinessAssayProjectDataDOList.size() > 0) {
businessAssayProjectDataMapper.updateBatch(updateBusinessAssayProjectDataDOList);
}
if (updateBusinessAssayParameterDataDOList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataDOList);
}
if (updateBusinessSubSampleAssessmentDOList.size() > 0) {
businessSubSampleAssessmentMapper.updateBatch(updateBusinessSubSampleAssessmentDOList);
}
if (updateBusinessSubParentSampleAssessmentDOList.size() > 0) {
businessSubParentSampleAssessmentMapper.updateBatch(updateBusinessSubParentSampleAssessmentDOList);
}
//======================== 新建 =====================================================================
if (saveBusinessAssayTaskDataDOList.size() > 0) {
businessAssayTaskDataMapper.insertBatch(saveBusinessAssayTaskDataDOList);
}
if (saveBusinessAssayProjectDataDOList.size() > 0) {
businessAssayProjectDataMapper.insertBatch(saveBusinessAssayProjectDataDOList);
}
if (saveBusinessAssayParameterDataDOList.size() > 0) {
businessAssayParameterDataMapper.insertBatch(saveBusinessAssayParameterDataDOList);
}
if (saveBusinessSubSampleAssessmentDOList.size() > 0) {
businessSubSampleAssessmentMapper.insertBatch(saveBusinessSubSampleAssessmentDOList);
}
if (saveBusinessSubParentSampleAssessmentDOList.size() > 0) {
businessSubParentSampleAssessmentMapper.insertBatch(saveBusinessSubParentSampleAssessmentDOList);
}
}
/**
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void changeMethod(ChangeAssayMethodReqVO req) { public void changeMethod(ChangeAssayMethodReqVO req) {
@@ -699,6 +1204,7 @@ public class SampleTaskAssignServiceImpl implements SampleTaskAssignService {
} }
**/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)

View File

@@ -14,6 +14,9 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data @Data
public class ConfigAssayMethodProjectCoefficientPageReqVO extends PageParam { public class ConfigAssayMethodProjectCoefficientPageReqVO extends PageParam {
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", example = "10243") @Schema(description = "检测方法配置ID", example = "10243")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -17,6 +17,9 @@ public class ConfigAssayMethodProjectCoefficientRespVO {
@ExcelProperty("ID") @ExcelProperty("ID")
private Long id; private Long id;
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243") @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243")
@ExcelProperty("检测方法配置ID") @ExcelProperty("检测方法配置ID")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -13,6 +13,9 @@ public class ConfigAssayMethodProjectCoefficientSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26850") @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26850")
private Long id; private Long id;
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243") @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "10243")
@NotNull(message = "检测方法配置ID不能为空") @NotNull(message = "检测方法配置ID不能为空")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -20,4 +20,7 @@ public class ConfigAssayMethodProjectExtendRespVO extends ConfigAssayMethodProje
@Schema(description = "显示名称") @Schema(description = "显示名称")
private String showName; private String showName;
@Schema(description = "分析类型 单杯-single_cup、双杯-double_cup、平行-single_parallel")
private String assayType;
} }

View File

@@ -13,6 +13,9 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data @Data
public class ConfigAssayMethodProjectRangePageReqVO extends PageParam { public class ConfigAssayMethodProjectRangePageReqVO extends PageParam {
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", example = "6862") @Schema(description = "检测方法配置ID", example = "6862")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -16,6 +16,9 @@ public class ConfigAssayMethodProjectRangeRespVO {
@ExcelProperty("ID") @ExcelProperty("ID")
private Long id; private Long id;
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6862") @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6862")
@ExcelProperty("检测方法配置ID") @ExcelProperty("检测方法配置ID")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -12,6 +12,9 @@ public class ConfigAssayMethodProjectRangeSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25632") @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25632")
private Long id; private Long id;
@Schema(description = "主样配置ID", example = "30107")
private Long configBaseSampleId;
@Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6862") @Schema(description = "检测方法配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6862")
@NotNull(message = "检测方法配置ID不能为空") @NotNull(message = "检测方法配置ID不能为空")
private Long configAssayMethodId; private Long configAssayMethodId;

View File

@@ -10,6 +10,9 @@ public class ConfigSubSampleMethodConfInfo {
/** 添加分析任务 **/ /** 添加分析任务 **/
private ConfigSubSampleMethodConfAdd addAssayTask; private ConfigSubSampleMethodConfAdd addAssayTask;
/** 分析方法参数设置值配置 **/
private List<ConfigSubSampleMethodConfItem> setParam;
/** 分析方法参数取值配置 **/ /** 分析方法参数取值配置 **/
private List<ConfigSubSampleMethodConfItem> getParam; private List<ConfigSubSampleMethodConfItem> getParam;

View File

@@ -8,7 +8,10 @@ public class ConfigSubSampleMethodConfPoint {
/** 分析方法id **/ /** 分析方法id **/
private Long methodId; private Long methodId;
/** 检测项目 **/ /** 分析方法Key **/
private String methodKey;
/** 检测项目,多个以“,”号分割 **/
private String project; private String project;
/** 参数 **/ /** 参数 **/

View File

@@ -33,6 +33,11 @@ public class ConfigAssayMethodProjectCoefficientDO extends BusinessBaseDO {
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private Long id; private Long id;
/** /**
* 主样配置ID
*/
@TableField("CFG_BSE_SMP_ID")
private Long configBaseSampleId;
/**
* 检测方法配置ID * 检测方法配置ID
*/ */
@TableField("CFG_ASY_MTHD_ID") @TableField("CFG_ASY_MTHD_ID")

View File

@@ -32,6 +32,11 @@ public class ConfigAssayMethodProjectRangeDO extends BusinessBaseDO {
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private Long id; private Long id;
/** /**
* 主样配置ID
*/
@TableField("CFG_BSE_SMP_ID")
private Long configBaseSampleId;
/**
* 检测方法配置ID * 检测方法配置ID
*/ */
@TableField("CFG_ASY_MTHD_ID") @TableField("CFG_ASY_MTHD_ID")

View File

@@ -19,6 +19,7 @@ public interface ConfigAssayMethodProjectCoefficientMapper extends BaseMapperX<C
default PageResult<ConfigAssayMethodProjectCoefficientDO> selectPage(ConfigAssayMethodProjectCoefficientPageReqVO reqVO) { default PageResult<ConfigAssayMethodProjectCoefficientDO> selectPage(ConfigAssayMethodProjectCoefficientPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectCoefficientDO>() return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectCoefficientDO>()
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()) .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId()) .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId())
.eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getDictionaryProjectId, reqVO.getDictionaryProjectId()) .eqIfPresent(ConfigAssayMethodProjectCoefficientDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())
@@ -34,4 +35,9 @@ public interface ConfigAssayMethodProjectCoefficientMapper extends BaseMapperX<C
.orderByDesc(ConfigAssayMethodProjectCoefficientDO::getId)); .orderByDesc(ConfigAssayMethodProjectCoefficientDO::getId));
} }
default List<ConfigAssayMethodProjectCoefficientDO> selectByConfigBaseSampleIds(List<Long> configBaseSampleIdList){
return selectList(new LambdaQueryWrapperX<ConfigAssayMethodProjectCoefficientDO>()
.in(ConfigAssayMethodProjectCoefficientDO::getConfigBaseSampleId, configBaseSampleIdList));
}
} }

View File

@@ -18,6 +18,7 @@ public interface ConfigAssayMethodProjectRangeMapper extends BaseMapperX<ConfigA
default PageResult<ConfigAssayMethodProjectRangeDO> selectPage(ConfigAssayMethodProjectRangePageReqVO reqVO) { default PageResult<ConfigAssayMethodProjectRangeDO> selectPage(ConfigAssayMethodProjectRangePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectRangeDO>() return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectRangeDO>()
.eqIfPresent(ConfigAssayMethodProjectRangeDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
.eqIfPresent(ConfigAssayMethodProjectRangeDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId()) .eqIfPresent(ConfigAssayMethodProjectRangeDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
.eqIfPresent(ConfigAssayMethodProjectRangeDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId()) .eqIfPresent(ConfigAssayMethodProjectRangeDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId())
.eqIfPresent(ConfigAssayMethodProjectRangeDO::getDictionaryProjectId, reqVO.getDictionaryProjectId()) .eqIfPresent(ConfigAssayMethodProjectRangeDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())

View File

@@ -98,4 +98,17 @@ public interface ConfigSubSampleMethodMapper extends BaseMapperX<ConfigSubSample
.in(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleIds)); .in(ConfigSubSampleMethodDO::getConfigSubSampleId, configSubSampleIds));
} }
default List<ConfigSubSampleMethodExtendRespVO> selectByBaseSampleId(Long baseSampleId) {
return selectJoinList(ConfigSubSampleMethodExtendRespVO.class, new MPJLambdaWrapperX<ConfigSubSampleMethodDO>()
.leftJoin(ConfigSubSampleParentMethodDO.class, ConfigSubSampleParentMethodDO::getId, ConfigSubSampleMethodDO::getConfigSubSampleParentMethodId)
.leftJoin(ConfigSubSampleDO.class, ConfigSubSampleDO::getId, ConfigSubSampleMethodDO::getConfigSubSampleId)
.selectAll(ConfigSubSampleMethodDO.class)
.selectAs(ConfigSubSampleParentMethodDO::getConfigAssayMethodId, ConfigSubSampleMethodExtendRespVO::getConfigAssayMethodId)
.selectAs(ConfigSubSampleParentMethodDO::getIsDefaultUse, ConfigSubSampleMethodExtendRespVO::getIsDefaultUse)
.selectAs(ConfigSubSampleDO::getConfigSubSampleParentId, ConfigSubSampleMethodExtendRespVO::getConfigSubSampleParentId)
.selectAs(ConfigSubSampleDO::getConfigBaseSampleId, ConfigSubSampleMethodExtendRespVO::getConfigBaseSampleId)
.selectAs(ConfigSubSampleDO::getBaseSampleId, ConfigSubSampleMethodExtendRespVO::getBaseSampleId)
.eq(ConfigSubSampleDO::getBaseSampleId, baseSampleId));
}
} }

View File

@@ -202,6 +202,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr); if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
int rowLength = rowList.size(); int rowLength = rowList.size();
if(rowLength <= maxRowCount){ if(rowLength <= maxRowCount){
//以下为空白
if(rowList.size() < maxRowCount){
JSONObject t = new JSONObject();
t.put(colPrefix + "01", emptyText);
putEmptyData(t, 2,10);
rowList.add(t.clone());
}
pageRowList.add(rowList); pageRowList.add(rowList);
return assemblePageResult(mainData, pageRowList, maxRowCount); return assemblePageResult(mainData, pageRowList, maxRowCount);
} }

View File

@@ -214,9 +214,17 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
//委托单号 //委托单号
String entrustCode = ""; String entrustCode = "";
if(!ObjectUtils.isEmpty(entrustList)){ if(!ObjectUtils.isEmpty(entrustList)){
for(BusinessSampleEntrustRegistrationDO entrust : entrustList){ for(BusinessSampleEntrustRegistrationDO entrust : entrustList){
entrustCode += entrust.getEntrustNumber() + ","; entrustCode += entrust.getEntrustNumber() + ",";
String externalInfomation = entrust.getExternalInfomation();
if(!ObjectUtils.isEmpty(externalInfomation)){
JSONObject externalInfomationJson = JSONObject.parseObject(externalInfomation);
String sampleCategory = externalInfomationJson.getString("sampleCategory");
if(!ObjectUtils.isEmpty(sampleCategory))
formDataJson.put("sampleCategory", sampleCategory);
}
break; break;
} }
} }

View File

@@ -0,0 +1,9 @@
package com.zt.plat.module.qms.resource.material.constant;
/**
* 物料常量
*/
public class MaterialConstants {
// 字典 类型
public static final String DICT_MATERIAL_FLOW_TYPE = "jy_material_lifecycle_bsn_type";
}

View File

@@ -93,8 +93,12 @@ public class MaterialBatchController implements BusinessControllerMarker {
@Operation(summary = "获得物料批次分页") @Operation(summary = "获得物料批次分页")
// @PreAuthorize("@ss.hasPermission('qms:material-batch:query')") // @PreAuthorize("@ss.hasPermission('qms:material-batch:query')")
public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) { public CommonResult<PageResult<MaterialBatchRespVO>> getMaterialBatchPage(@Valid MaterialBatchPageReqVO pageReqVO) {
PageResult<MaterialBatchRespVO> pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO); PageResult<MaterialBatchRespVO> pageResult;
// return success(BeanUtils.toBean(pageResult, MaterialBatchRespVO.class)); if (!pageReqVO.getOnlyGong()) {
pageResult = materialBatchService.getMaterialBatchPageWithPdtInfo(pageReqVO);
} else {
pageResult = materialBatchService.getMaterialBatchGongPageWithPdtInfo(pageReqVO);
}
return success(pageResult); return success(pageResult);
} }

View File

@@ -88,10 +88,10 @@ public class MaterialInfomationController implements BusinessControllerMarker {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得物料实例分页") @Operation(summary = "获得物料实例分页")
@PreAuthorize("@ss.hasPermission('qms:material-infomation:query')") // @PreAuthorize("@ss.hasPermission('qms:material-infomation:query')")
public CommonResult<PageResult<MaterialInfomationRespVO>> getMaterialInfomationPage(@Valid MaterialInfomationPageReqVO pageReqVO) { public CommonResult<PageResult<MaterialInfomationRespVO>> getMaterialInfomationPage(@Valid MaterialInfomationPageReqVO pageReqVO) {
PageResult<MaterialInfomationDO> pageResult = materialInfomationService.getMaterialInfomationPage(pageReqVO); PageResult<MaterialInfomationRespVO> pageResult = materialInfomationService.getMaterialInfomationPageWithPdtInfo(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialInfomationRespVO.class)); return success(pageResult);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")

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

View File

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

View File

@@ -11,10 +11,9 @@ import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore; import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
import com.zt.plat.framework.excel.core.util.ExcelUtils; import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO;
import com.zt.plat.module.qms.resource.material.service.MaterialBatchService;
import com.zt.plat.module.qms.resource.material.service.MaterialLifecycleService; import com.zt.plat.module.qms.resource.material.service.MaterialLifecycleService;
import com.zt.plat.module.qms.resource.material.valid.AddGroup; import com.zt.plat.module.qms.resource.material.valid.AddGroup;
import com.zt.plat.module.qms.resource.material.valid.UpdateGroup; import com.zt.plat.module.qms.resource.material.valid.UpdateGroup;
@@ -24,6 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -36,9 +36,9 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 物料通用流程,物料验收、退换货") @Tag(name = "管理后台 - 物料通用流程,物料验收、退换货")
@RestController @RestController
@RequestMapping("/t/material-lifecycle") @RequestMapping("/qms/resource/material-lifecycle")
@Validated @Validated
@FileUploadController(source = "t.materiallifecycle") @FileUploadController(source = "resource.materiallifecycle")
@DeptDataPermissionIgnore(enable = "true") @DeptDataPermissionIgnore(enable = "true")
public class MaterialLifecycleController extends AbstractFileUploadController implements BusinessControllerMarker{ public class MaterialLifecycleController extends AbstractFileUploadController implements BusinessControllerMarker{
@@ -54,23 +54,23 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "新建物料流程") @Operation(summary = "新建物料流程")
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:create')") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')")
public CommonResult<MaterialLifecycleRespVO> createMaterialLifecycle(@Validated(AddGroup.class) @RequestBody MaterialLifecycleSaveReqVO createReqVO) { public CommonResult<MaterialLifecycleRespVO> createMaterialLifecycle(@Validated(AddGroup.class) @RequestBody MaterialLifecycleSaveReqVO createReqVO) {
return success(materialLifecycleService.createMaterialLifecycle(createReqVO)); return success(materialLifecycleService.createMaterialLifecycle(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新物料流程") @Operation(summary = "更新物料流程")
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:update')") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:update')")
public CommonResult<Boolean> updateMaterialLifecycle(@Validated(UpdateGroup.class) @RequestBody MaterialLifecycleSaveReqVO updateReqVO) { public CommonResult<Boolean> updateMaterialLifecycle(@Validated(UpdateGroup.class) @RequestBody MaterialLifecycleSaveReqVO updateReqVO) {
materialLifecycleService.updateMaterialLifecycle(updateReqVO); materialLifecycleService.updateMaterialLifecycle(updateReqVO);
return success(true); return success(true);
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除物料通用流程,物料验收、退换货") @Operation(summary = "删除物料流程")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
// @PreAuthorize("@ss.hasPermission('t:material-lifecycle:delete')") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:delete')")
public CommonResult<Boolean> deleteMaterialLifecycle(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteMaterialLifecycle(@RequestParam("id") Long id) {
materialLifecycleService.deleteMaterialLifecycle(id); materialLifecycleService.deleteMaterialLifecycle(id);
return success(true); return success(true);
@@ -78,7 +78,7 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除物料通用流程,物料验收、退换货") @Operation(summary = "批量删除物料流程")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:delete')") @PreAuthorize("@ss.hasPermission('t:material-lifecycle:delete')")
public CommonResult<Boolean> deleteMaterialLifecycleList(@RequestBody BatchDeleteReqVO req) { public CommonResult<Boolean> deleteMaterialLifecycleList(@RequestBody BatchDeleteReqVO req) {
materialLifecycleService.deleteMaterialLifecycleListByIds(req.getIds()); materialLifecycleService.deleteMaterialLifecycleListByIds(req.getIds());
@@ -86,25 +86,33 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
} }
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得物料通用流程,物料验收、退换货") @Operation(summary = "获得物料流程")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
public CommonResult<MaterialLifecycleRespVO> getMaterialLifecycle(@RequestParam("id") Long id) { public CommonResult<MaterialLifecycleRespVO> getMaterialLifecycle(@RequestParam("id") Long id) {
MaterialLifecycleDO materialLifecycle = materialLifecycleService.getMaterialLifecycle(id); MaterialLifecycleRespVO lifecycleRespVO = materialLifecycleService.getMaterialLifecycle(id);
return success(BeanUtils.toBean(materialLifecycle, MaterialLifecycleRespVO.class)); return success(lifecycleRespVO);
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得物料通用流程,物料验收、退换货分页") @Operation(summary = "获得物料流程分页")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:query')") // @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:query')")
public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) { public CommonResult<PageResult<MaterialLifecycleRespVO>> getMaterialLifecyclePage(@Valid MaterialLifecyclePageReqVO pageReqVO) {
PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO); PageResult<MaterialLifecycleDO> pageResult = materialLifecycleService.getMaterialLifecyclePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class)); return success(BeanUtils.toBean(pageResult, MaterialLifecycleRespVO.class));
} }
@PutMapping("/submit")
@Operation(summary = "提交(验收等流程)")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<Boolean> submitLifecycle(@RequestParam("id") Long id) {
return success(materialLifecycleService.submitLifecycle(id));
}
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出物料通用流程,物料验收、退换货 Excel") @Operation(summary = "导出物料通用流程,物料验收、退换货 Excel")
@PreAuthorize("@ss.hasPermission('t:material-lifecycle:export')") @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO, public void exportMaterialLifecycleExcel(@Valid MaterialLifecyclePageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {

View File

@@ -1,110 +0,0 @@
package com.zt.plat.module.qms.resource.material.controller.admin;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
import com.zt.plat.module.qms.resource.material.service.MaterialLocationService;
@Tag(name = "管理后台 - 存放位置")
@RestController
@RequestMapping("/qms/material-location")
@Validated
public class MaterialLocationController implements BusinessControllerMarker {
@Resource
private MaterialLocationService materialLocationService;
@PostMapping("/create")
@Operation(summary = "创建存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:create')")
public CommonResult<MaterialLocationRespVO> createMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO createReqVO) {
return success(materialLocationService.createMaterialLocation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:update')")
public CommonResult<Boolean> updateMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO updateReqVO) {
materialLocationService.updateMaterialLocation(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除存放位置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
public CommonResult<Boolean> deleteMaterialLocation(@RequestParam("id") Long id) {
materialLocationService.deleteMaterialLocation(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除存放位置")
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
public CommonResult<Boolean> deleteMaterialLocationList(@RequestBody BatchDeleteReqVO req) {
materialLocationService.deleteMaterialLocationListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得存放位置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
public CommonResult<MaterialLocationRespVO> getMaterialLocation(@RequestParam("id") Long id) {
MaterialLocationDO materialLocation = materialLocationService.getMaterialLocation(id);
return success(BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得存放位置分页")
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
public CommonResult<PageResult<MaterialLocationRespVO>> getMaterialLocationPage(@Valid MaterialLocationPageReqVO pageReqVO) {
PageResult<MaterialLocationDO> pageResult = materialLocationService.getMaterialLocationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialLocationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出存放位置 Excel")
@PreAuthorize("@ss.hasPermission('qms:material-location:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMaterialLocationExcel(@Valid MaterialLocationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialLocationDO> list = materialLocationService.getMaterialLocationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "存放位置.xls", "数据", MaterialLocationRespVO.class,
BeanUtils.toBean(list, MaterialLocationRespVO.class));
}
}

View File

@@ -22,6 +22,12 @@ public class MaterialBatchPageReqVO extends PageParam {
@Schema(description = "是否需要组装 children") @Schema(description = "是否需要组装 children")
private Boolean children = false; private Boolean children = false;
@Schema(description = "是否只需要工段")
private Boolean onlyGong = false;
@Schema(description = "true-已处理false-未处理")
private Boolean treatment = false;
@Schema(description = "批次编号") @Schema(description = "批次编号")
private String batchNo; private String batchNo;
@@ -54,7 +60,7 @@ public class MaterialBatchPageReqVO extends PageParam {
@Schema(description = "是否检化验,1-是0-否") @Schema(description = "是否检化验,1-是0-否")
private Integer assayFlag; private Integer assayFlag;
@Schema(description = "检化验状态,NOT_STARTED-未开始IN_PROGRESS-进行中PASSED-通过NOT_PASSED-未通过", example = "2") @Schema(description = "检化验状态,未开始,进行中,通过,未通过", example = "2")
private String assayStatus; private String assayStatus;
// @Schema(description = "检化验结果") // @Schema(description = "检化验结果")

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.material.controller.vo; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -33,10 +34,34 @@ public class MaterialInfomationRespVO {
@ExcelProperty("编码") @ExcelProperty("编码")
private String code; private String code;
@Schema(description = "名称")
@ExcelProperty("名称")
private String name;
@Schema(description = "型号")
@ExcelProperty("型号")
private String modelNo;
@Schema(description = "规格")
@ExcelProperty("规格")
private String specification;
@Schema(description = "技术参数") @Schema(description = "技术参数")
@ExcelProperty("技术参数") @ExcelProperty("技术参数")
private String parameter; private String parameter;
@Schema(description = "制造商")
@ExcelProperty("制造商")
private String manufacturer;
@Schema(description = "单位")
@ExcelProperty("单位")
private String unit;
@Schema(description = "保质期(天)")
@ExcelProperty("保质期(天)")
private Integer due;
@Schema(description = "上架状态,0-未上架1-已上架", example = "2") @Schema(description = "上架状态,0-未上架1-已上架", example = "2")
@ExcelProperty("上架状态,0-未上架1-已上架") @ExcelProperty("上架状态,0-未上架1-已上架")
private Integer publishStatus; private Integer publishStatus;

View File

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

View File

@@ -28,10 +28,32 @@ public class MaterialInventoryInboundDetailRespVO {
@ExcelProperty("批次工段id") @ExcelProperty("批次工段id")
private Long batchGongduanId; private Long batchGongduanId;
// 工段名
@Schema(description = "物料实例ID", example = "17457") @Schema(description = "物料实例ID", example = "17457")
@ExcelProperty("物料实例ID") @ExcelProperty("物料实例ID")
private Long materialInfomationId; private Long materialInfomationId;
@Schema(description = "物料编码")
@ExcelProperty("物料编码")
private String infomationCode;
@Schema(description = "物料名称")
@ExcelProperty("物料名称")
private String infomationName;
@Schema(description = "业务类型,验收入库、盘盈入库等")
@ExcelProperty("业务类型,验收入库、盘盈入库等")
private String businessType;
@Schema(description = "存放位置名称")
@ExcelProperty("存放位置名称")
private String locationName;
@Schema(description = "存放位置编码")
@ExcelProperty("存放位置编码")
private String locationCode;
@Schema(description = "入库人", example = "赵六") @Schema(description = "入库人", example = "赵六")
@ExcelProperty("入库人") @ExcelProperty("入库人")
private String inboundUserName; private String inboundUserName;

View File

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 入库 Response VO") @Schema(description = "管理后台 - 入库 Response VO")
@@ -48,6 +49,26 @@ public class MaterialInventoryInboundRespVO {
@ExcelProperty("申请时间") @ExcelProperty("申请时间")
private LocalDateTime applyTime; 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") @Schema(description = "流程实例id", example = "16660")
@ExcelProperty("流程实例id") @ExcelProperty("流程实例id")
private String flowInstanceId; private String flowInstanceId;

View File

@@ -1,8 +1,10 @@
package com.zt.plat.module.qms.resource.material.controller.vo; package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 入库新增/修改 Request VO") @Schema(description = "管理后台 - 入库新增/修改 Request VO")
@@ -36,6 +38,22 @@ public class MaterialInventoryInboundSaveReqVO {
@Schema(description = "申请时间") @Schema(description = "申请时间")
private LocalDateTime applyTime; 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") @Schema(description = "流程实例id", example = "16660")
private String flowInstanceId; private String flowInstanceId;

View File

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 物料通用流程明细 Response VO") @Schema(description = "管理后台 - 物料通用流程明细 Response VO")
@@ -20,18 +21,43 @@ public class MaterialLifecycleDetailRespVO {
@ExcelProperty("父id") @ExcelProperty("父id")
private Long lifecycleId; private Long lifecycleId;
@Schema(description = "物料大类id", example = "31283") @Schema(description = "物料大类id", example = "31283")
@ExcelProperty("物料大类id") @ExcelProperty("物料大类id")
private Long productId; private Long productId;
@Schema(description = "物料大类名称")
@ExcelProperty("物料大类名称")
private String productName;
@Schema(description = "物料大类编码")
@ExcelProperty("物料大类编码")
private String productCode;
@Schema(description = "物料大类型号")
@ExcelProperty("物料大类型号")
private String productModelNo;
@Schema(description = "物料批次id", example = "12948") @Schema(description = "物料批次id", example = "12948")
@ExcelProperty("物料批次id") @ExcelProperty("物料批次id")
private Long batchId; private Long batchId;
@Schema(description = "物料批次号")
@ExcelProperty("物料批次号")
private String batchNo;
@Schema(description = "批次工段id", example = "21334") @Schema(description = "批次工段id", example = "21334")
@ExcelProperty("批次工段id") @ExcelProperty("批次工段id")
private Long batchGongduanId; private Long batchGongduanId;
@Schema(description = "批次工段-部门名称")
@ExcelProperty("批次工段-部门名称")
private String assignDepartmentName;
@Schema(description = "是否检化验,1-是0-否")
@ExcelProperty("是否检化验,1-是0-否")
private Integer assayFlag;
@Schema(description = "物料实例id", example = "968") @Schema(description = "物料实例id", example = "968")
@ExcelProperty("物料实例id") @ExcelProperty("物料实例id")
private Long infomationId; private Long infomationId;

View File

@@ -22,6 +22,9 @@ public class MaterialLifecycleDetailSaveReqVO {
@Schema(description = "批次工段id", example = "21334") @Schema(description = "批次工段id", example = "21334")
private Long batchGongduanId; private Long batchGongduanId;
@Schema(description = "是否检化验,1-是0-否")
private Integer assayFlag;
@Schema(description = "物料实例id", example = "968") @Schema(description = "物料实例id", example = "968")
private Long infomationId; private Long infomationId;

View File

@@ -44,7 +44,7 @@ public class MaterialLifecyclePageReqVO extends PageParam {
@Schema(description = "流程实例id", example = "12151") @Schema(description = "流程实例id", example = "12151")
private String flowInstanceId; private String flowInstanceId;
@Schema(description = "提交状态,提交状态,0-未提交1-已提交", example = "1") @Schema(description = "提交状态,0-未提交1-已提交", example = "1")
private Integer submitStatus; private Integer submitStatus;
@Schema(description = "流程审批状态", example = "1") @Schema(description = "流程审批状态", example = "1")

View File

@@ -2,10 +2,12 @@ package com.zt.plat.module.qms.resource.material.controller.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 物料通用流程,物料验收、退换货 Response VO") @Schema(description = "管理后台 - 物料通用流程,物料验收、退换货 Response VO")
@Data @Data
@@ -62,6 +64,7 @@ public class MaterialLifecycleRespVO {
@Schema(description = "流程审批状态", example = "1") @Schema(description = "流程审批状态", example = "1")
@ExcelProperty("流程审批状态") @ExcelProperty("流程审批状态")
@Dict(dicCode = "flow_status")
private String flowStatus; private String flowStatus;
@Schema(description = "所属部门") @Schema(description = "所属部门")
@@ -76,4 +79,8 @@ public class MaterialLifecycleRespVO {
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "流程明细")
@ExcelProperty("流程明细")
private List<MaterialLifecycleDetailRespVO> detailList;
} }

View File

@@ -23,29 +23,25 @@ public class MaterialLifecycleSaveReqVO {
private String title; private String title;
@Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2") @Schema(description = "业务类型,【字典】【jy_material_lifecycle_bsn_type】验收、退换货、配置申请", example = "2")
@NotNull(groups = AddGroup.class, message = "业务类型不能为空")
private String businessType; private String businessType;
@Schema(description = "业务类型编码") @Schema(description = "业务类型编码")
private String businessTypeCode; private String businessTypeCode;
@Schema(description = "申请人") @Schema(description = "申请人")
@NotNull(groups = AddGroup.class, message = "申请人不能为空")
private String applyUser; private String applyUser;
@Schema(description = "申请人id", example = "4976") @Schema(description = "申请人id", example = "4976")
@NotNull(groups = AddGroup.class, message = "申请人id 不能为空")
private Long applyUserId; private Long applyUserId;
@Schema(description = "申请部门") @Schema(description = "申请部门")
@NotNull(groups = AddGroup.class, message = "申请部门不能为空")
private String applyDepartment; private String applyDepartment;
@Schema(description = "申请部门id", example = "19765") @Schema(description = "申请部门id", example = "19765")
@NotNull(groups = AddGroup.class, message = "申请部门id 不能为空")
private Long applyDepartmentId; private Long applyDepartmentId;
@Schema(description = "申请时间") @Schema(description = "申请时间")
@NotNull(groups = AddGroup.class, message = "申请时间不能为空")
private LocalDateTime applyTime; private LocalDateTime applyTime;
@Schema(description = "表单数据,表单数据") @Schema(description = "表单数据,表单数据")
@@ -67,6 +63,6 @@ public class MaterialLifecycleSaveReqVO {
private String remark; private String remark;
@Schema(description = "工段列表") @Schema(description = "工段列表")
private List<Long> gongIds; private List<MaterialLifecycleDetailSaveReqVO> detailList;
} }

View File

@@ -1,41 +0,0 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 存放位置分页 Request VO")
@Data
public class MaterialLocationPageReqVO extends PageParam {
@Schema(description = "上级id", example = "9092")
private Long parentId;
@Schema(description = "名称", example = "赵六")
private String name;
@Schema(description = "编码")
private String code;
@Schema(description = "容量")
private String capacity;
@Schema(description = "位置")
private String location;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -1,51 +0,0 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 存放位置 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialLocationRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724")
@ExcelProperty("主键")
private Long id;
@Schema(description = "上级id", example = "9092")
@ExcelProperty("上级id")
private Long parentId;
@Schema(description = "名称", example = "赵六")
@ExcelProperty("名称")
private String name;
@Schema(description = "编码")
@ExcelProperty("编码")
private String code;
@Schema(description = "容量")
@ExcelProperty("容量")
private String capacity;
@Schema(description = "位置")
@ExcelProperty("位置")
private String location;
@Schema(description = "所属部门")
@ExcelProperty("所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -1,36 +0,0 @@
package com.zt.plat.module.qms.resource.material.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 存放位置新增/修改 Request VO")
@Data
public class MaterialLocationSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724")
private Long id;
@Schema(description = "上级id", example = "9092")
private Long parentId;
@Schema(description = "名称", example = "赵六")
private String name;
@Schema(description = "编码")
private String code;
@Schema(description = "容量")
private String capacity;
@Schema(description = "位置")
private String location;
@Schema(description = "所属部门")
private String systemDepartmentCode;
@Schema(description = "备注")
private String remark;
}

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

View File

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

View File

@@ -46,17 +46,57 @@ public class MaterialInfomationDO extends BusinessBaseDO {
* 存放位置 * 存放位置
*/ */
@TableField("LOC_ID") @TableField("LOC_ID")
private String locationId; private Long locationId;
/**
* 工段id
*/
@TableField("GONG_ID")
private Long gongduanId;
/** /**
* 编码 * 编码
*/ */
@TableField("CD") @TableField("CD")
private String code; private String code;
/** /**
* 名称
*/
@TableField("NAME")
private String name;
/**
* 型号
*/
@TableField("MDL_NO")
private String modelNo;
/**
* 规格
*/
@TableField("SPEC")
private String specification;
/**
* 技术参数 * 技术参数
*/ */
@TableField("PRM") @TableField("PRM")
private String parameter; 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-已上架 * 上架状态,0-未上架1-已上架
*/ */
@@ -107,6 +147,11 @@ public class MaterialInfomationDO extends BusinessBaseDO {
*/ */
@TableField("OPN_DT") @TableField("OPN_DT")
private LocalDateTime openDate; 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 com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*; import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* 入库 DO * 入库 DO
@@ -70,6 +71,31 @@ public class MaterialInventoryInboundDO extends BusinessBaseDO {
*/ */
@TableField("APL_TM") @TableField("APL_TM")
private LocalDateTime applyTime; 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 * 流程实例id
*/ */

View File

@@ -48,6 +48,11 @@ public class MaterialLifecycleDetailDO extends BusinessBaseDO {
*/ */
@TableField("BAT_GONG_ID") @TableField("BAT_GONG_ID")
private Long batchGongduanId; private Long batchGongduanId;
/**
* 是否检化验,1-是0-否
*/
@TableField("ASY_FLG")
private Integer assayFlag;
/** /**
* 物料实例id * 物料实例id
*/ */

View File

@@ -1,67 +0,0 @@
package com.zt.plat.module.qms.resource.material.dal.dataobject;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
/**
* 存放位置 DO
*
* @author 后台管理
*/
@TableName("t_mtrl_loc")
@KeySequence("t_mtrl_loc_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class MaterialLocationDO extends BusinessBaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 上级id
*/
@TableField("PRN_ID")
private Long parentId;
/**
* 名称
*/
@TableField("NAME")
private String name;
/**
* 编码
*/
@TableField("CD")
private String code;
/**
* 容量
*/
@TableField("CPY")
private String capacity;
/**
* 位置
*/
@TableField("LOC")
private String location;
/**
* 所属部门
*/
@TableField("SYS_DEPT_CD")
private String systemDepartmentCode;
/**
* 备注
*/
@TableField("RMK")
private String remark;
}

View File

@@ -1,16 +1,19 @@
package com.zt.plat.module.qms.resource.material.dal.mapper; package com.zt.plat.module.qms.resource.material.dal.mapper;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; 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.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@@ -36,20 +39,22 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
.eqIfPresent(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus()) .eqIfPresent(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
.eqIfPresent(MaterialBatchDO::getAssayFlag, reqVO.getAssayFlag()) .eqIfPresent(MaterialBatchDO::getAssayFlag, reqVO.getAssayFlag())
.eqIfPresent(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus()) .eqIfPresent(MaterialBatchDO::getAssayStatus, reqVO.getAssayStatus())
//.eqIfPresent(MaterialBatchDO::getAssayResult, reqVO.getAssayResult())
.eqIfPresent(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(MaterialBatchDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(MaterialBatchDO::getRemark, reqVO.getRemark()) .eqIfPresent(MaterialBatchDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(MaterialBatchDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialBatchDO::getId)); .orderByDesc(MaterialBatchDO::getId));
} }
default PageResult<MaterialBatchRespVO> selectPage(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) { default PageResult<MaterialBatchRespVO> selectPageWithPdtInfo(MaterialBatchPageReqVO reqVO, List<Long> pdtIds) {
MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>() MPJLambdaWrapper<MaterialBatchDO> wrapper = new MPJLambdaWrapperX<MaterialBatchDO>()
.selectAll(MaterialBatchDO.class) .selectAll(MaterialBatchDO.class)
.selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName) .selectAs(MaterialProductDO::getName, MaterialBatchRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode) .selectAs(MaterialProductDO::getCode, MaterialBatchRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo) .selectAs(MaterialProductDO::getModelNo, MaterialBatchRespVO::getProductModelNo)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId) .leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialBatchDO::getProductId)
// 只查询批次
.eq(MaterialBatchDO::getParentId, 0)
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds) .in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId()) .eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
.likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo()) .likeIfExists(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
@@ -69,4 +74,87 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper); return selectJoinPage(reqVO, MaterialBatchRespVO.class, wrapper);
} }
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)
.ne(MaterialBatchDO::getAcceptanceStatus, MaterialAcceptStatus.accepted.name())
// 未处理的不允许再次选择
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.TMT_STS = 0 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;
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)
.eq(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
// .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())
.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())
// 已处理
.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

@@ -1,10 +1,14 @@
package com.zt.plat.module.qms.resource.material.dal.mapper; package com.zt.plat.module.qms.resource.material.dal.mapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@@ -42,4 +46,42 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
.orderByDesc(MaterialInfomationDO::getId)); .orderByDesc(MaterialInfomationDO::getId));
} }
default PageResult<MaterialInfomationRespVO> selectPageWithPdtInfo(MaterialInfomationPageReqVO reqVO) {
MPJLambdaWrapper<MaterialInfomationDO> wrapper = new MPJLambdaWrapperX<MaterialInfomationDO>()
.select(MaterialInfomationDO::getId,
MaterialInfomationDO::getProductId, MaterialInfomationDO::getBatchId, MaterialInfomationDO::getGongduanId,
MaterialInfomationDO::getCode, MaterialInfomationDO::getPublishStatus,
MaterialInfomationDO::getUsageStatus, MaterialInfomationDO::getManagerDepartmentId,
MaterialInfomationDO::getManagerDepartmentName, MaterialInfomationDO::getManagerUserId, MaterialInfomationDO::getManagerUserName,
MaterialInfomationDO::getOpenStatus, MaterialInfomationDO::getOpenUserId, MaterialInfomationDO::getOpenUserName,
MaterialInfomationDO::getOpenDate, MaterialInfomationDO::getExpirationDate, MaterialInfomationDO::getExpirationFlag,
MaterialInfomationDO::getRemainingVolume, MaterialInfomationDO::getUseEndFlag,
MaterialInfomationDO::getSystemDepartmentCode, MaterialInfomationDO::getRemark,
MaterialInfomationDO::getCreateTime, MaterialInfomationDO::getUpdateTime)
.select(MaterialProductDO::getName, MaterialProductDO::getSpecification,
MaterialProductDO::getModelNo, MaterialProductDO::getParameter, MaterialProductDO::getManufacturer,
MaterialProductDO::getUnit, MaterialProductDO::getDue)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
.eqIfExists(MaterialInfomationDO::getProductId, reqVO.getProductId())
.eqIfExists(MaterialInfomationDO::getBatchId, reqVO.getBatchId())
.eqIfExists(MaterialInfomationDO::getLocationId, reqVO.getLocationId())
.eqIfExists(MaterialInfomationDO::getCode, reqVO.getCode())
.eqIfExists(MaterialProductDO::getParameter, reqVO.getParameter())
.eqIfExists(MaterialInfomationDO::getPublishStatus, reqVO.getPublishStatus())
.eqIfExists(MaterialInfomationDO::getUsageStatus, reqVO.getUsageStatus())
.eqIfExists(MaterialInfomationDO::getManagerDepartmentId, reqVO.getManagerDepartmentId())
.likeIfExists(MaterialInfomationDO::getManagerDepartmentName, reqVO.getManagerDepartmentName())
.eqIfExists(MaterialInfomationDO::getManagerUserId, reqVO.getManagerUserId())
.likeIfExists(MaterialInfomationDO::getManagerUserName, reqVO.getManagerUserName())
.eqIfExists(MaterialInfomationDO::getOpenStatus, reqVO.getOpenStatus())
.eqIfExists(MaterialInfomationDO::getOpenUserId, reqVO.getOpenUserId())
.likeIfExists(MaterialInfomationDO::getOpenUserName, reqVO.getOpenUserName())
.eqIfExists(MaterialInfomationDO::getExpirationFlag, reqVO.getExpirationFlag())
.eqIfExists(MaterialInfomationDO::getUseEndFlag, reqVO.getUseEndFlag())
.eqIfExists(MaterialInfomationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.likeIfExists(MaterialInfomationDO::getRemark, reqVO.getRemark())
.orderByDesc(MaterialInfomationDO::getId);
return selectJoinPage(reqVO, MaterialInfomationRespVO.class, wrapper);
}
} }

View File

@@ -3,10 +3,18 @@ package com.zt.plat.module.qms.resource.material.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailPageReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 入库明细,验收入库、盘盈入库等 Mapper * 入库明细,验收入库、盘盈入库等 Mapper
* *
@@ -32,4 +40,47 @@ public interface MaterialInventoryInboundDetailMapper extends BaseMapperX<Materi
.orderByDesc(MaterialInventoryInboundDetailDO::getId)); .orderByDesc(MaterialInventoryInboundDetailDO::getId));
} }
default PageResult<MaterialInventoryInboundDetailRespVO> selectPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO reqVO){
MPJLambdaWrapperX<MaterialInventoryInboundDetailDO> wrapperX = new MPJLambdaWrapperX<MaterialInventoryInboundDetailDO>()
.selectAll(MaterialInventoryInboundDetailDO.class)
.selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode)
.selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName)
.selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType)
.selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName)
.selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode)
.leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
.leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId())
.eqIfPresent(MaterialInventoryInboundDetailDO::getMaterialInfomationId, reqVO.getMaterialInfomationId())
.likeIfPresent(MaterialInventoryInboundDetailDO::getInboundUserName, reqVO.getInboundUserName())
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundUserId, reqVO.getInboundUserId())
.likeIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentName, reqVO.getInboundDepartmentName())
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentId, reqVO.getInboundDepartmentId())
.betweenIfPresent(MaterialInventoryInboundDetailDO::getInboundTime, reqVO.getInboundTime())
.eqIfPresent(MaterialInventoryInboundDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(MaterialInventoryInboundDetailDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialInventoryInboundDetailDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialInventoryInboundDetailDO::getInboundId);
return selectJoinPage(reqVO, MaterialInventoryInboundDetailRespVO.class, wrapperX);
}
default List<MaterialInventoryInboundDetailRespVO> selectMaterialInfoListByInboundId(Long inboundId) {
MPJLambdaWrapperX<MaterialInventoryInboundDetailDO> wrapperX = new MPJLambdaWrapperX<MaterialInventoryInboundDetailDO>()
.selectAll(MaterialInventoryInboundDetailDO.class)
.selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode)
.selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName)
.selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType)
.selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName)
.selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode)
.leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
.leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, inboundId);
return selectJoinList(MaterialInventoryInboundDetailRespVO.class, wrapperX);
}
} }

View File

@@ -1,12 +1,19 @@
package com.zt.plat.module.qms.resource.material.dal.mapper; package com.zt.plat.module.qms.resource.material.dal.mapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailPageReqVO; 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.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 物料通用流程明细 Mapper * 物料通用流程明细 Mapper
* *
@@ -32,4 +39,19 @@ public interface MaterialLifecycleDetailMapper extends BaseMapperX<MaterialLifec
.orderByDesc(MaterialLifecycleDetailDO::getId)); .orderByDesc(MaterialLifecycleDetailDO::getId));
} }
default List<MaterialLifecycleDetailRespVO> selectListWithPdtBatInfo(Long id){
MPJLambdaWrapper<MaterialLifecycleDetailDO> wrapper = new MPJLambdaWrapper<MaterialLifecycleDetailDO>()
.selectAll(MaterialLifecycleDetailDO.class)
.selectAs(MaterialProductDO::getName, MaterialLifecycleDetailRespVO::getProductName)
.selectAs(MaterialProductDO::getCode, MaterialLifecycleDetailRespVO::getProductCode)
.selectAs(MaterialProductDO::getModelNo, MaterialLifecycleDetailRespVO::getProductModelNo)
.selectAs("batch.BAT_NO", MaterialLifecycleDetailRespVO::getBatchNo)
.selectAs("gongduan.INB_QTY", MaterialLifecycleDetailRespVO::getInfluenceCount)
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialLifecycleDetailDO::getProductId)
.leftJoin(MaterialBatchDO.class, "batch", MaterialBatchDO::getId, MaterialLifecycleDetailDO::getBatchId)
.leftJoin(MaterialBatchDO.class, "gongduan", MaterialBatchDO::getId, MaterialLifecycleDetailDO::getBatchGongduanId)
.eq(MaterialLifecycleDetailDO::getLifecycleId, id);
return selectJoinList(MaterialLifecycleDetailRespVO.class, wrapper);
}
} }

View File

@@ -17,15 +17,15 @@ public interface MaterialLifecycleMapper extends BaseMapperX<MaterialLifecycleDO
default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) { default PageResult<MaterialLifecycleDO> selectPage(MaterialLifecyclePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>() return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLifecycleDO>()
.eqIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle()) .likeIfPresent(MaterialLifecycleDO::getTitle, reqVO.getTitle())
.eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType()) .eqIfPresent(MaterialLifecycleDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode()) .eqIfPresent(MaterialLifecycleDO::getBusinessTypeCode, reqVO.getBusinessTypeCode())
.eqIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser()) .likeIfPresent(MaterialLifecycleDO::getApplyUser, reqVO.getApplyUser())
.eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId()) .eqIfPresent(MaterialLifecycleDO::getApplyUserId, reqVO.getApplyUserId())
.eqIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment()) .likeIfPresent(MaterialLifecycleDO::getApplyDepartment, reqVO.getApplyDepartment())
.eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId()) .eqIfPresent(MaterialLifecycleDO::getApplyDepartmentId, reqVO.getApplyDepartmentId())
.betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime()) .betweenIfPresent(MaterialLifecycleDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData()) .likeIfPresent(MaterialLifecycleDO::getFormData, reqVO.getFormData())
.eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId()) .eqIfPresent(MaterialLifecycleDO::getFlowInstanceId, reqVO.getFlowInstanceId())
.eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus()) .eqIfPresent(MaterialLifecycleDO::getSubmitStatus, reqVO.getSubmitStatus())
.eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus()) .eqIfPresent(MaterialLifecycleDO::getFlowStatus, reqVO.getFlowStatus())

View File

@@ -1,31 +0,0 @@
package com.zt.plat.module.qms.resource.material.dal.mapper;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 存放位置 Mapper
*
* @author 后台管理
*/
@Mapper
public interface MaterialLocationMapper extends BaseMapperX<MaterialLocationDO> {
default PageResult<MaterialLocationDO> selectPage(MaterialLocationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLocationDO>()
.eqIfPresent(MaterialLocationDO::getParentId, reqVO.getParentId())
.likeIfPresent(MaterialLocationDO::getName, reqVO.getName())
.eqIfPresent(MaterialLocationDO::getCode, reqVO.getCode())
.eqIfPresent(MaterialLocationDO::getCapacity, reqVO.getCapacity())
.eqIfPresent(MaterialLocationDO::getLocation, reqVO.getLocation())
.eqIfPresent(MaterialLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.eqIfPresent(MaterialLocationDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MaterialLocationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaterialLocationDO::getId));
}
}

View File

@@ -0,0 +1,10 @@
package com.zt.plat.module.qms.resource.material.enums;
/**
* 物料验收状态
*/
public enum MaterialAcceptStatus {
accepted,
partAccepted,
notAccepted
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.qms.resource.material.enums;
import lombok.Getter;
@Getter
public enum MaterialFlowType {
acceptance("验收"),
return_exchange("退换货"),
config_apply("配置申请");
private final String name;
MaterialFlowType(String name) {
this.name = name;
}
public static MaterialFlowType fromName(String name) {
for (MaterialFlowType type : MaterialFlowType.values()) {
if (type.getName().equals(name)) {
return type;
}
}
throw new IllegalArgumentException("No enum constant with name: " + name);
}
}

View File

@@ -116,4 +116,27 @@ public interface MaterialBatchService {
* @return 工段列表 * @return 工段列表
*/ */
List<MaterialBatchDO> getGongduanListByGongIds(List<Long> gongIds); List<MaterialBatchDO> getGongduanListByGongIds(List<Long> gongIds);
/**
* 获得批次工段分页 - 需要可以层级穿透查询及返回物料信息
*
* @param pageReqVO 分页请求参数
* @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

@@ -1,22 +1,20 @@
package com.zt.plat.module.qms.resource.material.service; package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.exception.ErrorCode;
import com.zt.plat.framework.common.exception.ServiceException; import com.zt.plat.framework.common.exception.ServiceException;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.core.code.SequenceUtil; import com.zt.plat.module.qms.core.code.SequenceUtil;
import com.zt.plat.module.qms.enums.ErrorCodeConstants; 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.MaterialBatchPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO; 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.controller.vo.MaterialBatchSaveReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; 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.dataobject.MaterialProductDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper;
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -24,8 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -50,15 +46,18 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
@Autowired @Autowired
private MaterialProductService materialProductService; private MaterialProductService materialProductService;
private final String sequenceKey = "QMS_MATERIAL_BATCH_NO"; @Autowired
private MaterialLifecycleDetailService materialLifecycleDetailService;
private final String batchSequenceKey = "QMS_MATERIAL_BATCH_NO";
@Override @Override
public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) { public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) {
// 插入 // 插入
MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class); MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class);
mtrlBat.setAcceptanceStatus(MaterialAcceptStatus.notAccepted.name());
// 批次编号 // 批次编号
mtrlBat.setBatchNo(sequenceUtil.genCode(sequenceKey)); mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey));
mtrlBat.setParentId(0L); mtrlBat.setParentId(0L);
materialBatchMapper.insert(mtrlBat); materialBatchMapper.insert(mtrlBat);
@@ -71,12 +70,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
public void updateMaterialBatch(MaterialBatchSaveReqVO updateReqVO) { public void updateMaterialBatch(MaterialBatchSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
Long reqId = updateReqVO.getId(); Long reqId = updateReqVO.getId();
validateMaterialBatchExists(reqId); MaterialBatchDO batchDO = materialBatchMapper.selectById(reqId);
if (batchDO == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
// 已经拆分工段的不可编辑 // 已经提交的不可修改
List<MaterialBatchDO> asnDOs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class) if (batchDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,不可修改");
.eq(MaterialBatchDO::getParentId, reqId));
if (CollUtil.isNotEmpty(asnDOs)) throw exception(MATERIAL_BATCH_ASSIGN_END);
// 更新 // 更新
MaterialBatchDO updateObj = BeanUtils.toBean(updateReqVO, MaterialBatchDO.class); MaterialBatchDO updateObj = BeanUtils.toBean(updateReqVO, MaterialBatchDO.class);
@@ -140,21 +137,39 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
Long pdtId = pageReqVO.getProductId(); Long pdtId = pageReqVO.getProductId();
PageResult<MaterialBatchRespVO> pageResult; PageResult<MaterialBatchRespVO> pageResult;
if (pdtId == null) { if (pdtId == null) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of()); pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, List.of());
} else { } else {
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId); List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) { if (CollUtil.isEmpty(mtrlDos)) {
pageResult = materialBatchMapper.selectPage(pageReqVO, List.of()); pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, List.of());
} else { } else {
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList(); List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
pageResult = materialBatchMapper.selectPage(pageReqVO, pdtIds); pageResult = materialBatchMapper.selectPageWithPdtInfo(pageReqVO, pdtIds);
}
}
// 如果获取是批次分页再根据批次ids获取工段
List<MaterialBatchRespVO> batches = pageResult.getList();
if (CollUtil.isNotEmpty(batches)) {
List<Long> batIds = batches.stream().map(MaterialBatchRespVO::getId).toList();
List<MaterialBatchDO> gongs = materialBatchMapper.selectList(Wrappers.lambdaQuery(MaterialBatchDO.class)
.in(MaterialBatchDO::getParentId, batIds));
if (CollUtil.isNotEmpty(gongs)) {
List<MaterialBatchRespVO> gongRespVOs = gongs.stream().map(gong -> BeanUtils.toBean(gong, MaterialBatchRespVO.class)).toList();
batches.addAll(gongRespVOs);
pageResult.setList(batches);
} }
} }
if (!pageReqVO.getChildren()) return pageResult; if (!pageReqVO.getChildren()) return pageResult;
List<MaterialBatchRespVO> voList = pageResult.getList(); List<MaterialBatchRespVO> voList = pageResult.getList();
if (CollUtil.isNotEmpty(voList)) { if (CollUtil.isNotEmpty(voList)) {
List<MaterialBatchRespVO> treeVos = this.listTransTree(voList, 0L); List<MaterialBatchRespVO> treeVos = this.listTransTree(voList, 0L);
for (MaterialBatchRespVO batch : treeVos) {
List<MaterialBatchRespVO> children = batch.getChildren();
if (CollUtil.isEmpty(children)) continue;
children.forEach(child ->
batch.setInboundEndQuantity(batch.getInboundEndQuantity().add(child.getInboundEndQuantity()))
);
}
pageResult.setList(treeVos); pageResult.setList(treeVos);
} }
@@ -178,7 +193,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
// 2. 拆分后的数量要相等 // 2. 拆分后的数量要相等
MaterialBatchDO mtrlBat = materialBatchMapper.selectById(batId); MaterialBatchDO mtrlBat = materialBatchMapper.selectById(batId);
if (mtrlBat == null) throw exception(MATERIAL_BATCH_NOT_EXISTS); if (mtrlBat == null) throw exception(MATERIAL_BATCH_NOT_EXISTS);
if (mtrlBat.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,不可修改");
BigDecimal total = BigDecimal.valueOf(0); BigDecimal total = BigDecimal.valueOf(0);
for (MaterialBatchSaveReqVO batAsn : createReqVOs) { for (MaterialBatchSaveReqVO batAsn : createReqVOs) {
total = total.add(batAsn.getInboundQuantity()); total = total.add(batAsn.getInboundQuantity());
@@ -189,7 +204,6 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
boolean exists = materialBatchMapper.exists(Wrappers.lambdaQuery(MaterialBatchDO.class) boolean exists = materialBatchMapper.exists(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId)); .eq(MaterialBatchDO::getParentId, batId));
if (exists) { if (exists) {
if (mtrlBat.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "批次已经提交,禁止修改");
// 删除之前的拆分数据 // 删除之前的拆分数据
materialBatchMapper.delete(Wrappers.lambdaQuery(MaterialBatchDO.class) materialBatchMapper.delete(Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, batId)); .eq(MaterialBatchDO::getParentId, batId));
@@ -198,7 +212,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
// 3. 保存工段 // 3. 保存工段
List<MaterialBatchDO> gongEts = createReqVOs.stream().map(batAsn -> { List<MaterialBatchDO> gongEts = createReqVOs.stream().map(batAsn -> {
MaterialBatchDO bean = BeanUtils.toBean(batAsn, MaterialBatchDO.class); MaterialBatchDO bean = BeanUtils.toBean(batAsn, MaterialBatchDO.class);
bean.setProductId(mtrlBat.getProductId()); bean.setProductId(mtrlBat.getProductId()).setBatchNo(mtrlBat.getBatchNo());
return bean; return bean;
}).toList(); }).toList();
materialBatchMapper.insertBatch(gongEts); materialBatchMapper.insertBatch(gongEts);
@@ -235,6 +249,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
.ne(MaterialBatchDO::getParentId, 0)); .ne(MaterialBatchDO::getParentId, 0));
} }
@Transactional
@Override @Override
public Boolean submitMaterialBatch(Long id) { public Boolean submitMaterialBatch(Long id) {
MaterialBatchDO batchDO = materialBatchMapper.selectById(id); MaterialBatchDO batchDO = materialBatchMapper.selectById(id);
@@ -245,6 +260,10 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交"); if (!exists) throw new ServiceException(1_032_160_000, "批次还未拆分,不可提交");
batchDO.setSubmitStatus(1); batchDO.setSubmitStatus(1);
materialBatchMapper.updateById(batchDO); materialBatchMapper.updateById(batchDO);
// 提交工段
MaterialBatchDO updateBatch = new MaterialBatchDO().setSubmitStatus(1);
materialBatchMapper.update(updateBatch, Wrappers.lambdaQuery(MaterialBatchDO.class)
.eq(MaterialBatchDO::getParentId, id));
return true; return true;
} }
@@ -256,6 +275,51 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
.ne(MaterialBatchDO::getParentId, 0)); .ne(MaterialBatchDO::getParentId, 0));
} }
@Override
public PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
Long pdtId = pageReqVO.getProductId();
if (MaterialAcceptStatus.accepted.name().equals(pageReqVO.getAcceptanceStatus())) {
// 用于入库
if (pdtId == null) {
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
}
List<MaterialProductDO> mtrlDos = materialProductService.getMaterialProductsByLikeIdPath(pdtId);
if (CollUtil.isEmpty(mtrlDos)) {
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
}
List<Long> pdtIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, pdtIds);
}
// 用于验收
// 需要排除已经被选择的工段
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,19 @@ public interface MaterialInfomationService {
* @return 大类id-库存数量 * @return 大类id-库存数量
*/ */
Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds); Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds);
/**
* 批量保存物料实例
*
* @param infomationDOS 物料实例
*/
void saveBatch(List<MaterialInfomationDO> infomationDOS);
/**
* 获得物料实例分页
*
* @param pageReqVO 分页查询
* @return 物料实例分页
*/
PageResult<MaterialInfomationRespVO> getMaterialInfomationPageWithPdtInfo(@Valid MaterialInfomationPageReqVO pageReqVO);
} }

View File

@@ -10,6 +10,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomation
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper;
import groovy.util.logging.Slf4j;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -27,6 +28,8 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INFOMATIO
* *
* @author 后台管理 * @author 后台管理
*/ */
@lombok.extern.slf4j.Slf4j
@Slf4j
@Service @Service
@Validated @Validated
public class MaterialInfomationServiceImpl implements MaterialInfomationService { public class MaterialInfomationServiceImpl implements MaterialInfomationService {
@@ -103,8 +106,18 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
return maps.stream().collect(Collectors.toMap( return maps.stream().collect(Collectors.toMap(
map -> (Long) map.get("PDT_ID"), map -> (Long) map.get("PDT_ID"),
map -> ((Long) map.get("quantity")) map -> (Long) map.get("QUANTITY")
)); ));
} }
@Override
public void saveBatch(List<MaterialInfomationDO> infomationDOS) {
materialInfomationMapper.insertBatch(infomationDOS);
}
@Override
public PageResult<MaterialInfomationRespVO> getMaterialInfomationPageWithPdtInfo(MaterialInfomationPageReqVO pageReqVO) {
return materialInfomationMapper.selectPageWithPdtInfo(pageReqVO);
}
} }

View File

@@ -61,4 +61,26 @@ public interface MaterialInventoryInboundDetailService {
*/ */
PageResult<MaterialInventoryInboundDetailDO> getMaterialInventoryInboundDetailPage(MaterialInventoryInboundDetailPageReqVO pageReqVO); PageResult<MaterialInventoryInboundDetailDO> getMaterialInventoryInboundDetailPage(MaterialInventoryInboundDetailPageReqVO pageReqVO);
/**
* 批量保存入库明细
*
* @param detailList 入库明细
*/
void saveBatch(List<MaterialInventoryInboundDetailDO> detailList);
/**
* 获取包含物料信息的入库明细
*
* @param pageReqVO 分页查询
* @return 分页数据
*/
PageResult<MaterialInventoryInboundDetailRespVO> getInventoryInboundDetailPageWithMaterialInfo(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO);
/**
* 根据入库单ID 获取物料列表
*
* @param inboundId 入库单ID
* @return 物料列表
*/
List<MaterialInventoryInboundDetailRespVO> getMaterialInfoListByInboundId(Long inboundId);
} }

View File

@@ -86,4 +86,22 @@ public class MaterialInventoryInboundDetailServiceImpl implements MaterialInvent
return materialInventoryInboundDetailMapper.selectPage(pageReqVO); return materialInventoryInboundDetailMapper.selectPage(pageReqVO);
} }
@Override
public void saveBatch(List<MaterialInventoryInboundDetailDO> detailList) {
materialInventoryInboundDetailMapper.insertBatch(detailList);
}
@Override
public PageResult<MaterialInventoryInboundDetailRespVO> getInventoryInboundDetailPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO pageReqVO) {
return materialInventoryInboundDetailMapper.selectPageWithMaterialInfo(pageReqVO);
}
@Override
public List<MaterialInventoryInboundDetailRespVO> getMaterialInfoListByInboundId(Long inboundId) {
return materialInventoryInboundDetailMapper.selectMaterialInfoListByInboundId(inboundId);
}
} }

View File

@@ -1,21 +1,34 @@
package com.zt.plat.module.qms.resource.material.service; package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil; 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.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; 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.MaterialInventoryInboundPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundRespVO; 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.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 com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInventoryInboundMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; 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,107 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb
@Resource @Resource
private MaterialInventoryInboundMapper materialInventoryInboundMapper; 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 @Override
public MaterialInventoryInboundRespVO createMaterialInventoryInbound(MaterialInventoryInboundSaveReqVO createReqVO) { public MaterialInventoryInboundRespVO createMaterialInventoryInbound(MaterialInventoryInboundSaveReqVO createReqVO) {
// 插入 Long gongduanId = createReqVO.getGongduanId();
MaterialInventoryInboundDO materialInventoryInbound = BeanUtils.toBean(createReqVO, MaterialInventoryInboundDO.class); BigDecimal reqQuantity = createReqVO.getQuantity();
materialInventoryInboundMapper.insert(materialInventoryInbound); 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)
.setName(product.getName())
.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 @Override

View File

@@ -65,7 +65,51 @@ public interface MaterialLifecycleDetailService {
* 批量保存 * 批量保存
* *
* @param detailDOS 需要保存的列表 * @param detailDOS 需要保存的列表
* @return 成功与否
*/ */
Boolean saveBatch(List<MaterialLifecycleDetailDO> detailDOS); void saveBatch(List<MaterialLifecycleDetailDO> detailDOS);
/**
* 根据流程id 删除流程明细数据
*
* @param lfcId 流程id
*/
void deleteLifecycleDetailListByLfcId(Long lfcId);
/**
* 根据流程ids 删除流程明细数据
*
* @param ids 流程ids
*/
void deleteLifecycleDetailListByLfcIds(List<Long> ids);
/**
* 根据流程id 获取流程明细数据
*
* @param id 流程id
* @return 明细列表
*/
List<MaterialLifecycleDetailRespVO> getDetailListWithPdtInfoByLfcId(Long id);
/**
* 根据工段id 获取流程明细数据
* @param gongduanId 工段id
* @return 明细数据
*/
MaterialLifecycleDetailDO getMaterialLifecycleDetailByGongId(Long gongduanId);
/**
* 更新流程明细状态
*
* @param lfcId 流程id
* @param isTreat 是否已处理
*/
void updateDetailTreatStatusByLfcId(Long lfcId, Boolean isTreat);
/**
* 根据流程id 获取流程明细数据
*
* @param lfcId 流程id
* @return 明细列表
*/
List<MaterialLifecycleDetailDO> getDetailListByLfcId(Long lfcId);
} }

View File

@@ -1,8 +1,11 @@
package com.zt.plat.module.qms.resource.material.service; package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil; 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.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; 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.MaterialLifecycleDetailPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO; import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleDetailSaveReqVO;
@@ -87,10 +90,52 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta
} }
@Override @Override
public Boolean saveBatch(List<MaterialLifecycleDetailDO> detailDOS) { public void saveBatch(List<MaterialLifecycleDetailDO> detailDOS) {
if (CollUtil.isEmpty(detailDOS)) return false; if (CollUtil.isEmpty(detailDOS)) return;
materialLifecycleDetailMapper.insertBatch(detailDOS); materialLifecycleDetailMapper.insertBatch(detailDOS);
return true; }
@Override
public void deleteLifecycleDetailListByLfcId(Long lfcId) {
materialLifecycleDetailMapper.delete(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
.eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId));
}
@Override
public void deleteLifecycleDetailListByLfcIds(List<Long> ids) {
materialLifecycleDetailMapper.delete(Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
.in(MaterialLifecycleDetailDO::getLifecycleId, ids));
}
@Override
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, Boolean isTreat) {
MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isTreat ? 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

@@ -51,7 +51,7 @@ public interface MaterialLifecycleService {
* @param id 编号 * @param id 编号
* @return 物料通用流程,物料验收、退换货 * @return 物料通用流程,物料验收、退换货
*/ */
MaterialLifecycleDO getMaterialLifecycle(Long id); MaterialLifecycleRespVO getMaterialLifecycle(Long id);
/** /**
* 获得物料通用流程,物料验收、退换货分页 * 获得物料通用流程,物料验收、退换货分页
@@ -61,4 +61,11 @@ public interface MaterialLifecycleService {
*/ */
PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO); PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO);
/**
* 提交(验收等流程)
*
* @param id 编号
* @return 是否成功
*/
Boolean submitLifecycle(Long id);
} }

View File

@@ -1,38 +1,68 @@
package com.zt.plat.module.qms.resource.material.service; package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil; 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.exception.ServiceException;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecyclePageReqVO; import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleRespVO; import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLifecycleSaveReqVO; import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
import com.zt.plat.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
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.common.dic.controller.vo.DictionaryBusinessRespVO;
import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO;
import com.zt.plat.module.qms.common.dic.service.DictionaryBusinessService;
import com.zt.plat.module.qms.enums.QmsBpmConstant;
import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.resource.material.constant.MaterialConstants;
import com.zt.plat.module.qms.resource.material.controller.vo.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO; import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper; import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
import com.zt.plat.module.qms.resource.material.enums.MaterialFlowType;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.ERROR_CODE_MODULE_COMMON;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_NOT_EXISTS; import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_LIFECYCLE_NOT_EXISTS;
import static com.zt.plat.module.qms.enums.QmsBpmConstant.BPM_CALLBACK_BEAN_NAME;
/** /**
* 物料通用流程,物料验收、退换货 Service 实现类 * 物料通用流程,物料验收、退换货 Service 实现类
* *
* @author 后台管理 * @author 后台管理
*/ */
@Service @Slf4j
@Service("materialLifecycleService")
@Validated @Validated
public class MaterialLifecycleServiceImpl implements MaterialLifecycleService { public class MaterialLifecycleServiceImpl implements MaterialLifecycleService , BMPCallbackInterface {
@Resource @Resource
private MaterialLifecycleMapper materialLifecycleMapper; private MaterialLifecycleMapper materialLifecycleMapper;
@@ -43,64 +73,128 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
@Autowired @Autowired
private MaterialLifecycleDetailService materialLifecycleDetailService; private MaterialLifecycleDetailService materialLifecycleDetailService;
@Autowired
private BpmTaskApi bpmTaskApi;
@Autowired
private BpmProcessInstanceApi bpmProcessInstanceApi;
@Autowired
private DataKeyCheckService dataKeyCheckService;
@Autowired
private DictionaryBusinessService dictionaryBusinessService;
@Transactional @Transactional
@Override @Override
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) { public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
// 插入 // 插入
MaterialLifecycleDO mtrlLfc = BeanUtils.toBean(createReqVO, MaterialLifecycleDO.class); MaterialLifecycleDO mtrlLfc = BeanUtils.toBean(createReqVO, MaterialLifecycleDO.class);
mtrlLfc.setSubmitStatus(0); mtrlLfc.setSubmitStatus(0);
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (loginUser == null) throw new ServiceException(1_032_160_000, "登录用户不存在");
mtrlLfc.setApplyUser(loginUserNickname)
.setApplyUserId(loginUser.getId())
.setApplyDepartment(loginUser.getVisitDeptName())
.setApplyDepartmentId(loginUser.getVisitDeptId());
mtrlLfc.setFlowStatus(QmsCommonConstant.NOT_START);
materialLifecycleMapper.insert(mtrlLfc); materialLifecycleMapper.insert(mtrlLfc);
List<Long> gongIds = createReqVO.getGongIds(); List<MaterialLifecycleDetailSaveReqVO> detailList = createReqVO.getDetailList();
if (CollUtil.isEmpty(gongIds)) if (CollUtil.isEmpty(detailList))
return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class); return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class);
// 保存工段明细 // 保存工段明细
List<Long> gongIds = detailList.stream().map(MaterialLifecycleDetailSaveReqVO::getBatchGongduanId).toList();
Map<Long, Integer> gongAssayMap = detailList.stream().collect(Collectors.toMap(
MaterialLifecycleDetailSaveReqVO::getBatchGongduanId, MaterialLifecycleDetailSaveReqVO::getAssayFlag));
List<MaterialBatchDO> gongs = materialBatchService.getGongduanListByGongIds(gongIds); List<MaterialBatchDO> gongs = materialBatchService.getGongduanListByGongIds(gongIds);
if (CollUtil.isEmpty(gongs) || gongs.size() != gongIds.size()) if (CollUtil.isEmpty(gongs) || gongs.size() != gongIds.size())
throw new ServiceException(1_032_160_000, "工段不存在或与传入的工段数量不匹配"); throw new ServiceException(1_032_160_000, "工段不存在或与传入的工段数量不匹配");
for (MaterialBatchDO gong : gongs) {
gong.setAssayFlag(gongAssayMap.get(gong.getId()));
}
List<MaterialLifecycleDetailDO> detailDOS = getLifecycleDetailDOsByGongs(gongs, gongIds, mtrlLfc);
materialLifecycleDetailService.saveBatch(detailDOS);
return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class);
}
/**
* 工段列表转流程明细列表
*
*/
private List<MaterialLifecycleDetailDO> getLifecycleDetailDOsByGongs(List<MaterialBatchDO> gongs, List<Long> gongIds, MaterialLifecycleDO mtrlLfc) {
Map<Long, MaterialBatchDO> gongsMap = gongs.stream().collect(Collectors.toMap(MaterialBatchDO::getId, Function.identity())); Map<Long, MaterialBatchDO> gongsMap = gongs.stream().collect(Collectors.toMap(MaterialBatchDO::getId, Function.identity()));
List<MaterialLifecycleDetailDO> detailDOS = gongIds.stream().map(id -> { return gongIds.stream().map(id -> {
MaterialBatchDO gong = gongsMap.get(id); MaterialBatchDO gong = gongsMap.get(id);
MaterialLifecycleDetailDO detailDO = new MaterialLifecycleDetailDO(); MaterialLifecycleDetailDO detailDO = new MaterialLifecycleDetailDO();
detailDO.setLifecycleId(mtrlLfc.getId()) detailDO.setLifecycleId(mtrlLfc.getId())
.setProductId(gong.getProductId()).setBatchId(gong.getParentId()) .setProductId(gong.getProductId()).setBatchId(gong.getParentId())
.setBatchGongduanId(gong.getId()) .setBatchGongduanId(gong.getId()).setBusinessType(mtrlLfc.getBusinessType())
.setAssayFlag(gong.getAssayFlag())
.setTreatmentStatus(0); .setTreatmentStatus(0);
return detailDO; return detailDO;
}).toList(); }).toList();
materialLifecycleDetailService.saveBatch(detailDOS);
return BeanUtils.toBean(mtrlLfc, MaterialLifecycleRespVO.class);
} }
@Transactional @Transactional
@Override @Override
public void updateMaterialLifecycle(MaterialLifecycleSaveReqVO updateReqVO) { public void updateMaterialLifecycle(MaterialLifecycleSaveReqVO updateReqVO) {
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(updateReqVO.getId()); Long reqId = updateReqVO.getId();
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(reqId);
if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS); if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
if (lifecycleDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "流程已提交,不可修改"); if (lifecycleDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "流程已提交,不可修改");
List<Long> gongIds = updateReqVO.getGongIds(); List<MaterialLifecycleDetailSaveReqVO> detailList = updateReqVO.getDetailList();
// 更新 // 更新
MaterialLifecycleDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLifecycleDO.class); MaterialLifecycleDO mtrlLfc = BeanUtils.toBean(updateReqVO, MaterialLifecycleDO.class);
if (CollUtil.isEmpty(gongIds)) { if (CollUtil.isEmpty(detailList)) {
materialLifecycleMapper.updateById(updateObj); materialLifecycleMapper.updateById(mtrlLfc);
return; return;
} }
// 明细 // 删除原来的明细
materialLifecycleDetailService.deleteLifecycleDetailListByLfcId(reqId);
List<Long> gongIds = detailList.stream().map(MaterialLifecycleDetailSaveReqVO::getBatchGongduanId).toList();
Map<Long, Integer> gongAssayMap = detailList.stream().collect(Collectors.toMap(
MaterialLifecycleDetailSaveReqVO::getBatchGongduanId, MaterialLifecycleDetailSaveReqVO::getAssayFlag));
List<MaterialBatchDO> gongs = materialBatchService.getGongduanListByGongIds(gongIds);
if (CollUtil.isEmpty(gongs) || gongs.size() != gongIds.size())
throw new ServiceException(1_032_160_000, "工段不存在或与传入的工段数量不匹配");
for (MaterialBatchDO gong : gongs) {
gong.setAssayFlag(gongAssayMap.get(gong.getId()));
}
// 保存新的明细
List<MaterialLifecycleDetailDO> detailDOS = getLifecycleDetailDOsByGongs(gongs, gongIds, mtrlLfc);
materialLifecycleDetailService.saveBatch(detailDOS);
materialLifecycleMapper.updateById(mtrlLfc);
} }
@Transactional
@Override @Override
public void deleteMaterialLifecycle(Long id) { public void deleteMaterialLifecycle(Long id) {
// 校验存在 MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
validateMaterialLifecycleExists(id); if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
// 删除 // 已提交的流程不允许删除
if (lifecycleDO.getSubmitStatus() == 1) throw new ServiceException(1_032_160_000, "流程已提交,不可删除");
// 删除明细
materialLifecycleDetailService.deleteLifecycleDetailListByLfcId(id);
// 删除流程
materialLifecycleMapper.deleteById(id); materialLifecycleMapper.deleteById(id);
} }
@Transactional
@Override @Override
public void deleteMaterialLifecycleListByIds(List<Long> ids) { public void deleteMaterialLifecycleListByIds(List<Long> ids) {
// 校验存在 List<MaterialLifecycleDO> list = materialLifecycleMapper.selectByIds(ids);
validateMaterialLifecycleExists(ids); if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
// 删除 throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
}
// 存在已提交的流程不允许删除
for (MaterialLifecycleDO lifecycle : list) {
if (lifecycle.getSubmitStatus() == 1)
throw new ServiceException(1_032_160_000, "存在已提交的流程,不可删除");
}
// 删除明细
materialLifecycleDetailService.deleteLifecycleDetailListByLfcIds(ids);
// 删除流程
materialLifecycleMapper.deleteByIds(ids); materialLifecycleMapper.deleteByIds(ids);
} }
@@ -118,13 +212,182 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService {
} }
@Override @Override
public MaterialLifecycleDO getMaterialLifecycle(Long id) { public MaterialLifecycleRespVO getMaterialLifecycle(Long id) {
return materialLifecycleMapper.selectById(id); MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
if (lifecycleDO == null) return null;
MaterialLifecycleRespVO respVO = BeanUtils.toBean(lifecycleDO, MaterialLifecycleRespVO.class);
// 获取明细
List<MaterialLifecycleDetailRespVO> detailRespVOS = materialLifecycleDetailService.getDetailListWithPdtInfoByLfcId(id);
respVO.setDetailList(detailRespVOS);
return respVO;
} }
@Override @Override
public PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO) { public PageResult<MaterialLifecycleDO> getMaterialLifecyclePage(MaterialLifecyclePageReqVO pageReqVO) {
return materialLifecycleMapper.selectPage(pageReqVO); PageResult<MaterialLifecycleDO> pageResult = materialLifecycleMapper.selectPage(pageReqVO);
List<MaterialLifecycleDO> list = pageResult.getList();
if (CollUtil.isEmpty(list)) return pageResult;
list.forEach(mtrlLfc -> {
String formData = mtrlLfc.getFormData();
if (formData != null) {
String title = (String) JSONUtil.parseObj(formData).get("title");
mtrlLfc.setTitle(title);
}
});
pageResult.setList(list);
return pageResult;
}
@Override
public Boolean submitLifecycle(Long id) {
MaterialLifecycleDO lifecycleDO = materialLifecycleMapper.selectById(id);
if (lifecycleDO == null) throw exception(MATERIAL_LIFECYCLE_NOT_EXISTS);
Integer submitStatus = lifecycleDO.getSubmitStatus();
if (submitStatus == 1) throw new ServiceException(1_032_160_000, "申请已经提交过");
lifecycleDO.setApplyTime(LocalDateTime.now());
// 发起流程
this.createProcessInstance(lifecycleDO);
lifecycleDO.setSubmitStatus(1);
materialLifecycleMapper.updateById(lifecycleDO);
return true;
}
private void createProcessInstance(MaterialLifecycleDO lifecycleDO) {
String flowInstanceId = lifecycleDO.getFlowInstanceId();
// 流程已经发起过
if (StrUtil.isNotEmpty(flowInstanceId)) {
CommonResult<List<BpmTaskRespDTO>> taskRet = bpmTaskApi.getTaskListByProcessInstanceId(flowInstanceId);
List<BpmTaskRespDTO> taskList = taskRet.getData();
if(CollUtil.isEmpty(taskList))
throw exception0(ERROR_CODE_MODULE_COMMON, "流程任务查询失败,请联系管理员处理");
String taskId = taskList.get(taskList.size() - 1).getId();
//驳回后重新提交
BpmTaskApproveReqDTO reqVO = new BpmTaskApproveReqDTO();
reqVO.setId(taskId);
CommonResult<Boolean> result = bpmProcessInstanceApi.approveTask(reqVO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
}
lifecycleDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
return;
}
// 发起流程
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (loginUser == null) return;
String loginUserNickname = SecurityFrameworkUtils.getLoginUserNickname();
Long loginUserId = loginUser.getId();
Map<String, Object> variables = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
variables.put("mainId", lifecycleDO.getId());
variables.put("applyUser", loginUserNickname);
variables.put("applyUserId", loginUserId);
variables.put("applyDepartment", loginUser.getVisitDeptName());
variables.put("applyDepartmentId", loginUser.getVisitDeptId());
variables.put("applyTime", sdf.format(new Date()));
variables.put(BPM_CALLBACK_BEAN_NAME, "materialLifecycleService");
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId()))
.setVariables(variables);
// 流程key 根据业务类型动态获取
List<DictionaryBusinessDO> items = dictionaryBusinessService.queryDictItemsByKey(MaterialConstants.DICT_MATERIAL_FLOW_TYPE);
if (CollUtil.isEmpty(items)) throw new ServiceException(1_032_160_000, "流程配置不存在");
Map<String, String> processKeyMap = items.stream().collect(Collectors.toMap(DictionaryBusinessDO::getName, DictionaryBusinessDO::getCustomConfig));
MaterialFlowType materialFlowType = MaterialFlowType.fromName(lifecycleDO.getBusinessType());
Object processKey = JSONUtil.parseObj(processKeyMap.get(materialFlowType.getName())).get("processKey");
if (processKey == null) throw new ServiceException(1_032_160_000, "流程配置 key 不存在");
reqDTO.setProcessDefinitionKey(processKey.toString());
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
}
lifecycleDO.setFlowInstanceId(result.getData());
lifecycleDO.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
lifecycleDO.setApplyUser(loginUserNickname)
.setApplyUserId(loginUserId)
.setApplyDepartment(loginUser.getVisitDeptName())
.setApplyDepartmentId(loginUser.getVisitDeptId());
}
/**
* 流程回调处理
*
*/
@Override
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
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)){
// 驳回。流程需要配置退回到发起节点
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
entity.setFlowStatus(QmsCommonConstant.REJECTED);
} else if("3".equals(PROCESS_STATUS)){
// 拒绝
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
entity.setFlowStatus(QmsCommonConstant.REFUSED);
} else if("4".equals(PROCESS_STATUS)){
// 作废
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
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(), true);
// 更新批次工段验收状态
materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), MaterialAcceptStatus.accepted.name());
} }
} }
materialLifecycleMapper.updateById(entity);
return CommonResult.success(new JSONObject());
}
}

View File

@@ -1,64 +0,0 @@
package com.zt.plat.module.qms.resource.material.service;
import java.util.*;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
import jakarta.validation.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
import com.zt.plat.framework.common.pojo.PageResult;
/**
* 存放位置 Service 接口
*
* @author 后台管理
*/
public interface MaterialLocationService {
/**
* 创建存放位置
*
* @param createReqVO 创建信息
* @return 编号
*/
MaterialLocationRespVO createMaterialLocation(@Valid MaterialLocationSaveReqVO createReqVO);
/**
* 更新存放位置
*
* @param updateReqVO 更新信息
*/
void updateMaterialLocation(@Valid MaterialLocationSaveReqVO updateReqVO);
/**
* 删除存放位置
*
* @param id 编号
*/
void deleteMaterialLocation(Long id);
/**
* 批量删除存放位置
*
* @param ids 编号
*/
void deleteMaterialLocationListByIds(List<Long> ids);
/**
* 获得存放位置
*
* @param id 编号
* @return 存放位置
*/
MaterialLocationDO getMaterialLocation(Long id);
/**
* 获得存放位置分页
*
* @param pageReqVO 分页查询
* @return 存放位置分页
*/
PageResult<MaterialLocationDO> getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO);
}

View File

@@ -1,90 +0,0 @@
package com.zt.plat.module.qms.resource.material.service;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLocationMapper;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
/**
* 存放位置 Service 实现类
*
* @author 后台管理
*/
@Service
@Validated
public class MaterialLocationServiceImpl implements MaterialLocationService {
@Resource
private MaterialLocationMapper materialLocationMapper;
@Override
public MaterialLocationRespVO createMaterialLocation(MaterialLocationSaveReqVO createReqVO) {
// 插入
MaterialLocationDO materialLocation = BeanUtils.toBean(createReqVO, MaterialLocationDO.class);
materialLocationMapper.insert(materialLocation);
// 返回
return BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class);
}
@Override
public void updateMaterialLocation(MaterialLocationSaveReqVO updateReqVO) {
// 校验存在
validateMaterialLocationExists(updateReqVO.getId());
// 更新
MaterialLocationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLocationDO.class);
materialLocationMapper.updateById(updateObj);
}
@Override
public void deleteMaterialLocation(Long id) {
// 校验存在
validateMaterialLocationExists(id);
// 删除
materialLocationMapper.deleteById(id);
}
@Override
public void deleteMaterialLocationListByIds(List<Long> ids) {
// 校验存在
validateMaterialLocationExists(ids);
// 删除
materialLocationMapper.deleteByIds(ids);
}
private void validateMaterialLocationExists(List<Long> ids) {
List<MaterialLocationDO> list = materialLocationMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(MATERIAL_LOCATION_NOT_EXISTS);
}
}
private void validateMaterialLocationExists(Long id) {
if (materialLocationMapper.selectById(id) == null) {
throw exception(MATERIAL_LOCATION_NOT_EXISTS);
}
}
@Override
public MaterialLocationDO getMaterialLocation(Long id) {
return materialLocationMapper.selectById(id);
}
@Override
public PageResult<MaterialLocationDO> getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO) {
return materialLocationMapper.selectPage(pageReqVO);
}
}

View File

@@ -329,7 +329,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
Map<Long, Long> stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds); Map<Long, Long> stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds);
if (CollUtil.isNotEmpty(stockQuantityMap)) { if (CollUtil.isNotEmpty(stockQuantityMap)) {
for (MaterialProductRespVO vo : voList) { for (MaterialProductRespVO vo : voList) {
vo.setInventoryQuantity(BigDecimal.valueOf(stockQuantityMap.get(vo.getId()))); Long val = stockQuantityMap.get(vo.getId());
vo.setInventoryQuantity(BigDecimal.valueOf(val == null ? 0L : val));
} }
} }

View File

@@ -55,6 +55,26 @@ public class XRFDeviceSampleReqVO implements Serializable {
@Schema(description = "样品时间") @Schema(description = "样品时间")
private LocalDateTime sampleTime; 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

@@ -35,7 +35,6 @@ import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMetho
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodConfItem; 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.ConfigSubSampleMethodConfPoint;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigSubSampleMethodExtendRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleMethodDO;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper; import com.zt.plat.module.qms.business.config.dal.mapper.ConfigSubSampleMethodMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.AutoIngredientsTaskAssayResultReqVO; import com.zt.plat.module.qms.thirdpartyapi.controller.vo.AutoIngredientsTaskAssayResultReqVO;
@@ -81,6 +80,7 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
public List<AutoIngredientsTaskRespVO> taskList(AutoIngredientsTaskQueryReqVO reqVO) { public List<AutoIngredientsTaskRespVO> taskList(AutoIngredientsTaskQueryReqVO reqVO) {
BusinessAssayTaskPageReqVO search = new BusinessAssayTaskPageReqVO(); BusinessAssayTaskPageReqVO search = new BusinessAssayTaskPageReqVO();
search.setIsIngredients(QmsCommonConstant.YES); search.setIsIngredients(QmsCommonConstant.YES);
search.setIngredientsWay(QmsCommonConstant.AUTOMATIC);//自动火试金配料
search.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS); search.setIngredientsStatus(QmsCommonConstant.IN_PROGRESS);
if (reqVO.getTaskTimeStart() != null && reqVO.getTaskTimeEnd() != null) { if (reqVO.getTaskTimeStart() != null && reqVO.getTaskTimeEnd() != null) {
LocalDateTime[] taskAssignSubmiTimes = {reqVO.getTaskTimeStart(), reqVO.getTaskTimeEnd()}; LocalDateTime[] taskAssignSubmiTimes = {reqVO.getTaskTimeStart(), reqVO.getTaskTimeEnd()};
@@ -154,13 +154,18 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) { for (ConfigSubSampleMethodConfItem configSubSampleMethodConfItem : downIngredients) {
if (configSubSampleMethodConfItem.getRequired()) { if (configSubSampleMethodConfItem.getRequired()) {
ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource(); ConfigSubSampleMethodConfPoint source = configSubSampleMethodConfItem.getSource();
String project = source.getProject(); List<String> projectList = Arrays.asList(source.getProject().split(","));//来源可以有多个
for (String project : projectList) {
String parameter = source.getParameter(); String parameter = source.getParameter();
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = currentBusinessAssayProjectDataList.stream().filter(f -> f.getSimpleName().equals(project)).findFirst().orElse(null); BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = currentBusinessAssayProjectDataList.stream().filter(f -> 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); BusinessAssayParameterDataExtendRespVO currentBusinessAssayParameterData = businessAssayParameterDataList.stream().filter(f -> f.getBusinessAssayProjectDataId().equals(currentBusinessAssayProjectData.getId()) && f.getParameterKey().equals(parameter)).findFirst().orElse(null);
if (StringUtils.isNotBlank(currentBusinessAssayParameterData.getValue())) {
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget(); ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
String field = target.getField(); String field = target.getField();
BeanUtil.setFieldValue(autoIngredientsTaskDetailRespVO, field, currentBusinessAssayParameterData.getValue()); BeanUtil.setFieldValue(autoIngredientsTaskDetailRespVO, field, currentBusinessAssayParameterData.getValue());
break;
}
}
} }
} }
} }
@@ -186,6 +191,13 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
Long taskId = body.getTaskId(); Long taskId = body.getTaskId();
//查询任务分配信息 //查询任务分配信息
BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(taskId); BusinessAssayTaskDO businessAssayTaskDO = businessAssayTaskMapper.selectById(taskId);
if (QmsCommonConstant.MANUAL.equals(businessAssayTaskDO.getIngredientsWay())) {
throw new ServiceException(1_032_001_000, "当前任务已人工配料");
}
if (QmsCommonConstant.SUBMITTED.equals(businessAssayTaskDO.getTaskAssayStatus())) {
throw new ServiceException(1_032_001_000, "当前任务已提交");
}
List<AutoIngredientsTaskDetailAssayResultReqVO> sampleList = body.getSampleList(); List<AutoIngredientsTaskDetailAssayResultReqVO> sampleList = body.getSampleList();
//获取检测任务id //获取检测任务id
List<Long> businessAssayTaskDataIdList = sampleList.stream().map(m -> m.getId()).collect(Collectors.toList()); List<Long> businessAssayTaskDataIdList = sampleList.stream().map(m -> m.getId()).collect(Collectors.toList());
@@ -232,8 +244,8 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
// System.out.println("fieldValue:" + fieldValue); // System.out.println("fieldValue:" + fieldValue);
ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget(); ConfigSubSampleMethodConfPoint target = configSubSampleMethodConfItem.getTarget();
String project = target.getProject(); List<String> projectList = Arrays.asList(target.getProject().split(","));//目标可以有多个
for (String project : projectList) {
BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(autoIngredientsTaskDetailAssayResultReqVO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null); BusinessAssayProjectDataExtendRespVO currentBusinessAssayProjectData = businessAssayProjectDataList.stream().filter(f -> f.getBusinessAssayTaskDataId().equals(autoIngredientsTaskDetailAssayResultReqVO.getId()) && f.getSimpleName().equals(project)).findFirst().orElse(null);
String parameter = target.getParameter(); String parameter = target.getParameter();
if (StringUtils.isBlank(parameter)) { if (StringUtils.isBlank(parameter)) {
@@ -244,7 +256,7 @@ public class AutoIngredientsServiceImpl implements AutoIngredientsService {
currentBusinessAssayParameterData.setValue(fieldValue.toString()); currentBusinessAssayParameterData.setValue(fieldValue.toString());
updateBusinessAssayParameterDataDOList.add(BeanUtils.toBean(currentBusinessAssayParameterData, BusinessAssayParameterDataDO.class)); updateBusinessAssayParameterDataDOList.add(BeanUtils.toBean(currentBusinessAssayParameterData, BusinessAssayParameterDataDO.class));
} }
}
} }
} }
} }

View File

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -14,32 +15,48 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.zt.plat.framework.common.util.object.BeanUtils; 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.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.BusinessAssayProjectDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO; 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.BusinessQCManagementDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessQCManagementProjectDataDO; 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.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.BusinessAssayProjectDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessAssayTaskDataMapper; 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.BusinessQCCoefficientDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCCoefficientParameterDataMapper; 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.BusinessQCManagementDataMapper;
import com.zt.plat.module.qms.business.bus.dal.mapper.BusinessQCManagementProjectDataMapper; 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.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.ConfigAssayMethodProjectDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFConversionRateDO; 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.ConfigXRFLineDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigXRFProjectDO; 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.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.ConfigXRFConversionRateMapper;
import com.zt.plat.module.qms.business.config.dal.mapper.ConfigXRFLineMapper; 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.business.config.dal.mapper.ConfigXRFProjectMapper;
import com.zt.plat.module.qms.enums.QmsCommonConstant; import com.zt.plat.module.qms.enums.QmsCommonConstant;
import com.zt.plat.module.qms.thirdpartyapi.controller.vo.*; 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 jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -59,15 +76,30 @@ public class XRFDataServiceImpl implements XRFDataService {
@Resource @Resource
private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper; private ConfigAssayMethodProjectMapper configAssayMethodProjectMapper;
@Resource
private ConfigSubSampleMethodMapper configSubSampleMethodMapper;
@Resource @Resource
private BusinessXRFDataMapper businessXRFDataMapper; private BusinessXRFDataMapper businessXRFDataMapper;
@Resource
private BaseSampleMapper baseSampleMapper;
@Resource
private BusinessSampleEntrustDetailMapper businessSampleEntrustDetailMapper;
@Resource @Resource
private BusinessAssayTaskDataMapper businessAssayTaskDataMapper; private BusinessAssayTaskDataMapper businessAssayTaskDataMapper;
@Resource
private BusinessAssayTaskParameterDataMapper businessAssayTaskParameterDataMapper;
@Resource @Resource
private BusinessAssayProjectDataMapper businessAssayProjectDataMapper; private BusinessAssayProjectDataMapper businessAssayProjectDataMapper;
@Resource
private BusinessAssayParameterDataMapper businessAssayParameterDataMapper;
@Resource @Resource
private BusinessQCManagementDataMapper businessQCManagementDataMapper; private BusinessQCManagementDataMapper businessQCManagementDataMapper;
@@ -121,6 +153,14 @@ public class XRFDataServiceImpl implements XRFDataService {
//根据样品编号及分析方法类型,获取检测任务数据 //根据样品编号及分析方法类型,获取检测任务数据
List<BusinessAssayTaskDataExtendRespVO> businessAssayTaskDataList = businessAssayTaskDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf"); 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"); List<BusinessQCManagementDataDO> businessQCManagementDataList = businessQCManagementDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf");
@@ -128,7 +168,11 @@ public class XRFDataServiceImpl implements XRFDataService {
// List<BusinessQCCoefficientDataDO> businessQCCoefficientDataList = businessQCCoefficientDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf"); // List<BusinessQCCoefficientDataDO> businessQCCoefficientDataList = businessQCCoefficientDataMapper.selectBySampleAssayCodesAndConfigAssayMethodDictionaryBusinessKey(sampleCodeList, "xshxyggpf");
List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = new ArrayList<>(); List<BusinessAssayTaskDataDO> businessAssayTaskDataDOList = new ArrayList<>();
List<BusinessAssayTaskParameterDataDO> businessAssayTaskParameterDataList = new ArrayList<>();
List<BusinessAssayProjectDataDO> busElementValueList = new ArrayList<>(); List<BusinessAssayProjectDataDO> busElementValueList = new ArrayList<>();
List<BusinessAssayParameterDataDO> updateBusinessAssayParameterDataList = new ArrayList<>();
List<BusinessQCManagementProjectDataDO> busQcManageElementValueList = new ArrayList<>(); List<BusinessQCManagementProjectDataDO> busQcManageElementValueList = new ArrayList<>();
// List<BusinessQCCoefficientParameterDataDO> busQccParameterValueList = new ArrayList<>(); // List<BusinessQCCoefficientParameterDataDO> busQccParameterValueList = new ArrayList<>();
List<BusinessXRFDataDO> busYgDataList = new ArrayList<>(); List<BusinessXRFDataDO> busYgDataList = new ArrayList<>();
@@ -149,6 +193,8 @@ public class XRFDataServiceImpl implements XRFDataService {
busYgData.setXRFSampleId(ygDeviceSample.getSampleId()); busYgData.setXRFSampleId(ygDeviceSample.getSampleId());
busYgData.setSampleCode(ygDeviceSample.getSampleCode()); busYgData.setSampleCode(ygDeviceSample.getSampleCode());
busYgData.setSampleTime(ygDeviceSample.getSampleTime()); busYgData.setSampleTime(ygDeviceSample.getSampleTime());
busYgData.setSampleStartTime(ygDeviceSample.getSampleStartTime());
busYgData.setSampleEndTime(ygDeviceSample.getSampleEndTime());
busYgData.setAssayOperator(ygDeviceSample.getAssayOper()); busYgData.setAssayOperator(ygDeviceSample.getAssayOper());
busYgData.setIsCheckCreate(ygDeviceSample.getIsCheck() ? 1 : 0); busYgData.setIsCheckCreate(ygDeviceSample.getIsCheck() ? 1 : 0);
@@ -162,9 +208,28 @@ public class XRFDataServiceImpl implements XRFDataService {
//处理匹配 //处理匹配
//a. 分析样 //a. 分析样
List<BusinessAssayProjectDataExtendRespVO> tempBusElementValueList = new ArrayList<>(); 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) { 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()); List<BusinessAssayProjectDataExtendRespVO> busElementValues = businessAssayProjectDataMapper.selectByBusinessAssayTaskDataId(businessAssayTaskData.getId());
tempBusElementValueList.addAll(busElementValues); tempBusElementValueList.addAll(busElementValues);
} }
@@ -295,6 +360,121 @@ public class XRFDataServiceImpl implements XRFDataService {
if (currBusinessAssayTaskDataList != null && currBusinessAssayTaskDataList.size() > 0) { if (currBusinessAssayTaskDataList != null && currBusinessAssayTaskDataList.size() > 0) {
for (BusinessAssayTaskDataExtendRespVO businessAssayTaskData : currBusinessAssayTaskDataList) { 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.setIsMatched(QmsCommonConstant.YES);
busYgData.setBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId()); busYgData.setBusinessBaseSampleId(businessAssayTaskData.getBusinessBaseSampleId());
busYgData.setBusinessSubParentSampleId(businessAssayTaskData.getBusinessSubParentSampleId()); busYgData.setBusinessSubParentSampleId(businessAssayTaskData.getBusinessSubParentSampleId());
@@ -327,10 +507,21 @@ public class XRFDataServiceImpl implements XRFDataService {
//保存荧光数据 //保存荧光数据
businessXRFDataMapper.insertBatch(busYgDataList); businessXRFDataMapper.insertBatch(busYgDataList);
//更新任务参数
if (businessAssayTaskParameterDataList.size() > 0) {
businessAssayTaskParameterDataMapper.updateBatch(businessAssayTaskParameterDataList);
}
//更新分析结果 //更新分析结果
if (busElementValueList.size() > 0) { if (busElementValueList.size() > 0) {
businessAssayProjectDataMapper.updateBatch(busElementValueList); businessAssayProjectDataMapper.updateBatch(busElementValueList);
} }
//更新检测项目参数
if (updateBusinessAssayParameterDataList.size() > 0) {
businessAssayParameterDataMapper.updateBatch(updateBusinessAssayParameterDataList);
}
//荧光管理样和标准样 //荧光管理样和标准样
if (busQcManageElementValueList.size() > 0) { if (busQcManageElementValueList.size() > 0) {
businessQCManagementProjectDataMapper.updateBatch(busQcManageElementValueList); businessQCManagementProjectDataMapper.updateBatch(busQcManageElementValueList);

View File

@@ -15,6 +15,7 @@
tdp.NAME AS dictionaryProjectName, tdp.NAME AS dictionaryProjectName,
tdp.SMPL_NAME AS dictionaryProjectSimpleName, tdp.SMPL_NAME AS dictionaryProjectSimpleName,
tdp.SHW_NAME AS dictionaryProjectShowName, tdp.SHW_NAME AS dictionaryProjectShowName,
tbatd.ASY_TP AS assayType,
tbatd.CFG_ASY_MTHD_ID AS configAssayMethodId, tbatd.CFG_ASY_MTHD_ID AS configAssayMethodId,
tcam.NAME AS configAssayMethodName, tcam.NAME AS configAssayMethodName,
tcam.MTHD_NAME_CTGR AS configAssayMethodNameAndCategory, tcam.MTHD_NAME_CTGR AS configAssayMethodNameAndCategory,
@@ -44,6 +45,7 @@
tdp.NAME, tdp.NAME,
tdp.SMPL_NAME, tdp.SMPL_NAME,
tdp.SHW_NAME, tdp.SHW_NAME,
tbatd.ASY_TP,
tbatd.CFG_ASY_MTHD_ID, tbatd.CFG_ASY_MTHD_ID,
tcam.NAME, tcam.NAME,
tcam.MTHD_NAME_CTGR, tcam.MTHD_NAME_CTGR,

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLocationMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>