From ed1b3d212c9498fa9b646a310942b8ff1146243f Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Thu, 4 Aug 2022 10:21:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E7=89=87=E4=BF=AE=E6=94=B9=E3=80=81?= =?UTF-8?q?=E9=9B=BB=E7=AB=99=E8=B3=87=E8=A8=8A-=E5=8D=B3=E6=99=82?= =?UTF-8?q?=E8=B3=87=E8=A8=8A:=E4=BB=8A=E6=97=A5=E7=9A=84=E5=9C=96?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8F=96=E7=B4=AF=E7=A9=8D=E6=97=A5=E7=85=A7?= =?UTF-8?q?=E5=89=8D=E4=B8=80=E5=B0=8F=E6=99=82=E7=9A=84=E5=B7=AE=E9=A1=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationOverviewController.cs | 2 +- SolarPower/Models/Overview.cs | 2 + .../Implement/OverviewRepository.cs | 12 +- .../Views/AnalysisInverter/Index.cshtml | 110 +++++++++--------- .../Views/AnalysisStationCombine/Index.cshtml | 56 ++++----- .../Views/AnalysisStationInfo/Index.cshtml | 46 ++++---- .../Views/ElectricitySoldRecord/Index.cshtml | 6 +- SolarPower/Views/ExceptionRecord/Index.cshtml | 4 +- SolarPower/Views/MapOverview/Index.cshtml | 44 +++---- SolarPower/Views/NoticeSchedule/Index.cshtml | 6 +- SolarPower/Views/Operation/Index.cshtml | 4 +- .../Views/Operation/OperationRecord.cshtml | 4 +- SolarPower/Views/PowerGeneration/Index.cshtml | 6 +- SolarPower/Views/StationOverview/Index.cshtml | 36 +++--- .../StationOverviewInfo.cshtml | 36 +++--- .../Views/StationOverview/_History.cshtml | 4 +- .../Views/StationOverview/_UpToDate.cshtml | 38 +++--- SolarPower/Views/StationReport/Index.cshtml | 14 +-- 18 files changed, 216 insertions(+), 214 deletions(-) diff --git a/SolarPower/Controllers/StationOverviewController.cs b/SolarPower/Controllers/StationOverviewController.cs index 284911c..caec31c 100644 --- a/SolarPower/Controllers/StationOverviewController.cs +++ b/SolarPower/Controllers/StationOverviewController.cs @@ -356,7 +356,7 @@ namespace SolarPower.Controllers PowerIrradianceChart powerIrradianceTodayChart = new PowerIrradianceChart(); powerIrradianceTodayChart.Labels = powerIrradianceToday.Select(x => x.Label).ToList(); powerIrradianceTodayChart.PowerDatas = powerIrradianceToday.Select(x => x.PowerData).ToList(); - powerIrradianceTodayChart.IrradianceDatas = powerIrradianceToday.Select(x => x.IrradianceData).ToList(); + powerIrradianceTodayChart.IrradianceDatas = powerIrradianceToday.Select(x => x.IrrDayHourData).ToList(); powerIrradianceTodayChart.TemperatureDatas = powerIrradianceToday.Select(x => x.TemperatureData).ToList(); chartUptoDate.ChartToday = powerIrradianceTodayChart; diff --git a/SolarPower/Models/Overview.cs b/SolarPower/Models/Overview.cs index 38d6d6f..f5fc772 100644 --- a/SolarPower/Models/Overview.cs +++ b/SolarPower/Models/Overview.cs @@ -95,6 +95,7 @@ namespace SolarPower.Models public double PowerData { get; set; } public double IrradianceData { get; set; } public double TemperatureData { get; set; } + public double IrrDayHourData { get; set; } } public class PowerIrradianceChart @@ -202,6 +203,7 @@ namespace SolarPower.Models /// 累計日照 /// public double IrrDay { get; set; } + public double IrrDayHour { get; set; } } public class ExceptionEmailInfo diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index 6f76dca..8dca441 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -212,7 +212,7 @@ namespace SolarPower.Repository.Implement { try { - var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp,'%H %p') AS Label, ps.KWH AS PowerData, pyr.Irradiance AS IrradianceData, pyr.Temperature AS TemperatureData + var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp,'%H %p') AS Label, ps.KWH AS PowerData, pyr.IrrDayHour AS IrrDayHourData, pyr.Temperature AS TemperatureData FROM power_station_history_hour ps LEFT JOIN sensor_history_hour pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d %H') = DATE_FORMAT(pyr.timestamp, '%Y-%m-%d %H') WHERE ps.PowerStationId = @PowerStationId @@ -681,7 +681,7 @@ namespace SolarPower.Repository.Implement { // range 查詢同一天 range2 = @$" AND DATE_FORMAT(C.`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{ d1 }' AND '{ d2 }'"; sql = $@" SELECT C.TIMESTAMP, C.KWH AS KWH,C.SOLARHOUR, C.PR, - P.Irradiance, P.Temperature AS Temp , C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR + P.Irradiance, P.IrrDayHour, P.Temperature AS Temp , C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR FROM power_station_history_hour C LEFT JOIN sensor_history_hour P ON P.`TIMESTAMP` =C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId WHERE C.PowerStationId = {post.PowerstationId}{range2} "; @@ -696,7 +696,7 @@ namespace SolarPower.Repository.Implement // LEFT JOIN sensor_history_day P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId // join power_station_history_month m on DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(m.TIMESTAMP, '%Y-%m') AND m.PowerStationId = C.PowerStationId // WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP"; - sql = $@" SELECT C.TIMESTAMP, C.TODAYKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR + sql = $@" SELECT C.TIMESTAMP, C.TODAYKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.IrrDayHour, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR FROM power_station_history_day C LEFT JOIN sensor_history_day P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP"; break; @@ -704,16 +704,16 @@ namespace SolarPower.Repository.Implement } break; case 1: // day 沒有 dateRange - 月 - sql = $@" SELECT C.TIMESTAMP, {kwh} AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR + sql = $@" SELECT C.TIMESTAMP, {kwh} AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.IrrDayHour, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR FROM {usedb} C LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP"; break; case 2: // month 單月 - //sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR + //sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.IrrDayHour, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR // FROM power_station_history_month C // LEFT JOIN sensor_history_month P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m') AND P.PowerStationId = C.PowerStationId // WHERE C.PowerStationId = {post.PowerstationId}{range}"; - sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR + sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.IrrDayHour, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR FROM power_station_history_month C LEFT JOIN sensor_history_month P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m') AND P.PowerStationId = C.PowerStationId WHERE C.PowerStationId = {post.PowerstationId}{range}"; diff --git a/SolarPower/Views/AnalysisInverter/Index.cshtml b/SolarPower/Views/AnalysisInverter/Index.cshtml index 0e0d81e..adeba19 100644 --- a/SolarPower/Views/AnalysisInverter/Index.cshtml +++ b/SolarPower/Views/AnalysisInverter/Index.cshtml @@ -11,7 +11,7 @@