1. 加入補償機制
This commit is contained in:
parent
7fb6211db0
commit
d8ea8ceff1
@ -785,12 +785,13 @@ namespace SolarPower.Quartz.Jobs
|
||||
|
||||
#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();
|
||||
procInvSvc invSvc = new procInvSvc();
|
||||
procStationSvc siteSvc = new procStationSvc();
|
||||
procSensorSvc sensorSvc = new procSensorSvc(Connection_string);
|
||||
procInvSvc invSvc = new procInvSvc(Connection_string);
|
||||
procStationSvc siteSvc = new procStationSvc(Connection_string);
|
||||
foreach (var powerStation in powerStations)
|
||||
{
|
||||
foreach (DateTime day in EachDay(start_date, end_date))
|
||||
@ -806,8 +807,11 @@ namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -819,8 +823,11 @@ namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -832,10 +839,13 @@ namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
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 寄送日月報
|
||||
@ -1012,9 +1022,12 @@ namespace SolarPower.Quartz.Jobs
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
|
||||
if(exception.InnerException != null)
|
||||
{
|
||||
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<DateTime> EachDay(DateTime from, DateTime thru)
|
||||
{
|
||||
|
||||
@ -822,8 +822,11 @@ namespace SolarPower.Quartz.Jobs
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError("【CalcPowerStationJob】[Exception] - {0}", exception.Message);
|
||||
if (exception.InnerException != null)
|
||||
{
|
||||
logger.LogError("【CalcPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
"Root": "mWlR2HshQNhRRE34jg4kdg==",
|
||||
"Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||
},
|
||||
"mySql": "server=210.61.91.43;user=idafenweb;Database=solar_power_test;Port=10068;password=P@ssw0rd;charset='utf8';pooling=true;sslmode=none;",
|
||||
//"DBConfig": {
|
||||
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
|
||||
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
|
||||
@ -24,7 +25,7 @@
|
||||
//},
|
||||
"BackgroundServiceCron": {
|
||||
"CalcPowerStationJob": "0 5 * * * ?",
|
||||
"CalcAvgPowerStationJob": "0 0 2 * * ?",
|
||||
"CalcAvgPowerStationJob": "0/10 * * * * ?",
|
||||
"OperationScheduleJob": "0 0 2 * * ?",
|
||||
"CalcInverter15minJob": "0 2/15 * * * ?",
|
||||
"SendEmailJob": "0 0/5 * * * ?",
|
||||
@ -36,7 +37,7 @@
|
||||
"UserName": "shanghohui@gmail.com",
|
||||
"Password": "wswgnluvoodfexrb",
|
||||
"EnableSsl": true
|
||||
},
|
||||
}
|
||||
//"SMTPConfig": {
|
||||
// "Host": "smtp.gmail.com",
|
||||
// "Port": 25,
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"LoginExpireMinute": 60, //登入到期時間,單位(分)
|
||||
"mySql": "server=60.251.164.103;user=webuser;Database=solar_master;Port=11306;password=FICadmin99;charset='utf8';pooling=true;sslmode=none;",
|
||||
//"DBConfig": {
|
||||
// "Server": "MVgHWzR3rGDgD57TUoFunA==",
|
||||
// "port": "r4AoXMUDodcQjIzofGNCcg==",
|
||||
|
||||
@ -11,7 +11,19 @@ namespace solarApp.Service
|
||||
{
|
||||
public class procInvSvc
|
||||
{
|
||||
string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
string Connection1 = string.Empty;
|
||||
|
||||
public procInvSvc(string Connection_parame = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Connection_parame))
|
||||
{
|
||||
Connection1 = Connection_parame;
|
||||
}
|
||||
else
|
||||
{
|
||||
Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
public string _siteID { get; set; }
|
||||
public string _siteDB { get; set; }
|
||||
|
||||
@ -11,7 +11,20 @@ namespace solarApp.Service
|
||||
{
|
||||
public class procSensorSvc
|
||||
{
|
||||
string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
string Connection1 = string.Empty;
|
||||
|
||||
public procSensorSvc(string Connection_parame = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Connection_parame))
|
||||
{
|
||||
Connection1 = Connection_parame;
|
||||
}
|
||||
else
|
||||
{
|
||||
Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string _siteID { get; set; }
|
||||
public string _siteDB { get; set; }
|
||||
|
||||
@ -10,7 +10,19 @@ namespace solarApp.Service
|
||||
{
|
||||
public class procStationSvc
|
||||
{
|
||||
string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
string Connection1 = string.Empty;
|
||||
|
||||
public procStationSvc(string Connection_parame = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Connection_parame))
|
||||
{
|
||||
Connection1 = Connection_parame;
|
||||
}
|
||||
else
|
||||
{
|
||||
Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
public string _siteID { get; set; }
|
||||
public string _siteDB { get; set; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user