backend: 巨蛋棟 niagara 同步
This commit is contained in:
parent
a38a4473dd
commit
2d17934443
@ -83,7 +83,8 @@ namespace Backend.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
var building = ds.FirstOrDefault().building;
|
||||
string ss = ds.Where(x => x.tag_name != "").FirstOrDefault().tag_name;
|
||||
var building = ss.Split("_")[0];
|
||||
string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node
|
||||
await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag
|
||||
await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel);
|
||||
@ -147,6 +148,11 @@ namespace Backend.Controllers
|
||||
ApiResult<bool> apiResult = new ApiResult<bool>();
|
||||
try
|
||||
{
|
||||
if (ds.Count > 0)
|
||||
{
|
||||
//string ss = ds.Where(x => x.tag_name != "").FirstOrDefault().tag_name;
|
||||
//var building = ss.Split("_")[0];
|
||||
|
||||
var building = ds.FirstOrDefault().device_building_tag;
|
||||
await niagaraDataSynchronizeRepository.InsertItemFromNiagara(ds, building); // insert 暫存table import_niagara_item
|
||||
await niagaraDataSynchronizeRepository.DeviceItemComparison(); //insert device_item
|
||||
@ -158,6 +164,8 @@ namespace Backend.Controllers
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = result;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
|
@ -134,8 +134,10 @@ namespace Backend.Services.Implement
|
||||
/// <returns></returns>
|
||||
public List<ImpNiaItem> obixHisQuery(string bqlUrlString, string urlString, string slot)
|
||||
{
|
||||
String username = "obixUser";
|
||||
String password = "Admin123456";
|
||||
//String username = "obixUser";
|
||||
//String password = "Admin123456";
|
||||
String username = "stanGG";
|
||||
String password = "St12345678";
|
||||
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
|
||||
#region get control point data
|
||||
@ -234,11 +236,12 @@ namespace Backend.Services.Implement
|
||||
row.device_system_tag = tagName.Split('_')[1];
|
||||
row.device_floor_tag = tagName.Split('_')[4];
|
||||
row.device_name_tag = tagName.Split('_')[3];
|
||||
row.device_point_name = tagName.Split('_')[8];
|
||||
row.device_point_name = tagName.Split('_')[5];
|
||||
row.parent_path = stationName;
|
||||
|
||||
//full_name 其實是點位名稱 point_name
|
||||
row.full_name = conPoint.Where(x => x.name == tagName).Select(x => x.displayName).FirstOrDefault();
|
||||
result.Add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,8 @@
|
||||
"Port": "js2LutKe+rdjzdxMPQUrvQ==",
|
||||
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
|
||||
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
|
||||
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||
"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
||||
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
|
||||
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
|
||||
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
|
||||
"Password": "FVAPxztxpY4gJJKQ/se4bQ=="
|
||||
}
|
||||
@ -57,8 +57,8 @@
|
||||
//"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpHFicuOA83OZeuWHBFdi/xpfEIklxyQ/wP75bEKwrdh+fXXgjmpc9cLX9GqbBC7eGw==", //三菱
|
||||
//"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpD06cJcRzpVx0+IAssROlE4MlzSDPojSI17+XkQIL9Eu" //三菱
|
||||
|
||||
//"UrlSlot": "e1dUH6340WkFoHPJYq7IYQ==", // 巨蛋棟 D2
|
||||
"UrlSlot": "f9cDBTw5PCfbDTOt4Kwbew==", // 旅館棟 slot:/Arena/H|
|
||||
"UrlSlot": "e1dUH6340WkFoHPJYq7IYQ==", // 巨蛋棟 D2
|
||||
//"UrlSlot": "f9cDBTw5PCfbDTOt4Kwbew==", // 旅館棟 slot:/Arena/H|
|
||||
"ObixQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", //巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisBqlQuery": "7C/j7U8PmDqMxpb7f6gMpIDkLYyNwmXoqhx+N1G+fqQxEETrRbFLZfC7Sud5yX24CphfLlSUbfjft7gcP6v+gw==", // 巨蛋 http://192.168.0.136:8082/obix/config/Program/ObixQuery/query/
|
||||
"ObixHisUrlQuery": "7C/j7U8PmDqMxpb7f6gMpEVUZrrjJT0WiTUBn0FzipXfBFsxYAX3plIWBcJ+oZzW", //巨蛋 http://192.168.0.136:8081/obix/histories
|
||||
|
@ -68,7 +68,7 @@ namespace Repository.BackendRepository.Implement
|
||||
});
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
bool isDome = false; //是否為巨蛋案
|
||||
foreach (var row in ds2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(row.tag_name)) continue;
|
||||
@ -97,12 +97,13 @@ namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
if (arrTag.Length == 5)
|
||||
{
|
||||
isDome= true;
|
||||
sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag,
|
||||
device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" +
|
||||
row.tag_name + "', '" + //niagara_tags
|
||||
"', '" + //device_area_tag
|
||||
arrTag[0] + "', '" + //device_building_tag
|
||||
arrTag[1] + "', '" + //device_system_tag
|
||||
arrTag[1] + "', '" + //device_system_tag 巨蛋沒有大類,後面再用關聯的方式補上
|
||||
arrTag[3] + "', '" + //device_name_tag
|
||||
arrTag[2] + "', '" + //device_floor_tag
|
||||
"', '" + //device_master_tag
|
||||
@ -118,6 +119,20 @@ namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
await conn.ExecuteAsync(sb.ToString());
|
||||
sb.Clear();
|
||||
|
||||
//巨蛋特殊處理
|
||||
if (isDome)
|
||||
{
|
||||
sb.Append($@" -- tag 第二碼為小類(除了安全系統之外)
|
||||
update import_niagara_tag set device_name_tag = device_system_tag
|
||||
where device_system_tag <> 'S';
|
||||
|
||||
update import_niagara_tag a join dic_system b
|
||||
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code
|
||||
set device_system_tag = b.s1_code -- tag 第二碼為小類(除了安全系統之外)
|
||||
where device_system_tag <> 'S'; -- 安全系統 第二段大類 第四段小類");
|
||||
await conn.ExecuteAsync(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -144,8 +144,10 @@ namespace tpDomeWinAPP.Service
|
||||
public List<device_value2> obixQuery(string urlString, string bql)
|
||||
{
|
||||
List<device_value2> result = new List<device_value2>();
|
||||
String username = "obixUser";
|
||||
String password = "Admin123456";
|
||||
//String username = "obixUser";
|
||||
//String password = "Admin123456";
|
||||
String username = "stanGG";
|
||||
String password = "St12345678";
|
||||
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||
String API_Url = urlString;
|
||||
|
||||
@ -171,8 +173,6 @@ namespace tpDomeWinAPP.Service
|
||||
//xmlDoc.Save("N4.xml");
|
||||
|
||||
|
||||
|
||||
|
||||
string jsonText = JsonConvert.SerializeXmlNode(xmlDoc);
|
||||
// JObject resultVal = (JObject)JsonConvert.DeserializeObject(jsonText);
|
||||
var data = Welcome.FromJson(jsonText);
|
||||
@ -197,7 +197,7 @@ namespace tpDomeWinAPP.Service
|
||||
}
|
||||
else if (i > 1 && i < s2.Length - 2)
|
||||
{
|
||||
row.tag_name += "_" + s2[i];
|
||||
row.tag_name += "_" + s2[i].Replace("$3", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,10 +166,18 @@ namespace tpDomeWinAPP
|
||||
if (tabControl1.SelectedIndex == 0)
|
||||
{
|
||||
webRequestSvc svc = new webRequestSvc();
|
||||
string url_slot2 = "slot:/NTPC/B1|";//wsp
|
||||
string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint ";//三菱: url_slot; wsp: url_slot2
|
||||
//ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
|
||||
ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
|
||||
//string url_slot2 = "slot:/NTPC/B1|";//wsp
|
||||
//string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint ";//三菱: url_slot; wsp: url_slot2
|
||||
////ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
|
||||
//ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
|
||||
//ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
|
||||
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
|
||||
|
||||
// string url_slot2 = "slot:/Arena/H/F1/B5F/FP/H_F1_B5F_FP_01|";//"ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/H/F1/B5F/FP/H_F1_B5F_FP_01|";
|
||||
string url_slot2 = "slot:/Arena/H|";
|
||||
string bql = url_slot + "neql:hs:geoAddr=\"ER1\" ";//三菱: url_slot; wsp: url_slot2
|
||||
ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
|
||||
//ds = svc.obixQuery("http://60.251.164.125:8080/obix/config/Program/ObixQuery/query/", bql);//三菱
|
||||
//ds = svc.obixQuery("http://192.168.0.136:8081/obix/config/Program/ObixQuery/query/", bql);//wsp
|
||||
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
|
||||
dataGridView1.DataSource = ds;
|
||||
|
Loading…
Reference in New Issue
Block a user