From f2cb1c996e6f725c843e398ea8a35f55f94e1c73 Mon Sep 17 00:00:00 2001 From: yf001217 <834502597@qq.com> Date: Tue, 9 Jun 2026 15:14:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?iqc=E6=8A=A5=E8=A1=A8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QmdReportManagementControllerService.java | 28 +++++++++++++++++-- .../common/pojo/qo/QmdReportManagementQO.java | 16 +++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmdReportManagementControllerService.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmdReportManagementControllerService.java index 0a1a4276..266aa1ec 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmdReportManagementControllerService.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmdReportManagementControllerService.java @@ -22,6 +22,7 @@ public class QmdReportManagementControllerService { private final IQmsInspectionStandardService inspectionStandardService; private final IQmsInspectionStandardItemService inspectionStandardItemService; + private final IQmsQcMaterialService qcMaterialService; private final IQmsPdiDetectionRulesService pdiDetectionRulesService; private final IQmsPdiDetectionRulesStatusItemService pdiStatusItemService; private final IQmsPdiComponentAnagementService pdiComponentService; @@ -33,8 +34,13 @@ public class QmdReportManagementControllerService { * IQC报表查询 */ public List searchIqc(QmdReportManagementQO.IqcReportQO request) { + List materialIds = getIqcMaterialIds(request.getMaterialNo()); + if (CollectionUtil.isEmpty(materialIds)) { + return Collections.emptyList(); + } + QmsInspectionStandard currentStandard = inspectionStandardService.lambdaQuery() - .eq(QmsInspectionStandard::getMaterialId, request.getMaterialId()) + .in(QmsInspectionStandard::getMaterialId, materialIds) .eq(QmsInspectionStandard::getVersion, request.getVersion()) .last("LIMIT 1") .one(); @@ -51,7 +57,7 @@ public class QmdReportManagementControllerService { } List allStandards = inspectionStandardService.lambdaQuery() - .eq(QmsInspectionStandard::getMaterialId, request.getMaterialId()) + .in(QmsInspectionStandard::getMaterialId, materialIds) .list(); Map versionMap = allStandards.stream() .collect(Collectors.toMap(QmsInspectionStandard::getId, QmsInspectionStandard::getVersion, (a, b) -> a)); @@ -84,9 +90,14 @@ public class QmdReportManagementControllerService { * IQC版本号查询 */ public List searchIqcVersions(QmdReportManagementQO.IqcVersionQO request) { + List materialIds = getIqcMaterialIds(request.getMaterialNo()); + if (CollectionUtil.isEmpty(materialIds)) { + return Collections.emptyList(); + } + return inspectionStandardService.lambdaQuery() .select(QmsInspectionStandard::getVersion) - .eq(QmsInspectionStandard::getMaterialId, request.getMaterialId()) + .in(QmsInspectionStandard::getMaterialId, materialIds) .list() .stream() .map(QmsInspectionStandard::getVersion) @@ -251,6 +262,17 @@ public class QmdReportManagementControllerService { .toList(); } + private List getIqcMaterialIds(String materialNo) { + return qcMaterialService.lambdaQuery() + .select(QmsQcMaterial::getId) + .eq(QmsQcMaterial::getMaterialNo, materialNo) + .list() + .stream() + .map(QmsQcMaterial::getId) + .filter(Objects::nonNull) + .toList(); + } + private Map getPdiComponentMap(List items) { Set componentIds = items.stream() .map(QmsPdiDetectionRulesStatusItem::getComponentsId) diff --git a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmdReportManagementQO.java b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmdReportManagementQO.java index b66539e3..cf04988a 100644 --- a/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmdReportManagementQO.java +++ b/nflg-wms-common/src/main/java/com/nflg/wms/common/pojo/qo/QmdReportManagementQO.java @@ -14,11 +14,11 @@ public class QmdReportManagementQO { public static class IqcReportQO { /** - * 物料ID + * 物料编号 */ - @JsonAlias("material_id") - @NotNull(message = "物料ID不能为空") - private Long materialId; + @JsonAlias("material_no") + @NotBlank(message = "物料编号不能为空") + private String materialNo; /** * 版本号 @@ -31,11 +31,11 @@ public class QmdReportManagementQO { public static class IqcVersionQO { /** - * 物料ID + * 物料编号 */ - @JsonAlias("material_id") - @NotNull(message = "物料ID不能为空") - private Long materialId; + @JsonAlias("material_no") + @NotBlank(message = "物料编号不能为空") + private String materialNo; } @Data From cd7149b5b7a1d26c3af5176e1bedf3a6a462fb27 Mon Sep 17 00:00:00 2001 From: yf001217 <834502597@qq.com> Date: Tue, 9 Jun 2026 16:03:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?pqc=E6=A3=80=E6=B5=8B=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QmsPqcInspectionRuleController.java | 20 ++++ ...QmsPqcInspectionRuleControllerService.java | 12 ++ ...qcInspectionRuleControllerServiceImpl.java | 109 ++++++++++++++++++ 3 files changed, 141 insertions(+) diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/controller/QmsPqcInspectionRuleController.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/controller/QmsPqcInspectionRuleController.java index 43250160..58b201d8 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/controller/QmsPqcInspectionRuleController.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/controller/QmsPqcInspectionRuleController.java @@ -5,12 +5,14 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO; +import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO; import com.nflg.qms.admin.service.QmsPqcInspectionRuleControllerService; import com.nflg.wms.common.constant.Constant; import com.nflg.wms.common.pojo.ApiResult; import com.nflg.wms.common.pojo.PageData; import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO; +import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO; import com.nflg.wms.common.util.MultilingualUtil; import com.nflg.wms.repository.entity.DictionaryItem; import com.nflg.wms.repository.service.IDictionaryItemService; @@ -18,6 +20,7 @@ import com.nflg.wms.starter.BaseController; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -132,6 +135,23 @@ public class QmsPqcInspectionRuleController extends BaseController { return ApiResult.success(result); } + /** + * 根据机型编号查询该机型最新启用PQC规则下的检查点列表 + */ + @GetMapping("/points") + public ApiResult> listPointsByModelNo(@NotNull String modelNo) { + return ApiResult.success(ruleControllerService.listPointsByModelNo(modelNo)); + } + + /** + * 根据检查点ID查询对应的检测项列表(分组返回) + * 返回三类:关键物料拍照类、工序检查-自检复核类、工序检查-QC检测类 + */ + @GetMapping("/items") + public ApiResult listItemsByInspectionPointId(@NotNull Long inspectionPointId) { + return ApiResult.success(ruleControllerService.listItemsByInspectionPointIdGrouped(inspectionPointId)); + } + /** * 获取步装字典 */ diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsPqcInspectionRuleControllerService.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsPqcInspectionRuleControllerService.java index f83baff0..9115774f 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsPqcInspectionRuleControllerService.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/QmsPqcInspectionRuleControllerService.java @@ -5,11 +5,13 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAddQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO; +import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO; import com.nflg.wms.common.pojo.PageData; import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO; +import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO; import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; @@ -69,6 +71,16 @@ public interface QmsPqcInspectionRuleControllerService { */ Long deletePoint(Long pointId); + + + List listPointsByModelNo(String modelNo); + + /** + * 根据检查点ID查询检测项列表(分组返回) + */ + QmsPqcInspectionPointItemsGroupedVO listItemsByInspectionPointIdGrouped(Long inspectionPointId); + + /** * 导入PQC检测规则 * @param file Excel文件 diff --git a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/impl/QmsPqcInspectionRuleControllerServiceImpl.java b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/impl/QmsPqcInspectionRuleControllerServiceImpl.java index 1aa4b432..8504e08d 100644 --- a/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/impl/QmsPqcInspectionRuleControllerServiceImpl.java +++ b/nflg-qms-admin/src/main/java/com/nflg/qms/admin/service/impl/QmsPqcInspectionRuleControllerServiceImpl.java @@ -11,6 +11,7 @@ import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleAuditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleEditQO; import com.nflg.qms.admin.pojo.qo.PqcInspectionRuleSearchQO; import com.nflg.qms.admin.pojo.vo.PqcInspectionPointItemVO; +import com.nflg.qms.admin.pojo.vo.PqcInspectionPointListVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionPointVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleDetailVO; import com.nflg.qms.admin.pojo.vo.PqcInspectionRuleVO; @@ -22,6 +23,8 @@ import com.nflg.wms.common.pojo.PageData; import com.nflg.wms.common.pojo.dto.PqcInspectionRuleExportDTO; import com.nflg.wms.common.pojo.dto.PqcInspectionRuleImportDTO; import com.nflg.wms.common.pojo.qo.PqcInspectionRuleExportQO; +import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemListVO; +import com.nflg.wms.common.pojo.vo.QmsPqcInspectionPointItemsGroupedVO; import com.nflg.wms.common.util.DateTimeUtil; import com.nflg.wms.common.util.EecExcelUtil; import com.nflg.wms.common.util.PageUtil; @@ -90,6 +93,87 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti @Resource private IFileUploadRecordService fileUploadRecordService; + @Override + public QmsPqcInspectionPointItemsGroupedVO listItemsByInspectionPointIdGrouped(Long inspectionPointId) { + // 查询所有检测项 + List allItems = itemsService.lambdaQuery() + .eq(QmsPqcInspectionPointItems::getInspectionCodeId, inspectionPointId) + .orderByAsc(QmsPqcInspectionPointItems::getSort) + .list(); + + // 初始化三个分类列表 + List materialItems = new ArrayList<>(); // 第1类:关键物料拍照 + List selfReviewItems = new ArrayList<>(); // 第2类:工序检查-自检复核 + List qcItems = new ArrayList<>(); // 第3类:工序检查-QC检测 + + // 分类逻辑 + for (QmsPqcInspectionPointItems item : allItems) { + QmsPqcInspectionPointItemListVO vo = new QmsPqcInspectionPointItemListVO() + .setId(item.getId()) + .setInspectionCodeId(item.getInspectionCodeId()) + .setSort(item.getSort()) + .setInspectionContent(item.getInspectionContent()) + .setInspectionType(item.getInspectionType()) + .setInspectionMethods(item.getInspectionMethods()) + .setInspectionImgUrl(item.getInspectionImgUrl()) + .setInspectionLevel(item.getInspectionLevel()); + + Integer type = item.getInspectionType(); + Integer level = item.getInspectionLevel(); + + // 第1类:关键物料拍照类 + // 包含:inspectionType = 0(所有)+ inspectionType = 2(所有) + if (type == 0 || type == 2) { + materialItems.add(vo); + } + + // 第2类和第3类:工序检查(按类型和星级分) + // 包含:inspectionType = 1 或 2 + if (type == 1 || type == 2) { + if (level == 1 || level == 2) { + // 星级1或2 → 自检复核类 + selfReviewItems.add(vo); + } else if (level == 3) { + // 星级3 → QC检测类 + qcItems.add(vo); + } + } + } + + // 组装返回结果 + QmsPqcInspectionPointItemsGroupedVO groupedVO = new QmsPqcInspectionPointItemsGroupedVO(); + groupedVO.setMaterialItems(materialItems); + groupedVO.setSelfReviewItems(selfReviewItems); + groupedVO.setQcItems(qcItems); + + return groupedVO; + } + + /** + * 保存检查点和检查项 + */ + @Override + public List listPointsByModelNo(String modelNo) { + QmsPqcInspectionRule latestRule = ruleService.lambdaQuery() + .eq(QmsPqcInspectionRule::getModelNo, modelNo) + .eq(QmsPqcInspectionRule::getIsDisabled, true) + .orderByDesc(QmsPqcInspectionRule::getRuleVersion) + .last("LIMIT 1") + .one(); + if (latestRule == null) { + return Collections.emptyList(); + } + return pointService.lambdaQuery() + .eq(QmsPqcInspectionPoint::getPqcRuleId, latestRule.getId()) + .list() + .stream() + .map(point -> new PqcInspectionPointListVO() + .setId(point.getId()) + .setInspectionPointCode(point.getInspectionPointCode()) + .setInspectionPointName(point.getInspectionPointName())) + .collect(Collectors.toList()); + } + @Override public PageData search(PqcInspectionRuleSearchQO qo) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -393,6 +477,31 @@ public class QmsPqcInspectionRuleControllerServiceImpl implements QmsPqcInspecti return rule != null ? rule.getId() : null; } + public List getCurrentValidPoints(String modelNo) { + QmsPqcInspectionRule rule = ruleService.lambdaQuery() + .eq(QmsPqcInspectionRule::getModelNo, modelNo) + .eq(QmsPqcInspectionRule::getIsDisabled, true) + .eq(QmsPqcInspectionRule::getAuditStatus, 1) + .orderByDesc(QmsPqcInspectionRule::getRuleVersion) + .orderByDesc(QmsPqcInspectionRule::getCreateTime) + .last("LIMIT 1") + .one(); + if (Objects.isNull(rule)) { + return Collections.emptyList(); + } + + return pointService.lambdaQuery() + .eq(QmsPqcInspectionPoint::getPqcRuleId, rule.getId()) + .orderByAsc(QmsPqcInspectionPoint::getId) + .list() + .stream() + .map(point -> new PqcInspectionPointListVO() + .setId(point.getId()) + .setInspectionPointCode(point.getInspectionPointCode()) + .setInspectionPointName(point.getInspectionPointName())) + .toList(); + } + // ========================= 私有方法 ========================= /**