From dcca7c4afcef847f2592e0c41dea85be7b27d645 Mon Sep 17 00:00:00 2001 From: Kai Date: Thu, 11 Nov 2021 18:11:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=80=86=E8=AE=8A=E5=99=A8=E4=BA=A4?= =?UTF-8?q?=E5=8F=89=E5=88=86=E6=9E=90bug=20fix=202.=20=E5=9C=B0=E5=9C=96?= =?UTF-8?q?=E7=B8=BD=E8=A6=BD=E6=89=8B=E6=A9=9F=E7=89=88=203.=20=E9=9B=BB?= =?UTF-8?q?=E7=AB=99=E4=BA=A4=E5=8F=89=E5=88=86=E6=9E=90=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=97=A5=E7=85=A7=E3=80=81=E6=A8=A1=E7=B5=84=E6=BA=AB?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisStationInfoController.cs | 68 +++++++++---------- .../Implement/StationReportRepository.cs | 4 +- .../Views/AnalysisInverter/Index.cshtml | 13 ++-- .../Views/AnalysisStationInfo/Index.cshtml | 4 +- SolarPower/Views/MapOverview/Index.cshtml | 10 +-- 5 files changed, 50 insertions(+), 49 deletions(-) diff --git a/SolarPower/Controllers/AnalysisStationInfoController.cs b/SolarPower/Controllers/AnalysisStationInfoController.cs index 06a9ea5..bf7831f 100644 --- a/SolarPower/Controllers/AnalysisStationInfoController.cs +++ b/SolarPower/Controllers/AnalysisStationInfoController.cs @@ -217,24 +217,24 @@ namespace SolarPower.Controllers var temp_item = item.OrderBy(x => x.Timestamp).ToList(); - DeviceHistoryInfo Irradiance = new DeviceHistoryInfo(); - Irradiance.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["Irradiance"]); - Irradiance.YaxesKey = "Irradiance"; - Irradiance.Values = new List(); - foreach (var xa in XAxis) - { - var history = temp_item.Where(x => xa == x.Timestamp).FirstOrDefault(); + //DeviceHistoryInfo Irradiance = new DeviceHistoryInfo(); + //Irradiance.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["Irradiance"]); + //Irradiance.YaxesKey = "Irradiance"; + //Irradiance.Values = new List(); + //foreach (var xa in XAxis) + //{ + // var history = temp_item.Where(x => xa == x.Timestamp).FirstOrDefault(); - if (history != null) - { - Irradiance.Values.Add(history.Irradiance); - } - else - { - Irradiance.Values.Add(0); - } - } - analysisDevice.Series.Add(Irradiance); + // if (history != null) + // { + // Irradiance.Values.Add(history.Irradiance); + // } + // else + // { + // Irradiance.Values.Add(0); + // } + //} + //analysisDevice.Series.Add(Irradiance); DeviceHistoryInfo KWH = new DeviceHistoryInfo(); KWH.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["KWH"]); @@ -312,24 +312,24 @@ namespace SolarPower.Controllers } analysisDevice.Series.Add(PR); - DeviceHistoryInfo modelTemperature = new DeviceHistoryInfo(); - modelTemperature.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["Temperature"]); - modelTemperature.YaxesKey = "Temperature"; - modelTemperature.Values = new List(); - foreach (var xa in XAxis) - { - var history = temp_item.Where(x => xa == x.Timestamp).FirstOrDefault(); + //DeviceHistoryInfo modelTemperature = new DeviceHistoryInfo(); + //modelTemperature.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["Temperature"]); + //modelTemperature.YaxesKey = "Temperature"; + //modelTemperature.Values = new List(); + //foreach (var xa in XAxis) + //{ + // var history = temp_item.Where(x => xa == x.Timestamp).FirstOrDefault(); - if (history != null) - { - modelTemperature.Values.Add(Math.Round(history.Temperature, 2)); - } - else - { - modelTemperature.Values.Add(0); - } - } - analysisDevice.Series.Add(modelTemperature); + // if (history != null) + // { + // modelTemperature.Values.Add(Math.Round(history.Temperature, 2)); + // } + // else + // { + // modelTemperature.Values.Add(0); + // } + //} + //analysisDevice.Series.Add(modelTemperature); } } #endregion diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 00adb1f..392de79 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -80,10 +80,10 @@ namespace SolarPower.Repository.Implement ) c on a.powerStationid = c.powerStationid and DATE_FORMAT(a.`TIMESTAMP`,''%Y-%m-%d'') = c.report_date left join ( - select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d %H:%i'')report_date, irradiance, Temperature + select powerStationID, DATE_FORMAT(TIMESTAMP,''%Y-%m-%d %H:00'')report_date, irradiance, Temperature from sensor_history_hour where powerstationid = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,''%Y-%m-%d'') = ''{post.Time}'' - ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d %H:%i'') = d.report_date + ) d on a.powerStationid = d.powerStationid and DATE_FORMAT(a.TIMESTAMP,''%Y-%m-%d %H:00'') = d.report_date join ( select id, name stationName, powerRate from power_station where id = {post.PowerStation} diff --git a/SolarPower/Views/AnalysisInverter/Index.cshtml b/SolarPower/Views/AnalysisInverter/Index.cshtml index cc4e6a2..efb5c7e 100644 --- a/SolarPower/Views/AnalysisInverter/Index.cshtml +++ b/SolarPower/Views/AnalysisInverter/Index.cshtml @@ -388,15 +388,16 @@ }); $('#js_list_accordion').on("change", 'input[name="selectedInverterId[]"]', function (event) { + var powerStationId = $(this).attr('data-power-station-id'); + if (this.checked) { - if ($.inArray(this.value, selected_inverter) < 0) { - var powerStationId = $(this).attr('data-power-station-id'); - selected_inverter.push({ powerStationId: powerStationId, InverterId: this.value }); + if ($.map(selected_inverter, function (item, index) { return item.InverterId }).indexOf(this.value) < 0) { + selected_inverter.push({ 'powerStationId': powerStationId, 'InverterId': this.value }); } } else { - if ($.inArray(this.value, selected_inverter) > -1) { - var powerStationId = $(this).attr('data-power-station-id'); - selected_inverter.splice($.inArray({ powerStationId: powerStationId, InverterId: this.value }, selected_inverter), 1); + var result = $.map(selected_inverter, function (item, index) { return item.InverterId }).indexOf(this.value) + if (result > -1) { + selected_inverter.splice(result, 1); } } }); diff --git a/SolarPower/Views/AnalysisStationInfo/Index.cshtml b/SolarPower/Views/AnalysisStationInfo/Index.cshtml index d473a10..2a4cd73 100644 --- a/SolarPower/Views/AnalysisStationInfo/Index.cshtml +++ b/SolarPower/Views/AnalysisStationInfo/Index.cshtml @@ -123,10 +123,10 @@ var selected_device = []; var PWS_compare_col = [ { key: "KWH", title: "發電量", default: true }, - { key: "Irradiance", title: "日照度", default: false }, + @*{ key: "Irradiance", title: "日照度", default: false },*@ { key: "KWHKWP", title: "有效日照時數", default: false }, { key: "PR", title: "PR %", default: false }, - { key: "Temperature", title: "模組溫度", default: false }, + @*{ key: "Temperature", title: "模組溫度", default: false },*@ { key: "SolarHour", title: "日照小時", default: false }, ] var PWR_compare_col = [ diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index 3af9f0e..4f33c0e 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -97,7 +97,7 @@
-
+

電站分佈圖

@@ -111,9 +111,9 @@
-
+
-
+

電站總數

@@ -125,7 +125,7 @@
-
+

總裝置容量

@@ -136,7 +136,7 @@
-
+

電站分佈小計