半夜歸檔部分註解掉,保留winfrom的歸檔動作

This commit is contained in:
wanling040@gmail.com 2022-08-24 10:31:10 +08:00
parent be9b7880d3
commit b591fca836

View File

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