[後端] 修改tag缺失, 修改根據quantity 獲取parent_path
This commit is contained in:
parent
d39b7ccb8b
commit
c63558de71
@ -113,15 +113,15 @@ namespace Backend.Controllers
|
|||||||
building = data.GroupBy(x => x.tag_name.Split("_")[1]).Select(x => x.Key).ToList();
|
building = data.GroupBy(x => x.tag_name.Split("_")[1]).Select(x => x.Key).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node
|
//string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node
|
||||||
await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag
|
//await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag
|
||||||
await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel);
|
//await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel);
|
||||||
await niagaraDataSynchronizeRepository.CheckDiffFullNameAndCover();
|
//await niagaraDataSynchronizeRepository.CheckDiffFullNameAndCover();
|
||||||
await niagaraDataSynchronizeRepository.CheckFullNameEmptyReplaceByDeviceName();
|
//await niagaraDataSynchronizeRepository.CheckFullNameEmptyReplaceByDeviceName();
|
||||||
await niagaraDataSynchronizeRepository.InsertBuildingMenu();
|
//await niagaraDataSynchronizeRepository.InsertBuildingMenu();
|
||||||
await niagaraDataSynchronizeRepository.InsertSubSystemFloor();
|
//await niagaraDataSynchronizeRepository.InsertSubSystemFloor();
|
||||||
await niagaraDataSynchronizeRepository.InsertFloor();
|
//await niagaraDataSynchronizeRepository.InsertFloor();
|
||||||
await this.DeviceDisasterAsync();
|
//await this.DeviceDisasterAsync();
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
@ -201,14 +201,15 @@ namespace Backend.Controllers
|
|||||||
//var building = ss.Split("_")[0];
|
//var building = ss.Split("_")[0];
|
||||||
|
|
||||||
var building = ds.GroupBy(x => x.device_building_tag).Select(x => x.Key).ToList();
|
var building = ds.GroupBy(x => x.device_building_tag).Select(x => x.Key).ToList();
|
||||||
await niagaraDataSynchronizeRepository.InsertItemFromNiagara(ds, building); // insert 暫存table import_niagara_item
|
//await niagaraDataSynchronizeRepository.InsertItemFromNiagara(ds, building); // insert 暫存table import_niagara_item
|
||||||
await niagaraDataSynchronizeRepository.DeviceItemComparison(); //insert device_item
|
//await niagaraDataSynchronizeRepository.DeviceItemComparison(); //insert device_item
|
||||||
await niagaraDataSynchronizeRepository.CheckItemDiffFullNameAndCover(); // update device_item.fullname
|
//await niagaraDataSynchronizeRepository.CheckItemDiffFullNameAndCover(); // update device_item.fullname
|
||||||
await niagaraDataSynchronizeRepository.ItemCheckFullNameEmptyReplaceByDeviceName(); // 檢查device_item內FullName為空的值,以points取代
|
//await niagaraDataSynchronizeRepository.ItemCheckFullNameEmptyReplaceByDeviceName(); // 檢查device_item內FullName為空的值,以points取代
|
||||||
await niagaraDataSynchronizeRepository.CheckItemIsShowHistory();
|
//await niagaraDataSynchronizeRepository.CheckItemIsShowHistory();
|
||||||
|
|
||||||
#region 歷史資料處理
|
#region 歷史資料處理
|
||||||
ds.Clear();
|
ds.Clear();
|
||||||
|
var isDome = await backendRepository.GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
|
||||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||||
var variableObix = backendRepository.GetAllAsync<Backend.Models.KeyValue>(sqlObix).Result;
|
var variableObix = backendRepository.GetAllAsync<Backend.Models.KeyValue>(sqlObix).Result;
|
||||||
var obixApiConfig = new Backend.Models.ObixApiConfig();
|
var obixApiConfig = new Backend.Models.ObixApiConfig();
|
||||||
@ -223,6 +224,8 @@ namespace Backend.Controllers
|
|||||||
ds.AddRange(data);
|
ds.AddRange(data);
|
||||||
// save to history
|
// save to history
|
||||||
await niagaraDataSynchronizeRepository.InsertItemFromNiagara_History(ds, building); // insert 暫存table import_niagara_item_history
|
await niagaraDataSynchronizeRepository.InsertItemFromNiagara_History(ds, building); // insert 暫存table import_niagara_item_history
|
||||||
|
if (!string.IsNullOrEmpty(isDome) && isDome.Contains("ibms_dome"))
|
||||||
|
await niagaraDataSynchronizeRepository.RecoverSysTag("import_niagara_item_history"); // recover missing deivce_system_tag
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
||||||
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
||||||
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||||
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||||
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
||||||
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
|
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
|
||||||
"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
|
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
|
||||||
//"Database": "2U+9jYGy0dCbMzLaguBXow==", //tpe_dome_mall
|
//"Database": "2U+9jYGy0dCbMzLaguBXow==", //tpe_dome_mall
|
||||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||||
|
@ -62,6 +62,8 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
var variableArchive = await backgroundServiceRepository.GetAllAsync<KeyValue>(sqlArchive);
|
var variableArchive = await backgroundServiceRepository.GetAllAsync<KeyValue>(sqlArchive);
|
||||||
var electricMeterGuid = variableArchive.Where(x => x.Name == "ElectricMeterGuid").Select(x => x.Value).FirstOrDefault();
|
var electricMeterGuid = variableArchive.Where(x => x.Name == "ElectricMeterGuid").Select(x => x.Value).FirstOrDefault();
|
||||||
var waterMeterGuid = variableArchive.Where(x => x.Name == "WaterMeterGuid").Select(x => x.Value).FirstOrDefault();
|
var waterMeterGuid = variableArchive.Where(x => x.Name == "WaterMeterGuid").Select(x => x.Value).FirstOrDefault();
|
||||||
|
string station = string.Empty;
|
||||||
|
string tagQuantity = await backgroundServiceRepository.GetOneAsync<string>("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0;");
|
||||||
|
|
||||||
#region http variable
|
#region http variable
|
||||||
HttpWebRequest archiveRequest = null;
|
HttpWebRequest archiveRequest = null;
|
||||||
@ -160,11 +162,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -222,11 +230,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -654,11 +668,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
List<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
|
||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
@ -718,11 +738,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -1044,11 +1070,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -1106,11 +1138,17 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
|
@ -55,6 +55,8 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
var variableArchive = await backgroundServiceRepository.GetAllAsync<KeyValue>(sqlArchive);
|
var variableArchive = await backgroundServiceRepository.GetAllAsync<KeyValue>(sqlArchive);
|
||||||
repeatTimes = Convert.ToInt32(variableArchive.Where(x => x.Name == "RepeatTimes").Select(x => x.Value).FirstOrDefault());
|
repeatTimes = Convert.ToInt32(variableArchive.Where(x => x.Name == "RepeatTimes").Select(x => x.Value).FirstOrDefault());
|
||||||
var saveToMSDB = await backgroundServiceRepository.GetOneAsync<string>("select system_value from variable where system_type = 'save_to_ms_db' and deleted = 0");
|
var saveToMSDB = await backgroundServiceRepository.GetOneAsync<string>("select system_value from variable where system_type = 'save_to_ms_db' and deleted = 0");
|
||||||
|
string station = string.Empty;
|
||||||
|
string tagQuantity = await backgroundServiceRepository.GetOneAsync<string>("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0;");
|
||||||
|
|
||||||
#region 取得obix 設定
|
#region 取得obix 設定
|
||||||
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
|
||||||
@ -280,11 +282,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~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/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveDayRequest.Method = "POST";
|
archiveDayRequest.Method = "POST";
|
||||||
@ -368,11 +376,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
deviceNumberPoint.FullDeviceNumberPoint = string.Format("{0}_{1}", error_day.Device_number, error_day.Point);
|
deviceNumberPoint.FullDeviceNumberPoint = string.Format("{0}_{1}", error_day.Device_number, error_day.Point);
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
var startTimestamp = string.Format("{0}+08:00", error_day.Start_timestamp.Replace(" ", "T"));
|
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 endTimestamp = string.Format("{0}+08:00", error_day.End_timestamp.Replace(" ", "T"));
|
||||||
var historyQueryFilter = $@"<obj is='obix: HistoryFilter'>
|
var historyQueryFilter = $@"<obj is='obix: HistoryFilter'>
|
||||||
@ -470,11 +484,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~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/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveWeekRequest.Method = "POST";
|
archiveWeekRequest.Method = "POST";
|
||||||
@ -560,11 +580,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~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/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveWeekRequest.Method = "POST";
|
archiveWeekRequest.Method = "POST";
|
||||||
@ -656,11 +682,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~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/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveMonthRequest.Method = "POST";
|
archiveMonthRequest.Method = "POST";
|
||||||
@ -749,11 +781,17 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
if (tagQuantity.Equals("5"))
|
||||||
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
station = await backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
where device_building_tag = '{device_number.Split("_")[0]}' and device_floor_tag = '{device_number.Split("_")[2]}'
|
||||||
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
and device_name_tag = '{device_number.Split("_")[1]}' and device_point_name = '{device_number.Split("_")[5]}'");
|
||||||
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
else
|
||||||
|
station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
|
||||||
|
where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint}/~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/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveMonthRequest.Method = "POST";
|
archiveMonthRequest.Method = "POST";
|
||||||
|
@ -246,7 +246,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
|
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
{
|
{
|
||||||
if (isDome == "ibms_dome_dome/D2" || isDome == "ibms_dome_hotel/H")
|
if (isDome.Contains("ibms_dome"))
|
||||||
{
|
{
|
||||||
sb.Append($@" update import_niagara_item a join dic_system b
|
sb.Append($@" update import_niagara_item a join dic_system b
|
||||||
on a.device_name_tag COLLATE utf8mb4_0900_ai_ci = b.s2_code COLLATE utf8mb4_0900_ai_ci
|
on a.device_name_tag COLLATE utf8mb4_0900_ai_ci = b.s2_code COLLATE utf8mb4_0900_ai_ci
|
||||||
@ -1150,5 +1150,39 @@ device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recover device_system_tag
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task RecoverSysTag(string tableName)
|
||||||
|
{
|
||||||
|
//檢查
|
||||||
|
using (IDbConnection conn = GetDbConnection())
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append($@"SET SQL_SAFE_UPDATES = 0;
|
||||||
|
update {tableName} a
|
||||||
|
join dic_system ds on ds.s2_code = a.device_name_tag
|
||||||
|
set a.device_system_tag = ds.s1_code
|
||||||
|
where a.device_system_tag is null or a.device_system_tag = '';");
|
||||||
|
await conn.ExecuteAsync(sb.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,5 +76,11 @@ namespace Repository.BackendRepository.Interface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task InsertFloor();
|
Task InsertFloor();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recover device_system_tag
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task RecoverSysTag(string tableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user