檢核補上 Sensor 每天的筆數檢查
This commit is contained in:
parent
57ccee0c09
commit
7f4fe753dc
@ -151,9 +151,17 @@ namespace solarApp.Service
|
||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||
{
|
||||
conn.Open();
|
||||
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg
|
||||
//string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg
|
||||
// from sensor_history_day a join power_station b on a.PowerStationId = b.id
|
||||
// where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+date2+"' and b.`code` = @siteID";
|
||||
string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg, c.count
|
||||
from sensor_history_day a join power_station b on a.PowerStationId = b.id
|
||||
where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+date2+"' and b.`code` = @siteID";
|
||||
join (
|
||||
select PowerStationId, left(a.`TIMESTAMP`, 10) reportDate, count(*) count from sensor_history_hour a join power_station b on a.PowerStationId = b.id
|
||||
where b.`code` = @siteID and left(`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + @"'
|
||||
group by PowerStationId, left(a.`TIMESTAMP`, 10)
|
||||
)c on a.PowerStationId = c.PowerStationId and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = c.reportDate
|
||||
where left(a.`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + @"' and b.`code` = @siteID";
|
||||
List<sensor_hour> ds = conn.Query<sensor_hour>(sql, new { siteID = siteID }).AsList<sensor_hour>();
|
||||
conn.Close();
|
||||
return ds;
|
||||
|
||||
3
solarApp/fmMain.Designer.cs
generated
3
solarApp/fmMain.Designer.cs
generated
@ -1409,6 +1409,7 @@ namespace solarApp
|
||||
this.gv_web_sensor_day.RowTemplate.Height = 25;
|
||||
this.gv_web_sensor_day.Size = new System.Drawing.Size(666, 253);
|
||||
this.gv_web_sensor_day.TabIndex = 4;
|
||||
this.gv_web_sensor_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_web_sensor_day_CellFormatting);
|
||||
//
|
||||
// panel12
|
||||
//
|
||||
@ -1649,7 +1650,7 @@ namespace solarApp
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Name = "fmMain";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "太陽能電站數據檢核 V0729";
|
||||
this.Text = "太陽能電站數據檢核 V0817";
|
||||
this.Load += new System.EventHandler(this.fmMain_Load);
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tb_inv.ResumeLayout(false);
|
||||
|
||||
@ -267,5 +267,16 @@ namespace solarApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void gv_web_sensor_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (gv_web_sensor_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_web_sensor_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||
{
|
||||
if (gv_web_sensor_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||
{
|
||||
gv_web_sensor_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user