This commit is contained in:
b110212000 2021-08-19 10:50:59 +08:00
commit b99ce00ca6
5 changed files with 26 additions and 3 deletions

View File

@ -370,6 +370,7 @@ namespace SolarPower.Controllers
Name = post.Name, Name = post.Name,
Email = post.Email, Email = post.Email,
Phone = post.Phone, Phone = post.Phone,
RoleId = post.RoleId,
UpdatedBy = myUser.Id, UpdatedBy = myUser.Id,
}; };
@ -380,6 +381,7 @@ namespace SolarPower.Controllers
"Name", "Name",
"Email", "Email",
"Phone", "Phone",
"RoleId",
"UpdatedBy", "UpdatedBy",
}; };

View File

@ -86,6 +86,7 @@ namespace SolarPower.Models.User
public byte Status { get; set; } //狀態 public byte Status { get; set; } //狀態
public string Email { get; set; } //信箱 public string Email { get; set; } //信箱
public string Phone { get; set; } //手機 public string Phone { get; set; } //手機
public int RoleId { get; set; } //角色編號
} }
/// <summary> /// <summary>

View File

@ -151,9 +151,17 @@ namespace solarApp.Service
using (MySqlConnection conn = new MySqlConnection(Connection1)) using (MySqlConnection conn = new MySqlConnection(Connection1))
{ {
conn.Open(); 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 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>(); List<sensor_hour> ds = conn.Query<sensor_hour>(sql, new { siteID = siteID }).AsList<sensor_hour>();
conn.Close(); conn.Close();
return ds; return ds;

View File

@ -1409,6 +1409,7 @@ namespace solarApp
this.gv_web_sensor_day.RowTemplate.Height = 25; 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.Size = new System.Drawing.Size(666, 253);
this.gv_web_sensor_day.TabIndex = 4; 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 // panel12
// //
@ -1649,7 +1650,7 @@ namespace solarApp
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Name = "fmMain"; this.Name = "fmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "太陽能電站數據檢核 V0729"; this.Text = "太陽能電站數據檢核 V0817";
this.Load += new System.EventHandler(this.fmMain_Load); this.Load += new System.EventHandler(this.fmMain_Load);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tb_inv.ResumeLayout(false); this.tb_inv.ResumeLayout(false);

View File

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