From 0615483bb4a80a39c21ce6a51478f91f07493c20 Mon Sep 17 00:00:00 2001 From: "jay.chang" Date: Mon, 5 Feb 2024 13:24:01 +0800 Subject: [PATCH] =?UTF-8?q?[BackendWorkerService]=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9C=88=E6=AD=B8=E6=AA=94=E8=B5=B7=E8=A8=96=E6=99=82=E9=96=93?= =?UTF-8?q?=E9=82=8F=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Quartz/Jobs/ArchiveElectricMeterDayJob.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs b/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs index 386a1ff..39c05fc 100644 --- a/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs +++ b/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using NPOI.SS.Formula.Functions; using Quartz; using Repository.BackendRepository.Interface; using Repository.Helper; @@ -140,7 +141,7 @@ namespace BackendWorkerService.Quartz.Jobs { try { - + await task_Detail.InsertWorkTime("ArchiveElectricMeterDayJob", "Day", "水電表天任務開始"); var preDay = now.AddDays(-1); //取得前一天 var dbDateName = preDay.Year.ToString().PadLeft(4, '0') + preDay.Month.ToString().PadLeft(2, '0'); @@ -674,7 +675,7 @@ namespace BackendWorkerService.Quartz.Jobs } } } - await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Day", "任務完成"); + await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Day", "水電表天任務完成"); } catch (Exception exception) { @@ -1102,9 +1103,9 @@ namespace BackendWorkerService.Quartz.Jobs var preDay = now.AddDays(-1); //取得前一天 var dayInMonth = DateTime.DaysInMonth(preDay.Year, preDay.Month); - var FirstDay = preDay.AddDays(- dayInMonth + 1); + var FirstDay = new DateTime(preDay.Year, preDay.Month, 1); //var LastDay = now.AddMonths(1).AddDays(-now.AddMonths(1).Day); // 這是抓到該月最後一天 - var LastDay = FirstDay.AddMonths(1); //但實際應該抓隔月第一天 + var LastDay = now; @@ -1600,7 +1601,7 @@ namespace BackendWorkerService.Quartz.Jobs await backgroundServiceMsSqlRepository.ExecuteSql(mySql, waterArchiveMonthRawDatas); } } - await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Month", "任務完成"); + await task_Detail.InsertWorkTime_End("ArchiveElectricMeterDayJob", "Month", "水電表月任務完成"); } catch (Exception exception) {