From f57a9de2dbe69e7f867b39c25abdab58b401a2df Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期六, 07 十一月 2026 16:01:32 +0800
Subject: [PATCH] fix(mes): 过滤异常未来遥测时间
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/template/MesQcTemplateItemServiceImpl.java | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/template/MesQcTemplateItemServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/template/MesQcTemplateItemServiceImpl.java
index 2b49345..c46144c 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/template/MesQcTemplateItemServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/qc/template/MesQcTemplateItemServiceImpl.java
@@ -7,9 +7,11 @@
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO;
+import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateItemDO;
import cn.iocoder.yudao.module.mes.dal.mysql.qc.template.MesQcTemplateItemMapper;
+import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -26,7 +28,7 @@
/**
* MES 璐ㄦ鏂规-浜у搧鍏宠仈 Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -38,6 +40,8 @@
@Resource
@Lazy
private MesQcTemplateService templateService;
+ @Resource
+ private MesMdItemService mesMdItemService;
@Override
public Long createTemplateItem(MesQcTemplateItemSaveReqVO createReqVO) {
@@ -112,8 +116,17 @@
@Override
public MesQcTemplateItemDO getRequiredTemplateByItemIdAndType(Long itemId, Integer qcType) {
+ if (itemId == null) {
+ throw exception(QC_NO_TEMPLATE);
+ }
// 1. 鏌ュ嚭 itemId 鍏宠仈鐨勬墍鏈� templateItem
- List<MesQcTemplateItemDO> templateItems = templateItemMapper.selectListByItemId(itemId);
+ // 鍏煎涓ゅ鐗╂枡 ID锛氳川妫�/浠撳偍鍗曟嵁浼犲叆 mdm_item.id锛孭RO 宸ュ崟/浠诲姟浼犲叆 mes_md_item.id
+ Long templateItemId = itemId;
+ MesMdItemDO mesItem = mesMdItemService.getItem(itemId);
+ if (mesItem != null && mesItem.getMdmItemId() != null) {
+ templateItemId = mesItem.getMdmItemId();
+ }
+ List<MesQcTemplateItemDO> templateItems = templateItemMapper.selectListByItemId(templateItemId);
if (CollUtil.isEmpty(templateItems)) {
throw exception(QC_NO_TEMPLATE);
}
--
Gitblit v1.9.3