From 7857b1c5f18976b39a0083cbd30b8a04782961cb Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Sat, 11 Oct 2025 15:19:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(mes):=20=E6=B7=BB=E5=8A=A0=E5=9C=A8?= =?UTF-8?q?=E5=88=B6=E5=93=81=E8=B7=9F=E8=B8=AA=E6=8A=A5=E8=A1=A8=E6=80=BB?= =?UTF-8?q?=E6=95=B0=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ProdReportMapper 中新增 wipTrackingReportCount 方法- 在 ProdReportMapper.xml 中添加对应的 SQL 查询语句- 在 ProdReportServiceImpl 中调用新方法以恢复分页总条数显示- 优化分页查询逻辑,关闭自动 count 避免复杂 SQL 解析失败 - 添加异常处理确保简化版 count 失败不影响列表数据返回 --- .../dromara/mes/mapper/ProdReportMapper.java | 5 ++++ .../service/impl/ProdReportServiceImpl.java | 15 +++++++++- .../resources/mapper/mes/ProdReportMapper.xml | 29 ++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdReportMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdReportMapper.java index 8dafbf7f..24cb9413 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdReportMapper.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdReportMapper.java @@ -118,6 +118,11 @@ public interface ProdReportMapper { */ List wipTrackingReportList(@Param("map") Map hashMap); + /** + * 在制品跟踪报表总数(简化版 count) + */ + Long wipTrackingReportCount(@Param("map") Map hashMap); + /** * 获取订单的工序进度详情(单订单) */ diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdReportServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdReportServiceImpl.java index 00843d80..4378a870 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdReportServiceImpl.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdReportServiceImpl.java @@ -209,11 +209,24 @@ public class ProdReportServiceImpl implements IProdReportService { @Override public TableDataInfo wipTrackingReportList(Map hashMap, PageQuery pageQuery) { // 使用优化后的SQL查询,大部分计算已在数据库层完成 - Page page = prodReportMapper.wipTrackingReportList(hashMap, pageQuery.build()); + // 关闭自动 count,避免对复杂 CTE SQL 的解析失败 + Page mpPage = pageQuery.build(); + mpPage.setSearchCount(false); + Page page = prodReportMapper.wipTrackingReportList(hashMap, mpPage); // 批量获取工序进度信息以提升性能 enrichWithProcessProgressBatch(page.getRecords()); + // 使用简化版 count SQL 统计总数,恢复分页总条数显示 + try { + Long total = prodReportMapper.wipTrackingReportCount(hashMap); + if (total != null) { + page.setTotal(total); + } + } catch (Exception ignore) { + // 简化 count 失败时不影响列表数据返回 + } + return TableDataInfo.build(page); } diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdReportMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdReportMapper.xml index 096411ca..b6496ee0 100644 --- a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdReportMapper.xml +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdReportMapper.xml @@ -400,7 +400,7 @@ o.plan_end_time AS planEndTime, GETDATE() AS currentTime, CAST(ISNULL(ps.totalProcessCount, 0) AS VARCHAR(10)) + '道' AS totalProcessCount, - -- 清理工序名称中的多余逗号和空格 + LTRIM(RTRIM(REPLACE(REPLACE(ISNULL(ps.wipProcessNames, ''), ',,', ','), ',', ','))) AS wipProcesses, LTRIM(RTRIM(REPLACE(REPLACE(ISNULL(ps.remainingProcessNames, ''), ',,', ','), ',', ','))) AS remainingProcesses, -- 整体进度计算:已完成数量占比 + 在制品进度占比 @@ -462,6 +462,33 @@ ORDER BY o.order_code DESC + + +