diff --git a/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs b/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs index 79bc6db..9da90a8 100644 --- a/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs +++ b/BackendWorkerService/Quartz/Jobs/ArchiveElectricMeterDayJob.cs @@ -47,6 +47,7 @@ namespace BackendWorkerService.Quartz.Jobs public async Task Execute(IJobExecutionContext context) { Task_Detail task_Detail = new Task_Detail(loggers, backgroundServiceRepository); + string device_number = string.Empty; try { if(await task_Detail.GetNeedWorkTask("ArchiveElectricMeterDayJob", "All")) @@ -159,7 +160,7 @@ namespace BackendWorkerService.Quartz.Jobs List> waterArchiveDayRawDatas = new List>(); foreach (var deviceNumberPoint in electricDeviceNumberPoints) { - + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -216,7 +217,7 @@ namespace BackendWorkerService.Quartz.Jobs } foreach (var deviceNumberPoint in waterDeviceNumberPoints) { - + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -628,6 +629,7 @@ namespace BackendWorkerService.Quartz.Jobs List> waterArchiveWeekRawDatas = new List>(); foreach (var deviceNumberPoint in electricDeviceNumberPoints) { + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -685,6 +687,7 @@ namespace BackendWorkerService.Quartz.Jobs } foreach (var deviceNumberPoint in waterDeviceNumberPoints) { + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -993,6 +996,7 @@ namespace BackendWorkerService.Quartz.Jobs List> waterArchiveMonthRawDatas = new List>(); foreach (var deviceNumberPoint in electricDeviceNumberPoints) { + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -1049,6 +1053,7 @@ namespace BackendWorkerService.Quartz.Jobs } foreach (var deviceNumberPoint in waterDeviceNumberPoints) { + device_number = deviceNumberPoint.FullDeviceNumberPoint; archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/"); //HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/"); archiveRequest.Method = "POST"; @@ -1337,8 +1342,6 @@ namespace BackendWorkerService.Quartz.Jobs catch(Exception ex) { await task_Detail.WorkFail("ArchiveElectricMeterDayJob", "Compensate", ex.ToString()); - logger.LogError("【ArchiveElectricMeterDayJob】【補償機制】【任務失敗】"); - logger.LogError("【ArchiveElectricMeterDayJob】【補償機制】【任務失敗】[Exception]:{0}", ex.ToString()); } } #endregion 補償機制 @@ -1350,7 +1353,7 @@ namespace BackendWorkerService.Quartz.Jobs { await task_Detail.WorkFail("ArchiveElectricMeterDayJob", "All", exception.ToString()); logger.LogError("【ArchiveElectricMeterDayJob】【任務失敗】"); - logger.LogError("【ArchiveElectricMeterDayJob】【任務失敗】[Exception]:{0}", exception.ToString()); + logger.LogError("【ArchiveElectricMeterDayJob】【任務失敗】[Exception]:{0}, {1}", exception.ToString(), "device_number = " + device_number); } }