From 3fe20a24a27fd107de1f48773324daf15b7e1b01 Mon Sep 17 00:00:00 2001 From: haoliang <821644@qq.com> Date: Sat, 16 May 2026 01:08:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A7=E9=87=8F=E4=B8=BA0?= =?UTF-8?q?=E6=97=B6=E6=8E=92=E8=A1=8C=E5=92=8C=E5=9B=BE=E8=A1=A8=E4=BB=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=A0=E6=84=8F=E4=B9=89=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CncRepository/Impl/Dashboard/DashboardRepository.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CncRepository/Impl/Dashboard/DashboardRepository.cs b/src/CncRepository/Impl/Dashboard/DashboardRepository.cs index 2cd4dad..74b28eb 100644 --- a/src/CncRepository/Impl/Dashboard/DashboardRepository.cs +++ b/src/CncRepository/Impl/Dashboard/DashboardRepository.cs @@ -95,8 +95,9 @@ namespace CncRepository.Impl.Dashboard COALESCE(SUM(ad.day_quantity), 0) AS Quantity, (CASE WHEN m.last_ping_time IS NOT NULL AND m.last_ping_time >= NOW() - INTERVAL 20 SECOND THEN 1 ELSE 0 END) AS Status, (SELECT program_name FROM cnc_daily_production - WHERE machine_id = m.id AND production_date = CURDATE() - ORDER BY id DESC LIMIT 1) AS Program + WHERE machine_id = m.id AND production_date = CURDATE() + AND end_total_count > base_total_count + ORDER BY id DESC LIMIT 1) AS Program FROM cnc_machine m LEFT JOIN ( SELECT machine_id, production_date, @@ -187,6 +188,7 @@ namespace CncRepository.Impl.Dashboard FROM cnc_daily_production WHERE production_date BETWEEN @StartDate AND @EndDate GROUP BY program_name + HAVING SUM(end_total_count - base_total_count) > 0 ORDER BY TotalQuantity {orderBy} LIMIT @Top"; var rows = conn.Query(sql, new { StartDate = startDate, EndDate = endDate, Top = top }).ToList(); @@ -206,6 +208,7 @@ namespace CncRepository.Impl.Dashboard FROM cnc_daily_production WHERE production_date BETWEEN @StartDate AND @EndDate GROUP BY program_name + HAVING SUM(end_total_count - base_total_count) > 0 ORDER BY TotalQuantity DESC LIMIT @Top"; var rows = conn.Query(sql, new { StartDate = startDate, EndDate = endDate, Top = top }).ToList();