From 8a07c6ed56de90e7b2deb233f50df1d8f79cbe9f Mon Sep 17 00:00:00 2001 From: Kai Date: Mon, 19 Jul 2021 13:44:40 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=20=E9=80=86=E8=AE=8A?= =?UTF-8?q?=E5=99=A8=E8=A8=88=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Quartz/Jobs/CalcPowerStationJob.cs | 6 +-- .../Implement/PowerStationRepository.cs | 42 +++++++++++++++++++ SolarPower/Views/MapOverview/Index.cshtml | 20 ++++----- .../StationOverviewInfo.cshtml | 24 +++++------ .../Views/StationOverview/_Exception.cshtml | 4 +- 5 files changed, 68 insertions(+), 28 deletions(-) diff --git a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs index d559d3b..65bdd6b 100644 --- a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs @@ -138,8 +138,6 @@ namespace SolarPower.Quartz.Jobs } #endregion - - #region kWh/kWp //直接填寫 calcPowerStation.Today_kwhkwp = history.KWHKWP; @@ -175,7 +173,7 @@ namespace SolarPower.Quartz.Jobs var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB); logger.LogInformation("【CalcPowerStationJob】【取得成功電站[{0}]在{1}的日照計設備資訊】", powerStation.Code, dateTime); logger.LogInformation("【CalcPowerStationJob】【電站[{0}]在{1}的日照計設備資訊】 - {2}", powerStation.Code, dateTime, System.Text.Json.JsonSerializer.Serialize(deviceInfos)); - + if (deviceInfos != null) { //2. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均 @@ -283,7 +281,7 @@ namespace SolarPower.Quartz.Jobs logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的天氣預報的資訊】", powerStation.Code, dateTime); var weather = await powerStationRepository.SelectNowWeather(powerStation.CityId); logger.LogInformation("【CalcPowerStationJob】【取得成功電站[{0}]在{1}的天氣預報的資訊】", powerStation.Code, dateTime); - if(weather != null) + if (weather != null) { calcPowerStation.TodayWeather = weather.WeatherKey; calcPowerStation.RateOfRain = weather.PoP; diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 8f90655..7aac78d 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -2768,6 +2768,48 @@ namespace SolarPower.Repository.Implement inv.PowerStationId, DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP, inv.INVERTERID, + AVG(inv.AC1V) AS AC1V, + AVG(inv.AC1A) AS AC1A, + AVG(inv.AC1W) AS AC1W, + AVG(inv.AC1F) AS AC1F, + AVG(inv.AC1WH) AS AC1WH, + AVG(inv.AC2V) AS AC2V, + AVG(inv.AC2A) AS AC2A, + AVG(inv.AC2W) AS AC2W, + AVG(inv.AC2F) AS AC2F, + AVG(inv.AC2WH) AS AC2WH, + AVG(inv.AC3V) AS AC3V, + AVG(inv.AC3A) AS AC3A, + AVG(inv.AC3W) AS AC3W, + AVG(inv.AC3F) AS AC3F, + AVG(inv.AC3WH) AS AC3WH, + AVG(inv.ACRUNTIME) AS ACRUNTIME, + AVG(inv.DC1V) AS DC1V, + AVG(inv.DC1A) AS DC1A, + AVG(inv.DC1W) AS DC1W, + AVG(inv.DC1WH) AS DC1WH, + AVG(inv.DC2V) AS DC2V, + AVG(inv.DC2A) AS DC2A, + AVG(inv.DC2W) AS DC2W, + AVG(inv.DC2WH) AS DC2WH, + AVG(inv.DC3V) AS DC3V, + AVG(inv.DC3A) AS DC3A, + AVG(inv.DC3W) AS DC3W, + AVG(inv.DC3WH) AS DC3WH, + AVG(inv.DC4V) AS DC4V, + AVG(inv.DC4A) AS DC4A, + AVG(inv.DC4W) AS DC4W, + AVG(inv.DC4WH) AS DC4WH, + AVG(inv.DC5V) AS DC5V, + AVG(inv.DC5A) AS DC5A, + AVG(inv.DC5W) AS DC5W, + AVG(inv.DC5WH) AS DC5WH, + AVG(inv.PR) AS PR, + AVG(inv.RA1) AS RA1, + AVG(inv.RA2) AS RA2, + AVG(inv.RA3) AS RA3, + AVG(inv.RA4) AS RA4, + AVG(inv.RA5) AS RA5, SUM(inv.KWH) AS KWH, MAX(inv.TODAYKWH) AS TODAYKWH, MAX(inv.TODAYKWH) / i.Capacity AS KWHKWP diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index 7586374..8c3a66c 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -232,16 +232,16 @@ mapOverview = rel.data; - $("#today_kwh").html(mapOverview.today_kwh); - $("#total_kwh").html(mapOverview.total_kwh); - $("#today_irradiance").html(mapOverview.today_irradiance); - $("#avg_irradiance").html(mapOverview.avg_irradiance); - $("#today_PR").html(mapOverview.today_PR); - $("#avg_PR").html(mapOverview.avg_PR); - $("#today_kwhkwp").html(mapOverview.today_kwhkwp); - $("#avg_kwhkwp").html(mapOverview.avg_kwhkwp); - $("#today_carbon").html(mapOverview.today_carbon); - $("#total_carbon").html(mapOverview.total_carbon); + $("#today_kwh").html(mapOverview.today_kwh.toFixed(2)); + $("#total_kwh").html(mapOverview.total_kwh.toFixed(2)); + $("#today_irradiance").html(mapOverview.today_irradiance.toFixed(2)); + $("#avg_irradiance").html(mapOverview.avg_irradiance.toFixed(2)); + $("#today_PR").html(mapOverview.today_PR.toFixed(2)); + $("#avg_PR").html(mapOverview.avg_PR.toFixed(2)); + $("#today_kwhkwp").html(mapOverview.today_kwhkwp.toFixed(2)); + $("#avg_kwhkwp").html(mapOverview.avg_kwhkwp.toFixed(2)); + $("#today_carbon").html(mapOverview.today_carbon.toFixed(2)); + $("#total_carbon").html(mapOverview.total_carbon.toFixed(2)); $("#total_power_station_count").html(mapOverview.totalPowerStationCount); $("#total_capacity").html(mapOverview.totalCapacity); $("#update_at").html(mapOverview.updatedAt); diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index f4440da..f6e20d6 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -180,18 +180,18 @@ } stationOverview = rel.data; - $("#today_kwh").html(stationOverview.today_kwh); - $("#total_kwh").html(stationOverview.total_kwh); - $("#today_irradiance").html(stationOverview.today_irradiance); - $("#avg_irradiance").html(stationOverview.avg_irradiance); - $("#today_PR").html(stationOverview.today_PR); - $("#avg_PR").html(stationOverview.avg_PR); - $("#today_kwhkwp").html(stationOverview.today_kwhkwp); - $("#avg_kwhkwp").html(stationOverview.avg_kwhkwp); - $("#total_money").html(stationOverview.total_money); - $("#today_money").html(stationOverview.today_money); - $("#today_carbon").html(stationOverview.today_carbon); - $("#total_carbon").html(stationOverview.total_carbon); + $("#today_kwh").html(stationOverview.today_kwh.toFixed(2)); + $("#total_kwh").html(stationOverview.total_kwh.toFixed(2)); + $("#today_irradiance").html(stationOverview.today_irradiance.toFixed(2)); + $("#avg_irradiance").html(stationOverview.avg_irradiance.toFixed(2)); + $("#today_PR").html(stationOverview.today_PR.toFixed(2)); + $("#avg_PR").html(stationOverview.avg_PR.toFixed(2)); + $("#today_kwhkwp").html(stationOverview.today_kwhkwp.toFixed(2)); + $("#avg_kwhkwp").html(stationOverview.avg_kwhkwp.toFixed(2)); + $("#total_money").html(stationOverview.total_money.toFixed(2)); + $("#today_money").html(stationOverview.today_money.toFixed(2)); + $("#today_carbon").html(stationOverview.today_carbon.toFixed(2)); + $("#total_carbon").html(stationOverview.total_carbon.toFixed(2)); $("#update_at").html(stationOverview.updatedAt); $('#power-station-title').html(stationOverview.stationName); $('#weather-temp').html(stationOverview.todayWeatherTemp + '°C
降雨幾率: ' + stationOverview.rateOfRain + '%'); diff --git a/SolarPower/Views/StationOverview/_Exception.cshtml b/SolarPower/Views/StationOverview/_Exception.cshtml index 4a5bf05..a931b08 100644 --- a/SolarPower/Views/StationOverview/_Exception.cshtml +++ b/SolarPower/Views/StationOverview/_Exception.cshtml @@ -1,8 +1,8 @@ 
- - + +