From 61ef4d71dbb7315bd423bd0babacea5e5415b637 Mon Sep 17 00:00:00 2001 From: haoliang <821644@qq.com> Date: Sat, 16 May 2026 01:25:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=91=98=E5=B7=A5=E4=BA=A7?= =?UTF-8?q?=E9=87=8F=E4=B8=BA0=E6=97=B6=E6=98=8E=E7=BB=86=E5=92=8C?= =?UTF-8?q?=E9=A5=BC=E5=9B=BE=E4=BB=8D=E6=98=BE=E7=A4=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CncRepository/Impl/DailyProductionRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CncRepository/Impl/DailyProductionRepository.cs b/src/CncRepository/Impl/DailyProductionRepository.cs index 34e656a..132728c 100644 --- a/src/CncRepository/Impl/DailyProductionRepository.cs +++ b/src/CncRepository/Impl/DailyProductionRepository.cs @@ -173,7 +173,7 @@ namespace CncRepository.Impl var parameters = new DynamicParameters(); parameters.Add("Start", startDate); parameters.Add("End", endDate); if (workerId.HasValue) { sql += " AND w.id = @WorkerId"; parameters.Add("WorkerId", workerId.Value); } - sql += " GROUP BY w.id, w.name ORDER BY TotalQuantity DESC"; + sql += " GROUP BY w.id, w.name HAVING COALESCE(SUM(dp.end_total_count - dp.base_total_count), 0) > 0 ORDER BY TotalQuantity DESC"; var items = conn.Query(sql, parameters).ToList(); if (items.Count > 0) { int grandTotal = items.Sum(x => x.TotalQuantity); for (int i = 0; i < items.Count; i++) { items[i].Rank = i + 1; if (grandTotal > 0) items[i].Percentage = Math.Round((decimal)items[i].TotalQuantity / grandTotal * 100, 1); } } return items;