diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionMainController.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionMainController.java index 85bc7cc..364f9d5 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionMainController.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionMainController.java @@ -1,12 +1,15 @@ package org.dromara.qms.controller; -import java.util.ArrayList; import java.util.List; - +import java.util.ArrayList; import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.common.excel.core.DefaultExcelListener; +import org.dromara.common.excel.core.ExcelResult; +import org.springframework.beans.BeanUtils; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.dromara.common.idempotent.annotation.RepeatSubmit; @@ -22,18 +25,14 @@ import org.dromara.qms.domain.vo.QcInspectionMainVo; import org.dromara.qms.domain.bo.QcInspectionMainBo; import org.dromara.qms.service.IQcInspectionMainService; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.springframework.http.MediaType; import org.springframework.web.multipart.MultipartFile; -import org.dromara.common.excel.core.DefaultExcelListener; -import org.dromara.common.excel.core.ExcelResult; -import org.springframework.beans.BeanUtils; /** - * 质检主表 + * 质检任务 * 前端访问路由地址为:/qms/QcInspectionMain * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ @Validated @RequiredArgsConstructor @@ -44,7 +43,7 @@ public class QcInspectionMainController extends BaseController { private final IQcInspectionMainService qcInspectionMainService; /** - * 查询质检主表列表 + * 查询质检任务列表 */ @SaCheckPermission("qms:QcInspectionMain:list") @GetMapping("/list") @@ -53,29 +52,30 @@ public class QcInspectionMainController extends BaseController { } /** - * 导出质检主表列表 + * 导出质检任务列表 */ @SaCheckPermission("qms:QcInspectionMain:export") - @Log(title = "质检主表", businessType = BusinessType.EXPORT) + @Log(title = "质检任务", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(QcInspectionMainBo bo, HttpServletResponse response) { List list = qcInspectionMainService.queryList(bo); - ExcelUtil.exportExcel(list, "质检主表", QcInspectionMainVo.class, response); + ExcelUtil.exportExcel(list, "质检任务", QcInspectionMainVo.class, response); } /** - * 导出质检主表列表模板(无任何数据) + * 导出质检任务列表模板(无任何数据) */ @SaCheckPermission("qms:QcInspectionMain:export") - @Log(title = "质检主表", businessType = BusinessType.EXPORT) + @Log(title = "质检任务", businessType = BusinessType.EXPORT) @PostMapping("/exportTemplate") - public void exportTemplate(HttpServletResponse response) { + public void exportTemplate(QcInspectionMainBo bo, HttpServletResponse response) { List list = new ArrayList<>(); - ExcelUtil.exportExcel(list, "质检结果", QcInspectionMainVo.class, response); + ExcelUtil.exportExcel(list, "质检任务", QcInspectionMainVo.class, response); } + /** - * 获取质检主表详细信息 + * 获取质检任务详细信息 * * @param inspectionId 主键 */ @@ -87,10 +87,10 @@ public class QcInspectionMainController extends BaseController { } /** - * 新增质检主表 + * 新增质检任务 */ @SaCheckPermission("qms:QcInspectionMain:add") - @Log(title = "质检主表", businessType = BusinessType.INSERT) + @Log(title = "质检任务", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() public R add(@Validated(AddGroup.class) @RequestBody QcInspectionMainBo bo) { @@ -98,10 +98,10 @@ public class QcInspectionMainController extends BaseController { } /** - * 修改质检主表 + * 修改质检任务 */ @SaCheckPermission("qms:QcInspectionMain:edit") - @Log(title = "质检主表", businessType = BusinessType.UPDATE) + @Log(title = "质检任务", businessType = BusinessType.UPDATE) @RepeatSubmit() @PutMapping() public R edit(@Validated(EditGroup.class) @RequestBody QcInspectionMainBo bo) { @@ -109,12 +109,12 @@ public class QcInspectionMainController extends BaseController { } /** - * 删除质检主表 + * 删除质检任务 * * @param inspectionIds 主键串 */ @SaCheckPermission("qms:QcInspectionMain:remove") - @Log(title = "质检主表", businessType = BusinessType.DELETE) + @Log(title = "质检任务", businessType = BusinessType.DELETE) @DeleteMapping("/{inspectionIds}") public R remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] inspectionIds) { @@ -123,7 +123,7 @@ public class QcInspectionMainController extends BaseController { /** - * 下拉框查询质检主表列表 + * 下拉框查询质检任务列表 */ @GetMapping("/getQcInspectionMainList") diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionResultController.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionResultController.java index 1c696da..c0c8b84 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionResultController.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/controller/QcInspectionResultController.java @@ -1,13 +1,14 @@ package org.dromara.qms.controller; import java.util.List; - +import java.util.ArrayList; import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; import org.dromara.common.excel.core.DefaultExcelListener; import org.dromara.common.excel.core.ExcelResult; +import org.springframework.beans.BeanUtils; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -24,15 +25,14 @@ import org.dromara.qms.domain.vo.QcInspectionResultVo; import org.dromara.qms.domain.bo.QcInspectionResultBo; import org.dromara.qms.service.IQcInspectionResultService; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.springframework.beans.BeanUtils; import org.springframework.web.multipart.MultipartFile; /** * 质检结果子表 * 前端访问路由地址为:/qms/qcInspectionResult * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ @Validated @RequiredArgsConstructor @@ -62,6 +62,18 @@ public class QcInspectionResultController extends BaseController { ExcelUtil.exportExcel(list, "质检结果子表", QcInspectionResultVo.class, response); } + /** + * 导出质检结果子表列表模板(无任何数据) + */ + @SaCheckPermission("qms:qcInspectionResult:export") + @Log(title = "质检结果子表", businessType = BusinessType.EXPORT) + @PostMapping("/exportTemplate") + public void exportTemplate(QcInspectionResultBo bo, HttpServletResponse response) { + List list = new ArrayList<>(); + ExcelUtil.exportExcel(list, "质检结果子表", QcInspectionResultVo.class, response); + } + + /** * 获取质检结果子表详细信息 * diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionMain.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionMain.java index b399e74..4c3edad 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionMain.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionMain.java @@ -4,7 +4,6 @@ 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; @@ -12,10 +11,10 @@ import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serial; /** - * 质检主表对象 qc_inspection_main + * 质检任务对象 qc_inspection_main * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ @Data @EqualsAndHashCode(callSuper = true) @@ -36,6 +35,11 @@ public class QcInspectionMain extends TenantEntity { */ private String inspectionNo; + /** + * 关联模板主表ID + */ + private Long templateId; + /** * 物料编码 */ @@ -87,9 +91,9 @@ public class QcInspectionMain extends TenantEntity { private String workshop; /** - * 检测类型主键 + * 检验类别(首检/过程检等等) */ - private Long typeId; + private Long inspectionType; /** * 单据状态(0未处理/1完成) @@ -148,24 +152,4 @@ public class QcInspectionMain extends TenantEntity { private String delFlag; - /** - * 检测类型编码 - */ - @TableField(exist = false) - private String typeCode;//JOIN - - /** - * 检测类型名称 - */ - @TableField(exist = false) - private String typeName;//JOIN - - /** - * 检测类型(字典:首检 专检 自检 互检 原材料检 抽检 成品检) - */ - @TableField(exist = false) - private Long qcInspectionType;//JOIN - - - } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionResult.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionResult.java index a3bd304..6a6b35e 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionResult.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/QcInspectionResult.java @@ -11,8 +11,8 @@ import java.io.Serial; /** * 质检结果子表对象 qc_inspection_result * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ @Data @EqualsAndHashCode(callSuper = true) @@ -58,6 +58,76 @@ public class QcInspectionResult extends TenantEntity { */ private String problemDetail; + /** + * 检测项编码(快照) + */ + private String itemCode; + + /** + * 检测项名称(快照) + */ + private String itemName; + + /** + * 检测位置(快照) + */ + private String inspectionPosition; + + /** + * 检测项目类别(快照) + */ + private String categoryName; + + /** + * 关联检测类型表(快照) + */ + private Long typeId; + + /** + * 检测方式(0定性,1定量)(快照) + */ + private Long detectType; + + /** + * 控制类型(0手动,1自动)(快照) + */ + private Long controlType; + + /** + * 标准值(快照) + */ + private BigDecimal standardValue; + + /** + * 控制上限(快照) + */ + private BigDecimal upperLimit; + + /** + * 控制下限(快照) + */ + private BigDecimal lowerLimit; + + /** + * 规格名称(快照) + */ + private String specName; + + /** + * 规格上限(快照) + */ + private BigDecimal specUpper; + + /** + * 规格下限(快照) + */ + private BigDecimal specLower; + + /** + * 检测项说明(快照) + */ + private String description; + /** * 是否删除(0表示存在,2表示删除) */ diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionMainBo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionMainBo.java index b94ac25..0438475 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionMainBo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionMainBo.java @@ -8,16 +8,15 @@ 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; /** - * 质检主表业务对象 qc_inspection_main + * 质检任务业务对象 qc_inspection_main * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ @Data @EqualsAndHashCode(callSuper = true) @@ -27,7 +26,6 @@ public class QcInspectionMainBo extends BaseEntity { /** * 质检主键 */ -// @NotNull(message = "质检主键不能为空", groups = { AddGroup.class, EditGroup.class }) private Long inspectionId; /** @@ -35,6 +33,11 @@ public class QcInspectionMainBo extends BaseEntity { */ private String inspectionNo; + /** + * 关联模板主表ID + */ + private Long templateId; + /** * 物料编码 */ @@ -86,9 +89,9 @@ public class QcInspectionMainBo extends BaseEntity { private String workshop; /** - * 检测类型主键 + * 检验类别(首检/过程检等等) */ - private Long typeId; + private Long inspectionType; /** * 单据状态(0未处理/1完成) @@ -141,19 +144,4 @@ public class QcInspectionMainBo extends BaseEntity { private String remark; - /** - * 检测类型编码 - */ - private String typeCode;//JOIN - - /** - * 检测类型名称 - */ - private String typeName;//JOIN - - /** - * 检测类型(字典:首检 专检 自检 互检 原材料检 抽检 成品检) - */ - private Long qcInspectionType;//JOIN - } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionResultBo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionResultBo.java index c71db89..559303d 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionResultBo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/bo/QcInspectionResultBo.java @@ -13,8 +13,8 @@ import java.math.BigDecimal; /** * 质检结果子表业务对象 qc_inspection_result * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ @Data @EqualsAndHashCode(callSuper = true) @@ -24,7 +24,6 @@ public class QcInspectionResultBo extends BaseEntity { /** * 结果主键 */ -// @NotNull(message = "结果主键不能为空", groups = { AddGroup.class, EditGroup.class }) private Long resultId; /** @@ -57,5 +56,75 @@ public class QcInspectionResultBo extends BaseEntity { */ private String problemDetail; + /** + * 检测项编码(快照) + */ + private String itemCode; + + /** + * 检测项名称(快照) + */ + private String itemName; + + /** + * 检测位置(快照) + */ + private String inspectionPosition; + + /** + * 检测项目类别(快照) + */ + private String categoryName; + + /** + * 关联检测类型表(快照) + */ + private Long typeId; + + /** + * 检测方式(0定性,1定量)(快照) + */ + private Long detectType; + + /** + * 控制类型(0手动,1自动)(快照) + */ + private Long controlType; + + /** + * 标准值(快照) + */ + private BigDecimal standardValue; + + /** + * 控制上限(快照) + */ + private BigDecimal upperLimit; + + /** + * 控制下限(快照) + */ + private BigDecimal lowerLimit; + + /** + * 规格名称(快照) + */ + private String specName; + + /** + * 规格上限(快照) + */ + private BigDecimal specUpper; + + /** + * 规格下限(快照) + */ + private BigDecimal specLower; + + /** + * 检测项说明(快照) + */ + private String description; + } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionMainVo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionMainVo.java index 6b57dd1..c2831b0 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionMainVo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionMainVo.java @@ -2,7 +2,6 @@ package org.dromara.qms.domain.vo; import java.math.BigDecimal; import java.util.Date; -import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.qms.domain.QcInspectionMain; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; @@ -19,12 +18,11 @@ import java.util.Date; /** - * 质检主表视图对象 qc_inspection_main + * 质检任务视图对象 qc_inspection_main * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ - @Data @ExcelIgnoreUnannotated @AutoMapper(target = QcInspectionMain.class) @@ -36,7 +34,7 @@ public class QcInspectionMainVo implements Serializable { /** * 质检主键 */ -// @ExcelProperty(value = "质检主键") + @ExcelProperty(value = "质检主键") private Long inspectionId; /** @@ -45,6 +43,12 @@ public class QcInspectionMainVo implements Serializable { @ExcelProperty(value = "检测单号/卡号") private String inspectionNo; + /** + * 关联模板主表ID + */ + @ExcelProperty(value = "关联模板主表ID") + private Long templateId; + /** * 物料编码 */ @@ -107,10 +111,11 @@ public class QcInspectionMainVo implements Serializable { private String workshop; /** - * 检测类型主键 + * 检验类别(首检/过程检等等) */ - @ExcelProperty(value = "检测类型主键") - private Long typeId; + @ExcelProperty(value = "检验类别", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "qc_inspection_type") + private Long inspectionType; /** * 单据状态(0未处理/1完成) @@ -174,83 +179,4 @@ public class QcInspectionMainVo implements Serializable { private String remark; - /** - * 检测类型编码 - */ - private String typeCode;//JOIN - - /** - * 检测类型名称 - */ - private String typeName;//JOIN - - /** - * 检测类型(字典:首检 专检 自检 互检 原材料检 抽检 成品检) - */ - private Long qcInspectionType;//JOIN - - // ========== PDA专用字段 ========== - - /** - * 检测项明细列表(用于详情页面) - */ - private List inspectionItems; - - /** - * 质检结果文本(合格/不合格) - */ - private String resultText; - - /** - * 单据状态文本(未处理/完成) - */ - private String statusText; - - /** - * 检测类型文本 - */ - private String inspectionTypeText; - - /** - * 合格率(百分比) - */ - private BigDecimal qualifiedRate; - - /** - * 是否有不合格项 - */ - private Boolean hasUnqualifiedItems; - - /** - * 检测项总数 - */ - private Integer totalItemCount; - - /** - * 已检测项数 - */ - private Integer completedItemCount; - - /** - * 检测进度(百分比) - */ - private BigDecimal inspectionProgress; - - /** - * 是否可以提交(所有必检项都已完成) - */ - private Boolean canSubmit; - - /** - * 创建时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 更新时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionResultVo.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionResultVo.java index 8aa4c9b..66e36e8 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionResultVo.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/domain/vo/QcInspectionResultVo.java @@ -18,8 +18,8 @@ import java.util.Date; /** * 质检结果子表视图对象 qc_inspection_result * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ @Data @ExcelIgnoreUnannotated @@ -72,5 +72,103 @@ public class QcInspectionResultVo implements Serializable { @ExcelProperty(value = "定性不合格明细") private String problemDetail; + /** + * 检测项编码(快照) + */ + @ExcelProperty(value = "检测项编码", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String itemCode; + + /** + * 检测项名称(快照) + */ + @ExcelProperty(value = "检测项名称", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String itemName; + + /** + * 检测位置(快照) + */ + @ExcelProperty(value = "检测位置", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String inspectionPosition; + + /** + * 检测项目类别(快照) + */ + @ExcelProperty(value = "检测项目类别", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String categoryName; + + /** + * 关联检测类型表(快照) + */ + @ExcelProperty(value = "关联检测类型表", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private Long typeId; + + /** + * 检测方式(0定性,1定量)(快照) + */ + @ExcelProperty(value = "检测方式", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "detect_type") + private Long detectType; + + /** + * 控制类型(0手动,1自动)(快照) + */ + @ExcelProperty(value = "控制类型(0手动,1自动)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "control_type") + private Long controlType; + + /** + * 标准值(快照) + */ + @ExcelProperty(value = "标准值", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private BigDecimal standardValue; + + /** + * 控制上限(快照) + */ + @ExcelProperty(value = "控制上限", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private BigDecimal upperLimit; + + /** + * 控制下限(快照) + */ + @ExcelProperty(value = "控制下限", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private BigDecimal lowerLimit; + + /** + * 规格名称(快照) + */ + @ExcelProperty(value = "规格名称", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String specName; + + /** + * 规格上限(快照) + */ + @ExcelProperty(value = "规格上限", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private BigDecimal specUpper; + + /** + * 规格下限(快照) + */ + @ExcelProperty(value = "规格下限", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private BigDecimal specLower; + + /** + * 检测项说明(快照) + */ + @ExcelProperty(value = "检测项说明", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "快=照") + private String description; + } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionMainMapper.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionMainMapper.java index 34efb14..a8e4176 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionMainMapper.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionMainMapper.java @@ -8,26 +8,26 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import java.util.List; /** - * 质检主表Mapper接口 + * 质检任务Mapper接口 * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ public interface QcInspectionMainMapper extends BaseMapperPlus { /** - * 查询质检主表列表 + * 查询质检任务列表 * * @param bo 查询条件 - * @return 质检主表列表 + * @return 质检任务列表 */ List selectQcInspectionMainList(QcInspectionMainBo bo); /** - * 根据主键查询质检主表 + * 根据主键查询质检任务 * * @param inspectionId 主键 - * @return 质检主表 + * @return 质检任务 */ QcInspectionMainVo selectQcInspectionMainByInspectionId(Long inspectionId); diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionResultMapper.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionResultMapper.java index 99ca788..19bcb98 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionResultMapper.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/mapper/QcInspectionResultMapper.java @@ -10,8 +10,8 @@ import java.util.List; /** * 质检结果子表Mapper接口 * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ public interface QcInspectionResultMapper extends BaseMapperPlus { diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionMainServiceImpl.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionMainServiceImpl.java index 1770029..bee4160 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionMainServiceImpl.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionMainServiceImpl.java @@ -9,54 +9,34 @@ 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.QcInspectionTemplate; -import org.dromara.qms.domain.QcInspectionType; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.dromara.qms.domain.bo.QcInspectionMainBo; import org.dromara.qms.domain.vo.QcInspectionMainVo; import org.dromara.qms.domain.QcInspectionMain; import org.dromara.qms.mapper.QcInspectionMainMapper; import org.dromara.qms.service.IQcInspectionMainService; -import org.dromara.qms.service.IQcUnqualifiedReviewService; -import org.dromara.qms.service.IQcInspectionResultService; -import org.dromara.qms.domain.QcInspectionResult; -import org.dromara.qms.domain.vo.QcInspectionResultVo; -import org.dromara.qms.domain.vo.QcInspectionItemDetailVo; -import org.dromara.qms.domain.bo.QcUnqualifiedReviewBo; -import org.dromara.qms.domain.bo.QcInspectionResultBo; -import org.dromara.qms.utils.QcInspectionResultCalculator; -import org.dromara.common.satoken.utils.LoginHelper; -import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.Collection; -import java.util.Date; -import java.util.ArrayList; /** - * 质检主表Service业务层处理 + * 质检任务Service业务层处理 * * @author zch - * @date 2025-07-14 + * @date 2025-07-24 */ -@Slf4j @RequiredArgsConstructor @Service public class QcInspectionMainServiceImpl implements IQcInspectionMainService { private final QcInspectionMainMapper baseMapper; - private final IQcUnqualifiedReviewService qcUnqualifiedReviewService; - private final IQcInspectionResultService qcInspectionResultService; - private final QcUnqualifiedGeneratorService qcUnqualifiedGeneratorService; /** - * 查询质检主表 + * 查询质检任务 * * @param inspectionId 主键 - * @return 质检主表 + * @return 质检任务 */ @Override public QcInspectionMainVo queryById(Long inspectionId){ @@ -64,11 +44,11 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } /** - * 分页查询质检主表列表 + * 分页查询质检任务列表 * * @param bo 查询条件 * @param pageQuery 分页参数 - * @return 质检主表分页列表 + * @return 质检任务分页列表 */ @Override public TableDataInfo queryPageList(QcInspectionMainBo bo, PageQuery pageQuery) { @@ -78,10 +58,10 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } /** - * 查询符合条件的质检主表列表 + * 查询符合条件的质检任务列表 * * @param bo 查询条件 - * @return 质检主表列表 + * @return 质检任务列表 */ @Override public List queryList(QcInspectionMainBo bo) { @@ -93,13 +73,9 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { Map params = bo.getParams(); MPJLambdaWrapper lqw = JoinWrappers.lambda(QcInspectionMain.class) .selectAll(QcInspectionMain.class) - - //关联检测类型 - .select(QcInspectionType::getTypeName, QcInspectionType::getQcInspectionType, QcInspectionType::getTypeCode) - .leftJoin(QcInspectionType.class, QcInspectionType::getTypeId, QcInspectionMain::getTypeId) - - .eq(bo.getInspectionId() != null, QcInspectionMain::getInspectionId, bo.getInspectionId()) + .eq(bo.getInspectionId() != null, QcInspectionMain::getInspectionId, bo.getInspectionId()) .eq(StringUtils.isNotBlank(bo.getInspectionNo()), QcInspectionMain::getInspectionNo, bo.getInspectionNo()) + .eq(bo.getTemplateId() != null, QcInspectionMain::getTemplateId, bo.getTemplateId()) .eq(StringUtils.isNotBlank(bo.getMaterialCode()), QcInspectionMain::getMaterialCode, bo.getMaterialCode()) .eq(StringUtils.isNotBlank(bo.getMaterialType()), QcInspectionMain::getMaterialType, bo.getMaterialType()) .like(StringUtils.isNotBlank(bo.getMaterialName()), QcInspectionMain::getMaterialName, bo.getMaterialName()) @@ -110,7 +86,7 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { .eq(bo.getUnqualifiedQty() != null, QcInspectionMain::getUnqualifiedQty, bo.getUnqualifiedQty()) .eq(bo.getResult() != null, QcInspectionMain::getResult, bo.getResult()) .eq(StringUtils.isNotBlank(bo.getWorkshop()), QcInspectionMain::getWorkshop, bo.getWorkshop()) - .eq(bo.getTypeId() != null, QcInspectionMain::getTypeId, bo.getTypeId()) + .eq(bo.getInspectionType() != null, QcInspectionMain::getInspectionType, bo.getInspectionType()) .eq(bo.getStatus() != null, QcInspectionMain::getStatus, bo.getStatus()) .eq(StringUtils.isNotBlank(bo.getInspector()), QcInspectionMain::getInspector, bo.getInspector()) .eq(StringUtils.isNotBlank(bo.getShift()), QcInspectionMain::getShift, bo.getShift()) @@ -125,9 +101,9 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } /** - * 新增质检主表 + * 新增质检任务 * - * @param bo 质检主表 + * @param bo 质检任务 * @return 是否新增成功 */ @Override @@ -142,9 +118,9 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } /** - * 修改质检主表 + * 修改质检任务 * - * @param bo 质检主表 + * @param bo 质检任务 * @return 是否修改成功 */ @Override @@ -162,7 +138,7 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } /** - * 校验并批量删除质检主表信息 + * 校验并批量删除质检任务信息 * * @param ids 待删除的主键集合 * @param isValid 是否进行有效性校验 @@ -175,207 +151,4 @@ public class QcInspectionMainServiceImpl implements IQcInspectionMainService { } return baseMapper.deleteByIds(ids) > 0; } - - /** - * 分页查询未处理质检任务列表 (for PDA) - * 过滤未处理任务并支持用户权限 - */ - @Override - public TableDataInfo queryPageUnprocessedTasks(QcInspectionMainBo bo, PageQuery pageQuery) { - // 设置查询条件:只查询未处理的任务 - bo.setStatus(0L); // 单据状态(0未处理/1完成) - return queryPageList(bo, pageQuery); - } - - /** - * 查询质检详情包括子表检测项 (for PDA) - * 关联查询检测项明细数据 - */ - @Override - public QcInspectionMainVo queryByIdWithResults(Long inspectionId) { - QcInspectionMainVo mainVo = queryById(inspectionId); - if (mainVo != null) { - // 查询关联的检测项结果明细 - QcInspectionResultBo resultBo = new QcInspectionResultBo(); - resultBo.setInspectionId(inspectionId); - List results = qcInspectionResultService.queryList(resultBo); - - // 将检测项结果设置到主表VO中 - // 注意:这里假设QcInspectionMainVo有results字段,如果没有需要添加 - // mainVo.setResults(results); - } - return mainVo; - } - - /** - * 提交质检结果 (for PDA) - * 包含数据验证、结果计算、不合格品生成逻辑 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean submitInspectionResult(QcInspectionMainBo bo) { - try { - // 1. 验证质检数据的完整性 - if (!validateInspectionData(bo)) { - log.error("质检数据验证失败: {}", bo.getInspectionId()); - return false; - } - - // 2. 查询检测项数据 - List inspectionItems = getInspectionItems(bo.getInspectionId()); - - // 3. 计算检测项结果状态 - Long overallResult = QcInspectionResultCalculator.calculateOverallResult(inspectionItems); - - // 4. 更新质检主表结果 - bo.setResult(overallResult); - bo.setStatus(1L); // 设置为已完成 - bo.setInspectionTime(new Date()); - bo.setUpdateBy(LoginHelper.getUserId()); - bo.setUpdateTime(new Date()); - - // 计算合格数和不合格数 - calculateQualifiedQuantities(bo, inspectionItems); - - Boolean updated = updateByBo(bo); - if (!updated) { - log.error("更新质检主表失败: {}", bo.getInspectionId()); - return false; - } - - // 5. 如果存在不合格项,自动生成不合格品评审任务 - if (QcInspectionResultCalculator.RESULT_STATUS_UNQUALIFIED.equals(overallResult)) { - QcInspectionMainVo inspectionVo = queryById(bo.getInspectionId()); - Boolean generated = qcUnqualifiedGeneratorService.autoGenerateUnqualifiedReview(inspectionVo, inspectionItems); - if (!generated) { - log.warn("生成不合格品评审任务失败,但质检结果已保存: {}", bo.getInspectionId()); - } - } - - log.info("质检结果提交成功: 任务ID={}, 结果={}", bo.getInspectionId(), - overallResult == 0 ? "合格" : "不合格"); - return true; - - } catch (Exception e) { - log.error("提交质检结果异常: {}", bo.getInspectionId(), e); - throw e; // 让事务回滚 - } - } - - /** - * 分页查询质检任务历史记录 (for PDA) - */ - @Override - public TableDataInfo queryPageTaskHistory(QcInspectionMainBo bo, PageQuery pageQuery) { - // 设置查询条件:只查询已完成的任务 - bo.setStatus(1L); // 单据状态(0未处理/1完成) - return queryPageList(bo, pageQuery); - } - - /** - * 分页查询用户分派的质检任务 (for PDA) - */ - @Override - public TableDataInfo queryPageUserTasks(String inspector, PageQuery pageQuery) { - QcInspectionMainBo bo = new QcInspectionMainBo(); - //TODO:考虑质检人是填id还是name - bo.setInspector(inspector); - return queryPageList(bo, pageQuery); - } - - /** - * 验证质检数据的完整性和业务规则 (for PDA) - */ - @Override - public Boolean validateInspectionData(QcInspectionMainBo bo) { - QcInspectionResultCalculator.ValidationResult result = QcInspectionResultCalculator.validateInspectionData(bo); - - if (result.hasErrors()) { - log.warn("质检数据验证失败: {}, 错误: {}", bo.getInspectionId(), result.getErrors()); - return false; - } - - // 验证检测项数据 - List inspectionItems = getInspectionItems(bo.getInspectionId()); - QcInspectionResultCalculator.ValidationResult itemsResult = QcInspectionResultCalculator.validateInspectionItems(inspectionItems); - - if (itemsResult.hasErrors()) { - log.warn("检测项数据验证失败: {}, 错误: {}", bo.getInspectionId(), itemsResult.getErrors()); - return false; - } - - return true; - } - - /** - * 获取检测项数据 - * 这里需要根据实际的数据结构来实现 - */ - private List getInspectionItems(Long inspectionId) { - // 这里应该查询检测项明细数据 - // 由于没有具体的检测项明细表结构,这里返回空列表 - // 实际实现中需要根据具体的表结构来查询 - - try { - QcInspectionResultBo resultBo = new QcInspectionResultBo(); - resultBo.setInspectionId(inspectionId); - List results = qcInspectionResultService.queryList(resultBo); - - // 将QcInspectionResultVo转换为QcInspectionItemDetailVo - List items = new ArrayList<>(); - for (QcInspectionResultVo result : results) { - QcInspectionItemDetailVo item = convertToItemDetail(result); - items.add(item); - } - - return items; - } catch (Exception e) { - log.error("获取检测项数据失败: {}", inspectionId, e); - return new ArrayList<>(); - } - } - - /** - * 将QcInspectionResultVo转换为QcInspectionItemDetailVo - */ - private QcInspectionItemDetailVo convertToItemDetail(QcInspectionResultVo result) { - QcInspectionItemDetailVo item = new QcInspectionItemDetailVo(); - - // 这里需要根据实际的字段映射来转换 - // 由于没有看到QcInspectionResultVo的具体结构,这里只是示例 - item.setItemId(result.getResultId()); - // item.setItemCode(result.getItemCode()); - // item.setItemName(result.getItemName()); - // ... 其他字段映射 - - return item; - } - - /** - * 计算合格数和不合格数 - */ - private void calculateQualifiedQuantities(QcInspectionMainBo bo, List inspectionItems) { - if (inspectionItems == null || inspectionItems.isEmpty()) { - return; - } - - // 计算不合格项数量 - long unqualifiedCount = inspectionItems.stream() - .filter(item -> QcInspectionResultCalculator.RESULT_STATUS_UNQUALIFIED.equals( - QcInspectionResultCalculator.calculateItemResultStatus(item))) - .count(); - BigDecimal unqualifiedCountBigDecimal = BigDecimal.valueOf(unqualifiedCount); - - // 设置不合格数量 - bo.setUnqualifiedQty(unqualifiedCountBigDecimal); - - // 计算合格数量(总检测数量 - 不合格数量) - BigDecimal totalQty = bo.getInspectionQty(); - if (totalQty != null) { - -// bo.setQualifiedQty(totalQty - unqualifiedCount); - BigDecimal subtract = totalQty.subtract(unqualifiedCountBigDecimal); - bo.setQualifiedQty(subtract); - } - } } diff --git a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionResultServiceImpl.java b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionResultServiceImpl.java index d72ccea..d17e7ca 100644 --- a/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionResultServiceImpl.java +++ b/ruoyi-modules/hwmom-qms/src/main/java/org/dromara/qms/service/impl/QcInspectionResultServiceImpl.java @@ -23,8 +23,8 @@ import java.util.Collection; /** * 质检结果子表Service业务层处理 * - * @author Yinq - * @date 2025-07-14 + * @author zch + * @date 2025-07-24 */ @RequiredArgsConstructor @Service @@ -80,6 +80,20 @@ public class QcInspectionResultServiceImpl implements IQcInspectionResultService .eq(bo.getDetectValue() != null, QcInspectionResult::getDetectValue, bo.getDetectValue()) .eq(StringUtils.isNotBlank(bo.getSpecInspection()), QcInspectionResult::getSpecInspection, bo.getSpecInspection()) .eq(StringUtils.isNotBlank(bo.getProblemDetail()), QcInspectionResult::getProblemDetail, bo.getProblemDetail()) + .eq(StringUtils.isNotBlank(bo.getItemCode()), QcInspectionResult::getItemCode, bo.getItemCode()) + .like(StringUtils.isNotBlank(bo.getItemName()), QcInspectionResult::getItemName, bo.getItemName()) + .eq(StringUtils.isNotBlank(bo.getInspectionPosition()), QcInspectionResult::getInspectionPosition, bo.getInspectionPosition()) + .like(StringUtils.isNotBlank(bo.getCategoryName()), QcInspectionResult::getCategoryName, bo.getCategoryName()) + .eq(bo.getTypeId() != null, QcInspectionResult::getTypeId, bo.getTypeId()) + .eq(bo.getDetectType() != null, QcInspectionResult::getDetectType, bo.getDetectType()) + .eq(bo.getControlType() != null, QcInspectionResult::getControlType, bo.getControlType()) + .eq(bo.getStandardValue() != null, QcInspectionResult::getStandardValue, bo.getStandardValue()) + .eq(bo.getUpperLimit() != null, QcInspectionResult::getUpperLimit, bo.getUpperLimit()) + .eq(bo.getLowerLimit() != null, QcInspectionResult::getLowerLimit, bo.getLowerLimit()) + .like(StringUtils.isNotBlank(bo.getSpecName()), QcInspectionResult::getSpecName, bo.getSpecName()) + .eq(bo.getSpecUpper() != null, QcInspectionResult::getSpecUpper, bo.getSpecUpper()) + .eq(bo.getSpecLower() != null, QcInspectionResult::getSpecLower, bo.getSpecLower()) + .eq(StringUtils.isNotBlank(bo.getDescription()), QcInspectionResult::getDescription, bo.getDescription()) .orderByDesc(QcInspectionResult::getCreateTime); return lqw; } diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml index 6ac35dc..ded148f 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionMainMapper.xml @@ -4,9 +4,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + @@ -17,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -31,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select inspection_id, tenant_id, inspection_no, material_code, material_type, material_name, process_name, station_name, inspection_qty, qualified_qty, unqualified_qty, result, workshop, type_id, status, inspector, shift, team, inspection_time, production_order, batch_no, barcode, supplier_name, remark, create_dept, create_by, create_time, update_by, update_time, del_flag + select inspection_id, tenant_id, inspection_no, template_id, material_code, material_type, material_name, process_name, station_name, inspection_qty, qualified_qty, unqualified_qty, result, workshop, inspection_type, status, inspector, shift, team, inspection_time, production_order, batch_no, barcode, supplier_name, remark, create_dept, create_by, create_time, update_by, update_time, del_flag from qc_inspection_main @@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and inspection_id = #{inspectionId} and inspection_no = #{inspectionNo} + and template_id = #{templateId} and material_code = #{materialCode} and material_type = #{materialType} and material_name like concat('%', #{materialName}, '%') @@ -50,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and unqualified_qty = #{unqualifiedQty} and result = #{result} and workshop = #{workshop} - and type_id = #{typeId} + and inspection_type = #{inspectionType} and status = #{status} and inspector = #{inspector} and shift = #{shift} @@ -67,7 +69,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml index e0a20cf..184aa92 100644 --- a/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml +++ b/ruoyi-modules/hwmom-qms/src/main/resources/mapper/qms/QcInspectionResultMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -12,10 +12,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + - select result_id, tenant_id, inspection_id, item_id, detect_result, detect_value, spec_inspection, problem_detail, create_dept, create_by, create_time, update_by, update_time, del_flag + select result_id, tenant_id, inspection_id, item_id, detect_result, detect_value, spec_inspection, problem_detail, item_code, item_name, inspection_position, category_name, type_id, detect_type, control_type, standard_value, upper_limit, lower_limit, spec_name, spec_upper, spec_lower, description, create_dept, create_by, create_time, update_by, update_time, del_flag from qc_inspection_result @@ -29,6 +43,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and detect_value = #{detectValue} and spec_inspection = #{specInspection} and problem_detail = #{problemDetail} + and item_code = #{itemCode} + and item_name like concat('%', #{itemName}, '%') + and inspection_position = #{inspectionPosition} + and category_name like concat('%', #{categoryName}, '%') + and type_id = #{typeId} + and detect_type = #{detectType} + and control_type = #{controlType} + and standard_value = #{standardValue} + and upper_limit = #{upperLimit} + and lower_limit = #{lowerLimit} + and spec_name like concat('%', #{specName}, '%') + and spec_upper = #{specUpper} + and spec_lower = #{specLower} + and description = #{description} AND del_flag = '0' @@ -36,7 +64,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"