From f5be10dc0c90b1cbf264e0bd194f86474ea97412 Mon Sep 17 00:00:00 2001 From: Kai Date: Wed, 12 Jan 2022 16:27:09 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=83=8C=E6=99=AF=E5=9F=B7=E8=A1=8C=20?= =?UTF-8?q?=E9=80=86=E4=BE=BF=E5=99=A8=E6=AA=A2=E6=B8=AC=20=E6=8A=93?= =?UTF-8?q?=E5=8F=96=E6=89=80=E6=9C=89=E9=9B=BB=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Quartz/Jobs/CalcInverter15minJob.cs | 2 ++ .../Implement/PowerStationRepository.cs | 19 +++++++++++++++++++ .../Interface/IPowerStationRepository.cs | 2 ++ 3 files changed, 23 insertions(+) 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(); } }