From c42c1991797d55f0890516ce85e88e0edb5e7378 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Wed, 22 Sep 2021 10:21:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=B7=E5=8F=B2=E8=B3=87=E6=96=99=20?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=97=A5=E7=85=A7=E6=99=82=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implement/OverviewRepository.cs | 2 +- .../StationOverviewInfo.cshtml | 39 +++++++++++++++---- .../Views/StationOverview/_History.cshtml | 4 +- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index d239653..f314d9f 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -605,7 +605,7 @@ namespace SolarPower.Repository.Implement //range2 = $" DATE_FORMAT(C.TIMESTAMP,'%Y') = '{post.HistoryRange}'"; break; case 3: - select = "DATE_FORMAT(V.TIMESTAMP,'%Y') AS TIMESTAMP, MAX(KWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, SUM(SOLARHOUR-PSValue) AS DiffSOLARHOUR, AVG(PR) AS PR, AVG(Irradiance) AS Irradiance, AVG(Temp) AS Temp"; + select = "DATE_FORMAT(V.TIMESTAMP,'%Y') AS TIMESTAMP, MAX(KWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, SUM(SOLARHOUR-PSValue) AS DiffSOLARHOUR, AVG(PR) AS PR, AVG(Irradiance) AS Irradiance, AVG(Temp) AS Temp ,AVG(KWHKWP) AS KWHKWP "; kwh = "C.TOTALKWH"; usedb = "power_station_history_month"; pyrdb = "sensor_history_month"; diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index f7a0cdd..606634d 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -2390,6 +2390,12 @@ var listpr = new Array(0); var color = rgba(1); var color2 = rgba(2); + var listkwhkwp = new Array(0); + var times = 1; + var ALLkwhkwp = 0; + var kwhkwp = 0; + + $.each(rel.data, function (index, val) { TimestampALL = val.totaltime; kwhALL += val.kwh; @@ -2397,16 +2403,25 @@ irradianceALL += val.irradiance; prALL = val.pr; tempALL += val.temp; - - + + //暫時先執行到這--->取kwhkwp if (val.length != 0) { if (groupType != 6) { + + if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) { + kwhkwp = val.kwhkwp.toFixed(2); + } + if (groupType != 0) { + ALLkwhkwp += val.kwhkwp; + kwhkwp = (ALLkwhkwp / times).toFixed(2); + times++; + } diffSOLARHOURALL = val.solarhour; $('#HistoryDetailTable').append('' + '' + val.timestamp + '' + '' + val.kwh.toFixed(2) + '' + - '' + val.solarhour.toFixed(2) + '' + + '' + val.kwhkwp.toFixed(2) + '' + '' + val.irradiance.toFixed(2) + '' + '' + val.pr.toFixed(2) + '' + @@ -2420,14 +2435,23 @@ listtemperature.push(val.temp.toFixed(2)); listsolarhour.push(val.solarhour.toFixed(2)); listpr.push(val.pr.toFixed(2)); + listkwhkwp.push(val.kwhkwp.toFixed(2)); } else { + if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) { + kwhkwp = val.kwhkwp.toFixed(2); + } + if (groupType != 0) { + ALLkwhkwp += val.kwhkwp; + kwhkwp = (ALLkwhkwp / times).toFixed(2); + times++; + } diffSOLARHOURALL += val.diffSOLARHOUR; $('#HistoryDetailTable').append('' + '' + val.timestamp + '' + '' + val.kwh.toFixed(2) + '' + - '' + val.diffSOLARHOUR.toFixed(2) + '' + + '' + val.kwhkwp.toFixed(2) + '' + '' + val.irradiance.toFixed(2) + '' + '' + val.pr.toFixed(2) + '' + @@ -2441,6 +2465,7 @@ listtemperature.push(val.temp.toFixed(2)); listsolarhour.push(val.solarhour.toFixed(2)); listpr.push(val.pr.toFixed(2)); + listkwhkwp.push(val.kwhkwp.toFixed(2)); } @@ -2494,11 +2519,11 @@ data: listpr },{ type: 'bar', - label: '發電小時', + label: '有效日照時數', yAxisID: 'C', backgroundColor: 'rgba(165, 165, 165)', borderWidth: 1, - data: listsolarhour + data: listkwhkwp },{ type: 'bar', backgroundColor: 'rgba(103, 180, 172, 1)', @@ -2589,7 +2614,7 @@ $('#HistoryTotalTable').append('' + '' + TimestampALL + '' + '' + kwhALL.toFixed(2) + '' + - '' + diffSOLARHOURALL.toFixed(2) + '' + + '' + kwhkwp + '' + '' + irradianceALL.toFixed(2) + '' + '' + prALL.toFixed(2) + '' + '' + tempALL.toFixed(2) + '' + diff --git a/SolarPower/Views/StationOverview/_History.cshtml b/SolarPower/Views/StationOverview/_History.cshtml index e13f240..b6dbe1a 100644 --- a/SolarPower/Views/StationOverview/_History.cshtml +++ b/SolarPower/Views/StationOverview/_History.cshtml @@ -60,7 +60,7 @@ 時間 發電量(kWh) - 發電小時 + 有效日照時數 日照度(kWh/m2) PR(%) 溫度(℃) @@ -84,7 +84,7 @@ 時間 發電量(kWh) - 發電小時 + 有效日照時數 日照度(kWh/m2) PR(%) 溫度(℃)