From d4c5d3f9b05f589134f092fdfbb528409db3cbef Mon Sep 17 00:00:00 2001 From: JiaHao Liu Date: Mon, 10 Jan 2022 19:22:38 +0800 Subject: [PATCH] =?UTF-8?q?Inv=20=20=E8=B6=85=E6=99=82=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=EF=BC=8C=E5=84=AA=E5=8C=96SQL=20=E8=AA=9E=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Views/StationOverview/_History.cshtml | 2 +- solarApp/Service/procInvSvc.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SolarPower/Views/StationOverview/_History.cshtml b/SolarPower/Views/StationOverview/_History.cshtml index b6dbe1a..727039e 100644 --- a/SolarPower/Views/StationOverview/_History.cshtml +++ b/SolarPower/Views/StationOverview/_History.cshtml @@ -85,7 +85,7 @@ 時間 發電量(kWh) 有效日照時數 - 日照度(kWh/m2) + 日照度(W/m2) PR(%) 溫度(℃) diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index e0d532b..169400c 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -547,6 +547,7 @@ ALTER TABLE `temp_invDay{_powerStationID}_s1` ADD INDEX `temp_indexs1` (report_d #endregion #region 先新增 inv_no01 + string inv01 = _siteID01 + "0001"; sql = @$" insert report_invday(`report_date`, `PowerStationID`, inv_01, `hourKWH`, `hourKWHp`, `irradiance`, `temperature`, `hourmoney`, `pr`, createTime) select a.report_date, a.powerstationId , ifnull(round(a.kwh, 6), 0) inv_01, ifnull(b.KWH, 0) hourKWH, @@ -554,7 +555,7 @@ select a.report_date, a.powerstationId , ifnull(round(a.kwh, 6), 0) inv_01, ifn WHERE DATE_FORMAT(TIMESTAMP,'%Y-%m-%d') = '{_date1}' and powerstationid = {_powerStationID} ))*100,2) , 0) 'hourKWHp', ifnull(d.irradiance, 0) 'irradiance', ifnull(d.Temperature, 0) 'temperature', ifnull(b.money, 0) 'hourmoney', ifnull(round(b.PR, 2), 0) as pr, now() createTime -from temp_invDay{_powerStationID}_s1 a left join +from temp_invDay{_powerStationID}_s1 a join ( # 每小時加總 inv select powerStationid, `TIMESTAMP` report_date, siteid, sitetype, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH,round(KWHKWP, 2) KWHKWP, round(PR, 2) PR, round(money, 2) money @@ -568,7 +569,7 @@ from temp_invDay{_powerStationID}_s1 a left join from sensor_history_hour where powerstationid = {_powerStationID} and left(`TIMESTAMP`,10) = '{_date1}' ) d on a.powerStationid = d.powerStationid and a.`report_date` = d.report_date - where right(a.inverterid, 4) = '0001' + where a.inverterid = '{inv01}' # right(a.inverterid, 4) = '0001' GROUP BY left(a.report_date, 13) order by a.report_date ;"; conn.Execute(sql);