1. 加入補償機制

This commit is contained in:
Kai 2021-09-03 18:46:00 +08:00
parent 7fb6211db0
commit d8ea8ceff1
7 changed files with 68 additions and 13 deletions

View File

@ -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)
{

View File

@ -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);
}
}
}
}
}

View File

@ -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,

View File

@ -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==",

View File

@ -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; }

View File

@ -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; }

View File

@ -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; }