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 + + +