From 3b12a644de02a24b98c5f72cd267bba324dbd5d8 Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 22 Sep 2023 16:10:54 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9left?= =?UTF-8?q?=20join=20=E5=95=8F=E9=A1=8C,=20=E4=BF=AE=E6=94=B9=E5=90=8C?= =?UTF-8?q?=E6=AD=A5deviceitem=20=E5=88=A4=E6=96=B7=20[=E5=89=8D=E7=AB=AF]?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E8=AB=8B=E6=B1=82niagara=20history=20url?= =?UTF-8?q?=20=E6=9E=B6=E6=A7=8B,=20=E4=BF=AE=E6=94=B9left=20join=20?= =?UTF-8?q?=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/BuildMenuController.cs | 8 ++++---- Backend/Controllers/DeviceManageController.cs | 2 +- Backend/appsettings.Development.json | 2 +- .../c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg | Bin 0 -> 7477 bytes .../ApiControllers/AlarmRecordController.cs | 6 +++--- .../ApiControllers/HistoryController.cs | 16 +++++++++++++++- .../NiagaraDataSynchronizeRepository.cs | 2 -- 7 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg diff --git a/Backend/Controllers/BuildMenuController.cs b/Backend/Controllers/BuildMenuController.cs index fd9fd32..dcdac30 100644 --- a/Backend/Controllers/BuildMenuController.cs +++ b/Backend/Controllers/BuildMenuController.cs @@ -381,10 +381,10 @@ namespace Backend.Controllers case right_planimetric_click when 1 then '開' when 0 then '關' end right_planimetric_click_name, mv.system_key main_system_guid_name, sv.system_key sub_system_guid_name,lf.full_name left_floor_guid_name, rf.full_name right_floor_guid_name from building_menu bm - left join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.deleted = 0 - left join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0 - left join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid - left join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid + join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.deleted = 0 + join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0 + join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid + join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid where bm.building_tag = @building_tag and bm.main_system_tag in @MainList ORDER BY bm.priority, mv.system_priority ASC, sv.system_priority ASC, sv.created_at DESC ", new { building_tag = post.building_tag, MainList = post.MainList, main_system_type = main_system_type, sub_system_type = sub_system_type }); diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index 75f31b9..c7232dc 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -80,7 +80,7 @@ namespace Backend.Controllers f.floor_map_name, f.priority AS fPriority FROM sub_system_floor ssf - LEFT JOIN floor f ON ssf.floor_tag = f.full_name AND ssf.building_tag = f.building_tag AND f.deleted = 0 + JOIN floor f ON ssf.floor_tag = f.full_name AND ssf.building_tag = f.building_tag AND f.deleted = 0 WHERE ssf.deleted = 0 ORDER BY f.priority, f.created_at "; diff --git a/Backend/appsettings.Development.json b/Backend/appsettings.Development.json index 2c7281e..7704050 100644 --- a/Backend/appsettings.Development.json +++ b/Backend/appsettings.Development.json @@ -29,7 +29,7 @@ "Password": "FVAPxztxpY4gJJKQ/se4bQ==" }, "MSSqlDBConfig": { - "Server": "bJm+UAtbeaTjDmp/A5ep2w==", //0.130 + "Server": "bJm+UAtbeaTjDmp/A5ep2w21==", //0.130 "Port": "S5cUXKnKOacFtFy9+0dtpw==", "Database": "VvfWH/59gQguY2eA2xBCug==", //taipei_dome "Root": "4GCCJGAXzLa8ecdmPAkYKg==", diff --git a/Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg b/Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c002f985ced70c6e4242e115b923ebe11c899072 GIT binary patch literal 7477 zcmeHLby!qiw>~q&z(@`uf(Q;Fk~(z5kb(jd0)lj>goK1Riqg_ClpsilfFcM=NrMOs zNQrcplqjIw1LDu;yYbik<9nX_+*V*!otoe z&4UIvX=4dR32-;ow$f75veHiQw6*n2D2@(|F7A8#w(oHN5NweDZ3l;q03`y7Apl?y z763{Kfl)#Zn}D-m1Te@^EdMkJi~tHJJRAWKzs-B4|3Lq}05_)auO$=QdvQ6U!fHJ9 z-LTz`BcXWzIE}-!@G9o759!kj#_NH5{#~jJB6n-(-#K3%+!E5MiR6Bvn=Ual-{vbV zQvR0>v`%fT`t79a^iKKSms<7i{S^MCE_y|0%S2n6sY`l1y|r-K=ZoIUX5(muJF73Pwh#RGI&*B(Y9zyQdp@+Lmsc;YTao`n|0TmhV#F0vz0U2P`xX+y+?<+o zcjYhm|I+`>3_zn!;yUvuz8uLh5A8*Zxe<}M$_sl+>O!-_LBr*c1TnvtKeXcI{*;9=YMB+8SnXi3a=efv+&HbuujN>Z4U z4v(jMlfXM!V8e#dv7jb@ZRn}!a>N=SmGQ3(Q$3xErP=~twRqc{Lhkafu#pq|C_AJ( z*emh1U~@C_eEznZ6PluK&ghiNm==b}~+&e}*a)1%P|DC)Sg2_^@2v z0C3*m#Cn|fWgy&?_$3w~`h-0({~dP%`1f^;0boK$iP3cd*VQKA47f7=%i09y7YaLG znxIH<;xi|chh%qTHWl(5#{#KndUY)ghB|@%Z5QZ`GV^)>$N(pB)j{bc|!Flkx@Igh3e!AW^^HNGt(@ zBw1M;d(1^p@}Q0uvm@9VkN_pH0|Y&mydIQL5GbK3tQ3?G0OkP>_)C-lb54Jp^MA=Y z6f6ng$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)uRg4;FPj#JEoCg90x`{%`dTr%a$zbZjiNQZ1FBx7PFES=YFz@lcZY>f=9>< z4H&X*mQ69R5YSqaMl2gOQQZty*APcwB!cgPn}R6wSYh3a%RMDWIph{|Y?1SACg(yY z{SMuFS~I__DaQB;!lH^ko#?dpKkdIgyT{NOzdSizrFXxhWnwQ~bN{}&!MDb;<$ZF7 z(Pdp;{YVmR{FzzF)+s7)E)!*^nBph_NONy}Z#?_J2K{V_f9rnWCmU%i@~xnVNuys7 zqkT^{wu@446})97T!yy0h;9ytm(!FenNuPj$yW^e59Oo$y02?@{Os1^g7pSgiZ?;q r{N8IF0_GY>fzjo<+sSJc-xgmu9}fQqt4H%P literal 0 HcmV?d00001 diff --git a/FrontendWebApi/ApiControllers/AlarmRecordController.cs b/FrontendWebApi/ApiControllers/AlarmRecordController.cs index 5daf8be..9739835 100644 --- a/FrontendWebApi/ApiControllers/AlarmRecordController.cs +++ b/FrontendWebApi/ApiControllers/AlarmRecordController.cs @@ -60,9 +60,9 @@ namespace FrontendWebApi.ApiControllers JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account AND ap.building_tag IS NOT NULL ) ap ON bm.building_tag = ap.building_tag - LEFT JOIN building b ON bm.building_tag = b.building_tag - left join variable v2 on ap.ShowView = v2.id and v2.deleted = 0 - left join variable v1 on v2.system_parent_id = v1.id + JOIN building b ON bm.building_tag = b.building_tag and b.deleted = 0 + join variable v2 on ap.ShowView = v2.id and v2.deleted = 0 + join variable v1 on v2.system_parent_id = v1.id GROUP BY b.building_tag, b.full_name, v1.system_value, v1.system_key"; var alarmRecordPanelRawDatas = await frontendRepository.GetAllAsync(sqlBuildingMain, new { Account = account }); diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 9ebc514..8a80b3f 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1138,6 +1138,8 @@ namespace FrontendWebApi.ApiControllers order by b.priority, v1.system_priority, v2.system_priority, temp.priority;"; var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_numbers }); + string tagQuantity = await frontendRepository.GetOneAsync("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0;"); + string station = string.Empty; //轉換日期格式 var start = string.Format("{0}T00:00:00.000+08:00", post.Start_timestamp); @@ -1155,7 +1157,19 @@ namespace FrontendWebApi.ApiControllers { var device_number_point = historyItem.Device_number_point.Replace(":", "_"); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{device_number_point}/~historyQuery/"); + if (tagQuantity.Equals("5")) + station = await frontendRepository.GetOneAsync($@"select parent_path from import_niagara_item_history + where device_building_tag = '{device_number_point.Split("_")[0]}' and device_floor_tag = '{device_number_point.Split("_")[2]}' + and device_name_tag = '{device_number_point.Split("_")[1]}' and device_point_name = '{device_number_point.Split("_")[5]}'"); + else + station = frontendRepository.GetOneAsync($@"select parent_path from import_niagara_item_history + where device_building_tag = '{device_number_point.Split("_")[1].Replace("$3", "")}' and + device_system_tag = '{device_number_point.Split("_")[2]}' and device_name_tag = '{device_number_point.Split("_")[3]}' + and device_floor_tag = '{device_number_point.Split("_")[4]}' and device_master_tag = '{device_number_point.Split("_")[5]}' + and device_last_name_tag = '{device_number_point.Split("_")[6]}' and device_serial_tag = '{device_number_point.Split("_")[7]}' + and device_point_name = '{device_number_point.Split("_")[8]}'").Result; + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{device_number_point.Replace("$3", "")}/~historyQuery/"); request.Method = "POST"; request.Headers.Add("Authorization", "Basic " + encoded); request.PreAuthenticate = true; diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 1cf2fc5..9e68d8d 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -630,7 +630,6 @@ namespace Repository.BackendRepository.Implement ON d.device_system_tag = m.device_system_tag AND d.device_name_tag = m.device_name_tag AND d.points = m.device_point_name - AND d.full_name = m.full_name SET d.is_link = CASE WHEN m.device_point_name IS NULL THEN 0 ELSE 1 END; "); @@ -652,7 +651,6 @@ namespace Repository.BackendRepository.Implement ON d.device_system_tag = subquery.device_system_tag AND d.device_name_tag = subquery.device_name_tag AND d.points = subquery.device_point_name - AND d.full_name = subquery.full_name SET d.is_show_history = CASE WHEN subquery.device_point_name IS NULL THEN 0 ELSE 1 END WHERE (d.is_show_history);");