This commit is contained in:
b110212000 2021-09-06 18:00:48 +08:00
commit ee5e10dace
7 changed files with 68 additions and 13 deletions

View File

@ -785,12 +785,13 @@ namespace SolarPower.Quartz.Jobs
#region #region
var gobackDay = this.Configuration.GetValue<int>("GoBackDay"); //回推天數 var gobackDay = this.Configuration.GetValue<int>("GoBackDay"); //回推天數
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(); procSensorSvc sensorSvc = new procSensorSvc(Connection_string);
procInvSvc invSvc = new procInvSvc(); procInvSvc invSvc = new procInvSvc(Connection_string);
procStationSvc siteSvc = new procStationSvc(); procStationSvc siteSvc = new procStationSvc(Connection_string);
foreach (var powerStation in powerStations) foreach (var powerStation in powerStations)
{ {
foreach (DateTime day in EachDay(start_date, end_date)) foreach (DateTime day in EachDay(start_date, end_date))
@ -806,7 +807,10 @@ namespace SolarPower.Quartz.Jobs
{ {
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);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
} }
try try
@ -819,7 +823,10 @@ namespace SolarPower.Quartz.Jobs
{ {
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);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
} }
try try
@ -832,7 +839,10 @@ namespace SolarPower.Quartz.Jobs
{ {
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);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); if (exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
} }
} }
} }
@ -1012,7 +1022,10 @@ namespace SolarPower.Quartz.Jobs
catch (Exception exception) catch (Exception exception)
{ {
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); if(exception.InnerException != null)
{
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
} }
} }

View File

@ -822,7 +822,10 @@ namespace SolarPower.Quartz.Jobs
catch (Exception exception) catch (Exception exception)
{ {
logger.LogError("【CalcPowerStationJob】[Exception] - {0}", exception.Message); logger.LogError("【CalcPowerStationJob】[Exception] - {0}", exception.Message);
logger.LogError("【CalcPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); if (exception.InnerException != null)
{
logger.LogError("【CalcPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
} }
} }
} }

View File

@ -15,6 +15,7 @@
"Root": "mWlR2HshQNhRRE34jg4kdg==", "Root": "mWlR2HshQNhRRE34jg4kdg==",
"Password": "y4uPqlH9ncTgR/I07qpwaA==" "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": { //"DBConfig": {
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==", // "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==", // "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
@ -24,7 +25,7 @@
//}, //},
"BackgroundServiceCron": { "BackgroundServiceCron": {
"CalcPowerStationJob": "0 5 * * * ?", "CalcPowerStationJob": "0 5 * * * ?",
"CalcAvgPowerStationJob": "0 0 2 * * ?", "CalcAvgPowerStationJob": "0/10 * * * * ?",
"OperationScheduleJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?",
"CalcInverter15minJob": "0 2/15 * * * ?", "CalcInverter15minJob": "0 2/15 * * * ?",
"SendEmailJob": "0 0/5 * * * ?", "SendEmailJob": "0 0/5 * * * ?",
@ -36,7 +37,7 @@
"UserName": "shanghohui@gmail.com", "UserName": "shanghohui@gmail.com",
"Password": "wswgnluvoodfexrb", "Password": "wswgnluvoodfexrb",
"EnableSsl": true "EnableSsl": true
}, }
//"SMTPConfig": { //"SMTPConfig": {
// "Host": "smtp.gmail.com", // "Host": "smtp.gmail.com",
// "Port": 25, // "Port": 25,

View File

@ -8,6 +8,7 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"LoginExpireMinute": 60, //() "LoginExpireMinute": 60, //()
"mySql": "server=60.251.164.103;user=webuser;Database=solar_master;Port=11306;password=FICadmin99;charset='utf8';pooling=true;sslmode=none;",
//"DBConfig": { //"DBConfig": {
// "Server": "MVgHWzR3rGDgD57TUoFunA==", // "Server": "MVgHWzR3rGDgD57TUoFunA==",
// "port": "r4AoXMUDodcQjIzofGNCcg==", // "port": "r4AoXMUDodcQjIzofGNCcg==",

View File

@ -11,7 +11,19 @@ namespace solarApp.Service
{ {
public class procInvSvc 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 _siteID { get; set; }
public string _siteDB { get; set; } public string _siteDB { get; set; }

View File

@ -11,7 +11,20 @@ namespace solarApp.Service
{ {
public class procSensorSvc 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 _siteID { get; set; }
public string _siteDB { get; set; } public string _siteDB { get; set; }

View File

@ -10,7 +10,19 @@ namespace solarApp.Service
{ {
public class procStationSvc 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 _siteID { get; set; }
public string _siteDB { get; set; } public string _siteDB { get; set; }