From 90bc390cd7c7a433a6544853480787f6211fdd30 Mon Sep 17 00:00:00 2001 From: JiaHao Liu Date: Mon, 13 Sep 2021 18:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=B8=E6=AA=94=20debug=20,=20=E5=88=AA?= =?UTF-8?q?=E9=99=A4=E5=8F=83=E6=95=B8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Repository/Implement/StationReportRepository.cs | 6 ++---- solarApp/Service/procStationSvc.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 18a67bb..9174601 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -62,7 +62,7 @@ namespace SolarPower.Repository.Implement ) INTO @sql FROM inverter_history_hour where powerstationId = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = '{post.Time}'; SET @sql = CONCAT('SELECT DATE_FORMAT(a.TIMESTAMP,''%m-%d %H'') report_date, ', @sql, - ', b.KWH hourKWH, round((b.KWH / (SELECT MAX(TODAYKWH) FROM power_station_history_hour WHERE DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') = ''{post.Time}'' and powerstationid = {post.PowerStation}))*100,2) ''hourKWHp'', d.irradiance ''irradiance'', d.Temperature ''temperature'', + , b.KWH hourKWH, round((b.KWH / (SELECT MAX(TODAYKWH) FROM power_station_history_hour WHERE DATE_FORMAT(TIMESTAMP,''%Y-%m-%d'') = ''{post.Time}'' and powerstationid = {post.PowerStation}))*100,2) ''hourKWHp'', d.irradiance ''irradiance'', d.Temperature ''temperature'', b.money ''hourmoney'', c.TODAYKWH ''totKWH'', c.KWHKWP ''totKWHKWP'', c.money ''totmoney'', stationName, powerRate daymoney, c.SOLARHOUR tothour,round(b.PR, 2) as pr FROM inverter_history_hour a left join ( # 每小時加總 inv @@ -238,9 +238,7 @@ namespace SolarPower.Repository.Implement # select @sql as 'mySelect'; #顯示動態語法 PREPARE stmt FROM @sql; EXECUTE stmt; - DEALLOCATE PREPARE stmt; - - "; + DEALLOCATE PREPARE stmt;"; break; diff --git a/solarApp/Service/procStationSvc.cs b/solarApp/Service/procStationSvc.cs index c932491..2a4b7f3 100644 --- a/solarApp/Service/procStationSvc.cs +++ b/solarApp/Service/procStationSvc.cs @@ -43,7 +43,7 @@ namespace solarApp.Service conn.Open(); string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); - _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + _powerStationID = (ds.Count > 0) ? ds[0].ToString() : "0"; conn.Close(); } #endregion