diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index fce8a27..f179b04 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