diff --git a/SolarPower/Controllers/StationOverviewController.cs b/SolarPower/Controllers/StationOverviewController.cs index 670097d..a7d698b 100644 --- a/SolarPower/Controllers/StationOverviewController.cs +++ b/SolarPower/Controllers/StationOverviewController.cs @@ -65,6 +65,26 @@ namespace SolarPower.Controllers return apiResult; } + [HttpPost] + public ApiResult> GetPowerStationCollapse(string filter) + { + ApiResult> apiResult = new ApiResult>(); + try + { + apiResult.Code = "0000"; + var powerStationSummary = powerStationRepository.GetMyPowerStationSummary(myUser, filter); + + apiResult.Data = powerStationSummary; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = exception.ToString(); + } + + return apiResult; + } + [HttpPost] public async Task> GetStationCard(StationIds post) { diff --git a/SolarPower/DBSchema/solar_power_schema.sql b/SolarPower/DBSchema/solar_power_schema.sql index cf43ee4..b5c3a7e 100644 --- a/SolarPower/DBSchema/solar_power_schema.sql +++ b/SolarPower/DBSchema/solar_power_schema.sql @@ -1579,6 +1579,24 @@ ALTER TABLE `operation_plan_create` ALTER TABLE `operation_record` CHANGE COLUMN `FixDo` `FixDo` VARCHAR(50) NULL DEFAULT NULL COMMENT '維修項目' COLLATE 'utf8mb4_unicode_ci' AFTER `ErrorCode`; +-- 各電站每15min的逆變器歷史記錄 20210715 +CREATE TABLE `inverter_history_15min` ( + `Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `INVERTERID` VARCHAR(500) NULL DEFAULT NULL COLLATE 'utf8_general_ci', + `TIMESTAMP` TIMESTAMP NULL DEFAULT NULL, + `KWH` DOUBLE NULL DEFAULT NULL, + `TODAYKWH` DOUBLE NULL DEFAULT NULL, + `KWHKWP` DOUBLE NULL DEFAULT NULL, + PRIMARY KEY (`Id`) USING BTREE, + INDEX `IDX_01` (`PowerStationId`) USING BTREE +) +COMMENT='各電站每15min的逆變器歷史記錄' +COLLATE='utf8mb4_unicode_ci' +ENGINE=InnoDB +; + + -- 新增發電金額及減碳量 20210716 ALTER TABLE `power_station_history_hour` ADD COLUMN `MONEY` DOUBLE(22,0) NULL DEFAULT NULL AFTER `SOLARHOUR`, diff --git a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs index ebf3a11..43bc222 100644 --- a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs @@ -28,7 +28,10 @@ namespace SolarPower.Quartz.Jobs try { #region step1. 找出所有電站 + logger.LogInformation("【CalcAvgPowerStationJob】【開始取得電站資料】"); var powerStations = await powerStationRepository.GetAllAsync(); + logger.LogInformation("【CalcAvgPowerStationJob】【取得成功電站資料】"); + logger.LogInformation("【CalcAvgPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations)); #endregion List calcAvgPowerStations = new List(); @@ -52,14 +55,16 @@ namespace SolarPower.Quartz.Jobs var count = 0; #region 氣象觀測(取資料) + logger.LogInformation("【CalcAvgPowerStationJob】【開始取得氣象觀測】"); var client = new HttpClient(); var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/F-C0032-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&elementName=Wx,PoP&sort=time"; HttpResponseMessage response = client.GetAsync(UVUri).Result; String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString(); Root2 observation = JsonConvert.DeserializeObject(jsonUVs); + logger.LogInformation("【CalcAvgPowerStationJob】【取得成功氣象觀測】"); #endregion - foreach(var location in observation.Records.Location) + foreach (var location in observation.Records.Location) { WeatherForecast weatherForecast = new WeatherForecast(); weatherForecast.LocationName = location.LocationName; @@ -149,10 +154,14 @@ namespace SolarPower.Quartz.Jobs var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd"); #region step2-1. 計算該電站的30天平均資料 - var table_name = String.Format("`{0}`.`{1}01_station`", powerStation.SiteDB, powerStation.Code); + var table_name = String.Format("`{0}`.`s{1}01_station`", powerStation.SiteDB, powerStation.Code); + logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); var history = await powerStationRepository.CalcAvgPowerStationHistory30day(dateNowDay, table_name); + logger.LogInformation("【CalcAvgPowerStationJob】【取得成功電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); + logger.LogInformation("【CalcAvgPowerStationJob】【電站[{0}]在{1}的30天平均資料】 - {2}", powerStation.Code, dateNowDay, System.Text.Json.JsonSerializer.Serialize(history)); if (history != null) { + logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); history.PowerStationId = powerStation.Id; #region 計算電站30天的 kWh/kWp 與 PR 值 @@ -169,11 +178,15 @@ namespace SolarPower.Quartz.Jobs #endregion + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); } #endregion #region step2-2 計算電站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); + logger.LogInformation("【CalcAvgPowerStationJob】【電站[{0}]在{1}的30天日照計平均資料】 - {2}", powerStation.Code, dateNowDay, System.Text.Json.JsonSerializer.Serialize(avgPyrheliometerHistory)); if (avgPyrheliometerHistory != null) { calcPowerStation.Avg_irradiance = avgPyrheliometerHistory.AvgIrradiance; @@ -184,7 +197,10 @@ namespace SolarPower.Quartz.Jobs #region step2-3. 計算昨天的所有值總和 //電站資訊 + logger.LogInformation("【CalcAvgPowerStationJob】【開始取得電站[{0}]在{1}的所有值的總和】", powerStation.Code, dateNowDay); var historyDay = await powerStationRepository.GetLastOnePowerStationHistoryByDay(dateNowDay, table_name); + logger.LogInformation("【CalcAvgPowerStationJob】【取得成功電站[{0}]在{1}的所有值的總和】", powerStation.Code, dateNowDay); + logger.LogInformation("【CalcAvgPowerStationJob】【電站[{0}]在{1}的所有值的總和】 - {2}", powerStation.Code, dateNowDay, System.Text.Json.JsonSerializer.Serialize(historyDay)); if (historyDay != null) { historyDay.PowerStationId = powerStation.Id; @@ -192,14 +208,18 @@ 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); if (pyrheliometerHistorDay != null) { pyrheliometerHistoryDays.Add(pyrheliometerHistorDay); } //逆變器 + 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) { foreach(var inverterHistoryDay in inverterHistoriesDay) @@ -214,6 +234,7 @@ namespace SolarPower.Quartz.Jobs var dateNowMonth = DateTimeNow.ToString("yyyy-MM"); //電站該月份的歷史資料 + logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}月份的歷史資料總和】", powerStation.Code, dateNowMonth); var exist_history = await powerStationRepository.GetOnePowerStationHistoryByPowerStationIdAndMonth(powerStation.Id, dateNowMonth); if (exist_history == null) { //新增 @@ -224,6 +245,7 @@ namespace SolarPower.Quartz.Jobs insertPowerStationHistoryMonths.Add(historyMonth); } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的歷史資料總和】", powerStation.Code, dateNowMonth); } else { //修改 @@ -232,9 +254,12 @@ namespace SolarPower.Quartz.Jobs { updatePowerStationHistoryMonths.Add(historyMonth); } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的歷史資料總和】", powerStation.Code, dateNowMonth); } + //電站該月份的的日照度歷史資料 + logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}月份的日照度歷史資料】", powerStation.Code, dateNowMonth); var exist_pyrheliometer_history = await powerStationRepository.GetOnePyrheliometerHistoryByMonth(dateNowMonth, powerStation.Id); if (exist_pyrheliometer_history == null) { //新增 @@ -244,6 +269,7 @@ namespace SolarPower.Quartz.Jobs pyrheliometerHistoryMonth.Timestamp = Convert.ToDateTime(pyrheliometerHistoryMonth.Timestamp).ToString("yyyy-MM-dd"); insertPyrheliometerHistoryMonths.Add(pyrheliometerHistoryMonth); } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的日照度歷史資料】", powerStation.Code, dateNowMonth); } else { //修改 @@ -252,9 +278,11 @@ namespace SolarPower.Quartz.Jobs { updatePyrheliometerHistoryMonths.Add(pyrheliometerHistoryMonth); } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的日照度歷史資料】", powerStation.Code, dateNowMonth); } //電站該月份的的逆變器歷史資料 + logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}月份的逆變器歷史資料】", powerStation.Code, dateNowMonth); var exist_inverter_histories = await powerStationRepository.GetInverterHistoryByPowerStationIdAndMonth(dateNowMonth, powerStation.Id); if (exist_inverter_histories.Count == 0 ) { //新增 @@ -267,6 +295,7 @@ namespace SolarPower.Quartz.Jobs insertInverterHistoryMonths.Add(inverterHistoryMonth); } } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的逆變器歷史資料】", powerStation.Code, dateNowMonth); } else { //修改 @@ -279,6 +308,7 @@ namespace SolarPower.Quartz.Jobs updateInverterHistoryMonths.Add(inverterHistoryMonth); } } + logger.LogInformation("【CalcAvgPowerStationJob】【計算完成電站[{0}]在{1}月份的逆變器歷史資料】", powerStation.Code, dateNowMonth); } #endregion diff --git a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs index 670501e..7fa7ff8 100644 --- a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs +++ b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs @@ -25,9 +25,11 @@ namespace SolarPower.Quartz.Jobs { try { - /* #region step1. 找出所有電站 + logger.LogInformation("【CalcInverter15minJob】【開始取得電站資料】"); var powerStations = await powerStationRepository.GetAllAsync(); + logger.LogInformation("【CalcPowerStationJob】【取得成功電站資料】"); + logger.LogInformation("【CalcPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations)); #endregion List calcInverter15mins = new List(); @@ -44,47 +46,28 @@ namespace SolarPower.Quartz.Jobs break; } - //取得所有該電站的逆變器 - var controllers = await powerStationRepository.GetAllDeviceControllerId(powerStation.Id, powerStation.SiteDB); - var inverters = await powerStationRepository.InverterTable(controllers, powerStation.SiteDB); - - var inverterIds = inverters.Select(x => x.InverterId.Replace("s", "")).ToList(); - var calcInverter15min = new InverterHistory(); var dateNowTime = DateTimeNow.ToString("yyyy-MM-dd HH:mm"); - #region step2-1. 計算該電站的30天平均資料 - var table_name = String.Format("`{0}`.`{1}01_inv`", powerStation.SiteDB, powerStation.Code); - var history = await powerStationRepository.CalcInverterHisyort15minData(dateNowTime, table_name, inverterIds); - if (history != null) + //取得所有該電站的逆變器 + logger.LogInformation("【CalcInverter15minJob】【開始取得電站[{0}]在{1}的逆變器設備資訊】", powerStation.Code, dateNowTime); + var controllers = await powerStationRepository.GetAllDeviceControllerId(powerStation.Id, powerStation.SiteDB); + var inverters = await powerStationRepository.InverterTable(controllers, powerStation.SiteDB); + var inverterIds = inverters.Where(x => x.Enabled == 1 && x.Status != 0).Select(x => x.InverterId).ToList(); + logger.LogInformation("【CalcInverter15minJob】【取得成功電站[{0}]在{1}的逆變器設備資訊】", powerStation.Code, dateNowTime); + + var calcInverter15min = new InverterHistory(); + + #region step2-1. 計算該電站逆變器每15min 的值 + var table_name = String.Format("`{0}`.`s{1}01_inv`", powerStation.SiteDB, powerStation.Code); + logger.LogInformation("【CalcInverter15minJob】【開始計算電站[{0}]在{1}的每15分鐘逆變器資訊】", powerStation.Code, dateNowTime); + calcInverter15mins = await powerStationRepository.CalcInverterHisyort15minData(dateNowTime, powerStation.SiteDB, table_name, inverterIds); + logger.LogInformation("【CalcInverter15minJob】【計算完成電站[{0}]在{1}的每15分鐘逆變器資訊】", powerStation.Code, dateNowTime); + if (calcInverter15mins.Count() > 0) { - history.PowerStationId = powerStation.Id; - - #region 計算電站30天的 kWh/kWp 與 PR 值 - - #region 平均kWh/kWp - //直接填寫 - calcPowerStation.Avg_kwhkwp = history.AvgKWHKWP; - #endregion - - #region 平均PR - //直接填寫 - calcPowerStation.Avg_PR = history.AvgPR; - #endregion - - #endregion - - } - #endregion - - #region step2-2. 計算昨天的所有值總和 - - //逆變器 - var inverterHistoriesDay = await powerStationRepository.CalcInverterHistoryDayDataByPowerStationId(dateNowDay, powerStation.SiteDB, powerStation.Id); - if (inverterHistoriesDay != null) - { - foreach (var inverterHistoryDay in inverterHistoriesDay) + foreach (var inverterHistory in calcInverter15mins) { - allofInverterHistorDays.Add(inverterHistoryDay); + inverterHistory.TIMESTAMP = Convert.ToDateTime(inverterHistory.TIMESTAMP + ":00").ToString("yyyy-MM-dd HH:mm:ss"); + inverterHistory.PowerStationId = powerStation.Id; } } #endregion @@ -93,115 +76,24 @@ namespace SolarPower.Quartz.Jobs } #endregion - #region step3. calcPowerStations UPDATE 到 power_station 資料表 - List power_station_properties = new List() - { - "Id", - "avg_kwhkwp", - "avg_PR", - "avg_irradiance" - }; - - await powerStationRepository.UpdateList(calcAvgPowerStations, power_station_properties); - #endregion - - #region step4. 將各電站的每日及月的資料insert or update 各資料表 - //每日 - List history_properties_day = new List() - { - "PowerStationId", - "TIMESTAMP", - "SITEID", - "SITETYPE", - "TODAYKWH", - "TOTALKWH", - "KWHKWP", - "PR", - "MP", - "SolarHour" - }; - - await powerStationRepository.AddPowerStationHistoryDayList(powerStationHistoryDays, history_properties_day); - - //每月 - List history_properties_month = new List() - { - "PowerStationId", - "TIMESTAMP", - "SITEID", - "SITETYPE", - "MonthKWh", - "TOTALKWH", - "KWHKWP", - "PR", - "MP", - "SolarHour" - }; - - if (insertPowerStationHistoryMonths.Count > 0) - { - await powerStationRepository.AddPowerStationHistoryMonthList(insertPowerStationHistoryMonths, history_properties_month); - } - - if (updatePowerStationHistoryMonths.Count > 0) - { - await powerStationRepository.UpdatePowerStationHistoryMonthList(updatePowerStationHistoryMonths); - } - #endregion - - #region step5. 將各電站的每日及月的日照度資料insert or update 各資料表 - List pyrheliometer_history_properties = new List() - { - "PowerStationId", - "Timestamp", - "Irradiance", - "Temperature" - }; - //每日 - await powerStationRepository.AddPyrheliometerHistoryDayList(pyrheliometerHistoryDays, pyrheliometer_history_properties); - - //每月 - if (insertPyrheliometerHistoryMonths.Count > 0) - { - await powerStationRepository.AddPyrheliometerHistoryMonthList(insertPyrheliometerHistoryMonths, pyrheliometer_history_properties); - } - - if (updatePyrheliometerHistoryMonths.Count > 0) - { - await powerStationRepository.UpdatePyrheliometerHistoryMonthList(updatePyrheliometerHistoryMonths); - } - #endregion - - #region step6. 將各電站的每日及月的逆變器資料insert or update 各資料表 + #region step3. 將 inverter INSERT 到 inverter_history_hour 資料表 List inverter_history_properties = new List() { "PowerStationId", - "TIMESTAMP", "INVERTERID", + "TIMESTAMP", "KWH", "TODAYKWH", "KWHKWP", }; - //每日 - await powerStationRepository.AddInverterHistoryDayList(allofInverterHistorDays, inverter_history_properties); - //每月 - if (insertInverterHistoryMonths.Count > 0) - { - await powerStationRepository.AddInverterHistoryMonthList(insertInverterHistoryMonths, inverter_history_properties); - } - - if (updateInverterHistoryMonths.Count > 0) - { - await powerStationRepository.UpdateInverterHistoryMonthList(updateInverterHistoryMonths); - } + await powerStationRepository.AddInverter15minHistory(calcInverter15mins, inverter_history_properties); #endregion - */ } catch (Exception exception) { - logger.LogError("【{0}】{1}", "CalcAvgPowerStationJob", exception.Message); + logger.LogError("【{0}】{1}", "CalcInverter15minJob", exception.Message); } } } diff --git a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs index c965ec4..07b5847 100644 --- a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs @@ -30,10 +30,10 @@ namespace SolarPower.Quartz.Jobs try { #region step1. 找出所有電站 + logger.LogInformation("【CalcPowerStationJob】【開始取得電站資料】"); var powerStations = await powerStationRepository.GetAllAsync(); - - string json = System.Text.Json.JsonSerializer.Serialize(powerStations); - logger.LogError("【{0}】{1}", "CalcPowerStationJob - step1", json); + logger.LogInformation("【CalcPowerStationJob】【取得成功電站資料】"); + logger.LogInformation("【CalcPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations)); #endregion List powerStationHistoriesHour = new List(); @@ -47,11 +47,13 @@ namespace SolarPower.Quartz.Jobs var count = 0; #region 氣象觀測(取資料) + logger.LogInformation("【CalcPowerStationJob】【開始取得氣象觀測】"); var client = new HttpClient(); var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80"; HttpResponseMessage response = client.GetAsync(UVUri).Result; String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString(); Root2 observation = JsonConvert.DeserializeObject(jsonUVs); + logger.LogInformation("【CalcPowerStationJob】【取得成功氣象觀測】"); #endregion @@ -69,15 +71,16 @@ namespace SolarPower.Quartz.Jobs var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH"); #region step2-1. 取得該電站的當前這小時的歷史資料 - var table_name = String.Format("`{0}`.{1}01_station", powerStation.SiteDB, powerStation.Code); - logger.LogError("【{0}】{1}", "CalcPowerStationJob - time & dataTable", dateTime + "======" + table_name); + var table_name = String.Format("`{0}`.s{1}01_station", powerStation.SiteDB, powerStation.Code); + logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime); var history = await powerStationRepository.GetPowerStationHistoryPerHour(dateTime, table_name); - json = System.Text.Json.JsonSerializer.Serialize(history); - logger.LogError("【{0}】{1}", "CalcPowerStationJob - history", json); + logger.LogInformation("【CalcPowerStationJob】【取得成功電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime); + logger.LogInformation("【CalcPowerStationJob】【電站[{0}]在{1}的每小時歷史資料】 - {2}", powerStation.Code, dateTime, System.Text.Json.JsonSerializer.Serialize(history)); if (history != null) { + logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime); history.PowerStationId = powerStation.Id; history.Timestamp = Convert.ToDateTime(history.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); @@ -153,17 +156,22 @@ namespace SolarPower.Quartz.Jobs #endregion powerStationHistoriesHour.Add(history); + + logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime); } #endregion #region step2-2. 取得該電站的當前這小時的日照度歷史資料 //1. 找出該電站所有日照計設備(包含共享 + logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的日照計設備資訊】", powerStation.Code, dateTime); var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB); - // 找出該電站所有溫度計設備(包含共享 - var tempdeviceInfos = await powerStationRepository.GetListTempByPowerStationId(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. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均 + logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的日照計的日照度】", powerStation.Code, dateTime); var pyrheliometerHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, deviceInfos, 0); if (pyrheliometerHistory != null) @@ -174,32 +182,47 @@ namespace SolarPower.Quartz.Jobs pyrheliometerHistory.PowerStationId = powerStation.Id; pyrheliometerHistoriesHour.Add(pyrheliometerHistory); } + logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的日照計的日照度】", powerStation.Code, dateTime); } //2. 計算該電站所有溫度計設的每小時的平均在依照溫度計數量平均 + // 找出該電站所有溫度計設備(包含共享 + logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的溫度計設備資訊】", powerStation.Code, dateTime); + var tempdeviceInfos = await powerStationRepository.GetListTempByPowerStationId(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(tempdeviceInfos)); if (tempdeviceInfos != null) { + logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的溫度計的平均溫度】", powerStation.Code, dateTime); var tempHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, tempdeviceInfos, 1); if (tempHistory != null) { tempHistory.Timestamp = Convert.ToDateTime(tempHistory.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); tempHistory.PowerStationId = powerStation.Id; TempHistoriesHour.Add(tempHistory); + + logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的溫度計的平均溫度】", powerStation.Code, dateTime); } } - - #endregion #region step2-3. 計算該電站所有逆變器每小時值 - var inverter_table_name = String.Format("`{0}`.{1}01_inv", powerStation.SiteDB, powerStation.Code); + logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的逆變器設備資訊】", powerStation.Code, dateTime); + var controllers = await powerStationRepository.GetAllDeviceControllerId(powerStation.Id, powerStation.SiteDB); + var inverters = await powerStationRepository.InverterTable(controllers, powerStation.SiteDB); + var inverterIds = inverters.Select(x => x.InverterId).ToList(); + logger.LogInformation("【CalcPowerStationJob】【取得成功電站[{0}]在{1}的逆變器設備資訊】", powerStation.Code, dateTime); + logger.LogInformation("【CalcPowerStationJob】【電站[{0}]在{1}的逆變器設備資訊】 - {2}", powerStation.Code, dateTime, System.Text.Json.JsonSerializer.Serialize(inverterIds)); - inverterHistories = await powerStationRepository.CalcInverterHisyortHourData(dateTime, powerStation.SiteDB, inverter_table_name); + var inverter_table_name = String.Format("`{0}`.s{1}01_inv", powerStation.SiteDB, powerStation.Code); + + logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的逆變器的資訊】", powerStation.Code, dateTime); + inverterHistories = await powerStationRepository.CalcInverterHisyortHourData(dateTime, powerStation.SiteDB, inverter_table_name, inverterIds); foreach (var inverterHistory in inverterHistories) { inverterHistory.TIMESTAMP = Convert.ToDateTime(inverterHistory.TIMESTAMP + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); inverterHistory.PowerStationId = powerStation.Id; } - + logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的逆變器的資訊】", powerStation.Code, dateTime); #endregion #region 確認是否有觀測站(沒有則新增) @@ -218,7 +241,7 @@ namespace SolarPower.Quartz.Jobs calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue); } } - + calcPowerStation.WeathersStationId = weatherStationId; } #endregion @@ -226,9 +249,9 @@ namespace SolarPower.Quartz.Jobs WeatherObservation weatherObservation = new WeatherObservation(); if (powerStation.WeathersStationId != null) { - foreach(var Location in observation.Records.Location) + foreach (var Location in observation.Records.Location) { - if(Location.StationId == powerStation.WeathersStationId) + if (Location.StationId == powerStation.WeathersStationId) { calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue); weatherObservation.PowerStationId = powerStation.Id; @@ -240,15 +263,19 @@ namespace SolarPower.Quartz.Jobs } } + logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的天氣預報的資訊】", powerStation.Code, dateTime); var weather = await powerStationRepository.SelectNowWeather(powerStation.CityId); - calcPowerStation.TodayWeather = weather.WeatherKey; - calcPowerStation.RateOfRain = weather.PoP; + logger.LogInformation("【CalcPowerStationJob】【取得成功電站[{0}]在{1}的天氣預報的資訊】", powerStation.Code, dateTime); + if(weather != null) + { + calcPowerStation.TodayWeather = weather.WeatherKey; + calcPowerStation.RateOfRain = weather.PoP; + } weatherObservations.Add(weatherObservation); calcPowerStations.Add(calcPowerStation); count++; - } #endregion @@ -268,9 +295,6 @@ namespace SolarPower.Quartz.Jobs "SolarHour" }; - json = System.Text.Json.JsonSerializer.Serialize(powerStationHistoriesHour); - logger.LogError("【{0}】{1}", "CalcPowerStationJob - step3", json); - await powerStationRepository.AddPowerStationHistory(powerStationHistoriesHour, history_properties); #endregion @@ -328,7 +352,7 @@ namespace SolarPower.Quartz.Jobs "KWHKWP", }; - await powerStationRepository.AddInverterHisyort(inverterHistories, inverter_history_properties); + await powerStationRepository.AddInverterHistory(inverterHistories, inverter_history_properties); #endregion List weather_observation_properties = new List() @@ -338,10 +362,6 @@ namespace SolarPower.Quartz.Jobs "Temp" }; await powerStationRepository.AddWeatherObservation(weatherObservations, weather_observation_properties); - - - - } catch (Exception exception) { diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index 7c44bc0..7ade604 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -315,7 +315,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = @$"SELECT * FROM inverter_history_hour WHERE PowerStationId = @PowerStationId AND DATE_FORMAT(TIMESTAMP, '%Y-%m-%d') = @DateTime"; + var sql = @$"SELECT * FROM inverter_history_15min WHERE PowerStationId = @PowerStationId AND DATE_FORMAT(TIMESTAMP, '%Y-%m-%d') = @DateTime"; result = (await conn.QueryAsync(sql, new { PowerStationId = powerStationId, DateTime = dateTime })).ToList(); } diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 4125399..2c43bf7 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -23,7 +23,7 @@ namespace SolarPower.Repository.Implement } - public List GetMyPowerStationSummary(MyUser myUser) + public List GetMyPowerStationSummary(MyUser myUser, string filter = "") { List results = new List(); @@ -35,7 +35,7 @@ namespace SolarPower.Repository.Implement FROM power_station ps LEFT JOIN city c ON ps.CityId = c.Id"; - if(myUser.Role.Layer == 2) + if (myUser.Role.Layer == 2) { //公司管理員 sql += @" WHERE ps.Deleted = 0 AND ps.CompanyId = @CompanyId"; } @@ -48,8 +48,13 @@ namespace SolarPower.Repository.Implement { sql += @" WHERE ps.Deleted = 0"; } - - var myPowerStationInfos = conn.Query(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id }).ToList(); + + if (!string.IsNullOrEmpty(filter)) + { + sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')"; + } + + var myPowerStationInfos = conn.Query(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id, Filter = filter }).ToList(); var myPowerStationInfos_group = myPowerStationInfos.GroupBy(x => x.CityId); @@ -2290,10 +2295,10 @@ namespace SolarPower.Repository.Implement } } //(有修改) - public async Task GetPyrheliometerHistoryPerHour(string dateTime, List deviceInfos,int type) + public async Task GetPyrheliometerHistoryPerHour(string dateTime, List deviceInfos, int type) { var typename = ""; - if(type == 1) + if (type == 1) { typename = "Temperature";//1為溫度計 } @@ -2594,62 +2599,113 @@ namespace SolarPower.Repository.Implement } } - //public async Task> CalcInverterHisyort15minData(string dateTime, string table_name, List inverterIds) - //{ - // List result; - // using (IDbConnection conn = this._databaseHelper.GetConnection()) - // { - // try - // { - // var stratDateTime = Convert.ToDateTime(dateTime + ":00").AddMinutes(-15).ToString("yyyy-MM-dd HH:mm"); - - // var sql = $@"SELECT - // MAX(DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H:%i')) AS TIMESTAMP, - // s.INVERTERID, - // a.KWH, MAX(s.TODAYKWH) AS TODAYKWH, i.Capacity, (a.KWH/i.Capacity) AS KWHKWP - // FROM {table_name} s - // LEFT JOIN ( - // SELECT DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H:%i') AS TIMESTAMP, inv.INVERTERID, SUM(inv.WH)/1000 AS KWH - // FROM {table_name} inv - // WHERE DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H:%i') BETWEEN @StartDateTiime AND @EndDateTime - // GROUP BY DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H'), inv.INVERTERID) a - // ON DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H') = a.TIMESTAMP AND s.INVERTERID = a. INVERTERID - // LEFT JOIN {db_name}.inverter i ON CONCAT('s', s.INVERTERID) = i.InverterId - // WHERE DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H') = @DateTime - // GROUP BY DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H'), s.INVERTERID - // "; - - // result = (await conn.QueryAsync(sql, new { DateTime = dateTime })).ToList(); - // } - // catch (Exception exception) - // { - // throw exception; - // } - // return result; - // } - //} - - public async Task> CalcInverterHisyortHourData(string dateTime, string db_name, string table_name) + public async Task> CalcInverterHisyort15minData(string dateTime, string db_name, string table_name, List inverterIds) { List result; using (IDbConnection conn = this._databaseHelper.GetConnection()) { try { - var sql = $@"SELECT MAX(DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H')) AS TIMESTAMP, s.INVERTERID, a.KWH, MAX(s.TODAYKWH) AS TODAYKWH, i.Capacity, (a.KWH/i.Capacity) AS KWHKWP + var stratDateTime = Convert.ToDateTime(dateTime + ":00").AddMinutes(-15).ToString("yyyy-MM-dd HH:mm"); + + var sql = $@"SELECT + s.TIMESTAMP, + s.INVERTERID, + a.KWH, + s.TODAYKWH, + i.Capacity, + (a.KWH/i.Capacity) AS KWHKWP + FROM (SELECT + MAX(FROM_UNIXTIME(sub_inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i')) AS TIMESTAMP, + sub_inv.INVERTERID, + MAX(sub_inv.TODAYKWH) AS TODAYKWH + FROM {table_name} sub_inv + WHERE FROM_UNIXTIME(sub_inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i') BETWEEN @StartDateTime AND @EndDateTime + AND sub_inv.INVERTERID IN @InverterIds + GROUP BY sub_inv.INVERTERID) s + LEFT JOIN ( + SELECT MAX(FROM_UNIXTIME(sub_inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i')) AS TIMESTAMP, + sub_inv.INVERTERID, + SUM(sub_inv.WH)/1000 AS KWH + FROM {table_name} sub_inv + WHERE FROM_UNIXTIME(sub_inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i') BETWEEN @StartDateTime AND @EndDateTime + AND sub_inv.INVERTERID IN @InverterIds + GROUP BY sub_inv.INVERTERID) a + ON s.TIMESTAMP = a.TIMESTAMP AND s.INVERTERID = a. INVERTERID + LEFT JOIN {db_name}.inverter i ON s.INVERTERID = REPLACE(i.InverterId, 's', '');"; + + result = (await conn.QueryAsync(sql, new { StartDateTime = stratDateTime, EndDateTime = dateTime, InverterIds = inverterIds })).ToList(); + } + catch (Exception exception) + { + throw exception; + } + return result; + } + } + + public async Task AddInverter15minHistory(List entity, List properties) + { + int count; + using (IDbConnection conn = _databaseHelper.GetConnection()) + { + conn.Open(); + using (var trans = conn.BeginTransaction()) + { + try + { + string sql = GenerateInsertQueryWithCustomTable(properties, "inverter_history_15min"); + + count = await conn.ExecuteAsync(sql, entity, trans); + + trans.Commit(); + } + catch (Exception exception) + { + trans.Rollback(); + throw exception; + } + finally + { + conn.Close(); + } + } + return count; + } + } + + public async Task> CalcInverterHisyortHourData(string dateTime, string db_name, string table_name, List inverterIds) + { + List result; + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + try + { + var sql = $@"SELECT + MAX(FROM_UNIXTIME(s.TIMESTAMP/1000, '%Y-%m-%d %H')) AS TIMESTAMP, + s.INVERTERID, + a.KWH, + MAX(s.TODAYKWH) AS TODAYKWH, + i.Capacity, + (a.KWH/i.Capacity) AS KWHKWP FROM {table_name} s LEFT JOIN ( - SELECT DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H') AS TIMESTAMP, inv.INVERTERID, SUM(inv.WH)/1000 AS KWH + SELECT + FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d %H') AS TIMESTAMP, + inv.INVERTERID, + SUM(inv.WH)/1000 AS KWH FROM {table_name} inv WHERE DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H') = @DateTime - GROUP BY DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP/1000), '%Y-%m-%d %H'), inv.INVERTERID) a - ON DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H') = a.TIMESTAMP AND s.INVERTERID = a. INVERTERID - LEFT JOIN {db_name}.inverter i ON CONCAT('s', s.INVERTERID) = i.InverterId - WHERE DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H') = @DateTime + AND inv.INVERTERID IN @InverterIds + GROUP BY FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d %H'), inv.INVERTERID) a + ON FROM_UNIXTIME(s.TIMESTAMP/1000, '%Y-%m-%d %H') = a.TIMESTAMP AND s.INVERTERID = a. INVERTERID + LEFT JOIN {db_name}.inverter i ON s.INVERTERID = i.InverterId + WHERE FROM_UNIXTIME(s.TIMESTAMP/1000, '%Y-%m-%d %H') = @DateTime + AND s.INVERTERID IN @InverterIds GROUP BY DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d %H'), s.INVERTERID "; - result = (await conn.QueryAsync(sql, new { DateTime = dateTime })).ToList(); + result = (await conn.QueryAsync(sql, new { DateTime = dateTime, InverterIds = inverterIds })).ToList(); } catch (Exception exception) { @@ -2786,7 +2842,7 @@ namespace SolarPower.Repository.Implement } } - public async Task AddInverterHisyort(List entity, List properties) + public async Task AddInverterHistory(List entity, List properties) { int count; using (IDbConnection conn = _databaseHelper.GetConnection()) @@ -2974,7 +3030,7 @@ namespace SolarPower.Repository.Implement } } - public async Task SelectNowWeather (int CityId) + public async Task SelectNowWeather(int CityId) { NowWeather result = new NowWeather(); using (IDbConnection conn = this._databaseHelper.GetConnection()) diff --git a/SolarPower/Repository/Interface/IPowerStationRepository.cs b/SolarPower/Repository/Interface/IPowerStationRepository.cs index 3f6c2c6..14834e0 100644 --- a/SolarPower/Repository/Interface/IPowerStationRepository.cs +++ b/SolarPower/Repository/Interface/IPowerStationRepository.cs @@ -16,7 +16,7 @@ namespace SolarPower.Repository.Interface /// /// /// - List GetMyPowerStationSummary(MyUser myUser); + List GetMyPowerStationSummary(MyUser myUser, string filter = ""); /// /// 查詢縣市列表 @@ -518,9 +518,10 @@ namespace SolarPower.Repository.Interface Task Getonediv(string where, string db_name, string table_name); - //Task> CalcInverterHisyort15minData(string dateTime, string table_name, List inverterIds); - Task> CalcInverterHisyortHourData(string dateTime, string db_name, string table_name); - Task AddInverterHisyort(List entity, List properties); + Task> CalcInverterHisyort15minData(string dateTime, string db_name, string table_name, List inverterIds); + Task AddInverter15minHistory(List entity, List properties); + Task> CalcInverterHisyortHourData(string dateTime, string db_name, string table_name, List inverterIds); + Task AddInverterHistory(List entity, List properties); Task> CalcInverterHistoryDayDataByPowerStationId(string nowDay, string db_name, int powerStationId); Task AddInverterHistoryDayList(List entity, List properties); Task> GetInverterHistoryByPowerStationIdAndMonth(string month, int powerStationId); diff --git a/SolarPower/Startup.cs b/SolarPower/Startup.cs index 8422b9f..e13a2e9 100644 --- a/SolarPower/Startup.cs +++ b/SolarPower/Startup.cs @@ -99,6 +99,13 @@ namespace SolarPower ); #endregion + #region pqfܾT(CI2}l15@Ӵ`) + services.AddSingleton(); + services.AddSingleton( + new JobSchedule(jobType: typeof(CalcInverter15minJob), cronExpression: Configuration.GetValue("BackgroundServiceCron:CalcInverter15minJob")) + ); + #endregion + #region pqoqqT(CI5) services.AddSingleton(); services.AddSingleton( diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index e856523..7586374 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -12,7 +12,7 @@
-
+

發電量

diff --git a/SolarPower/Views/PowerStation/_DeviceSetting.cshtml b/SolarPower/Views/PowerStation/_DeviceSetting.cshtml index 95e8bd2..d63ddad 100644 --- a/SolarPower/Views/PowerStation/_DeviceSetting.cshtml +++ b/SolarPower/Views/PowerStation/_DeviceSetting.cshtml @@ -4,7 +4,7 @@
控制器
@@ -32,7 +32,7 @@
逆變器
@@ -67,7 +67,7 @@
裝置設定
@@ -105,7 +105,7 @@
共用裝置
diff --git a/SolarPower/Views/Shared/_Layout.cshtml b/SolarPower/Views/Shared/_Layout.cshtml index df35455..35fb043 100644 --- a/SolarPower/Views/Shared/_Layout.cshtml +++ b/SolarPower/Views/Shared/_Layout.cshtml @@ -17,7 +17,7 @@ - + @@ -45,6 +45,62 @@ +
@@ -138,17 +194,17 @@ @myPowerStationSummary.Amount diff --git a/SolarPower/Views/StationOverview/Index.cshtml b/SolarPower/Views/StationOverview/Index.cshtml index 6d666f5..3a35ce6 100644 --- a/SolarPower/Views/StationOverview/Index.cshtml +++ b/SolarPower/Views/StationOverview/Index.cshtml @@ -78,11 +78,11 @@
-
+

發電量

kWh
-
+

今日發電量

126,161.72

@@ -94,11 +94,11 @@
-
+

日照度

kW/m2
-
+

即時平均日照度

126,161.72

@@ -110,11 +110,11 @@
-
+

PR值

%
-
+

即時平均 PR 值

119.04

@@ -126,11 +126,11 @@
-
+

kWh / kWp

hr
-
+

即時平均 kWh / kWp

140.39

@@ -142,11 +142,11 @@
-
+

減碳量

kG
-
+

今日減碳量

6,091.78

diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 10d9ebc..213a2e2 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -5,144 +5,166 @@ } @using SolarPower.Models.Role @model RoleLayerEnum - - -
-
-
-
-
-
-
-

- - - - - - 新竹巨城站 -

-
-
-

-

27°C
降雨幾率: 15%

-
+@**@ +
+
+
+ @section Scripts{ -} \ No newline at end of file +} diff --git a/SolarPower/Views/StationOverview/_UpToDate.cshtml b/SolarPower/Views/StationOverview/_UpToDate.cshtml index 7899885..f2f45fc 100644 --- a/SolarPower/Views/StationOverview/_UpToDate.cshtml +++ b/SolarPower/Views/StationOverview/_UpToDate.cshtml @@ -1,11 +1,11 @@ 
-
+

發電量

kwh
-
+

今日發電量

126,161.72

@@ -17,11 +17,11 @@
-
+

發電金額

NTD
-
+

總發金額

126,161.72

@@ -33,11 +33,11 @@
-
+

日照度

kw/m2
-
+

即時平均日照度

126,161.72

@@ -49,10 +49,11 @@
-
+

PR值

+
%
-
+

即時平均 PR 值

119.04

@@ -64,10 +65,11 @@
-
+

kWh / kWp

+
hr
-
+

即時平均 kWh / kWp

140.39

@@ -79,11 +81,11 @@
-
+

減碳量

kG
-
+

今日減碳量

6,091.78

diff --git a/SolarPower/appsettings.Development.json b/SolarPower/appsettings.Development.json index 5fcd409..edb74e9 100644 --- a/SolarPower/appsettings.Development.json +++ b/SolarPower/appsettings.Development.json @@ -6,7 +6,7 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "LoginExpireMinute": 60, //nJɶA() + "LoginExpireMinute": 60, //?n?J???????A???(??) "DBConfig": { "Server": "MVgHWzR3rGDgD57TUoFunA==", "port": "r4AoXMUDodcQjIzofGNCcg==", @@ -24,8 +24,8 @@ "BackgroundServiceCron": { "CalcPowerStationJob": "0 5 * * * ?", "CalcAvgPowerStationJob": "0 0 2 * * ?", - //"CalcAvgPowerStationJob": "0/3 * * * * ?", - "OperationScheduleJob": "0 0 2 * * ?" + "OperationScheduleJob": "0 0 2 * * ?", + "CalcInverter15minJob": "0 2/15 * * * ?" }, "SMTPConfig": { "Host": "smtp.gmail.com", diff --git a/SolarPower/appsettings.json b/SolarPower/appsettings.json index ba21b62..93cb5bd 100644 --- a/SolarPower/appsettings.json +++ b/SolarPower/appsettings.json @@ -25,7 +25,8 @@ "BackgroundServiceCron": { "CalcPowerStationJob": "0 5 * * * ?", "CalcAvgPowerStationJob": "0 0 2 * * ?", - "OperationScheduleJob": "0 0 2 * * ?" + "OperationScheduleJob": "0 0 2 * * ?", + "CalcInverter15minJob": "0 2/15 * * * ?" }, "SMTPConfig": { "Host": "smtp.gmail.com", diff --git a/SolarPower/wwwroot/css/app.bundle.css b/SolarPower/wwwroot/css/app.bundle.css index 9069a71..61effee 100644 --- a/SolarPower/wwwroot/css/app.bundle.css +++ b/SolarPower/wwwroot/css/app.bundle.css @@ -866,7 +866,7 @@ html { /* app logo */ .page-logo { height: 4.125rem; - width: 16.875rem; + width: 15.29rem; -webkit-box-shadow: 0px 0px 28px 0px rgba(0, 0, 0, 0.13); box-shadow: 0px 0px 28px 0px rgba(0, 0, 0, 0.13); overflow: hidden; @@ -885,8 +885,9 @@ html { min-height: 1px; padding: 0 2rem; } .page-logo img { - /*width: 28px;*/ - height: 28px; } + /*width: 28px; + height: 28px; */ +} .page-logo .page-logo-link { -webkit-box-flex: 1; -ms-flex: 1 0 auto; @@ -1153,8 +1154,8 @@ html { -webkit-box-flex: 1; -ms-flex: 1 0 auto; flex: 1 0 auto; - width: 16.875rem; - max-width: 16.875rem; + width: 15.29rem; + max-width: 15.29rem; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; @@ -1524,7 +1525,7 @@ html { }*/ @media (min-width: 1399px) { .page-sidebar .primary-nav .nav-menu > li > a { - font-size: 1.125rem; } } + font-size: 1rem; } } /* app navigation filter */ .nav-filter { @@ -2431,7 +2432,7 @@ html { /* app content heading */ .subheader:not(:empty) { - margin-bottom: calc(1.5rem + 0.625rem); + margin-bottom: calc(.5rem + 0.625rem); position: relative; display: -webkit-box; display: -ms-flexbox; @@ -2738,7 +2739,7 @@ html { .page-breadcrumb { padding: 0; background: transparent; - margin: 0 0 1.5rem; + margin: 0 0 1rem; position: relative; text-shadow: #fff 0 1px; } diff --git a/SolarPower/wwwroot/css/themes/cust-theme-15.css b/SolarPower/wwwroot/css/themes/cust-theme-15.css index 86d85ad..82d6ecd 100644 --- a/SolarPower/wwwroot/css/themes/cust-theme-15.css +++ b/SolarPower/wwwroot/css/themes/cust-theme-15.css @@ -3033,3 +3033,63 @@ body:not(.mod-pace-custom) .pace .pace-progress { background: #fff; } /*# sourceMappingURL=cust-theme-15.css.map */ + + +.map-responsive{ + overflow:hidden; + padding-bottom:50%; + position:relative; + height:0; +} +.map-responsive iframe{ + left:0; + top:0; + height:100%; + width:100%; + position:absolute; +} + + + +.collapse.width { + width: 0; + max-width: 0; + height: 100%; + transition: right 0.3s linear, max-width 0.3s linear; + position: relative; + top: 0; + right: 100%; + left: 0; + display: block; + overflow: hidden; +} + +.vh-100 { + min-height: 100vh; +} + +.collapsing.width { + transition: right 0.3s linear, max-width 0.7s linear; + width: 0% !important; + height: 100%; + max-width: 0% !important; + min-width: 0; + right: 0; + position: relative; + display: block; +} + +.collapse .list-group-item { + white-space:nowrap +} + +.collapse.width.show { + transition: right 0.3s linear, max-width 0.3s linear; + width: 100%; + height: 100%; + max-width: 100%; + min-width: 50px; + right: 0; + position: relative; + display: block; +} diff --git a/SolarPower/wwwroot/css/vendors.bundle.css b/SolarPower/wwwroot/css/vendors.bundle.css index 020213d..6099eca 100644 --- a/SolarPower/wwwroot/css/vendors.bundle.css +++ b/SolarPower/wwwroot/css/vendors.bundle.css @@ -6927,7 +6927,7 @@ button.bg-dark:focus { .mb-5, .my-5 { - margin-bottom: 2rem !important; } + margin-bottom: 1rem !important; } .ml-5, .mx-5 {