半夜歸檔部分註解掉,保留winfrom的歸檔動作
This commit is contained in:
parent
be9b7880d3
commit
b591fca836
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user