feat(qms): 添加计划详情 ID 字段

- 在 QcInspectionMain、QcInspectionMainBo、QcInspectionMainVo 中添加 planDetailId 字段- 更新 QcInspectionMainMapper.xml,添加 planDetailId 的映射和查询
- 在 QcInspectionMainServiceImpl 中添加对 planDetailId 的查询条件
master
zch 2 days ago
parent 96f22b6203
commit 4e24aecb13

@ -27,7 +27,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
* 访:/qms/qcUnqualifiedRecord
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Validated
@RequiredArgsConstructor

@ -27,7 +27,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
* 访:/qms/qcUnqualifiedReview
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Validated
@RequiredArgsConstructor

@ -4,6 +4,7 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.io.Serial;
@ -11,7 +12,7 @@ import java.io.Serial;
* qc_unqualified_record
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ -28,14 +29,84 @@ public class QcUnqualifiedRecord extends TenantEntity {
private Long recordId;
/**
* ID
* ID
*/
private Long reviewId;
/**
*
*
*/
private String remark;
private String itemCode;
/**
*
*/
private String itemName;
/**
*
*/
private String inspectionPosition;
/**
*
*/
private Long categoryName;
/**
*
*/
private Long typeId;
/**
*
*/
private Long inspectionMethod;
/**
*
*/
private Long detectType;
/**
*
*/
private Long detectResult;
/**
*
*/
private BigDecimal detectValue;
/**
*
*/
private BigDecimal upperLimit;
/**
*
*/
private BigDecimal lowerLimit;
/**
*
*/
private String specInspectionValue;
/**
*
*/
private BigDecimal specUpper;
/**
*
*/
private BigDecimal specLower;
/**
*
*/
private String description;
/**
* 02

@ -4,6 +4,7 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -13,7 +14,7 @@ import java.io.Serial;
* qc_unqualified_review
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ -28,41 +29,42 @@ public class QcUnqualifiedReview extends TenantEntity {
*/
@TableId(value = "review_id", type = IdType.ASSIGN_ID)
private Long reviewId;
/**
*
*/
private String unqualifiedNo;
private Long unqualifiedReviewNo;
/**
* ID
*
*/
private Long inspectionId;
private Long reviewResult;
/**
* ID
*
*/
private Long typeId;
private String inspectionNo;
/**
*
*
*/
private String workOrder;
private Long inspectionType;
/**
*
*
*/
private String processCode;
private Date productionDate;
/**
* /
*/
private String workOrderNo;
/**
*
*/
private String processName;
/**
*
*/
private String batchNo;
/**
*
*/
@ -74,53 +76,65 @@ public class QcUnqualifiedReview extends TenantEntity {
private String materialCode;
/**
*
*
*/
private String inspectorResult;
private String materialSpec;
/**
* 0/1/2退
*
*/
private String reviewResult;
private String supplierName;
/**
*
*/
private String supplierCode;
/**
*
*/
private BigDecimal inspectionQty;
/**
*
*/
private String batchNo;
/**
*
*/
private String inspector;
/**
* ID
*/
private Long inspectorId;
/**
*
*/
private String reviewer;
/**
* ID
*/
private Long reviewerId;
/**
*
*/
private Date reviewTime;
/**
*
*/
private String remark;
/**
* 02
*/
@TableLogic
private String delFlag;
/**
* /
*/
@TableField(exist = false)
private String inspectionNo;//JOIN
/**
*
*/
@TableField(exist = false)
private String typeCode;//JOIN
/**
*
*/
@TableField(exist = false)
private String typeName;//JOIN
/**
* (
*/
@TableField(exist = false)
private Long qcInspectionType;//JOIN
}

@ -8,13 +8,13 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;
/**
* qc_unqualified_record
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ -27,49 +27,84 @@ public class QcUnqualifiedRecordBo extends BaseEntity {
private Long recordId;
/**
* ID
* ID
*/
private Long reviewId;
/**
*
*
*/
private String remark;
private String itemCode;
/**
* PDA
*
*/
private String reviewer;
private String itemName;
/**
* PDA
*
*/
private Date startTime;
private String inspectionPosition;
/**
* PDA
*
*/
private Date endTime;
private Long categoryName;
/**
* PDA
*
*/
private String materialCode;
private Long typeId;
/**
* PDA
*
*/
private String materialName;
private Long inspectionMethod;
/**
* PDA
*
*/
private String reviewResult;
private Long detectType;
/**
* PDA
*
*/
private String unqualifiedNo;
private Long detectResult;
/**
*
*/
private BigDecimal detectValue;
/**
*
*/
private BigDecimal upperLimit;
/**
*
*/
private BigDecimal lowerLimit;
/**
*
*/
private String specInspectionValue;
/**
*
*/
private BigDecimal specUpper;
/**
*
*/
private BigDecimal specLower;
/**
*
*/
private String description;
}

@ -8,6 +8,7 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -15,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
* qc_unqualified_review
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ -30,38 +31,38 @@ public class QcUnqualifiedReviewBo extends BaseEntity {
/**
*
*/
private String unqualifiedNo;
private Long unqualifiedReviewNo;
/**
* ID
*
*/
private Long inspectionId;
private Long reviewResult;
/**
* ID
*
*/
private Long typeId;
private String inspectionNo;
/**
*
*
*/
private String workOrder;
private Long inspectionType;
/**
*
*
*/
private String processCode;
private Date productionDate;
/**
* /
*/
private String workOrderNo;
/**
*
*/
private String processName;
/**
*
*/
private String batchNo;
/**
*
*/
@ -73,44 +74,59 @@ public class QcUnqualifiedReviewBo extends BaseEntity {
private String materialCode;
/**
*
*
*/
private String inspectorResult;
private String materialSpec;
/**
* 0/1/2退
*
*/
private String reviewResult;
private String supplierName;
/**
*
*/
private String supplierCode;
/**
*
*/
private BigDecimal inspectionQty;
/**
*
*/
private String batchNo;
/**
*
*/
private String inspector;
/**
* ID
*/
private Long inspectorId;
/**
*
*/
private String reviewer;
/**
* ID
*/
private Long reviewerId;
/**
*
*/
private Date reviewTime;
/**
* /
*
*/
private String inspectionNo;//JOIN
/**
*
*/
private String typeCode;//JOIN
/**
*
*/
private String typeName;//JOIN
/**
* (
*/
private Long qcInspectionType;//JOIN
private String remark;
}

@ -1,5 +1,6 @@
package org.dromara.qms.domain.vo;
import java.math.BigDecimal;
import org.dromara.qms.domain.QcUnqualifiedRecord;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
@ -18,7 +19,7 @@ import java.util.Date;
* qc_unqualified_record
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@ExcelIgnoreUnannotated
@ -35,102 +36,103 @@ public class QcUnqualifiedRecordVo implements Serializable {
private Long recordId;
/**
* ID
* ID
*/
@ExcelProperty(value = "关联评审表ID")
@ExcelProperty(value = "关联评审表ID")
private Long reviewId;
/**
*
*
*/
@ExcelProperty(value = "备注")
private String remark;
// PDA需要的关联信息来自QcUnqualifiedReview表
/**
*
*/
@ExcelProperty(value = "不合格检测单号")
private String unqualifiedNo;
@ExcelProperty(value = "检测项编码")
private String itemCode;
/**
* ID
*
*/
@ExcelProperty(value = "关联质检主表ID")
private Long inspectionId;
@ExcelProperty(value = "检测名称")
private String itemName;
/**
* /
*
*/
@ExcelProperty(value = "检测单号/卡号")
private String inspectionNo;
@ExcelProperty(value = "检测位置")
private String inspectionPosition;
/**
*
*
*/
@ExcelProperty(value = "检测类型名称")
private String typeName;
@ExcelProperty(value = "检测项目类别")
private Long categoryName;
/**
*
*
*/
@ExcelProperty(value = "派工单号")
private String workOrder;
@ExcelProperty(value = "关联检测类型表")
private Long typeId;
/**
*
*
*/
@ExcelProperty(value = "工序名称")
private String processName;
@ExcelProperty(value = "检测方法", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "qc_methond")
private Long inspectionMethod;
/**
*
*
*/
@ExcelProperty(value = "批次号")
private String batchNo;
@ExcelProperty(value = "检测方式", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "detect_type")
private Long detectType;
/**
*
*
*/
@ExcelProperty(value = "物料名称")
private String materialName;
@ExcelProperty(value = "检测结果", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "qc_result")
private Long detectResult;
/**
*
*
*/
@ExcelProperty(value = "物料编码")
private String materialCode;
@ExcelProperty(value = "检测值")
private BigDecimal detectValue;
/**
*
*
*/
@ExcelProperty(value = "质检员检测结果")
private String inspectorResult;
@ExcelProperty(value = "控制上限")
private BigDecimal upperLimit;
/**
* 0/1/2退/3/4
*
*/
@ExcelProperty(value = "评审结果")
@ExcelDictFormat(dictType = "qc_review_result")
private String reviewResult;
@ExcelProperty(value = "控制下限")
private BigDecimal lowerLimit;
/**
*
*
*/
@ExcelProperty(value = "评审人")
private String reviewer;
@ExcelProperty(value = "规格检测值")
private String specInspectionValue;
/**
*
*
*/
@ExcelProperty(value = "评审时间")
private Date reviewTime;
@ExcelProperty(value = "规格上限")
private BigDecimal specUpper;
/**
*
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
@ExcelProperty(value = "规格下限")
private BigDecimal specLower;
/**
*
*/
@ExcelProperty(value = "检查项说明")
private String description;
}

@ -1,8 +1,7 @@
package org.dromara.qms.domain.vo;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.qms.domain.QcUnqualifiedReview;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
@ -22,7 +21,7 @@ import java.util.Date;
* qc_unqualified_review
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Data
@ExcelIgnoreUnannotated
@ -42,31 +41,39 @@ public class QcUnqualifiedReviewVo implements Serializable {
*
*/
@ExcelProperty(value = "不合格检测单号")
private String unqualifiedNo;
private Long unqualifiedReviewNo;
/**
* ID
*
*/
@ExcelProperty(value = "关联质检主表ID")
private Long inspectionId;
@ExcelProperty(value = "评审结果", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "review_result")
private Long reviewResult;
/**
* ID
*
*/
@ExcelProperty(value = "检测类型ID")
private Long typeId;
@ExcelProperty(value = "质检单号")
private String inspectionNo;
/**
*
*
*/
@ExcelProperty(value = "派工单号")
private String workOrder;
@ExcelProperty(value = "检测类型")
private Long inspectionType;
/**
*
*
*/
@ExcelProperty(value = "工序编码")
private String processCode;
@ExcelProperty(value = "生产日期")
private Date productionDate;
/**
* /
*/
@ExcelProperty(value = "派工单号", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "或=者计划号/工单号")
private String workOrderNo;
/**
*
@ -74,12 +81,6 @@ public class QcUnqualifiedReviewVo implements Serializable {
@ExcelProperty(value = "工序名称")
private String processName;
/**
*
*/
@ExcelProperty(value = "批次号")
private String batchNo;
/**
*
*/
@ -93,17 +94,46 @@ public class QcUnqualifiedReviewVo implements Serializable {
private String materialCode;
/**
*
*
*/
@ExcelProperty(value = "质检员检测结果")
private String inspectorResult;
@ExcelProperty(value = "物料规格")
private String materialSpec;
/**
* 0/1/2退
*
*/
@ExcelProperty(value = "评审结果", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "review_result")
private String reviewResult;
@ExcelProperty(value = "供应商名称")
private String supplierName;
/**
*
*/
@ExcelProperty(value = "供应商编码")
private String supplierCode;
/**
*
*/
@ExcelProperty(value = "质检数量")
private BigDecimal inspectionQty;
/**
*
*/
@ExcelProperty(value = "批次号")
private String batchNo;
/**
*
*/
@ExcelProperty(value = "质检人")
private String inspector;
/**
* ID
*/
@ExcelProperty(value = "质检人ID")
private Long inspectorId;
/**
*
@ -111,6 +141,12 @@ public class QcUnqualifiedReviewVo implements Serializable {
@ExcelProperty(value = "评审人")
private String reviewer;
/**
* ID
*/
@ExcelProperty(value = "评审人ID")
private Long reviewerId;
/**
*
*/
@ -118,24 +154,10 @@ public class QcUnqualifiedReviewVo implements Serializable {
private Date reviewTime;
/**
* /
*
*/
private String inspectionNo;//JOIN
@ExcelProperty(value = "备注")
private String remark;
/**
*
*/
private String typeCode;//JOIN
/**
*
*/
private String typeName;//JOIN
/**
* (
*/
private Long qcInspectionType;//JOIN
}

@ -11,7 +11,7 @@ import java.util.List;
* Mapper
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
public interface QcUnqualifiedRecordMapper extends BaseMapperPlus<QcUnqualifiedRecord, QcUnqualifiedRecordVo> {

@ -11,7 +11,7 @@ import java.util.List;
* Mapper
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
public interface QcUnqualifiedReviewMapper extends BaseMapperPlus<QcUnqualifiedReview, QcUnqualifiedReviewVo> {

@ -9,7 +9,6 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.qms.domain.QcUnqualifiedReview;
import org.springframework.stereotype.Service;
import org.dromara.qms.domain.bo.QcUnqualifiedRecordBo;
import org.dromara.qms.domain.vo.QcUnqualifiedRecordVo;
@ -25,7 +24,7 @@ import java.util.Collection;
* Service
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@RequiredArgsConstructor
@Service
@ -76,6 +75,21 @@ public class QcUnqualifiedRecordServiceImpl implements IQcUnqualifiedRecordServi
.selectAll(QcUnqualifiedRecord.class)
.eq(bo.getRecordId() != null, QcUnqualifiedRecord::getRecordId, bo.getRecordId())
.eq(bo.getReviewId() != null, QcUnqualifiedRecord::getReviewId, bo.getReviewId())
.eq(StringUtils.isNotBlank(bo.getItemCode()), QcUnqualifiedRecord::getItemCode, bo.getItemCode())
.like(StringUtils.isNotBlank(bo.getItemName()), QcUnqualifiedRecord::getItemName, bo.getItemName())
.eq(StringUtils.isNotBlank(bo.getInspectionPosition()), QcUnqualifiedRecord::getInspectionPosition, bo.getInspectionPosition())
.like(bo.getCategoryName() != null, QcUnqualifiedRecord::getCategoryName, bo.getCategoryName())
.eq(bo.getTypeId() != null, QcUnqualifiedRecord::getTypeId, bo.getTypeId())
.eq(bo.getInspectionMethod() != null, QcUnqualifiedRecord::getInspectionMethod, bo.getInspectionMethod())
.eq(bo.getDetectType() != null, QcUnqualifiedRecord::getDetectType, bo.getDetectType())
.eq(bo.getDetectResult() != null, QcUnqualifiedRecord::getDetectResult, bo.getDetectResult())
.eq(bo.getDetectValue() != null, QcUnqualifiedRecord::getDetectValue, bo.getDetectValue())
.eq(bo.getUpperLimit() != null, QcUnqualifiedRecord::getUpperLimit, bo.getUpperLimit())
.eq(bo.getLowerLimit() != null, QcUnqualifiedRecord::getLowerLimit, bo.getLowerLimit())
.eq(StringUtils.isNotBlank(bo.getSpecInspectionValue()), QcUnqualifiedRecord::getSpecInspectionValue, bo.getSpecInspectionValue())
.eq(bo.getSpecUpper() != null, QcUnqualifiedRecord::getSpecUpper, bo.getSpecUpper())
.eq(bo.getSpecLower() != null, QcUnqualifiedRecord::getSpecLower, bo.getSpecLower())
.eq(StringUtils.isNotBlank(bo.getDescription()), QcUnqualifiedRecord::getDescription, bo.getDescription())
.orderByDesc(QcUnqualifiedRecord::getCreateTime);
return lqw;
}
@ -131,38 +145,4 @@ public class QcUnqualifiedRecordServiceImpl implements IQcUnqualifiedRecordServi
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public TableDataInfo<QcUnqualifiedRecordVo> queryPageListWithDetails(QcUnqualifiedRecordBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<QcUnqualifiedRecord> lqw = new MPJLambdaWrapper<>();
lqw.selectAll(QcUnqualifiedRecord.class)
.leftJoin(QcUnqualifiedReview.class, QcUnqualifiedReview::getReviewId, QcUnqualifiedRecord::getReviewId)
.select(QcUnqualifiedReview::getUnqualifiedNo, QcUnqualifiedReview::getReviewResult)
// 添加更多关联如果需要
.eq(bo.getRecordId() != null, QcUnqualifiedRecord::getRecordId, bo.getRecordId())
.eq(bo.getReviewId() != null, QcUnqualifiedRecord::getReviewId, bo.getReviewId())
.orderByDesc(QcUnqualifiedRecord::getCreateTime);
Page<QcUnqualifiedRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
@Override
public TableDataInfo<QcUnqualifiedRecordVo> queryPageUserRecords(String reviewer, PageQuery pageQuery) {
QcUnqualifiedRecordBo bo = new QcUnqualifiedRecordBo();
// 假设QcUnqualifiedRecord有reviewer字段否则需关联
// bo.setReviewer(reviewer);
return queryPageListWithDetails(bo, pageQuery); // 或自定义
}
@Override
public TableDataInfo<QcUnqualifiedRecordVo> queryPageRecordsByDateRange(QcUnqualifiedRecordBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<QcUnqualifiedRecord> lqw = buildQueryWrapper(bo);
Map<String, Object> params = bo.getParams();
if (params != null) {
lqw.ge(params.get("beginTime") != null, QcUnqualifiedRecord::getCreateTime, params.get("beginTime"))
.le(params.get("endTime") != null, QcUnqualifiedRecord::getCreateTime, params.get("endTime"));
}
Page<QcUnqualifiedRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
}

@ -9,14 +9,6 @@ import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.qms.domain.QcInspectionMain;
import org.dromara.qms.domain.QcInspectionType;
import org.dromara.qms.domain.bo.QcInspectionMainBo;
import org.dromara.qms.domain.bo.QcInspectionResultBo;
import org.dromara.qms.domain.vo.QcInspectionMainVo;
import org.dromara.qms.domain.vo.QcInspectionResultVo;
import org.dromara.qms.service.IQcInspectionResultService;
import org.springframework.stereotype.Service;
import org.dromara.qms.domain.bo.QcUnqualifiedReviewBo;
import org.dromara.qms.domain.vo.QcUnqualifiedReviewVo;
@ -24,24 +16,21 @@ import org.dromara.qms.domain.QcUnqualifiedReview;
import org.dromara.qms.mapper.QcUnqualifiedReviewMapper;
import org.dromara.qms.service.IQcUnqualifiedReviewService;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* Service
*
* @author zch
* @date 2025-07-18
* @date 2025-07-25
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class QcUnqualifiedReviewServiceImpl implements IQcUnqualifiedReviewService {
private final QcUnqualifiedReviewMapper baseMapper;
private final IQcInspectionResultService qcInspectionResultService;
/**
*
@ -80,561 +69,29 @@ public class QcUnqualifiedReviewServiceImpl implements IQcUnqualifiedReviewServi
return baseMapper.selectVoList(lqw);
}
/**
* (for PDA)
* reviewResult
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<QcUnqualifiedReviewVo> queryPagePendingReviews(QcUnqualifiedReviewBo bo, PageQuery pageQuery) {
// 设置查询条件只查询待评审的记录reviewResult为空
QcUnqualifiedReviewBo pendingBo = new QcUnqualifiedReviewBo();
// 复制原有查询条件
if (bo != null) {
pendingBo.setUnqualifiedNo(bo.getUnqualifiedNo());
pendingBo.setInspectionId(bo.getInspectionId());
pendingBo.setTypeId(bo.getTypeId());
pendingBo.setWorkOrder(bo.getWorkOrder());
pendingBo.setProcessCode(bo.getProcessCode());
pendingBo.setProcessName(bo.getProcessName());
pendingBo.setBatchNo(bo.getBatchNo());
pendingBo.setMaterialName(bo.getMaterialName());
pendingBo.setMaterialCode(bo.getMaterialCode());
pendingBo.setInspectorResult(bo.getInspectorResult());
pendingBo.setReviewer(bo.getReviewer());
pendingBo.setParams(bo.getParams());
}
// 强制设置reviewResult为null查询待评审记录
pendingBo.setReviewResult(null);
MPJLambdaWrapper<QcUnqualifiedReview> lqw = buildQueryWrapper(pendingBo);
// 添加条件reviewResult为空或null
lqw.and(wrapper -> wrapper.isNull(QcUnqualifiedReview::getReviewResult)
.or().eq(QcUnqualifiedReview::getReviewResult, ""));
Page<QcUnqualifiedReviewVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* (for PDA)
*
*
* @param reviewId
* @return
*/
@Override
public QcUnqualifiedReviewVo queryByIdWithItems(Long reviewId) {
QcUnqualifiedReviewVo reviewVo = queryById(reviewId);
if (reviewVo != null && reviewVo.getInspectionId() != null) {
// 查询关联的检测项结果明细
QcInspectionResultBo resultBo = new QcInspectionResultBo();
resultBo.setInspectionId(reviewVo.getInspectionId());
List<QcInspectionResultVo> inspectionResults = qcInspectionResultService.queryList(resultBo);
// 可以将检测项结果添加到reviewVo中但由于QcUnqualifiedReviewVo没有相应字段
// 这里暂时通过日志记录或者扩展VO类来处理
// 实际项目中可能需要扩展QcUnqualifiedReviewVo类添加inspectionResults字段
}
return reviewVo;
}
/**
* (for PDA)
*
*
* @param bo
* @return
*/
@Override
public Boolean submitReview(QcUnqualifiedReviewBo bo) {
// 设置评审时间
bo.setReviewTime(new Date());
// 更新评审结果
Boolean updated = updateByBo(bo);
if (updated) {
// 根据评审结果触发后续流程
triggerWorkflowProcess(bo);
}
return updated;
}
/**
* (for PDA)
*
* @param dateRange "2025-01-01,2025-01-31"
* @return
*/
@Override
public Map<String, Object> getUnqualifiedSummary(String dateRange) {
Map<String, Object> summary = new HashMap<>();
// 解析日期范围
LocalDate startDate = null;
LocalDate endDate = null;
if (StringUtils.isNotBlank(dateRange)) {
String[] dates = dateRange.split(",");
if (dates.length == 2) {
try {
startDate = LocalDate.parse(dates[0].trim(), DateTimeFormatter.ISO_LOCAL_DATE);
endDate = LocalDate.parse(dates[1].trim(), DateTimeFormatter.ISO_LOCAL_DATE);
} catch (Exception e) {
// 日期解析失败,使用默认范围(当月)
startDate = LocalDate.now().withDayOfMonth(1);
endDate = LocalDate.now();
}
}
} else {
// 默认查询当月数据
startDate = LocalDate.now().withDayOfMonth(1);
endDate = LocalDate.now();
}
// 构建查询条件
QcUnqualifiedReviewBo bo = new QcUnqualifiedReviewBo();
Map<String, Object> params = new HashMap<>();
params.put("beginTime", startDate.toString());
params.put("endTime", endDate.toString());
bo.setParams(params);
// 查询所有不合格品记录
List<QcUnqualifiedReviewVo> allRecords = queryList(bo);
// 统计总数
summary.put("totalCount", allRecords.size());
// 统计待评审数量
long pendingCount = allRecords.stream()
.filter(record -> StringUtils.isBlank(record.getReviewResult()))
.count();
summary.put("pendingCount", pendingCount);
// 统计已评审数量
long reviewedCount = allRecords.size() - pendingCount;
summary.put("reviewedCount", reviewedCount);
// 按评审结果分组统计
Map<String, Long> reviewResultStats = allRecords.stream()
.filter(record -> StringUtils.isNotBlank(record.getReviewResult()))
.collect(Collectors.groupingBy(
QcUnqualifiedReviewVo::getReviewResult,
Collectors.counting()
));
summary.put("scrapCount", reviewResultStats.getOrDefault("0", 0L)); // 报废
summary.put("reworkCount", reviewResultStats.getOrDefault("1", 0L)); // 返工
summary.put("returnCount", reviewResultStats.getOrDefault("2", 0L)); // 退货
summary.put("acceptCount", reviewResultStats.getOrDefault("3", 0L)); // 让步接收
summary.put("transferCount", reviewResultStats.getOrDefault("4", 0L)); // 流转
// 按物料分组统计
Map<String, Long> materialStats = allRecords.stream()
.filter(record -> StringUtils.isNotBlank(record.getMaterialName()))
.collect(Collectors.groupingBy(
QcUnqualifiedReviewVo::getMaterialName,
Collectors.counting()
));
summary.put("materialStats", materialStats);
// 按工序分组统计
Map<String, Long> processStats = allRecords.stream()
.filter(record -> StringUtils.isNotBlank(record.getProcessName()))
.collect(Collectors.groupingBy(
QcUnqualifiedReviewVo::getProcessName,
Collectors.counting()
));
summary.put("processStats", processStats);
return summary;
}
/**
* (for PDA)
*
*
* @param bo
* @return
*/
@Override
public Boolean triggerWorkflowProcess(QcUnqualifiedReviewBo bo) {
if (bo == null || StringUtils.isBlank(bo.getReviewResult())) {
log.error("评审结果为空,无法触发工作流程");
return false;
}
try {
log.info("开始触发工作流程: 评审ID={}, 评审结果={}", bo.getReviewId(), bo.getReviewResult());
// 根据评审结果触发不同的后续流程
switch (bo.getReviewResult()) {
case "0": // 报废
return handleScrapProcess(bo);
case "1": // 返工
return handleReworkProcess(bo);
case "2": // 退货
return handleReturnProcess(bo);
case "3": // 让步接收
return handleAcceptProcess(bo);
case "4": // 流转
return handleTransferProcess(bo);
default:
log.warn("未知的评审结果: {}", bo.getReviewResult());
return false;
}
} catch (Exception e) {
log.error("触发工作流程异常: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
/**
*
*
*/
private Boolean handleScrapProcess(QcUnqualifiedReviewBo bo) {
try {
log.info("执行报废流程: 评审ID={}", bo.getReviewId());
// 1. 更新库存状态为报废
updateInventoryStatus(bo, "SCRAPPED");
// 2. 生成报废单据
generateScrapDocument(bo);
// 3. 更新质检主表状态
updateInspectionMainStatus(bo, "SCRAPPED");
// 4. 记录处理日志
recordProcessLog(bo, "报废流程执行完成");
log.info("报废流程执行成功: 评审ID={}", bo.getReviewId());
return true;
} catch (Exception e) {
log.error("报废流程执行失败: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
/**
*
*
*/
private Boolean handleReworkProcess(QcUnqualifiedReviewBo bo) {
try {
log.info("执行返工流程: 评审ID={}", bo.getReviewId());
// 1. 生成返工工单
generateReworkOrder(bo);
// 2. 分派返工任务给相关人员
assignReworkTask(bo);
// 3. 更新质检主表状态为返工中
updateInspectionMainStatus(bo, "REWORKING");
// 4. 更新库存状态
updateInventoryStatus(bo, "REWORKING");
// 5. 记录处理日志
recordProcessLog(bo, "返工流程执行完成,已生成返工工单");
log.info("返工流程执行成功: 评审ID={}", bo.getReviewId());
return true;
} catch (Exception e) {
log.error("返工流程执行失败: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
/**
* 退
* 退
*/
private Boolean handleReturnProcess(QcUnqualifiedReviewBo bo) {
try {
log.info("执行退货流程: 评审ID={}", bo.getReviewId());
// 1. 生成退货单据
generateReturnDocument(bo);
// 2. 通知供应商
notifySupplier(bo);
// 3. 更新库存状态为待退货
updateInventoryStatus(bo, "RETURNING");
// 4. 更新质检主表状态
updateInspectionMainStatus(bo, "RETURNED");
// 5. 记录处理日志
recordProcessLog(bo, "退货流程执行完成,已通知供应商");
log.info("退货流程执行成功: 评审ID={}", bo.getReviewId());
return true;
} catch (Exception e) {
log.error("退货流程执行失败: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
/**
*
*
*/
private Boolean handleAcceptProcess(QcUnqualifiedReviewBo bo) {
try {
log.info("执行让步接收流程: 评审ID={}", bo.getReviewId());
// 1. 更新质检状态为让步合格
updateInspectionMainStatus(bo, "CONDITIONALLY_ACCEPTED");
// 2. 更新库存状态为可用
updateInventoryStatus(bo, "AVAILABLE");
// 3. 生成让步接收单据
generateAcceptanceDocument(bo);
// 4. 触发入库流程
triggerInboundProcess(bo);
// 5. 记录处理日志
recordProcessLog(bo, "让步接收流程执行完成,产品已入库");
log.info("让步接收流程执行成功: 评审ID={}", bo.getReviewId());
return true;
} catch (Exception e) {
log.error("让步接收流程执行失败: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
/**
*
*
*/
private Boolean handleTransferProcess(QcUnqualifiedReviewBo bo) {
try {
log.info("执行流转流程: 评审ID={}", bo.getReviewId());
// 1. 确定流转目标部门或工序
String transferTarget = determineTransferTarget(bo);
// 2. 生成流转单据
generateTransferDocument(bo, transferTarget);
// 3. 通知目标部门
notifyTargetDepartment(bo, transferTarget);
// 4. 更新质检主表状态
updateInspectionMainStatus(bo, "TRANSFERRED");
// 5. 更新库存状态
updateInventoryStatus(bo, "TRANSFERRED");
// 6. 记录处理日志
recordProcessLog(bo, "流转流程执行完成,已转移至: " + transferTarget);
log.info("流转流程执行成功: 评审ID={}, 流转目标={}", bo.getReviewId(), transferTarget);
return true;
} catch (Exception e) {
log.error("流转流程执行失败: 评审ID={}", bo.getReviewId(), e);
return false;
}
}
// 以下是辅助方法的实现
/**
*
*/
private void updateInventoryStatus(QcUnqualifiedReviewBo bo, String status) {
try {
// TODO: 实现库存状态更新逻辑
// 这里需要调用库存管理模块的接口
log.info("更新库存状态: 评审ID={}, 状态={}", bo.getReviewId(), status);
} catch (Exception e) {
log.error("更新库存状态失败: 评审ID={}, 状态={}", bo.getReviewId(), status, e);
}
}
/**
*
*/
private void updateInspectionMainStatus(QcUnqualifiedReviewBo bo, String status) {
try {
// TODO: 实现质检主表状态更新逻辑
// 这里需要调用质检主表服务的更新方法
log.info("更新质检主表状态: 质检ID={}, 状态={}", bo.getInspectionId(), status);
} catch (Exception e) {
log.error("更新质检主表状态失败: 质检ID={}, 状态={}", bo.getInspectionId(), status, e);
}
}
/**
*
*/
private void generateScrapDocument(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现报废单据生成逻辑
log.info("生成报废单据: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("生成报废单据失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private void generateReworkOrder(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现返工工单生成逻辑
log.info("生成返工工单: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("生成返工工单失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private void assignReworkTask(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现返工任务分派逻辑
log.info("分派返工任务: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("分派返工任务失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
* 退
*/
private void generateReturnDocument(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现退货单据生成逻辑
log.info("生成退货单据: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("生成退货单据失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private void notifySupplier(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现供应商通知逻辑
log.info("通知供应商: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("通知供应商失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private void generateAcceptanceDocument(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现让步接收单据生成逻辑
log.info("生成让步接收单据: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("生成让步接收单据失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private void triggerInboundProcess(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现入库流程触发逻辑
log.info("触发入库流程: 评审ID={}", bo.getReviewId());
} catch (Exception e) {
log.error("触发入库流程失败: 评审ID={}", bo.getReviewId(), e);
}
}
/**
*
*/
private String determineTransferTarget(QcUnqualifiedReviewBo bo) {
try {
// TODO: 实现流转目标确定逻辑
// 这里可以根据业务规则或配置来确定流转目标
return "质量管理部"; // 默认流转目标
} catch (Exception e) {
log.error("确定流转目标失败: 评审ID={}", bo.getReviewId(), e);
return "质量管理部";
}
}
/**
*
*/
private void generateTransferDocument(QcUnqualifiedReviewBo bo, String transferTarget) {
try {
// TODO: 实现流转单据生成逻辑
log.info("生成流转单据: 评审ID={}, 目标={}", bo.getReviewId(), transferTarget);
} catch (Exception e) {
log.error("生成流转单据失败: 评审ID={}, 目标={}", bo.getReviewId(), transferTarget, e);
}
}
/**
*
*/
private void notifyTargetDepartment(QcUnqualifiedReviewBo bo, String transferTarget) {
try {
// TODO: 实现目标部门通知逻辑
log.info("通知目标部门: 评审ID={}, 目标={}", bo.getReviewId(), transferTarget);
} catch (Exception e) {
log.error("通知目标部门失败: 评审ID={}, 目标={}", bo.getReviewId(), transferTarget, e);
}
}
/**
*
*/
private void recordProcessLog(QcUnqualifiedReviewBo bo, String message) {
try {
// TODO: 实现处理日志记录逻辑
log.info("记录处理日志: 评审ID={}, 消息={}", bo.getReviewId(), message);
} catch (Exception e) {
log.error("记录处理日志失败: 评审ID={}, 消息={}", bo.getReviewId(), message, e);
}
}
private MPJLambdaWrapper<QcUnqualifiedReview> buildQueryWrapper(QcUnqualifiedReviewBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<QcUnqualifiedReview> lqw = JoinWrappers.lambda(QcUnqualifiedReview.class)
.selectAll(QcUnqualifiedReview.class)
//关联质检主表
.select(QcInspectionMain::getInspectionNo)
.leftJoin(QcInspectionMain.class, QcInspectionMain::getInspectionId, QcUnqualifiedReview::getInspectionId)
//关联检测类型
.select(QcInspectionType::getTypeName, QcInspectionType::getQcInspectionType, QcInspectionType::getTypeCode, QcInspectionType::getQcInspectionType)
.leftJoin(QcInspectionType.class, QcInspectionType::getTypeId, QcUnqualifiedReview::getTypeId)
.eq(bo.getReviewId() != null, QcUnqualifiedReview::getReviewId, bo.getReviewId())
.eq(StringUtils.isNotBlank(bo.getUnqualifiedNo()), QcUnqualifiedReview::getUnqualifiedNo, bo.getUnqualifiedNo())
.eq(bo.getInspectionId() != null, QcUnqualifiedReview::getInspectionId, bo.getInspectionId())
.eq(bo.getTypeId() != null, QcUnqualifiedReview::getTypeId, bo.getTypeId())
.eq(StringUtils.isNotBlank(bo.getWorkOrder()), QcUnqualifiedReview::getWorkOrder, bo.getWorkOrder())
.eq(StringUtils.isNotBlank(bo.getProcessCode()), QcUnqualifiedReview::getProcessCode, bo.getProcessCode())
.eq(bo.getUnqualifiedReviewNo() != null, QcUnqualifiedReview::getUnqualifiedReviewNo, bo.getUnqualifiedReviewNo())
.eq(bo.getReviewResult() != null, QcUnqualifiedReview::getReviewResult, bo.getReviewResult())
.eq(StringUtils.isNotBlank(bo.getInspectionNo()), QcUnqualifiedReview::getInspectionNo, bo.getInspectionNo())
.eq(bo.getInspectionType() != null, QcUnqualifiedReview::getInspectionType, bo.getInspectionType())
.eq(bo.getProductionDate() != null, QcUnqualifiedReview::getProductionDate, bo.getProductionDate())
.eq(StringUtils.isNotBlank(bo.getWorkOrderNo()), QcUnqualifiedReview::getWorkOrderNo, bo.getWorkOrderNo())
.like(StringUtils.isNotBlank(bo.getProcessName()), QcUnqualifiedReview::getProcessName, bo.getProcessName())
.eq(StringUtils.isNotBlank(bo.getBatchNo()), QcUnqualifiedReview::getBatchNo, bo.getBatchNo())
.like(StringUtils.isNotBlank(bo.getMaterialName()), QcUnqualifiedReview::getMaterialName, bo.getMaterialName())
.eq(StringUtils.isNotBlank(bo.getMaterialCode()), QcUnqualifiedReview::getMaterialCode, bo.getMaterialCode())
.eq(StringUtils.isNotBlank(bo.getInspectorResult()), QcUnqualifiedReview::getInspectorResult, bo.getInspectorResult())
.eq(StringUtils.isNotBlank(bo.getReviewResult()), QcUnqualifiedReview::getReviewResult, bo.getReviewResult())
.eq(StringUtils.isNotBlank(bo.getMaterialSpec()), QcUnqualifiedReview::getMaterialSpec, bo.getMaterialSpec())
.like(StringUtils.isNotBlank(bo.getSupplierName()), QcUnqualifiedReview::getSupplierName, bo.getSupplierName())
.eq(StringUtils.isNotBlank(bo.getSupplierCode()), QcUnqualifiedReview::getSupplierCode, bo.getSupplierCode())
.eq(bo.getInspectionQty() != null, QcUnqualifiedReview::getInspectionQty, bo.getInspectionQty())
.eq(StringUtils.isNotBlank(bo.getBatchNo()), QcUnqualifiedReview::getBatchNo, bo.getBatchNo())
.eq(StringUtils.isNotBlank(bo.getInspector()), QcUnqualifiedReview::getInspector, bo.getInspector())
.eq(bo.getInspectorId() != null, QcUnqualifiedReview::getInspectorId, bo.getInspectorId())
.eq(StringUtils.isNotBlank(bo.getReviewer()), QcUnqualifiedReview::getReviewer, bo.getReviewer())
.eq(bo.getReviewerId() != null, QcUnqualifiedReview::getReviewerId, bo.getReviewerId())
.eq(bo.getReviewTime() != null, QcUnqualifiedReview::getReviewTime, bo.getReviewTime())
.orderByDesc(QcUnqualifiedReview::getCreateTime);
return lqw;
@ -691,57 +148,4 @@ public class QcUnqualifiedReviewServiceImpl implements IQcUnqualifiedReviewServi
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public Boolean autoGenerateUnqualifiedReview(QcInspectionMainVo inspectionVo, List<QcInspectionResultVo> inspectionResults) {
// 检查是否有不合格项
boolean hasUnqualified = inspectionResults.stream()
.anyMatch(result -> Long.valueOf(1).equals(result.getDetectResult()));
if (!hasUnqualified) {
log.info("无不合格项,无需生成评审记录: inspectionId={}", inspectionVo.getInspectionId());
return false;
}
QcUnqualifiedReviewBo bo = new QcUnqualifiedReviewBo();
bo.setInspectionId(inspectionVo.getInspectionId());
// bo.setTypeId(inspectionVo.getTypeId());
bo.setMaterialCode(inspectionVo.getMaterialCode());
bo.setMaterialName(inspectionVo.getMaterialName());
bo.setProcessName(inspectionVo.getProcessName());
bo.setWorkOrder(inspectionVo.getProductionOrder());
bo.setBatchNo(inspectionVo.getBatchNo());
bo.setInspectorResult(inspectionVo.getResult().toString());
// 生成唯一的不合格编号
String unqualifiedNo = generateUnqualifiedNo();
bo.setUnqualifiedNo(unqualifiedNo);
// 设置默认值
bo.setReviewResult(null); // 待评审
Boolean inserted = insertByBo(bo);
if (inserted) {
log.info("不合格品评审记录生成成功: reviewId={}, unqualifiedNo={}", bo.getReviewId(), unqualifiedNo);
} else {
log.error("不合格品评审记录生成失败: inspectionId={}", inspectionVo.getInspectionId());
}
return inserted;
}
/**
*
* : UNQ-yyyyMMdd-XXXX (XXXX4)
*/
private String generateUnqualifiedNo() {
LocalDate today = LocalDate.now();
String prefix = "UNQ-" + today.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + "-";
// 查询当天已生成的记录数
long count = baseMapper.selectCount(Wrappers.<QcUnqualifiedReview>lambdaQuery()
.likeRight(QcUnqualifiedReview::getUnqualifiedNo, prefix));
// 生成序列号
String seq = String.format("%04d", count + 1);
return prefix + seq;
}
}

@ -4,15 +4,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.qms.mapper.QcUnqualifiedRecordMapper">
<resultMap type="QcUnqualifiedRecordVo" id="QcUnqualifiedRecordResult">
<resultMap type="org.dromara.qms.domain.vo.QcUnqualifiedRecordVo" id="QcUnqualifiedRecordResult">
<result property="recordId" column="record_id" />
<result property="reviewId" column="review_id" />
<result property="remark" column="remark" />
<result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" />
<result property="inspectionPosition" column="inspection_position" />
<result property="categoryName" column="category_name" />
<result property="typeId" column="type_id" />
<result property="inspectionMethod" column="inspection_method" />
<result property="detectType" column="detect_type" />
<result property="detectResult" column="detect_result" />
<result property="detectValue" column="detect_value" />
<result property="upperLimit" column="upper_limit" />
<result property="lowerLimit" column="lower_limit" />
<result property="specInspectionValue" column="spec_inspection_value" />
<result property="specUpper" column="spec_upper" />
<result property="specLower" column="spec_lower" />
<result property="description" column="description" />
</resultMap>
<sql id="selectQcUnqualifiedRecordVo">
select record_id, tenant_id, review_id, remark, create_dept, create_by, create_time, update_by, update_time, del_flag
select record_id, review_id, tenant_id, item_code, item_name, inspection_position, category_name, type_id, inspection_method, detect_type, detect_result, detect_value, upper_limit, lower_limit, spec_inspection_value, spec_upper, spec_lower, description, create_dept, create_by, create_time, update_by, update_time, del_flag
from qc_unqualified_record
</sql>
@ -21,8 +34,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="recordId != null "> and record_id = #{recordId}</if>
<if test="reviewId != null "> and review_id = #{reviewId}</if>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="inspectionPosition != null and inspectionPosition != ''"> and inspection_position = #{inspectionPosition}</if>
<if test="categoryName != null "> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="inspectionMethod != null "> and inspection_method = #{inspectionMethod}</if>
<if test="detectType != null "> and detect_type = #{detectType}</if>
<if test="detectResult != null "> and detect_result = #{detectResult}</if>
<if test="detectValue != null "> and detect_value = #{detectValue}</if>
<if test="upperLimit != null "> and upper_limit = #{upperLimit}</if>
<if test="lowerLimit != null "> and lower_limit = #{lowerLimit}</if>
<if test="specInspectionValue != null and specInspectionValue != ''"> and spec_inspection_value = #{specInspectionValue}</if>
<if test="specUpper != null "> and spec_upper = #{specUpper}</if>
<if test="specLower != null "> and spec_lower = #{specLower}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
</where>
AND del_flag = '0'
AND del_flag = '0'
</select>
<select id="selectQcUnqualifiedRecordByRecordId" parameterType="Long" resultMap="QcUnqualifiedRecordResult">

@ -4,26 +4,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.qms.mapper.QcUnqualifiedReviewMapper">
<resultMap type="QcUnqualifiedReview" id="QcUnqualifiedReviewResult">
<resultMap type="org.dromara.qms.domain.vo.QcUnqualifiedReviewVo" id="QcUnqualifiedReviewResult">
<result property="reviewId" column="review_id" />
<result property="unqualifiedNo" column="unqualified_no" />
<result property="inspectionId" column="inspection_id" />
<result property="typeId" column="type_id" />
<result property="workOrder" column="work_order" />
<result property="processCode" column="process_code" />
<result property="unqualifiedReviewNo" column="unqualified_review_no" />
<result property="reviewResult" column="review_result" />
<result property="inspectionNo" column="inspection_no" />
<result property="inspectionType" column="inspection_type" />
<result property="productionDate" column="production_date" />
<result property="workOrderNo" column="work_order_no" />
<result property="processName" column="process_name" />
<result property="batchNo" column="batch_no" />
<result property="materialName" column="material_name" />
<result property="materialCode" column="material_code" />
<result property="inspectorResult" column="inspector_result" />
<result property="reviewResult" column="review_result" />
<result property="materialSpec" column="material_spec" />
<result property="supplierName" column="supplier_name" />
<result property="supplierCode" column="supplier_code" />
<result property="inspectionQty" column="inspection_qty" />
<result property="batchNo" column="batch_no" />
<result property="inspector" column="inspector" />
<result property="inspectorId" column="inspector_id" />
<result property="reviewer" column="reviewer" />
<result property="reviewerId" column="reviewer_id" />
<result property="reviewTime" column="review_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectQcUnqualifiedReviewVo">
select review_id, tenant_id, unqualified_no, inspection_id, type_id, work_order, process_code, process_name, batch_no, material_name, material_code, inspector_result, review_result, reviewer, review_time, create_dept, create_by, create_time, update_by, update_time, del_flag
select review_id, tenant_id, unqualified_review_no, review_result, inspection_no, inspection_type, production_date, work_order_no, process_name, material_name, material_code, material_spec, supplier_name, supplier_code, inspection_qty, batch_no, inspector, inspector_id, reviewer, reviewer_id, review_time, remark, create_dept, create_by, create_time, update_by, update_time, del_flag
from qc_unqualified_review
</sql>
@ -31,18 +37,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectQcUnqualifiedReviewVo"/>
<where>
<if test="reviewId != null "> and review_id = #{reviewId}</if>
<if test="unqualifiedNo != null and unqualifiedNo != ''"> and unqualified_no = #{unqualifiedNo}</if>
<if test="inspectionId != null "> and inspection_id = #{inspectionId}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="workOrder != null and workOrder != ''"> and work_order = #{workOrder}</if>
<if test="processCode != null and processCode != ''"> and process_code = #{processCode}</if>
<if test="unqualifiedReviewNo != null "> and unqualified_review_no = #{unqualifiedReviewNo}</if>
<if test="reviewResult != null "> and review_result = #{reviewResult}</if>
<if test="inspectionNo != null and inspectionNo != ''"> and inspection_no = #{inspectionNo}</if>
<if test="inspectionType != null "> and inspection_type = #{inspectionType}</if>
<if test="productionDate != null "> and production_date = #{productionDate}</if>
<if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="inspectorResult != null and inspectorResult != ''"> and inspector_result = #{inspectorResult}</if>
<if test="reviewResult != null and reviewResult != ''"> and review_result = #{reviewResult}</if>
<if test="materialSpec != null and materialSpec != ''"> and material_spec = #{materialSpec}</if>
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if>
<if test="inspectionQty != null "> and inspection_qty = #{inspectionQty}</if>
<if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
<if test="inspector != null and inspector != ''"> and inspector = #{inspector}</if>
<if test="inspectorId != null "> and inspector_id = #{inspectorId}</if>
<if test="reviewer != null and reviewer != ''"> and reviewer = #{reviewer}</if>
<if test="reviewerId != null "> and reviewer_id = #{reviewerId}</if>
<if test="reviewTime != null "> and review_time = #{reviewTime}</if>
</where>
AND del_flag = '0'

Loading…
Cancel
Save