From 07c15adc14f24bcaf2448a9118a43f15500d7331 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Sat, 8 Nov 2025 16:36:14 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E4=BA=A7=E9=87=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=8F=96=E6=B6=88=E5=B7=B2=E5=AE=8C=E6=88=90=E7=AD=9B?= =?UTF-8?q?=E9=80=89=EF=BC=8C=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HighWayIot.Repository/service/ZxDailyReportService.cs | 3 ++- HighWayIot.Winform/Business/MonitorDataRefreshBusiness.cs | 2 +- .../UserControlPages/MonitorMainPages/MonitorMainPage.cs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/HighWayIot.Repository/service/ZxDailyReportService.cs b/HighWayIot.Repository/service/ZxDailyReportService.cs index 2dee2a1..910b39d 100644 --- a/HighWayIot.Repository/service/ZxDailyReportService.cs +++ b/HighWayIot.Repository/service/ZxDailyReportService.cs @@ -83,11 +83,12 @@ namespace HighWayIot.Repository.service { try { + DateTime useTime = DateTime.Now - TimeSpan.FromMinutes(60); ZxDailyReportEntity entity = _repository.AsQueryable() .OrderByDescending(x => x.StartTime) //取最近一小时内未完成的数据,防止取到很久以前的数据 - .First(x => x.DeviceNo == rgvNo && x.IsDone == 0 && x.StartTime > (DateTime.Now - TimeSpan.FromMinutes(60))); + .First(x => x.DeviceNo == rgvNo && x.IsDone == 0 && x.StartTime > useTime); return entity; } catch (Exception ex) diff --git a/HighWayIot.Winform/Business/MonitorDataRefreshBusiness.cs b/HighWayIot.Winform/Business/MonitorDataRefreshBusiness.cs index a70a7ee..91d2be9 100644 --- a/HighWayIot.Winform/Business/MonitorDataRefreshBusiness.cs +++ b/HighWayIot.Winform/Business/MonitorDataRefreshBusiness.cs @@ -29,7 +29,7 @@ namespace HighWayIot.Winform.Business public MonitorDataRefreshBusiness() { // 启动定时器,每隔1秒刷新一次报表数据 - refreshTimer = new System.Threading.Timer(RefreshData, null, 0, 1600); + refreshTimer = new Timer(RefreshData, null, 0, 1600); } /// diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs index e58bbd8..ddd2ccc 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs @@ -234,9 +234,9 @@ namespace HighWayIot.Winform.UserControlPages MonitorDataGridView.DataSource = _monitorDataSources; MonitorDataGridView.CellFormatting += MonitorDataGridView_CellFormatting; - int daycount = dailyEntity.Count(x => x.StartTime >= DayStartTime && x.StartTime <= DayEndTine && x.IsDone == 1); + int daycount = dailyEntity.Count(x => x.StartTime >= DayStartTime && x.StartTime <= DayEndTine); DayProductNumTextBox.Text = daycount.ToString(); - int nightcount = dailyEntity.Count(x => x.StartTime >= NightStartTime && x.StartTime <= NightEndTime && x.IsDone == 1); + int nightcount = dailyEntity.Count(x => x.StartTime >= NightStartTime && x.StartTime <= NightEndTime); NightProductNumTextBox.Text = nightcount.ToString(); NowDateProductNumTextBox.Text = dailyEntity.Count(x => x.StartTime >= LastDayStartTime && x.StartTime <= LastNightEndTime).ToString();