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();