修改紅綠燈的 紅燈判斷, alarmClass = 14 為紅燈

This commit is contained in:
cesar liu 2022-08-31 09:52:36 +08:00
parent b84b7cc180
commit 49ca4742f8
3 changed files with 15 additions and 17 deletions

View File

@ -212,7 +212,7 @@ namespace solarApp.Service
//sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname //sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname
// from " + _siteDB + @".device a // from " + _siteDB + @".device a
// where left(UID, 11) = @siteID and deleted = 0 and enabled = 1 and `status` = 1 "; // where left(UID, 11) = @siteID and deleted = 0 and enabled = 1 and `status` = 1 ";
sql = @$"select a.id, CONCAT( {_siteID} ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname sql = @$"select a.id, CONCAT( '{_siteID}' ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname
from {_siteDB}.device a left join {_siteDB}.sharedevice b on a.id = b.deviceID from {_siteDB}.device a left join {_siteDB}.sharedevice b on a.id = b.deviceID
where (left(UID, 11) = @siteID or b.PowerStationID = {_powerStationID}) and deleted = 0 and enabled = 1 and `status` = 1 "; where (left(UID, 11) = @siteID or b.PowerStationID = {_powerStationID}) and deleted = 0 and enabled = 1 and `status` = 1 ";
List<sensor_model> ds_sensor = conn.Query<sensor_model>(sql, new { siteID = _siteID01 }).AsList<sensor_model>(); List<sensor_model> ds_sensor = conn.Query<sensor_model>(sql, new { siteID = _siteID01 }).AsList<sensor_model>();
@ -227,11 +227,11 @@ namespace solarApp.Service
// { "Name":" 電表","EName":"PWR"}]} // { "Name":" 電表","EName":"PWR"}]}
// { "Name":"風向計","EName":"WIN"}]} // { "Name":"風向計","EName":"WIN"}]}
// { "Name":" 累計日照計","EName":"TPY"}]} // { "Name":" 累計日照計","EName":"TPY"}]}
var irrlst = ds_sensor.FindAll(x => x.type.Contains("PYR")); var irrlst = ds_sensor.FindAll(x => x.type.Contains("PYR")); //日照計
var modelTemplst = ds_sensor.FindAll(x => x.type.Contains("MTR")); var modelTemplst = ds_sensor.FindAll(x => x.type.Contains("MTR")); //模組溫度計
var envTemplst = ds_sensor.FindAll(x => x.type.Contains("ETR")); var envTemplst = ds_sensor.FindAll(x => x.type.Contains("ETR")); //環境溫度計
var humlst = ds_sensor.FindAll(x => x.type.Contains("EMM")); var humlst = ds_sensor.FindAll(x => x.type.Contains("EMM"));//環境濕度計
var vandlst = ds_sensor.FindAll(x => x.type.Contains("VAN")); var vandlst = ds_sensor.FindAll(x => x.type.Contains("VAN")); //風速計
var dustlst = ds_sensor.FindAll(x => x.type.Contains("DST")); //落塵計 add @ 2021-12-12 var dustlst = ds_sensor.FindAll(x => x.type.Contains("DST")); //落塵計 add @ 2021-12-12
var winlst = ds_sensor.FindAll(x => x.type.Contains("WIN")); //風向計 add @ 2021-12-12 var winlst = ds_sensor.FindAll(x => x.type.Contains("WIN")); //風向計 add @ 2021-12-12
var irrDaylst = ds_sensor.FindAll(x => x.type.Contains("TPY")); //累計日照計 add @ 2021-12-12 var irrDaylst = ds_sensor.FindAll(x => x.type.Contains("TPY")); //累計日照計 add @ 2021-12-12

View File

@ -50,7 +50,7 @@ namespace solarApp.Service
#endregion #endregion
#region #region
sql = $@" select max(id) new_id, (select max(id) old_id from err_main ) old_id sql = $@" select max(id) new_id, (select max(id) old_id from err_main ) old_id
from alarmorion_orionalarmrecord "; from alarmorion_orionalarmrecord ";
var ds_max = conn.Query<max_id>(sql, commandTimeout: 600).AsList<max_id>(); var ds_max = conn.Query<max_id>(sql, commandTimeout: 600).AsList<max_id>();
@ -145,8 +145,8 @@ namespace solarApp.Service
site_id, alarmID, datestamp, HealthStatus site_id, alarmID, datestamp, HealthStatus
from ( from (
select site_id, datestamp, sourceState, id alarmID, select site_id, datestamp, sourceState, id alarmID,
case when alarmClass = 4 then 3 # Network - case when alarmClass = 14 then 3 # Network -
when alarmClass != 4 then 2 end HealthStatus # inv, sensor when alarmClass != 14 then 2 end HealthStatus # inv, sensor
from err_main from err_main
where sourceState = 1 and left(site_id , 1) = '0' where sourceState = 1 and left(site_id , 1) = '0'
and datestamp > '{ System.DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd")}' and datestamp > '{ System.DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd")}'

View File

@ -556,8 +556,7 @@ namespace solarApp
procInvSvc invSvc = new procInvSvc(); procInvSvc invSvc = new procInvSvc();
procStationSvc siteSvc = new procStationSvc(); procStationSvc siteSvc = new procStationSvc();
//foreach (var item in site_list)
//{
sensorSvc.isFirst = true; sensorSvc.isFirst = true;
foreach (DateTime day in EachDay(DateTime.Parse(date1), DateTime.Parse(date2))) foreach (DateTime day in EachDay(DateTime.Parse(date1), DateTime.Parse(date2)))
{ {
@ -568,8 +567,7 @@ namespace solarApp
siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
invSvc.report_invDay(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); invSvc.report_invDay(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
} }
i++;
//}
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!"; lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!";
} }