同步程式

This commit is contained in:
cesar liu 2022-08-31 10:04:01 +08:00
commit 048d983d29
6 changed files with 210 additions and 167 deletions

View File

@ -786,114 +786,114 @@ namespace SolarPower.Quartz.Jobs
}
#endregion
// end from here
#region
var gobackDay = this.Configuration.GetValue<int>("GoBackDay"); //回推天數
var Connection_string = Configuration.GetValue<string>("mySql");
var start_date = DateTimeNow.AddDays(-1 * gobackDay);
var end_date = DateTimeNow.AddDays(-1);
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行補償機制】");
procSensorSvc sensorSvc = new procSensorSvc(Connection_string);
procInvSvc invSvc = new procInvSvc(Connection_string, logger);
procStationSvc siteSvc = new procStationSvc(Connection_string);
foreach (var powerStation in powerStations)
{
start_date = DateTimeNow.AddDays(-1 * gobackDay);
for (; start_date <= end_date; start_date = start_date.AddDays(1))
{
var day_str = start_date.ToString("yyyy-MM-dd");
#region Sensor
try
{
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
sensorSvc.archiveData(powerStation.Code, day_str);
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
}
catch (Exception exception)
{
logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
#endregion
//#region 補償機
//var gobackDay = this.Configuration.GetValue<int>("GoBackDay"); //回推天數
//var Connection_string = Configuration.GetValue<string>("mySql");
//var start_date = DateTimeNow.AddDays(-1 * gobackDay);
//var end_date = DateTimeNow.AddDays(-1);
//logger.LogInformation("【CalcAvgPowerStationJob】【開始執行補償機制】");
//procSensorSvc sensorSvc = new procSensorSvc(Connection_string);
//procInvSvc invSvc = new procInvSvc(Connection_string, logger);
//procStationSvc siteSvc = new procStationSvc(Connection_string);
//foreach (var powerStation in powerStations)
//{
// start_date = DateTimeNow.AddDays(-1 * gobackDay);
// for (; start_date <= end_date; start_date = start_date.AddDays(1))
// {
// var day_str = start_date.ToString("yyyy-MM-dd");
// #region 歸檔 Sensor
// try
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
// sensorSvc.archiveData(powerStation.Code, day_str);
// logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
// }
// catch (Exception exception)
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str);
// logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
// if (exception.InnerException != null)
// {
// logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
// }
// }
// #endregion
#region
try
{
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
sensorSvc.archiveMeterData(powerStation.Code, day_str);
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
}
catch (Exception exception)
{
logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
#endregion
// #region 歸檔 電錶
// try
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
// sensorSvc.archiveMeterData(powerStation.Code, day_str);
// logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
// }
// catch (Exception exception)
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str);
// logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
// if (exception.InnerException != null)
// {
// logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
// }
// }
// #endregion
#region Inv
try
{
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
invSvc.archiveData(powerStation.Code, day_str);
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
}
catch (Exception exception)
{
logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
#endregion
// #region 歸檔 Inv
// try
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
// invSvc.archiveData(powerStation.Code, day_str);
// logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
// }
// catch (Exception exception)
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str);
// logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
// if (exception.InnerException != null)
// {
// logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
// }
// }
// #endregion
#region Station hour
try
{
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
siteSvc.archiveData(powerStation.Code, day_str);
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
}
catch (Exception exception)
{
logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
#endregion
// #region 歸檔 Station hour
// try
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
// siteSvc.archiveData(powerStation.Code, day_str);
// logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
// }
// catch (Exception exception)
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str);
// logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
// if (exception.InnerException != null)
// {
// logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
// }
// }
// #endregion
#region
try
{
logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
invSvc.report_invDay(powerStation.Code, day_str);
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
}
catch (Exception exception)
{
logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
#endregion
}
}
logger.LogInformation("【CalcAvgPowerStationJob】【執行完成補償機制】");
#endregion
// #region 製作日報表
// try
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
// invSvc.report_invDay(powerStation.Code, day_str);
// logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
// }
// catch (Exception exception)
// {
// logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str);
// logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
// if (exception.InnerException != null)
// {
// logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
// }
// }
// #endregion
// }
//}
//logger.LogInformation("【CalcAvgPowerStationJob】【執行完成補償機制】");
//#endregion

View File

@ -53,8 +53,7 @@ namespace SolarPower.Quartz.Jobs
x.priority == 2 &&
(DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes_Priority2).ToList();
var ExceptionListex3 = ExceptionList.Where(x => x.sourceState == 1 &&
x.priority == 3 &&
var ExceptionListex3 = ExceptionList.Where(x => x.priority == 3 &&
(DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes_Priority3).ToList();
ExceptionListex.AddRange(ExceptionListex2);
ExceptionListex.AddRange(ExceptionListex3);
@ -63,24 +62,37 @@ namespace SolarPower.Quartz.Jobs
{
var UserListWithPowerstation = await overviewRepository.GetUserListWithPowerstation(Exception.PowerStationId);
var Content = $"電站名稱:{Exception.PowerStationName}" + "<br>" +
$"設備編號:{Exception.errDevice}" + "<br>" +
$"異常ID編號:{Exception.id}" + "<br>" +
//var Content = $"電站名稱:{Exception.PowerStationName}" + "<br>" +
// $"設備編號:{Exception.errDevice}" + "<br>" +
// $"異常ID編號:{Exception.id}" + "<br>" +
// $"異常類別:{Exception.alarmClassName}" + "<br>" +
// $"異常訊息:{Exception.errMsg}" + "<br>";
//if(Exception.errMsgT == "d")
//{
// Content += $"當前數值:{Exception.errValue}" + "<br>";
//}
//Content += $"發生時間:{Exception.dev_time}";
var Content = $"發生時間:{Exception.dev_time}" + "<br>" +
$"電站名稱:{Exception.PowerStationName}" + "<br>" +
$"異常類別:{Exception.alarmClassName}" + "<br>" +
$"設備訊息:{Exception.errMsg}" + "<br>";
if(Exception.errMsgT == "d")
$"異常訊息:{Exception.errMsg}" + "<br>" +
$"設備編號:{Exception.errDevice}" + "<br>" +
$"異常編號:{Exception.id}" + "<br>";
if (Exception.errMsgT == "d")
{
Content += $"當前數值:{Exception.errValue}" + "<br>";
}
Content += $"發生時間:{Exception.dev_time}";
foreach (var user in UserListWithPowerstation)
{
var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
string companyName = getCompany.Result;
NoticeSchedule DaySchedule = new NoticeSchedule()
{
UserId = user.Id,
EmailType = 4,
RecipientEmail = user.Email,
Subject = "異常通知",
Subject = "太陽能監控系統異常通知-" + Exception.PowerStationName + "-" + Exception.alarmClassName,
Content = Content,
RecipientName = user.Name,
Type = 1,

View File

@ -250,6 +250,9 @@ namespace SolarPower.Quartz.Jobs
var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented));
if (stationReportName != "")
{
var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
string companyName = getCompany.Result;
if (user.Email != null && IsValidEmail(user.Email))
{
NoticeSchedule DaySchedule = new NoticeSchedule()
@ -257,7 +260,7 @@ namespace SolarPower.Quartz.Jobs
UserId = user.Id,
EmailType = 0,
RecipientEmail = user.Email,
Subject = "日報表",
Subject = companyName + "-太陽能監控系統-日報表",
Attachment = stationReportName,
RecipientName = user.Name,
Type = 1
@ -290,12 +293,14 @@ namespace SolarPower.Quartz.Jobs
var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented));
if (user.Email != null && IsValidEmail(user.Email))
{
var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
string companyName = getCompany.Result;
NoticeSchedule MaxSchedule = new NoticeSchedule()
{
UserId = user.Id,
EmailType = 2,
RecipientEmail = user.Email,
Subject = "綜合報表",
Subject = companyName + "-太陽能監控系統-綜合報表",
Attachment = stationMaxReportName,
RecipientName = user.Name,
Type = 1
@ -326,10 +331,12 @@ namespace SolarPower.Quartz.Jobs
var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented));
if (user.Email != null && IsValidEmail(user.Email))
{
var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
string companyName = getCompany.Result;
NoticeSchedule MaxmonthSchedule = new NoticeSchedule()
{
RecipientEmail = user.Email,
Subject = "綜合報表",
Subject = companyName + "-太陽能監控系統-綜合報表",
Attachment = stationReportmaxmonthName,
RecipientName = user.Name,
Type = 1,
@ -372,10 +379,12 @@ namespace SolarPower.Quartz.Jobs
{
if (user.Email != null && IsValidEmail(user.Email))
{
var getCompany = noticeScheduleRepository.GetCompanyNameById(user.Id);
string companyName = getCompany.Result;
NoticeSchedule MonthSchedule = new NoticeSchedule()
{
RecipientEmail = user.Email,
Subject = "月報表",
Subject = companyName + "-太陽能監控系統-月報表",
Attachment = stationReportmonthName,
RecipientName = user.Name,
Type = 1,

View File

@ -54,11 +54,7 @@ namespace SolarPower.Quartz.Jobs
{
attachments = notice.Attachment.Split(',').ToList();
}
var getCompany = noticeScheduleRepository.GetCompanyNameById(notice.Id);
string companyName = getCompany.Result;
var result = Send(recipientEmails, notice.Subject, notice.Content, attachments, companyName);
var result = Send(recipientEmails, notice.Subject, notice.Content, attachments);
if (result.CompareTo("成功") == 0)
{
@ -99,7 +95,7 @@ namespace SolarPower.Quartz.Jobs
}
}
private string Send(List<string> recipientEmails, string subject, string content, List<string> attachments, string companyName)
private string Send(List<string> recipientEmails, string subject, string content, List<string> attachments)
{
var reason = string.Empty;
var CanDoSend = true;
@ -108,8 +104,7 @@ namespace SolarPower.Quartz.Jobs
MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式
//var kkk = $"FIC 太陽能電站管理系統通知 <{smtp.UserName}>";
var kkk = companyName + $" 太陽能電站管理系統通知 <{smtp.UserName}>";
var kkk = $"太陽能電站管理系統通知 <{smtp.UserName}>";
MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人
foreach (var email in recipientEmails)
{

View File

@ -39,7 +39,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4 active" data-toggle="tab" href="#tab-overview-uptodate" role="tab">
<i class="fal fa-monitor-heart-rate text-success"></i> <span class="hidden-sm-down ml-1">即時資訊</span>
<i class="fal fa-monitor-heart-rate text-success"></i> <span class="hidden-sm-down ml-1" id="page_UpToDate">即時資訊</span>
</a>
</li>
}
@ -48,7 +48,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-info" role="tab">
<i class="fal fa-info-square text-success"></i> <span class="hidden-sm-down ml-1">基本資料</span>
<i class="fal fa-info-square text-success"></i> <span class="hidden-sm-down ml-1" id="page_Info">基本資料</span>
</a>
</li>
}
@ -57,7 +57,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-InverterInfo" role="tab">
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">逆變器監控</span>
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1" id="page_InverterInfo">逆變器監控</span>
</a>
</li>
}
@ -66,7 +66,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-inverter" role="tab">
<i class="fal fa-analytics text-success"></i> <span class="hidden-sm-down ml-1">逆變器分析</span>
<i class="fal fa-analytics text-success"></i> <span class="hidden-sm-down ml-1" id="page_Inverter">逆變器分析</span>
</a>
</li>
}
@ -75,7 +75,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-history" role="tab">
<i class="fal fa-history text-success"></i> <span class="hidden-sm-down ml-1">歷史資料</span>
<i class="fal fa-history text-success"></i> <span class="hidden-sm-down ml-1" id="page_History">歷史資料</span>
</a>
</li>
}
@ -86,7 +86,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-exception" role="tab">
<i class="fal fa-sensor-alert text-success"></i> <span class="hidden-sm-down ml-1">異常記錄</span>
<i class="fal fa-sensor-alert text-success"></i> <span class="hidden-sm-down ml-1" id="page_Exception">異常記錄</span>
</a>
</li>
}
@ -95,7 +95,7 @@
{
<li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-operationRecord" role="tab">
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">運維記錄</span>
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1" id="page_OperationRecord">運維記錄</span>
</a>
</li>
}
@ -196,8 +196,47 @@
}
}
$(function () {
function checkPage() {
isloadingdone_uptodate = true;
isloadingdone_info = true;
isloadingdone_inverterinfo = true;
isloadingdone_inverter = true;
isloadingdone_history = true;
isloadingdone_exception = true;
isloadingdone_operation = true;
var i1 = document.getElementById("page_UpToDate");
var i2 = document.getElementById("page_Info");
var i3 = document.getElementById("page_InverterInfo");
var i4 = document.getElementById("page_Inverter");
var i5 = document.getElementById("page_History");
var i6 = document.getElementById("page_Exception");
var i7 = document.getElementById("page_OperationRecord");
if (i1 != null)
{
isloadingdone_uptodate = false;
}
if (i2 != null) {
isloadingdone_info = false;
}
if (i3 != null) {
isloadingdone_inverterinfo = false;
}
if (i4 != null) {
isloadingdone_inverter = false;
}
if (i5 != null) {
isloadingdone_history = false;
}
if (i6 != null) {
isloadingdone_exception = false;
}
if (i7 != null) {
isloadingdone_operation = false;
}
}
$(function () {
checkPage();
var url = new URL(location.href);
stationId = url.searchParams.get('stationId');

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();
@ -102,11 +103,6 @@ namespace solarApp
//
}
/// <summary>
/// timer 觸發
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//每日歸檔
@ -119,16 +115,19 @@ namespace solarApp
dtSelect2.Value = System.DateTime.Now.AddDays(-1);
bt_archive.PerformClick();
autoTask = false;
//bt_archive_Click.PerformClick();
}
//異常處理 每 5分鐘跑一次
if ((DateTime.Now.Minute % 5) == 0 && 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();
lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString();
lbMsgTitle.Text = "異常處理 done" + DateTime.Now.ToString() ;
autoTask = false;
//bt_archive_Click.PerformClick();
}
@ -310,11 +309,8 @@ namespace solarApp
sensorSvc.archiveData(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd"));
invSvc.archiveData(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd"));
siteSvc.archiveData(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;
foreach (var item in site_list)
{
@ -323,9 +319,9 @@ namespace solarApp
{
sensorSvc.archiveSensorHistoryHourData(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd"));
sensorSvc.isFirst = false;
invSvc.report_invDay(item.SiteID.Substring(0, 9), day.ToString("yyyy-MM-dd"));
}
}
#endregion
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!";
}
@ -556,7 +552,8 @@ namespace solarApp
procInvSvc invSvc = new procInvSvc();
procStationSvc siteSvc = new procStationSvc();
//foreach (var item in site_list)
//{
sensorSvc.isFirst = true;
foreach (DateTime day in EachDay(DateTime.Parse(date1), DateTime.Parse(date2)))
{
@ -567,7 +564,8 @@ namespace solarApp
siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
invSvc.report_invDay(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
}
i++;
//}
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!";
}
@ -600,12 +598,8 @@ namespace solarApp
MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式
if (tbUserName.Text.Trim().Length > 0)
{
var kkk = $"FIC 太陽能電站管理系統通知 <{tbUserName.Text.Trim()}>";
MyMail.From = new System.Net.Mail.MailAddress(tbUserName.Text.Trim()); //寄件人
}
MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人
foreach (var email in recipientEmails)
{
MyMail.To.Add(email); //設定收件者Email
@ -636,8 +630,7 @@ namespace solarApp
if (CanDoSend)
{
SMTPConfig smtp = new SMTPConfig(); ;
//smtp.Host = "smtp.gmail.com";
smtp.Host = "msa.hinet.net";
smtp.Host = "smtp.gmail.com";
//smtp.UserName = "ficgreen01@gmail.com";
//smtp.Password = "qwe2015qwe";
//smtp.UserName = "ficgreen02@gmail.com";
@ -646,13 +639,8 @@ namespace solarApp
//smtp.Password = "wswgnluvoodfexrb";
//smtp.EnableSsl = true;
//smtp.Port = 587;
if (tbUserName.Text.Trim().Length > 0)
{
smtp.UserName = tbUserName.Text;
smtp.Password = tbPassword.Text;
}
//smtp.UserName = tbUserName.Text;
//smtp.Password = tbPassword.Text;
if (rbSSL.Checked)
{
smtp.EnableSsl = true;