網頁背景執行: 讓異常通知根據priority送進寄信的資料表
This commit is contained in:
parent
19f6a8e1df
commit
3d518658c3
@ -221,6 +221,8 @@ namespace SolarPower.Models
|
|||||||
public int PowerStationId { get; set; }//電站流水號
|
public int PowerStationId { get; set; }//電站流水號
|
||||||
public string normalTime { get; set; }//賦歸時間
|
public string normalTime { get; set; }//賦歸時間
|
||||||
public string errMsgT { get; set; } //errMsgType
|
public string errMsgT { get; set; } //errMsgType
|
||||||
|
public int priority { get; set; }//priority
|
||||||
|
public int sourceState { get; set; }//異常狀態
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserPowerStationTo
|
public class UserPowerStationTo
|
||||||
|
|||||||
@ -39,13 +39,25 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ExceptionTimes = this.Configuration.GetValue<int>("ExceptionTimes");
|
var ExceptionTimes = this.Configuration.GetValue<int>("ExceptionTimes");
|
||||||
|
var ExceptionTimes_Priority1 = this.Configuration.GetValue<int>("ExceptionTimes_Priority1");
|
||||||
|
var ExceptionTimes_Priority2 = this.Configuration.GetValue<int>("ExceptionTimes_Priority2");
|
||||||
|
var ExceptionTimes_Priority3 = this.Configuration.GetValue<int>("ExceptionTimes_Priority3");
|
||||||
var ExceptionList = await overviewRepository.GetEmailExceptionList();
|
var ExceptionList = await overviewRepository.GetEmailExceptionList();
|
||||||
if(ExceptionList.Count > 0 )
|
if(ExceptionList.Count > 0 )
|
||||||
{
|
{
|
||||||
//var a = ExceptionList.Where(x=>x.id == 39835).Select(x => (DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60)).ToList();
|
var ExceptionListex = ExceptionList.Where(x => x.sourceState == 1 &&
|
||||||
|
x.priority == 1 &&
|
||||||
|
(DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes_Priority1).ToList();
|
||||||
|
|
||||||
var ExceptionListex = ExceptionList.Where(x => x.normalTime == "1970-01-01 08:00:00" && (DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes).ToList();
|
var ExceptionListex2 = ExceptionList.Where(x => x.sourceState == 1 &&
|
||||||
|
x.priority == 2 &&
|
||||||
|
(DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes_Priority2).ToList();
|
||||||
|
|
||||||
|
var ExceptionListex3 = ExceptionList.Where(x => x.sourceState == 1 &&
|
||||||
|
x.priority == 3 &&
|
||||||
|
(DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).TotalSeconds / 60) >= ExceptionTimes_Priority3).ToList();
|
||||||
|
ExceptionListex.AddRange(ExceptionListex2);
|
||||||
|
ExceptionListex.AddRange(ExceptionListex3);
|
||||||
|
|
||||||
foreach (var Exception in ExceptionListex)
|
foreach (var Exception in ExceptionListex)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -834,7 +834,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
var sql = $@"
|
var sql = $@"
|
||||||
SELECT a.`*`,ns.Id FROM
|
SELECT a.`*`,ns.Id FROM
|
||||||
(
|
(
|
||||||
select pr.FormId as FormId, pr.Id as ErrorID, a.id, site_id, `timestamp`,
|
select pr.FormId as FormId, pr.Id as ErrorID, priority, a.id, site_id, `timestamp`, a.sourceState,
|
||||||
FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time ,
|
FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time ,
|
||||||
a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime,
|
||||||
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName, ps.Id as PowerStationId,errDevice, err_valueKind, errValue,
|
a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName, ps.Id as PowerStationId,errDevice, err_valueKind, errValue,
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||||
//},
|
//},
|
||||||
"BackgroundServiceCron": {
|
"BackgroundServiceCron": {
|
||||||
"CalcPowerStationJob": "0 14 * * * ?",
|
"CalcPowerStationJob": "0 05 * * * ?",
|
||||||
"CalcAvgPowerStationJob": "0 12 0 * * ?",
|
"CalcAvgPowerStationJob": "0 12 0 * * ?",
|
||||||
"OperationScheduleJob": "0 0 8 * * ?",
|
"OperationScheduleJob": "0 0 8 * * ?",
|
||||||
"CalcInverter15minJob": "0 2/15 * * * ?",
|
"CalcInverter15minJob": "0 2/15 * * * ?",
|
||||||
@ -47,7 +47,10 @@
|
|||||||
"Password": "wswgnluvoodfexrb",
|
"Password": "wswgnluvoodfexrb",
|
||||||
"EnableSsl": true
|
"EnableSsl": true
|
||||||
},
|
},
|
||||||
"ExceptionTimes": 240 //異常通知時間,單位(分鐘)
|
"ExceptionTimes": 240, //異常通知時間,單位(分鐘)
|
||||||
|
"ExceptionTimes_Priority1": 1440,
|
||||||
|
"ExceptionTimes_Priority2": 720,
|
||||||
|
"ExceptionTimes_Priority3": 0
|
||||||
|
|
||||||
//"SMTPConfig": {
|
//"SMTPConfig": {
|
||||||
// "Host": "smtp.gmail.com",
|
// "Host": "smtp.gmail.com",
|
||||||
|
|||||||
@ -49,5 +49,8 @@
|
|||||||
"Password": "qwe2015qwe",
|
"Password": "qwe2015qwe",
|
||||||
"EnableSsl": true
|
"EnableSsl": true
|
||||||
},
|
},
|
||||||
"ExceptionTimes": 240 //異常通知時間,單位(分鐘)
|
"ExceptionTimes": 240, //異常通知時間,單位(分鐘)
|
||||||
|
"ExceptionTimes_Priority1": 1440,
|
||||||
|
"ExceptionTimes_Priority2": 720,
|
||||||
|
"ExceptionTimes_Priority3": 0
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user