From ccd29ae8401b29476448718fe7cad76975a2f53b Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Tue, 30 Aug 2022 09:37:08 +0800 Subject: [PATCH] =?UTF-8?q?solar=5FApp:=20=E4=BF=AE=E6=94=B9=E7=95=B0?= =?UTF-8?q?=E5=B8=B8=E5=90=8C=E6=AD=A5=E7=9A=84=E5=88=A4=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- solarApp/fmArchive.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 1ef2021..96ba532 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -19,6 +19,7 @@ namespace solarApp System.Timers.Timer _timer; bool autoTask = false; //測試自動跑 irrDayHour 累計日照小時差異 procSyncError svc = new procSyncError(); // 異常資料同步 + DateTime doTimerTaskTime = DateTime.Now; public fmArchive() { InitializeComponent(); @@ -113,12 +114,14 @@ namespace solarApp dtSelect1.Value = System.DateTime.Now.AddDays(-1); dtSelect2.Value = System.DateTime.Now.AddDays(-1); bt_archive.PerformClick(); + autoTask = false; //bt_archive_Click.PerformClick(); } //異常處理 每 5分鐘跑一次 - if ((DateTime.Now.Minute % 5) == 0 && (DateTime.Now.Second) < 30 && autoTask == false) + if ( DateTime.Now.Hour >= 05 && (DateTime.Now.Minute % 5) == 0 && (DateTime.Now.Second) < 30 && (autoTask == false || (DateTime.Now - doTimerTaskTime).TotalMinutes > 30)) { + doTimerTaskTime = DateTime.Now; autoTask = true; lbMsgTitle.Text = "異常處理 " + DateTime.Now.ToString() + " timer start"; btSyncErr.PerformClick(); @@ -319,7 +322,7 @@ namespace solarApp invSvc.report_invDay(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd")); } } - autoTask = true; + lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!"; }