diff --git a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs index 9a49fb4..8b25a1b 100644 --- a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs +++ b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs @@ -134,6 +134,8 @@ namespace SolarPower.Quartz.Jobs try { + powerStations = await powerStationRepository.GetAllNoStatusAsync(); + logger.LogInformation("【CalcInverter15minJob】開始檢測逆變器狀態"); var ps_groupby_SitDB = powerStations.GroupBy(x => x.SiteDB).ToList(); diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index ac15bf7..321f2a7 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -416,6 +416,25 @@ namespace SolarPower.Repository.Implement } } + public async Task> GetAllNoStatusAsync() + { + List result; + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + try + { + var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0"; + + result = (await conn.QueryAsync(sql)).ToList(); + } + catch (Exception exception) + { + throw exception; + } + return result; + } + } + /// /// 透過電站編號,取得單一電站資訊(覆寫) /// diff --git a/SolarPower/Repository/Interface/IPowerStationRepository.cs b/SolarPower/Repository/Interface/IPowerStationRepository.cs index 5aed3fe..bb3a7d2 100644 --- a/SolarPower/Repository/Interface/IPowerStationRepository.cs +++ b/SolarPower/Repository/Interface/IPowerStationRepository.cs @@ -612,5 +612,7 @@ namespace SolarPower.Repository.Interface Task CheckSensorAvgTableColumn(string dbname, string code); Task AlertColInvTableColumn(string dbname, string code); Task AlertColSensoravgTableColumn(string dbname, string code); + + Task> GetAllNoStatusAsync(); } }