solar_App: 修改異常同步的判斷

This commit is contained in:
wanling040@gmail.com 2022-08-30 09:37:08 +08:00
parent 08d888117e
commit ccd29ae840

View File

@ -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() + " 完成!";
}