[後端] 增加errlog device_number

This commit is contained in:
dev02 2023-07-14 12:22:57 +08:00
parent 299555fbc8
commit 949b9407af

View File

@ -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<Dictionary<string, object>> waterArchiveDayRawDatas = new List<Dictionary<string, object>>();
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<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
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<Dictionary<string, object>> waterArchiveMonthRawDatas = new List<Dictionary<string, object>>();
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);
}
}