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;