From 5873750d59582b6d06fc54eb9411fefa32385e26 Mon Sep 17 00:00:00 2001 From: Kai Date: Tue, 10 Aug 2021 18:34:00 +0800 Subject: [PATCH] 1. bug fix --- SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs | 13 ++++++++++--- SolarPower/Quartz/Jobs/CalcPowerStationJob.cs | 2 +- .../StationOverview/StationOverviewInfo.cshtml | 13 ++++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs index 12a3085..8354ec1 100644 --- a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs @@ -34,6 +34,8 @@ namespace SolarPower.Quartz.Jobs { try { + logger.LogInformation("【CalcAvgPowerStationJob】【任務開始】"); + #region 寄送日月報 var users = userRepository.GetAllAsync(); @@ -199,11 +201,13 @@ namespace SolarPower.Quartz.Jobs logger.LogInformation("【CalcAvgPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations)); #endregion + //電站資訊 List calcAvgPowerStations = new List(); List powerStationHistoryDays = new List(); List insertPowerStationHistoryMonths = new List(); List updatePowerStationHistoryMonths = new List(); + //日照計、溫度資訊 List pyrheliometerHistoryDays = new List(); List insertPyrheliometerHistoryMonths = new List(); List updatePyrheliometerHistoryMonths = new List(); @@ -215,6 +219,7 @@ namespace SolarPower.Quartz.Jobs "Temperature" }; + //逆變器 List allofInverterHistorDays = new List(); List insertInverterHistoryMonths = new List(); List updateInverterHistoryMonths = new List(); @@ -277,6 +282,7 @@ namespace SolarPower.Quartz.Jobs "KWHKWP", }; + //sensor List sensorAvgHistoryDays = new List(); List insertSensorAvgHistoryMonths = new List(); List updateSensorAvgHistoryMonths = new List(); @@ -336,6 +342,7 @@ namespace SolarPower.Quartz.Jobs "SENSORAVG50", }; + //電錶 List meterHistoriesDays = new List(); List insertmeterHistoryMonths = new List(); List updatemeterHistoryMonths = new List(); @@ -483,7 +490,7 @@ namespace SolarPower.Quartz.Jobs logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); } - #region step2-2 計算電站30天的日照計平均值 + #region 計算電站30天的日照計平均值 logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天日照計平均資料】", powerStation.Code, dateNowDay); var avgPyrheliometerHistory = await powerStationRepository.CalcAvgPyrheliometerHistory30day(dateNowDay, powerStation.Id); logger.LogInformation("【CalcAvgPowerStationJob】【取得成功電站[{0}]在{1}的30天日照計平均資料】", powerStation.Code, dateNowDay); @@ -532,7 +539,7 @@ namespace SolarPower.Quartz.Jobs } } - //日照計 + //日照計、溫度 logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的日照計所有值的平均】", powerStation.Code, dateNowDay); var pyrheliometerHistorDay = await powerStationRepository.CalcPyrheliometerHistoryDayDataByPowerStationId(dateNowDay, powerStation.Id); logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}的日照計所有值的平均】", powerStation.Code, dateNowDay); @@ -545,7 +552,7 @@ namespace SolarPower.Quartz.Jobs logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的逆變器所有值的平均】", powerStation.Code, dateNowDay); var inverterHistoriesDay = await powerStationRepository.CalcInverterHistoryDayDataByPowerStationId(dateNowDay, powerStation.SiteDB, powerStation.Id); logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}的逆變器所有值的平均】", powerStation.Code, dateNowDay); - if (inverterHistoriesDay != null) + if (inverterHistoriesDay != null && inverterHistoriesDay.Count() > 0) { foreach (var inverterHistoryDay in inverterHistoriesDay) { diff --git a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs index 57f47b9..ce57365 100644 --- a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs @@ -311,7 +311,7 @@ namespace SolarPower.Quartz.Jobs var meter_table_name = String.Format("s{0}01_meter", powerStation.Code); var full_meter_table_name = String.Format("`{0}`.`{1}`", powerStation.SiteDB, meter_table_name); var exist_meter_table = await powerStationRepository.ExistTable(powerStation.SiteDB, meter_table_name); - if (!string.IsNullOrEmpty(exist_seneoravg_table)) + if (!string.IsNullOrEmpty(exist_meter_table)) { logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的meter的資訊】", powerStation.Code, dateTime); var meterHistory = await powerStationRepository.CalcMeterHistory(dateTime, full_meter_table_name); diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 19a2208..fd942ab 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -1956,7 +1956,18 @@ text: '逆變器單日kWhkWp' }, xAxis: { - categories: HeatMap.xAxisOnTime + categories: HeatMap.xAxis, + labels: { + step: 1, + formatter: function () { + var aa = this.value.substr(-2); + if (aa == "00") { + return '' + this.value + ''; + } else { + return '' + this.value + ''; + } + } + } }, yAxis: { categories: HeatMap.yAxis,