合併新版

This commit is contained in:
cesar liu 2022-08-18 23:50:24 +08:00
commit c5b18933c4
10 changed files with 657 additions and 460 deletions

View File

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

View File

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

View File

@ -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,
@ -861,7 +861,7 @@ namespace SolarPower.Repository.Implement
left join power_station ps on ps.`Code` = site_id left join power_station ps on ps.`Code` = site_id
left join operation_record pr on pr.ErrorCode = a.id left join operation_record pr on pr.ErrorCode = a.id
where sourceState = 1 and ps.`Code` is not null where sourceState = 1 and ps.`Code` is not null
) a LEFT JOIN notice_schedule ns ON ns.ExceptionId = a.id ) a LEFT JOIN notice_schedule ns ON ns.ExceptionId = a.id
WHERE ns.Id IS NULL "; WHERE ns.Id IS NULL ";
exceptionEmailInfos = (await conn.QueryAsync<ExceptionEmailInfo>(sql)).ToList(); exceptionEmailInfos = (await conn.QueryAsync<ExceptionEmailInfo>(sql)).ToList();
} }

View File

@ -6090,7 +6090,7 @@ namespace SolarPower.Repository.Implement
case when ISNULL(a.Name) = 0 then Null else '' end error_reason case when ISNULL(a.Name) = 0 then Null else '' end error_reason
from power_station a from power_station a
where a.`Code` = '{code}' ;"; where a.`Code` = '{code}' ;";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// # 檢查電站缺少的欄位(編號)# // # 檢查電站缺少的欄位(編號)#
sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason) sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
@ -6116,7 +6116,7 @@ namespace SolarPower.Repository.Implement
case when ISNULL(a.Coordinate) = 0 then Null else '' end error_reason case when ISNULL(a.Coordinate) = 0 then Null else '' end error_reason
from power_station a from power_station a
where a.`Code` = '{code}' ;"; where a.`Code` = '{code}' ;";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// #檢查電站歸屬公司狀態(刪除)# // #檢查電站歸屬公司狀態(刪除)#
sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason) sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
@ -6148,7 +6148,7 @@ namespace SolarPower.Repository.Implement
from power_station a from power_station a
join company b on a.CompanyId = b.Id join company b on a.CompanyId = b.Id
where a.`Code` = '{code}' ;"; where a.`Code` = '{code}' ;";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// #檢查電站歸屬公司狀態(存在)# // #檢查電站歸屬公司狀態(存在)#
sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason) sql = $@"insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
@ -6169,7 +6169,7 @@ namespace SolarPower.Repository.Implement
from power_station_operation_personnel b from power_station_operation_personnel b
join power_station a on a.Id = b.PowerStationId join power_station a on a.Id = b.PowerStationId
where b.Deleted = 0 and a.`Code` = '{code}' ;"; where b.Deleted = 0 and a.`Code` = '{code}' ;";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// #檢查設備DBName是否填寫# // #檢查設備DBName是否填寫#
sql = $@" insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason) sql = $@" insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
@ -6190,7 +6190,7 @@ namespace SolarPower.Repository.Implement
from {DBname}.device b from {DBname}.device b
join power_station a on a.Id = b.PowerStationId join power_station a on a.Id = b.PowerStationId
where b.Deleted = 0 and b.Enabled = 1 and b.Status = 1 and b.TableName Is Null and a.`Code` = '{code}' "; where b.Deleted = 0 and b.Enabled = 1 and b.Status = 1 and b.TableName Is Null and a.`Code` = '{code}' ";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// #檢查設備ColName是否填寫# // #檢查設備ColName是否填寫#
sql = $@" insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason) sql = $@" insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
@ -6222,7 +6222,7 @@ namespace SolarPower.Repository.Implement
join {DBname}.controller b on a.id = b.PowerStationId join {DBname}.controller b on a.id = b.PowerStationId
join {DBname}.inverter c on b.id = c.ControllerId join {DBname}.inverter c on b.id = c.ControllerId
where a.`Code` = '{code}' and c.Deleted = 0 and c.Enabled = 1 and c.Status > 0 ;"; where a.`Code` = '{code}' and c.Deleted = 0 and c.Enabled = 1 and c.Status > 0 ;";
await conn.ExecuteAsync(sql); await conn.ExecuteAsync(sql, commandTimeout: 600);
// # 回傳結果 // # 回傳結果
sql = $@" select error_reason from power_station_enable_check sql = $@" select error_reason from power_station_enable_check
@ -6352,7 +6352,7 @@ namespace SolarPower.Repository.Implement
(SELECT count(*) ctInv_site, a.SITEID AS Inv_site,a.INVERTERID as Inv_inveter FROM {dbname}.s{code}01_inv a ORDER BY a.ID DESC LIMIT 1) b, (SELECT count(*) ctInv_site, a.SITEID AS Inv_site,a.INVERTERID as Inv_inveter FROM {dbname}.s{code}01_inv a ORDER BY a.ID DESC LIMIT 1) b,
(SELECT count(*) ctStation, a.SITEID AS Station FROM {dbname}.s{code}01_station a ORDER BY a.ID DESC LIMIT 1) c (SELECT count(*) ctStation, a.SITEID AS Station FROM {dbname}.s{code}01_station a ORDER BY a.ID DESC LIMIT 1) c
"; ";
resule = await conn.QueryFirstOrDefaultAsync<Check4table>(sql); resule = await conn.QueryFirstOrDefaultAsync<Check4table>(sql, commandTimeout: 600);
} }
catch (Exception exception) catch (Exception exception)

View File

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

View File

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

View File

@ -32,10 +32,65 @@ namespace solarApp.Model
public string errDeviceModel { get; set; } public string errDeviceModel { get; set; }
} }
public class ExceptionEmailInfo
{
public int id { get; set; }//Id編號
public string site_id { get; set; }//電站編號
public string alarmClassName { get; set; }//異常類別
public string errDevice { get; set; }//設備編號
public string errValue { get; set; }//原始值
public string dev_time { get; set; }//發生時間
public string errMsg { get; set; }//錯誤原因
public string PowerStationName { get; set; }//電站名稱
public int PowerStationId { get; set; }//電站流水號
public string normalTime { get; set; }//賦歸時間
public string errMsgT { get; set; } //errMsgType
public int priority { get; set; }//priority
public int sourceState { get; set; }//異常狀態
public string emailTime { get; set; }//送到寄信資料表的時間
}
public class NoticeInfo
{
public int Id { get; set; }//Id編號
public int Type { get; set; }//設備類型
public string RecipientName { get; set; }//收件人
public string RecipientEmail { get; set; }//收件Email
public string Subject { get; set; }//主旨
public string Content { get; set; }//內容
public int ExceptionId { get; set; }//異常id
public int IsDelivery { get; set; }//是否已寄出信件
public string DeliveryAt { get; set; }//寄出時間
public string CreatedAt { get; set; } //製造時間
}
public class AlarmorionInfo
{
public int id { get; set; }
public string site_id { get; set; }
public string timestamp2 { get; set; }
public string datestamp { get; set; }
public int uuidHash { get; set; }
//public Byte[] uuid { get; set; }
public string isOpen { get; set; }
public string sourceState { get; set; }
public string ackState { get; set; }
public Int16 ackRequired { get; set; }
public int alarmClass { get; set; }
public int priority { get; set; }
public Int64 normalTime { get; set; }
public Int64 ackTime { get; set; }
public string userAccount { get; set; }
public int alarmTransition { get; set; }
public Int64 lastUpdate { get; set; }
public string siteID { get; set; }
public string deviceID { get; set; }
public string errMsg { get; set; }
}
public class max_id public class max_id
{ {
public int new_id { get; set; } public int new_id { get; set; }
public int old_id { get; set; } public int old_id { get; set; }
} }
} }

View File

@ -194,5 +194,100 @@ namespace solarApp.Service
} }
return result; return result;
} }
public List<ExceptionEmailInfo> QueryExceptionData()
{
try
{
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = $@"SELECT a.`*`,ns.Id,
case priority when 1 then DATE_ADD(dev_time, INTERVAL 24 HOUR)
when 2 then DATE_ADD(dev_time, INTERVAL 12 HOUR)
else dev_time end emailTime
FROM
(
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 ,
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,
FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, c.errMsg_tw cerrMsg_tw, d.errMsg_tw derrMsg_tw,
case when c.errMsg_tw is null then
case when err_valueKind = 'b' then d.errMsg_tw
when err_valueKind = 'd' then CONCAT(d.errMsg_tw, ': ', round(a.errValue, 2))
when d.errMsg_tw is null then a.errValue
when a.errValue is null then d.errMsg_tw
else CONCAT(a.errValue, ', ' , ifNull(d.errMsg_tw, '')) end
else
case when err_valueKind = 'b' then c.errMsg_tw
when err_valueKind = 'd' then CONCAT(c.errMsg_tw, ': ', round(a.errValue, 2))
when c.errMsg_tw is null then a.errValue
when a.errValue is null then c.errMsg_tw
else CONCAT(a.errValue, ', ' , ifNull(c.errMsg_tw, '')) end
end errMsg
#, a.errDeviceBrand , d.brend , a.errDeviceModel, d.model , a.errValue , d.errCode
from err_main a
left join alarmorion_orionalarmclass b on a.alarmclass = b.id
left join ref_err_device c on trim(b.alarmClass) = c.deviceType
left join ref_err_inv d on lower(b.alarmClass) = d.deviceType
and a.errDeviceBrand = d.brend and a.errDeviceModel = d.model and a.errValue = d.errCode
left join power_station ps on ps.`Code` = site_id
left join operation_record pr on pr.ErrorCode = a.id
where sourceState = 1 and datestamp > '{System.DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd")}' and ps.`Code` is not null
) a LEFT JOIN notice_schedule ns ON a.id = ns.ExceptionId
WHERE ns.Id IS NULL
order by a.id desc limit 1000";
List<ExceptionEmailInfo> ds = conn.Query<ExceptionEmailInfo>(sql, commandTimeout: 600).AsList<ExceptionEmailInfo>();
conn.Close();
return ds;
}
}
catch (Exception ex)
{
throw ex;
}
}
public List<NoticeInfo> QueryNoticeData()
{
try
{
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = $@"select * from notice_schedule order by 1 desc limit 1000";
List<NoticeInfo> ds = conn.Query<NoticeInfo>(sql, commandTimeout: 600).AsList<NoticeInfo>();
conn.Close();
return ds;
}
}
catch (Exception ex)
{
throw ex;
}
}
public List<AlarmorionInfo> QueryAlarmorion_orionalarmrecordData()
{
try
{
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = $@"select a.*, FROM_UNIXTIME((a.`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') timestamp2
from alarmorion_orionalarmrecord a
order by 1 desc limit 1000";
List<AlarmorionInfo> ds = conn.Query<AlarmorionInfo>(sql, commandTimeout: 600).AsList<AlarmorionInfo>();
conn.Close();
return ds;
}
}
catch (Exception ex)
{
throw ex;
}
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@ namespace solarApp
get_inv_svc inv_svc = new get_inv_svc(); get_inv_svc inv_svc = new get_inv_svc();
getStationSvc stationSvc = new getStationSvc(); getStationSvc stationSvc = new getStationSvc();
getSensorSvc sensorSvc = new getSensorSvc(); getSensorSvc sensorSvc = new getSensorSvc();
procSyncError errorSvc = new procSyncError(); // 異常資料
public fmMain() public fmMain()
{ {
InitializeComponent(); InitializeComponent();
@ -28,12 +29,12 @@ namespace solarApp
//string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd");
string date1 = dtselect_inv.Value.AddDays(-7).ToString("yyyy-MM-dd"); string date1 = dtselect_inv.Value.AddDays(-7).ToString("yyyy-MM-dd");
gv_fic_inv_raw.DataSource = ""; gv_fic_inv_raw.DataSource = "";
gv_fic_inv_hour.DataSource = ""; //gv_fic_inv_hour.DataSource = "";
try try
{ {
gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); //gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -155,18 +156,18 @@ namespace solarApp
private void gv_fic_inv_hour_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) private void gv_fic_inv_hour_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{ {
//int rowindex = e.RowIndex; e.ColumnIndex ////int rowindex = e.RowIndex; e.ColumnIndex
if (gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value.ToString())) //if (gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value.ToString()))
{
if (gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value.ToString() != "12")
{
gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
}
}
//else
//{ //{
// gv_fic_inv_hour.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = gv_fic_inv_hour.DefaultCellStyle; // if (gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Value.ToString() != "12")
// {
// gv_fic_inv_hour.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
// }
//} //}
////else
////{
//// gv_fic_inv_hour.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = gv_fic_inv_hour.DefaultCellStyle;
////}
} }
@ -214,11 +215,11 @@ namespace solarApp
//string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd");
string date1 = dtSelect_sensor1.Value.AddDays(-7).ToString("yyyy-MM-dd"); string date1 = dtSelect_sensor1.Value.AddDays(-7).ToString("yyyy-MM-dd");
gv_fic_sensor_raw.DataSource = ""; gv_fic_sensor_raw.DataSource = "";
gv_fic_sensor_hour.DataSource = ""; //gv_fic_sensor_hour.DataSource = "";
try try
{ {
gv_fic_sensor_raw.DataSource = sensorSvc.get_sensor_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text); gv_fic_sensor_raw.DataSource = sensorSvc.get_sensor_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
gv_fic_sensor_hour.DataSource = sensorSvc.get_sensor_raw_hour(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 11)); //gv_fic_sensor_hour.DataSource = sensorSvc.get_sensor_raw_hour(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 11));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -246,13 +247,13 @@ namespace solarApp
private void gv_fic_sensor_hour_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) private void gv_fic_sensor_hour_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{ {
if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString())) //if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString()))
{ //{
if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString() != "12") // if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString() != "12")
{ // {
gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White }; // gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
} // }
} //}
} }
private void gv_web_inv_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) private void gv_web_inv_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
@ -298,5 +299,46 @@ namespace solarApp
} }
} }
} }
private void button1_Click_1(object sender, EventArgs e)
{
gv_all_data.DataSource = "";
gv_notice_data.DataSource = "";
try
{
gv_all_data.DataSource = errorSvc.QueryExceptionData();
gv_notice_data.DataSource = errorSvc.QueryNoticeData();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void gv_notice_test_data_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
//if (gv_notice_test_data.Rows[e.RowIndex].Cells[0].Value != null && !string.IsNullOrWhiteSpace(gv_notice_test_data.Rows[e.RowIndex].Cells[0].Value.ToString()))
//{
// if (gv_notice_test_data.Rows[e.RowIndex].Cells[0].Value.ToString() != "0")
// {
// gv_notice_test_data.Rows[e.RowIndex].Cells[0].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
// }
//}
}
private void button1_Click_2(object sender, EventArgs e)
{
if(label13.Text == "solar_master.notice_schedule資料表")
{
gv_notice_data.DataSource = errorSvc.QueryAlarmorion_orionalarmrecordData();
label13.Text = "solar_master.notice_schedule資料表";
}
else
{
gv_notice_data.DataSource = errorSvc.QueryNoticeData();
label13.Text = "solar_master.alarmorion_orionalarmrecord資料表";
}
}
} }
} }