[後台] 修改排程問題
This commit is contained in:
parent
b110151c8e
commit
cacab7f20e
@ -127,7 +127,7 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
obixApiConfig.ApiBase = variableObix.Where(x => x.Name == "ApiBase").Select(x => x.Value).FirstOrDefault();
|
||||
obixApiConfig.UserName = ed.AESDecrypt(variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault());
|
||||
obixApiConfig.Password = ed.AESDecrypt(variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault());
|
||||
|
||||
var station = await backgroundServiceRepository.GetOneAsync<string>($@"select system_value from variable where system_type = 'obixStatus' and deleted = 0");
|
||||
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(obixApiConfig.UserName + ":" + obixApiConfig.Password));
|
||||
#endregion 取得obix 設定
|
||||
|
||||
@ -160,8 +160,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||
{
|
||||
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
@ -217,8 +217,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||
{
|
||||
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
@ -628,8 +628,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
List<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
|
||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||
{
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
@ -685,8 +685,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
}
|
||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||
{
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
@ -993,8 +993,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
List<Dictionary<string, object>> waterArchiveMonthRawDatas = new List<Dictionary<string, object>>();
|
||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||
{
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
@ -1049,8 +1049,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
||||
}
|
||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||
{
|
||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
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";
|
||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveRequest.PreAuthenticate = true;
|
||||
|
@ -16,6 +16,7 @@ using Repository.Helper;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.BackendRepository.Implement;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
|
||||
namespace BackendWorkerService.Services.Implement
|
||||
{
|
||||
@ -39,6 +40,7 @@ namespace BackendWorkerService.Services.Implement
|
||||
bool result = false;
|
||||
int repeatTimes = 0;
|
||||
string targetTable = string.Empty;
|
||||
string sql_error_day = string.Empty;
|
||||
|
||||
EDFunction ed = new EDFunction();
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
@ -61,12 +63,12 @@ namespace BackendWorkerService.Services.Implement
|
||||
obixApiConfig.ApiBase = variableObix.Where(x => x.Name == "ApiBase").Select(x => x.Value).FirstOrDefault();
|
||||
obixApiConfig.UserName = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault();
|
||||
obixApiConfig.Password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault();
|
||||
|
||||
var station = await backgroundServiceRepository.GetOneAsync<string>($@"select system_value from variable where system_type = 'obixStatus' and deleted = 0");
|
||||
encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(obixApiConfig.UserName + ":" + obixApiConfig.Password));
|
||||
#endregion 取得obix 設定
|
||||
|
||||
//取得錯誤的設備sql format
|
||||
var sql_error_format = @"SELECT * FROM {0} WHERE is_complete = 0 AND repeat_times < @RepeatTimes";
|
||||
var sql_error_format = @"SELECT * FROM {0} WHERE is_complete = 0 AND repeat_times < @RepeatTimes AND (point = 'KWH' or point = 'RCV')";
|
||||
|
||||
//MY 新增/修改sql format
|
||||
var MYsql_update_format = @"
|
||||
@ -187,8 +189,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
// <reltime name='interval' val = 'PT1H' />
|
||||
// </obj>";
|
||||
|
||||
// HttpWebRequest archiveHourRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
// //HttpWebRequest archiveHourRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
// HttpWebRequest archiveHourRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
// //HttpWebRequest archiveHourRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
// archiveHourRequest.Method = "POST";
|
||||
// archiveHourRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
// archiveHourRequest.PreAuthenticate = true;
|
||||
@ -248,9 +250,17 @@ namespace BackendWorkerService.Services.Implement
|
||||
#endregion 時歸檔補償
|
||||
|
||||
#region 天歸檔補償
|
||||
string schema = await backgroundServiceRepository.GetOneAsync<string>(@"
|
||||
select system_value from variable where system_type = 'project_name' and deleted = 0");
|
||||
//取得所有須補償的設備資訊
|
||||
targetTable = "archive_electric_meter_day";
|
||||
var sql_error_day = string.Format(sql_error_format, targetTable);
|
||||
targetTable = await backgroundServiceRepository.GetOneAsync<string>($@"
|
||||
select table_name
|
||||
from information_schema.`TABLES`
|
||||
where TABLE_NAME like 'archive_electric_meter_day%' and TABLE_SCHEMA = '{schema.Split('/')[0]}'
|
||||
order by TABLE_NAME desc limit 1 ");
|
||||
if (!string.IsNullOrEmpty(targetTable))
|
||||
{
|
||||
sql_error_day = string.Format(sql_error_format, targetTable);
|
||||
var electric_error_days = await backgroundServiceRepository.GetAllAsync<ArchiveElectricMeter>(sql_error_day, new { RepeatTimes = repeatTimes });
|
||||
List<Dictionary<string, object>> electricArchiveDayRawDatas = new List<Dictionary<string, object>>();
|
||||
if (electric_error_days.Count() > 0)
|
||||
@ -264,15 +274,14 @@ namespace BackendWorkerService.Services.Implement
|
||||
|
||||
var startTimestamp = string.Format("{0}+08:00", error_day.Start_timestamp.Replace(" ", "T"));
|
||||
var endTimestamp = string.Format("{0}+08:00", error_day.End_timestamp.Replace(" ", "T"));
|
||||
|
||||
var historyQueryFilter = $@"<obj is='obix: HistoryFilter'>
|
||||
<abstime name='start' val='{startTimestamp}' />
|
||||
<abstime name='end' val='{endTimestamp}' />
|
||||
<reltime name='interval' val = 'PT1D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveDayRequest = (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/");
|
||||
archiveDayRequest.Method = "POST";
|
||||
archiveDayRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveDayRequest.PreAuthenticate = true;
|
||||
@ -325,15 +334,22 @@ namespace BackendWorkerService.Services.Implement
|
||||
{
|
||||
var Mysql_error_update = string.Format(MYsql_update_format, targetTable);
|
||||
var sql_error_update = string.Format(sql_update_format, targetTable);
|
||||
await backgroundServiceRepository.ExecuteSql(Mysql_error_update, electricArchiveDayRawDatas);
|
||||
if (!string.IsNullOrEmpty(saveToMSDB) && saveToMSDB == "1")
|
||||
{
|
||||
await backgroundServiceMsSqlRepository.ExecuteSql(sql_error_update, electricArchiveDayRawDatas);
|
||||
}
|
||||
await backgroundServiceRepository.ExecuteSql(Mysql_error_update, electricArchiveDayRawDatas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
targetTable = "archive_water_meter_day";
|
||||
targetTable = await backgroundServiceRepository.GetOneAsync<string>($@"
|
||||
select table_name
|
||||
from information_schema.`TABLES`
|
||||
where TABLE_NAME like 'archive_water_meter_day%' and TABLE_SCHEMA = '{schema.Split('/')[0]}'
|
||||
order by TABLE_NAME desc limit 1 ");
|
||||
if (!string.IsNullOrEmpty(targetTable))
|
||||
{
|
||||
sql_error_day = string.Format(sql_error_format, targetTable);
|
||||
var water_error_days = await backgroundServiceRepository.GetAllAsync<ArchiveElectricMeter>(sql_error_day, new { RepeatTimes = repeatTimes });
|
||||
List<Dictionary<string, object>> waterArchiveDayRawDatas = new List<Dictionary<string, object>>();
|
||||
@ -348,15 +364,14 @@ namespace BackendWorkerService.Services.Implement
|
||||
|
||||
var startTimestamp = string.Format("{0}+08:00", error_day.Start_timestamp.Replace(" ", "T"));
|
||||
var endTimestamp = string.Format("{0}+08:00", error_day.End_timestamp.Replace(" ", "T"));
|
||||
|
||||
var historyQueryFilter = $@"<obj is='obix: HistoryFilter'>
|
||||
<abstime name='start' val='{startTimestamp}' />
|
||||
<abstime name='end' val='{endTimestamp}' />
|
||||
<reltime name='interval' val = 'PT1D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveDayRequest = (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/");
|
||||
archiveDayRequest.Method = "POST";
|
||||
archiveDayRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveDayRequest.PreAuthenticate = true;
|
||||
@ -416,6 +431,7 @@ namespace BackendWorkerService.Services.Implement
|
||||
await backgroundServiceRepository.ExecuteSql(Mysql_error_update, waterArchiveDayRawDatas);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion 天歸檔補償
|
||||
|
||||
#region 週歸檔補償
|
||||
@ -442,8 +458,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
<reltime name='interval' val = 'PT7D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveWeekRequest = (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/");
|
||||
archiveWeekRequest.Method = "POST";
|
||||
archiveWeekRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveWeekRequest.PreAuthenticate = true;
|
||||
@ -526,8 +542,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
<reltime name='interval' val = 'PT7D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveWeekRequest = (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/");
|
||||
archiveWeekRequest.Method = "POST";
|
||||
archiveWeekRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveWeekRequest.PreAuthenticate = true;
|
||||
@ -616,8 +632,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveMonthRequest = (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/");
|
||||
archiveMonthRequest.Method = "POST";
|
||||
archiveMonthRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveMonthRequest.PreAuthenticate = true;
|
||||
@ -674,11 +690,11 @@ namespace BackendWorkerService.Services.Implement
|
||||
{
|
||||
await backgroundServiceMsSqlRepository.ExecuteSql(sql_error_update, electricArchiveMonthRawDatas);
|
||||
}
|
||||
await backgroundServiceRepository.ExecuteSql(MYsql_update_format, electricArchiveMonthRawDatas);
|
||||
await backgroundServiceRepository.ExecuteSql(Mysql_error_update, electricArchiveMonthRawDatas);
|
||||
}
|
||||
}
|
||||
|
||||
targetTable = "archive_electric_meter_month";
|
||||
targetTable = "archive_water_meter_month";
|
||||
sql_error_month = string.Format(sql_error_format, targetTable);
|
||||
var water_error_months = await backgroundServiceRepository.GetAllAsync<ArchiveElectricMeter>(sql_error_month, new { RepeatTimes = repeatTimes });
|
||||
List<Dictionary<string, object>> waterArchiveMonthRawDatas = new List<Dictionary<string, object>>();
|
||||
@ -703,8 +719,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
||||
</obj>";
|
||||
|
||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{deviceNumberPoint.FullDeviceNumberPoint}/~historyRollup/");
|
||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||
HttpWebRequest archiveMonthRequest = (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/");
|
||||
archiveMonthRequest.Method = "POST";
|
||||
archiveMonthRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||
archiveMonthRequest.PreAuthenticate = true;
|
||||
@ -761,7 +777,7 @@ namespace BackendWorkerService.Services.Implement
|
||||
{
|
||||
await backgroundServiceMsSqlRepository.ExecuteSql(sql_error_update, waterArchiveMonthRawDatas);
|
||||
}
|
||||
await backgroundServiceRepository.ExecuteSql(MYsql_update_format, waterArchiveMonthRawDatas);
|
||||
await backgroundServiceRepository.ExecuteSql(Mysql_error_update, waterArchiveMonthRawDatas);
|
||||
}
|
||||
}
|
||||
#endregion 月歸檔補償
|
||||
|
Loading…
Reference in New Issue
Block a user