確認歸檔流程

This commit is contained in:
cesar liu 2022-08-24 09:47:17 +08:00
parent b3b1f1a5b5
commit 70e76c6160

View File

@ -102,6 +102,11 @@ namespace solarApp
// //
} }
/// <summary>
/// timer 觸發
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
//每日歸檔 //每日歸檔
@ -120,10 +125,10 @@ namespace solarApp
if ((DateTime.Now.Minute % 5) == 0 && autoTask == false) if ((DateTime.Now.Minute % 5) == 0 && autoTask == false)
{ {
autoTask = true; autoTask = true;
lbMsgTitle.Text = "異常處理 " + DateTime.Now.ToString() + " timer start"; lbMsgTitle.Text = "異常處理 " + DateTime.Now.ToString() + " timer start";
btSyncErr.PerformClick(); btSyncErr.PerformClick();
lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString() ; lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString();
autoTask = false; autoTask = false;
} }
@ -308,6 +313,8 @@ namespace solarApp
invSvc.report_invDay(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd")); invSvc.report_invDay(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd"));
} }
} }
#region
sensorSvc.isFirst = true; sensorSvc.isFirst = true;
foreach (var item in site_list) foreach (var item in site_list)
{ {
@ -318,7 +325,8 @@ namespace solarApp
sensorSvc.isFirst = false; sensorSvc.isFirst = false;
} }
} }
#endregion
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!"; lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!";
} }
@ -579,8 +587,12 @@ namespace solarApp
MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼 MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼 MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式 MyMail.IsBodyHtml = true; //是否使用html格式
var kkk = $"FIC 太陽能電站管理系統通知 <{tbUserName.Text.Trim()}>"; if (tbUserName.Text.Trim().Length > 0)
MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人 {
var kkk = $"FIC 太陽能電站管理系統通知 <{tbUserName.Text.Trim()}>";
MyMail.From = new System.Net.Mail.MailAddress(tbUserName.Text.Trim()); //寄件人
}
foreach (var email in recipientEmails) foreach (var email in recipientEmails)
{ {
MyMail.To.Add(email); //設定收件者Email MyMail.To.Add(email); //設定收件者Email
@ -611,7 +623,8 @@ namespace solarApp
if (CanDoSend) if (CanDoSend)
{ {
SMTPConfig smtp = new SMTPConfig(); ; SMTPConfig smtp = new SMTPConfig(); ;
smtp.Host = "smtp.gmail.com"; //smtp.Host = "smtp.gmail.com";
smtp.Host = "msa.hinet.net";
//smtp.UserName = "ficgreen01@gmail.com"; //smtp.UserName = "ficgreen01@gmail.com";
//smtp.Password = "qwe2015qwe"; //smtp.Password = "qwe2015qwe";
//smtp.UserName = "ficgreen02@gmail.com"; //smtp.UserName = "ficgreen02@gmail.com";
@ -620,8 +633,13 @@ namespace solarApp
//smtp.Password = "wswgnluvoodfexrb"; //smtp.Password = "wswgnluvoodfexrb";
//smtp.EnableSsl = true; //smtp.EnableSsl = true;
//smtp.Port = 587; //smtp.Port = 587;
smtp.UserName = tbUserName.Text; if (tbUserName.Text.Trim().Length > 0)
smtp.Password = tbPassword.Text; {
smtp.UserName = tbUserName.Text;
smtp.Password = tbPassword.Text;
}
//smtp.UserName = tbUserName.Text;
//smtp.Password = tbPassword.Text;
if (rbSSL.Checked) if (rbSSL.Checked)
{ {
smtp.EnableSsl = true; smtp.EnableSsl = true;