station 增加排序與總計筆數
This commit is contained in:
parent
49504ccb2d
commit
0dc2b26283
@ -56,7 +56,8 @@ namespace solarApp.Model
|
||||
public double TOTALKWH { get; set; }
|
||||
public double PR { get; set; }
|
||||
public double SOLARHOUR { get; set; }
|
||||
public double kwhkwp { get; set; }
|
||||
public double kwhkwp { get; set; }
|
||||
public int count { get; set; }
|
||||
}
|
||||
|
||||
public class station_list
|
||||
|
||||
@ -116,9 +116,22 @@ namespace solarApp.Service
|
||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||
{
|
||||
conn.Open();
|
||||
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";
|
||||
//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";
|
||||
string sql = @"
|
||||
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, a.siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
||||
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money, count
|
||||
from power_station_history_day a join (
|
||||
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, SITEID, count(*) count
|
||||
from power_station_history_hour
|
||||
where siteid = @siteID and left(`TIMESTAMP`, 10) between @date1 and @date2
|
||||
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), SITEID
|
||||
) b on a.SITEID = b.SITEID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate
|
||||
where left(`TIMESTAMP`, 10) between @date1 and @date2 and a.siteid = @siteID
|
||||
order by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
|
||||
";
|
||||
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;
|
||||
|
||||
2
solarApp/fmMain.Designer.cs
generated
2
solarApp/fmMain.Designer.cs
generated
@ -929,6 +929,7 @@ namespace solarApp
|
||||
this.gv_web_station_day.RowTemplate.Height = 25;
|
||||
this.gv_web_station_day.Size = new System.Drawing.Size(711, 292);
|
||||
this.gv_web_station_day.TabIndex = 3;
|
||||
this.gv_web_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_web_station_day_CellFormatting);
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
@ -1061,6 +1062,7 @@ namespace solarApp
|
||||
this.gv_fic_station_day.RowTemplate.Height = 25;
|
||||
this.gv_fic_station_day.Size = new System.Drawing.Size(744, 453);
|
||||
this.gv_fic_station_day.TabIndex = 4;
|
||||
this.gv_fic_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_station_day_CellFormatting);
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
|
||||
@ -245,5 +245,27 @@ namespace solarApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void gv_fic_station_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||
{
|
||||
if (gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||
{
|
||||
gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void gv_web_station_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||
{
|
||||
if (gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||
{
|
||||
gv_web_station_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user