From b591fca8367bd3281de080017a5d0268e8c487b2 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Wed, 24 Aug 2022 10:31:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8A=E5=A4=9C=E6=AD=B8=E6=AA=94=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=A8=BB=E8=A7=A3=E6=8E=89=EF=BC=8C=E4=BF=9D=E7=95=99?= =?UTF-8?q?winfrom=E7=9A=84=E6=AD=B8=E6=AA=94=E5=8B=95=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Quartz/Jobs/CalcAvgPowerStationJob.cs | 208 +++++++++--------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs index 9d94efb..bde63d4 100644 --- a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs @@ -786,114 +786,114 @@ namespace SolarPower.Quartz.Jobs } #endregion // end from here - #region 補償機制 - var gobackDay = this.Configuration.GetValue("GoBackDay"); //回推天數 - var Connection_string = Configuration.GetValue("mySql"); - var start_date = DateTimeNow.AddDays(-1 * gobackDay); - var end_date = DateTimeNow.AddDays(-1); - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行補償機制】"); - procSensorSvc sensorSvc = new procSensorSvc(Connection_string); - procInvSvc invSvc = new procInvSvc(Connection_string, logger); - procStationSvc siteSvc = new procStationSvc(Connection_string); - foreach (var powerStation in powerStations) - { - start_date = DateTimeNow.AddDays(-1 * gobackDay); - for (; start_date <= end_date; start_date = start_date.AddDays(1)) - { - var day_str = start_date.ToString("yyyy-MM-dd"); - #region 歸檔 Sensor - try - { - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); - sensorSvc.archiveData(powerStation.Code, day_str); - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); - } - catch (Exception exception) - { - logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); - logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); - if (exception.InnerException != null) - { - logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); - } - } - #endregion + //#region 補償機制 + //var gobackDay = this.Configuration.GetValue("GoBackDay"); //回推天數 + //var Connection_string = Configuration.GetValue("mySql"); + //var start_date = DateTimeNow.AddDays(-1 * gobackDay); + //var end_date = DateTimeNow.AddDays(-1); + //logger.LogInformation("【CalcAvgPowerStationJob】【開始執行補償機制】"); + //procSensorSvc sensorSvc = new procSensorSvc(Connection_string); + //procInvSvc invSvc = new procInvSvc(Connection_string, logger); + //procStationSvc siteSvc = new procStationSvc(Connection_string); + //foreach (var powerStation in powerStations) + //{ + // start_date = DateTimeNow.AddDays(-1 * gobackDay); + // for (; start_date <= end_date; start_date = start_date.AddDays(1)) + // { + // var day_str = start_date.ToString("yyyy-MM-dd"); + // #region 歸檔 Sensor + // try + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); + // sensorSvc.archiveData(powerStation.Code, day_str); + // logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); + // } + // catch (Exception exception) + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Sensor補償機制】", powerStation.Code, day_str); + // logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + // if (exception.InnerException != null) + // { + // logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); + // } + // } + // #endregion - #region 歸檔 電錶 - try - { - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); - sensorSvc.archiveMeterData(powerStation.Code, day_str); - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); - } - catch (Exception exception) - { - logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); - logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); - if (exception.InnerException != null) - { - logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); - } - } - #endregion + // #region 歸檔 電錶 + // try + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); + // sensorSvc.archiveMeterData(powerStation.Code, day_str); + // logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); + // } + // catch (Exception exception) + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Meter補償機制】", powerStation.Code, day_str); + // logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + // if (exception.InnerException != null) + // { + // logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); + // } + // } + // #endregion - #region 歸檔 Inv - try - { - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); - invSvc.archiveData(powerStation.Code, day_str); - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); - } - catch (Exception exception) - { - logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); - logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); - if (exception.InnerException != null) - { - logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); - } - } - #endregion + // #region 歸檔 Inv + // try + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); + // invSvc.archiveData(powerStation.Code, day_str); + // logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); + // } + // catch (Exception exception) + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Inverter補償機制】", powerStation.Code, day_str); + // logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + // if (exception.InnerException != null) + // { + // logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); + // } + // } + // #endregion - #region 歸檔 Station hour - try - { - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); - siteSvc.archiveData(powerStation.Code, day_str); - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); - } - catch (Exception exception) - { - logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); - logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); - if (exception.InnerException != null) - { - logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); - } - } - #endregion + // #region 歸檔 Station hour + // try + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); + // siteSvc.archiveData(powerStation.Code, day_str); + // logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); + // } + // catch (Exception exception) + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的Site補償機制】", powerStation.Code, day_str); + // logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + // if (exception.InnerException != null) + // { + // logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); + // } + // } + // #endregion - #region 製作日報表 - try - { - logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); - invSvc.report_invDay(powerStation.Code, day_str); - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); - } - catch (Exception exception) - { - logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); - logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); - if (exception.InnerException != null) - { - logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); - } - } - #endregion - } - } - logger.LogInformation("【CalcAvgPowerStationJob】【執行完成補償機制】"); - #endregion + // #region 製作日報表 + // try + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【開始執行電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); + // invSvc.report_invDay(powerStation.Code, day_str); + // logger.LogInformation("【CalcAvgPowerStationJob】【執行完成電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); + // } + // catch (Exception exception) + // { + // logger.LogInformation("【CalcAvgPowerStationJob】【執行失敗電站[{0}]在{1}的 日報表製作】", powerStation.Code, day_str); + // logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + // if (exception.InnerException != null) + // { + // logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); + // } + // } + // #endregion + // } + //} + //logger.LogInformation("【CalcAvgPowerStationJob】【執行完成補償機制】"); + //#endregion