This commit is contained in:
JiaHao Liu 2021-08-13 19:31:19 +08:00
parent 8bc7d611c0
commit efdeb5d8bc
11 changed files with 155 additions and 69 deletions

View File

@ -106,6 +106,7 @@ namespace solarApp.Model
public double TODAYKWH { get; set; }
public double TOTALKWH { get; set; }
public double PR { get; set; }
public int count { get; set; }
}
public class web_inv_list

View File

@ -36,6 +36,8 @@ namespace solarApp.Model
public double humidityAvg { get; set; }
public double windAvg { get; set; }
public double dustAvg { get; set; }
public int count { get; set; }
}
public class sensor_hour

View File

@ -49,18 +49,26 @@ namespace solarApp.Service
// round(max(TOTALKWH), 2) TOTALKWH, round(max(PR), 2) PR, count(*) count
// from v_inv_temp where left(reportdate, 10) = '" + reportDate + "' and inverterid = '" + invID + "' " +
// "group by left(reportdate, 13), inverterid"; //round(avg(PR), 2) PR,
string sql = @" select a.reportdate, a.inverterid, a.KWH, b.TODAYKWH, b.TOTALKWH, b.PR, a.count from
(
select left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 13)reportdate, inverterid
,round((sum(WH)/1000), 2) KWH, count(*) count
string sql = @"
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')reportdate, inverterid ,round((sum(WH)/1000), 2) KWH,
round(max(TODAYKWH), 2) TODAYKWH, round(max(TOTALKWH), 2) TOTALKWH, round(max(PR), 2) PR, count(*) count
from " + siteDB + ".s" + siteID + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + "' and inverterid = '" + invID + @"'
group by left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 13), inverterid
)a join (
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, inverterid, round(PR, 2) PR
from " + siteDB + ".s" + siteID + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + @"' and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 2) = '55' and inverterid = '" + invID + @"'
)b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid ";
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), inverterid
order by 1; ";
//select a.reportdate, a.inverterid, a.KWH, b.TODAYKWH, b.TOTALKWH, b.PR, a.count from
// (
// select left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 13)reportdate, inverterid
// ,round((sum(WH)/1000), 2) KWH, count(*) count
// from " + siteDB + ".s" + siteID + @"_inv
// where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + "' and inverterid = '" + invID + @"'
// group by left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 13), inverterid
// )a join (
// select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, inverterid, round(PR, 2) PR
// from " + siteDB + ".s" + siteID + @"_inv
// where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + @"' and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 2) = '55' and inverterid = '" + invID + @"'
// )b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid ";
List<raw_inv_hour> ds = conn.Query<raw_inv_hour>(sql).AsList<raw_inv_hour>();
conn.Close();
return ds;
@ -106,8 +114,19 @@ namespace solarApp.Service
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR
from inverter_history_day where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+ date2 +"' and inverterid = '" + invID + "' ";
//string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR
// from inverter_history_day where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+ date2 +"' and inverterid = '" + invID + "' ";
string sql = @"
select DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') reportdate, a.inverterid, round(a.KWH, 2) KWH, round(a.TODAYKWH, 2) TODAYKWH,
round(a.TOTALKWH, 2) TOTALKWH, round(a.PR, 2) PR, count
from inverter_history_day a join (
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, count(*) count
from inverter_history_hour
where left(`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + @"' and inverterid = '" + invID + @"'
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), inverterid
) b on a.inverterid = b.inverterid and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate
where left(a.`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + "' and a.inverterid = '" + invID + "' order by 1";
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>();
conn.Close();
return ds;

View File

@ -107,16 +107,16 @@ namespace solarApp.Service
//電表
#endregion Sensor
sql = @"select a.siteID, a.reportdate, a.modelTempAvg, ifnull(b.irrAvg, 0) irrAvg, a.envTempAvg, humidityAvg, windAvg, dustAvg from
sql = @"select a.siteID, a.reportdate, a.modelTempAvg, ifnull(b.irrAvg, 0) irrAvg, a.envTempAvg, humidityAvg, windAvg, dustAvg, count from
(
select @siteID siteID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, "+ modelTempCol+ @" modelTempAvg
," + evnTempCol + @" envTempAvg, " + humCol + @" humidityAvg, " + windCol + @" windAvg, " + dustCol + @" dustAvg
select @siteID siteID, CONCAT( FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, " + modelTempCol+ @" modelTempAvg
," + evnTempCol + @" envTempAvg, " + humCol + @" humidityAvg, " + windCol + @" windAvg, " + dustCol + @" dustAvg, count(*) count
from " + siteDB + ".s" + siteID + @"_sensorAvg
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
) a left join
(
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate , " + irrCol + @" irrAvg
select CONCAT( FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate , " + irrCol + @" irrAvg
from " + siteDB + ".s" + siteID + @"_sensorAvg
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate "+ irrNot0 + @" # 0
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')

View File

@ -27,7 +27,7 @@ namespace solarApp.Service
{
conn.Open();
string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, siteid, round(KWH, 3) KWH, round(TODAYKWH, 3) TODAYKWH,
round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(TODAYKWH, 3)SOLARHOUR , round(kwhkwp, 3) kwhkwp
round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(SOLARHOUR, 3) SOLARHOUR , round(kwhkwp, 3) kwhkwp
from " + siteDB + ".s" + siteID + @"_station
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate";
List<raw_statino> ds = conn.Query<raw_statino>(sql, new { reportDate = reportDate }).AsList<raw_statino>();
@ -92,8 +92,10 @@ namespace solarApp.Service
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, siteid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, round(money, 3) money, round(todaymoney, 3) todaymoney, round(totalmoney, 3) totalmoney,
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, siteid, round(KWH, 2) KWH,
round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP,
round(money, 3) money, round(todaymoney, 3) todaymoney, round(totalmoney, 3) totalmoney,
round(carbon, 3) carbon, round(todayCarbon, 3) todayCarbon, round(totalCarbon, 3) totalCarbon
from power_station_history_hour
where siteID = @siteID and left(`TIMESTAMP`, 10) = '" + reportDate + "' ";
@ -109,7 +111,7 @@ namespace solarApp.Service
/// <param name="reportDate"></param>
/// <param name="invID"></param>
/// <returns></returns>
public List<web_station_hour> get_web_station_day(string date1, string date2, string siteID)
public List<web_station_day> get_web_station_day(string date1, string date2, string siteID)
{
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
@ -117,20 +119,20 @@ namespace solarApp.Service
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
from power_station_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and siteid = @siteID";
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { date1 = date1, date2 = date2 , siteID = siteID}).AsList<web_station_hour>();
List<web_station_day> ds = conn.Query<web_station_day>(sql, new { date1 = date1, date2 = date2 , siteID = siteID}).AsList<web_station_day>();
conn.Close();
return ds;
}
}
public List<web_station_hour> get_web_station_month(string date1, string date2, string siteID)
public List<web_station_day> get_web_station_month(string date1, string date2, string siteID)
{
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TOTALKWH, 2) TOTALKWH, round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
from power_station_history_month where left(`TIMESTAMP`, 7) between @date1 and @date2 and siteid = @siteID";
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { date1 = date1, date2 = date2, siteID = siteID }).AsList<web_station_hour>();
List<web_station_day> ds = conn.Query<web_station_day>(sql, new { date1 = date1, date2 = date2, siteID = siteID }).AsList<web_station_day>();
conn.Close();
return ds;
}
@ -147,7 +149,7 @@ namespace solarApp.Service
conn.Open(); // 01 控制器編號
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
from power_station
where id in (1, 8)";
where id in (1, 8, 9)";
List<station_list> ds = conn.Query<station_list>(sql).AsList<station_list>();
conn.Close();
return ds;

View File

@ -88,28 +88,28 @@ namespace solarApp.Service
#region 15 min
string sql = @"
INSERT INTO solar_master.inverter_history_15min( PowerStationId, TIMESTAMP, INVERTERID, KWH, TODAYKWH, KWHKWP)
select PowerStationId, reportdate, a.inverterid, KWH, TODAYKWH, round((kwh/capacity), 3) kwpkwp from
select PowerStationId, reportdate, a.inverterid, KWH, TODAYKWH, (kwh/capacity) kwpkwp from
(
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00:00')reportdate, inverterid,
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
from " + _siteDB + ".s" + _siteID01 + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '00' and '10'
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
union
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':15:00')reportdate, inverterid,
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
from " + _siteDB + ".s" + _siteID01 + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '15' and '25'
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
union
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':30:00')reportdate, inverterid,
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
from " + _siteDB + ".s" + _siteID01 + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '30' and '40'
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
union
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':45:00')reportdate, inverterid,
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
from " + _siteDB + ".s" + _siteID01 + @"_inv
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '45' and '55'
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid

View File

@ -61,7 +61,7 @@ namespace solarApp.Service
/// 清除指定期間、指定電站的 Sensor hour、day、month 資料
/// </summary>
/// <returns></returns>
private bool clearData()
public bool clearData()
{
bool result = false;
try
@ -185,9 +185,9 @@ namespace solarApp.Service
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg from
(
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(avg(" + modelTempCol + @"), 2) modelTempAvg,
round(avg(" + evnTempCol + @"), 2) envTempAvg, round(avg(" + humCol + @"), 2) humidityAvg, round(avg(" + windCol + @"), 2) windAvg,
round(avg(" + dustCol + @"), 2) dustAvg
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") modelTempAvg,
avg(" + evnTempCol + @") envTempAvg, avg(" + humCol + @") humidityAvg, avg(" + windCol + @") windAvg,
avg(" + dustCol + @") dustAvg
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')

View File

@ -32,6 +32,8 @@ namespace solarApp
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.bt_archive = new System.Windows.Forms.Button();
this.bt_clear_sensor = new System.Windows.Forms.Button();
this.bt_clear_station = new System.Windows.Forms.Button();
this.bt_clear_inv = new System.Windows.Forms.Button();
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
@ -88,6 +90,8 @@ namespace solarApp
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.splitContainer1.Panel1.Controls.Add(this.bt_archive);
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_sensor);
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_station);
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_inv);
this.splitContainer1.Panel1.Controls.Add(this.fp_site);
@ -105,6 +109,29 @@ namespace solarApp
this.splitContainer1.SplitterWidth = 10;
this.splitContainer1.TabIndex = 0;
//
// bt_archive
//
this.bt_archive.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.bt_archive.Location = new System.Drawing.Point(5, 528);
this.bt_archive.Name = "bt_archive";
this.bt_archive.Size = new System.Drawing.Size(282, 100);
this.bt_archive.TabIndex = 8;
this.bt_archive.Text = "單日歸檔";
this.bt_archive.UseVisualStyleBackColor = true;
this.bt_archive.Click += new System.EventHandler(this.bt_archive_Click);
//
// bt_clear_sensor
//
this.bt_clear_sensor.Enabled = false;
this.bt_clear_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.bt_clear_sensor.Location = new System.Drawing.Point(5, 256);
this.bt_clear_sensor.Name = "bt_clear_sensor";
this.bt_clear_sensor.Size = new System.Drawing.Size(135, 44);
this.bt_clear_sensor.TabIndex = 7;
this.bt_clear_sensor.Text = "clear data";
this.bt_clear_sensor.UseVisualStyleBackColor = true;
this.bt_clear_sensor.Click += new System.EventHandler(this.bt_clear_sensor_Click);
//
// bt_clear_station
//
this.bt_clear_station.Enabled = false;
@ -134,12 +161,12 @@ namespace solarApp
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
this.fp_site.Location = new System.Drawing.Point(0, 0);
this.fp_site.Name = "fp_site";
this.fp_site.Size = new System.Drawing.Size(300, 150);
this.fp_site.Size = new System.Drawing.Size(300, 176);
this.fp_site.TabIndex = 4;
//
// dtSelect
//
this.dtSelect.Location = new System.Drawing.Point(37, 156);
this.dtSelect.Location = new System.Drawing.Point(3, 193);
this.dtSelect.Name = "dtSelect";
this.dtSelect.Size = new System.Drawing.Size(204, 27);
this.dtSelect.TabIndex = 3;
@ -298,5 +325,7 @@ namespace solarApp
private System.Windows.Forms.Button btVerifyData;
private System.Windows.Forms.Button bt_clear_inv;
private System.Windows.Forms.Button bt_clear_station;
private System.Windows.Forms.Button bt_archive;
private System.Windows.Forms.Button bt_clear_sensor;
}
}

View File

@ -101,8 +101,10 @@ namespace solarApp
{
bt_clear_inv.Enabled = true;
bt_clear_station.Enabled = true;
bt_clear_sensor.Enabled = true;
bt_clear_inv.Text = "clear " + dtSelect.Value.ToString("MM-dd");
bt_clear_station.Text = "clear " + dtSelect.Value.ToString("MM-dd");
bt_clear_sensor.Text = "clear " + dtSelect.Value.ToString("MM-dd");
}
private void bt_clear_inv_Click(object sender, EventArgs e)
@ -149,5 +151,27 @@ namespace solarApp
//sensorSvc.archiveData();
MessageBox.Show("OK");
}
private void bt_archive_Click(object sender, EventArgs e)
{
bt_Sensor.PerformClick();
bt_Inv.PerformClick();
bt_site.PerformClick();
}
private void bt_clear_sensor_Click(object sender, EventArgs e)
{
string date1 = dtSelect.Value.ToString("yyyy-MM-dd");
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
procSensorSvc sensorSvc = new procSensorSvc();
sensorSvc._siteDB = lbSiteDB_sensor.Text;
sensorSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
sensorSvc._siteID01 = lbSiteID_sensor.Text;
sensorSvc._date1 = date1;
sensorSvc._date2 = date1;
sensorSvc.clearData();
//sensorSvc.archiveData();
MessageBox.Show("OK");
}
}
}

View File

@ -109,11 +109,10 @@ namespace solarApp
this.lb_raw_inv_hour = new System.Windows.Forms.Label();
this.tb2 = new System.Windows.Forms.TabPage();
this.sp_main_station = new System.Windows.Forms.SplitContainer();
this.label13 = new System.Windows.Forms.Label();
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
this.lbMsg_station = new System.Windows.Forms.Label();
this.bt_find_station = new System.Windows.Forms.Button();
this.dtselect_station1 = new System.Windows.Forms.DateTimePicker();
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
this.sp_child_station = new System.Windows.Forms.SplitContainer();
this.gv_web_station_month = new System.Windows.Forms.DataGridView();
this.panel10 = new System.Windows.Forms.Panel();
@ -499,6 +498,7 @@ namespace solarApp
this.gv_web_inv_day.RowTemplate.Height = 25;
this.gv_web_inv_day.Size = new System.Drawing.Size(666, 270);
this.gv_web_inv_day.TabIndex = 4;
this.gv_web_inv_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_web_inv_day_CellFormatting);
//
// panel8
//
@ -751,11 +751,10 @@ namespace solarApp
//
// sp_main_station.Panel1
//
this.sp_main_station.Panel1.Controls.Add(this.label13);
this.sp_main_station.Panel1.Controls.Add(this.fp_site);
this.sp_main_station.Panel1.Controls.Add(this.lbMsg_station);
this.sp_main_station.Panel1.Controls.Add(this.bt_find_station);
this.sp_main_station.Panel1.Controls.Add(this.dtselect_station1);
this.sp_main_station.Panel1.Controls.Add(this.fp_site);
//
// sp_main_station.Panel2
//
@ -765,23 +764,22 @@ namespace solarApp
this.sp_main_station.SplitterDistance = 257;
this.sp_main_station.TabIndex = 0;
//
// label13
// fp_site
//
this.label13.AutoSize = true;
this.label13.Dock = System.Windows.Forms.DockStyle.Bottom;
this.label13.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label13.Location = new System.Drawing.Point(0, 367);
this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(110, 24);
this.label13.TabIndex = 13;
this.label13.Text = "請選擇 電站";
this.fp_site.BackColor = System.Drawing.Color.Azure;
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
this.fp_site.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.fp_site.Location = new System.Drawing.Point(0, 0);
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
this.fp_site.Name = "fp_site";
this.fp_site.Size = new System.Drawing.Size(257, 315);
this.fp_site.TabIndex = 14;
//
// lbMsg_station
//
this.lbMsg_station.AutoSize = true;
this.lbMsg_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.lbMsg_station.Location = new System.Drawing.Point(30, 111);
this.lbMsg_station.Location = new System.Drawing.Point(23, 443);
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMsg_station.Name = "lbMsg_station";
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
@ -790,7 +788,7 @@ namespace solarApp
//
// bt_find_station
//
this.bt_find_station.Location = new System.Drawing.Point(16, 73);
this.bt_find_station.Location = new System.Drawing.Point(9, 405);
this.bt_find_station.Name = "bt_find_station";
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
this.bt_find_station.TabIndex = 7;
@ -801,22 +799,11 @@ namespace solarApp
// dtselect_station1
//
this.dtselect_station1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.dtselect_station1.Location = new System.Drawing.Point(14, 8);
this.dtselect_station1.Location = new System.Drawing.Point(5, 357);
this.dtselect_station1.Name = "dtselect_station1";
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
this.dtselect_station1.TabIndex = 6;
//
// fp_site
//
this.fp_site.BackColor = System.Drawing.Color.Azure;
this.fp_site.Dock = System.Windows.Forms.DockStyle.Bottom;
this.fp_site.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.fp_site.Location = new System.Drawing.Point(0, 391);
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
this.fp_site.Name = "fp_site";
this.fp_site.Size = new System.Drawing.Size(257, 645);
this.fp_site.TabIndex = 8;
//
// sp_child_station
//
this.sp_child_station.Dock = System.Windows.Forms.DockStyle.Fill;
@ -1563,6 +1550,7 @@ namespace solarApp
this.gv_fic_sensor_hour.RowTemplate.Height = 25;
this.gv_fic_sensor_hour.Size = new System.Drawing.Size(695, 453);
this.gv_fic_sensor_hour.TabIndex = 4;
this.gv_fic_sensor_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_sensor_hour_CellFormatting);
//
// panel14
//
@ -1789,7 +1777,6 @@ namespace solarApp
private System.Windows.Forms.Label lbMsg_station;
private System.Windows.Forms.Button bt_find_station;
private System.Windows.Forms.DateTimePicker dtselect_station;
private System.Windows.Forms.FlowLayoutPanel fp_site;
private System.Windows.Forms.Label lbMsg_inv;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dtselect_station1;
@ -1807,7 +1794,6 @@ namespace solarApp
private System.Windows.Forms.DataGridView gv_web_station_month;
private System.Windows.Forms.Label lbSiteID_inv;
private System.Windows.Forms.Label lbSiteName_inv;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label lbSiteDB_inv;
private System.Windows.Forms.Label lbSiteRaw;
private System.Windows.Forms.Label lbInvRaw;
@ -1847,5 +1833,6 @@ namespace solarApp
private System.Windows.Forms.Button btSearch_sensor;
private System.Windows.Forms.Button btSensor_switch;
private System.Windows.Forms.Button btInv_15min;
private System.Windows.Forms.FlowLayoutPanel fp_site;
}
}

View File

@ -223,5 +223,27 @@ namespace solarApp
gv_web_sensor_month.DataSource = sensorSvc.get_web_sensor50_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 09));
}
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.ToString() != "12")
{
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)
{
if (gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
{
if (gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
{
gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
}
}
}
}
}