From 27e75ed925b93364b3b0bcbfecb8a4cb9007d625 Mon Sep 17 00:00:00 2001 From: SinoroWu Date: Mon, 21 Nov 2022 23:43:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=9C=96=E8=B3=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A0=81=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_graphManagement.html | 197 +++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 Frontend/_graphManagement.html diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html new file mode 100644 index 0000000..8cc44db --- /dev/null +++ b/Frontend/_graphManagement.html @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +

圖資管理

+ +
+
+
+ + + + +
+
+ +
+
+ +
+
+ +
+ 查詢 +
+
+
+ +
+
+ 全選 +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + 上傳 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
圖號圖名原設計竣工圖功能
TEST03TEST03A-01.dwg + 編輯 + 刪除 +
TEST06TEST06A-01.dwgAS-01.dwg + 編輯 + 刪除 +
+
+ +
+
+ +
+ + + + + + + + + + + + \ No newline at end of file From 43751cad36cf5ad3fb735d673729e8169f111179 Mon Sep 17 00:00:00 2001 From: wanli Date: Tue, 22 Nov 2022 01:30:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[Frontend]=20baja=20function=20:=20?= =?UTF-8?q?=E8=A8=82=E9=96=B1=E9=9B=BB=E8=A1=A8/=E9=9B=BB=E6=A2=AF=20?= =?UTF-8?q?=E3=80=81=E9=9B=BB=E6=A2=AF=E7=9A=84=E5=8D=B3=E6=99=82=E7=8B=80?= =?UTF-8?q?=E6=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/js/n4js/bajatest.js | 190 ++++++++++++++++++++++++++++++- Frontend/js/n4js/elevatorbaja.js | 77 +++++++++++++ 2 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 Frontend/js/n4js/elevatorbaja.js diff --git a/Frontend/js/n4js/bajatest.js b/Frontend/js/n4js/bajatest.js index 171fad3..1b74869 100644 --- a/Frontend/js/n4js/bajatest.js +++ b/Frontend/js/n4js/bajatest.js @@ -1,3 +1,191 @@ - +let baja_subscribe_device_callback_func; //設定BQL訂閱之後要回傳的Function +var ordPath; //當前點選選單的tag,用來抓出設備路徑,例如:旅館棟->H,消防偵煙器->F3 + +function subscriptionDevices() { + // 用BQL的方式去訂閱 + this.setSubscribeDevicesByBql = function (tempOrdPath) { + ordPath = tempOrdPath; + BajaSubscribeDevicesByBql(); + }; + // BQL去訂閱回傳的Function + this.setSubscribeDevicesCallBack = function (callBackFunc) { + if (callBackFunc != undefined && callBackFunc != null) { + baja_subscribe_device_callback_func = callBackFunc; + } + } +} + +/** + * 使用者透過BQL指定路徑去訂閱設備點位 + */ +function BajaSubscribeDevicesByBql() { + require(['baja!'], function (baja) { + console.log("進入Function 準備執行BQL訂閱"); + var init_start = new Date(Date.now()); + var sub = new baja.Subscriber(); + + sub.attach('changed', function (prop) { + if (prop.getName() === 'out') { + var out_value = this.getOutDisplay(); + var target_device_number = this.$parent.getDisplayName().split('_').slice(0, 5).join('_'); + var point_name = this.getDisplayName(); + + //依據Facets判斷回傳的內容值為何 + var facets_split = this.getFacets1().$cEncStr.split('|'); + var facets_arr = []; + facets_split.forEach(function (item, index) { + facets_arr.push(item.split('=s:')); + }); + + var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}) + + var point_out_split = this.getOutDisplay().split(' '); + + let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]); + + if (key == undefined) { + key = point_out_split[0]; + } + + var modify_target_device = { + "device_number": target_device_number ? target_device_number : null, + "point_name": point_name ? point_name : null, + "value": key + } + + if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) { + baja_subscribe_device_callback_func(modify_target_device, true); //第2參數用在平面圖,刷新畫面 + } + } + }); + + //使用bql語法 + // var building_tag = "H"; + // var system_tag = "M10"; + // baja.Ord.make(`ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/${building_tag}/${system_tag}|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint`) + console.log(`local:|foxs:|station:|slot:/TPE/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`); + baja.Ord.make(`local:|foxs:|station:|slot:/TPE/${ordPath.building_tag}/${ordPath.system_tag}/${ordPath.name_tag}|bql:select name, displayname, slotPath, out.value, out, facets from control:ControlPoint`) + .get( + function (table) { + var tableStart, tableFinish; + var subStart, subFinish; + var component_index = 0; + var total_component_index = 0; + var readBqlFinish = new Date(Date.now()); + // $("#readPath-finish-timestamp").html(readBqlFinish.toISOString()); + // $("#readPath-finish-time").html((readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec"); + console.log("讀取路徑完成-花費時間", (readBqlFinish.getTime() - init_start.getTime()) / 1000 + "sec"); + + table.cursor({ + before: function () { + tableStart = new Date(Date.now()); + $("#table-start-timestamp").html(tableStart.toISOString()); + render_start = new Date(Date.now()); + }, + each: function (item, index) { + if (index < 1) { + subStart = new Date(Date.now()); + $("#sub-start").html(subStart.toISOString()); + } + $("#sub-number").html(index + 1); + total_component_index = index; + var target_device_number_split = this.getDisplay("slotPath").split('/'); + var target_device_number = target_device_number_split[target_device_number_split.length - 2]; + //console.log(target_device_number); + var point_name = this.getDisplay("name"); + var facets = this.getDisplay("facets"); + + //依據Facets判斷回傳的內容值為何 + var facets_split = facets.split(','); + var facets_arr = []; + facets_split.forEach(function (item, index) { + facets_arr.push(item.split('=')); + }); + + facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}) + + var point_out_split = this.getDisplay("out").split(' '); + + let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]); + + if (key == undefined) { + key = point_out_split[0]; + } + + var modify_target_device = { + "device_number": target_device_number ? target_device_number : null, + "point_name": point_name ? point_name : null, + "value": key + } + + //取得component當下就更新設備點位 + if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) { + baja_subscribe_device_callback_func(modify_target_device); + } + + + baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath")) + .get() + .then(function (component) { + component_index++; + var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_'); + var point_name = component.getDisplayName(); + + // //依據Facets判斷回傳的內容值為何 + // var facets_split = component.getFacets1().$cEncStr.split('|'); + // var facets_arr = []; + // facets_split.forEach(function (item, index) { + // facets_arr.push(item.split('=s:')); + // }); + + // var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}) + + // var point_out_split = component.getOutDisplay().split(' '); + + // let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]); + + // if (key == undefined) { + // key = point_out_split[0]; + // } + + // var modify_target_device = { + // "device_number": target_device_number ? target_device_number : null, + // "point_name": point_name ? point_name : null, + // "value": key + // } + + // //取得component當下就更新設備點位 + // if (baja_subscribe_device_callback_func != undefined && baja_subscribe_device_callback_func != null) { + // if (component_index == total_component_index) { + // baja_subscribe_device_callback_func(modify_target_device, true); + // } + // else { + // baja_subscribe_device_callback_func(modify_target_device); + // } + // } + + sub.subscribe({ + comps: component, + }); + + subFinish = new Date(Date.now()); + $("#sub-end").html(subFinish.toISOString()); + $("#sub-time").html((subFinish.getTime() - subStart.getTime()) / 1000 + "sec"); + // console.log("訂閱完成時間", (subFinish.getTime() - subStart.getTime()) / 1000 + "sec"); + }); + }, + after: function () { + tableFinish = new Date(Date.now()); + // $("#table-finish-timestamp").html(tableFinish.toISOString()); + // $("#table-time").html((tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec"); + console.log("表格完成時間", (tableFinish.getTime() - tableStart.getTime()) / 1000 + "sec"); + }, + limit: -1, + offset: 0 + }); + }); + }); +} + diff --git a/Frontend/js/n4js/elevatorbaja.js b/Frontend/js/n4js/elevatorbaja.js new file mode 100644 index 0000000..c357cff --- /dev/null +++ b/Frontend/js/n4js/elevatorbaja.js @@ -0,0 +1,77 @@ + + +function getElevatorInfoByBaja(path, callback) { + var _result = ""; + var _ss = '{'; + var _index = 0; + // + require(['baja!'], function (baja) { + baja.Ord.make("local:|foxs:|station:|slot:/" + path + "|bql:select name, displayName, out, out.value, slotPath, parent.name as 'device_number' from control:ControlPoint where name = 'CP' or name = 'RD' or name = 'DS' or name = 'ST' or name = 'LOAD' or name = 'MID' or name = 'HAND' or name = 'IND' or name = 'MD' or name = 'DNO'").get() + .then(function (table) { + return table.cursor({ + each: function (record) { + var item = null; + var value = null; + if (record.get('name') == "CP") { + item = "floor"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "RD") { //UP or DOWN + item = "direction"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "DS") { + item = "door_state"; + value = record.get('out').get('value') == true ? "OPEN" : "CLOSE"; + } + else if (record.get('name') == "ST") { + item = "running_status"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "LOAD") { + item = "loading"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "MID") { + item = "maintenance"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "HAND") { + item = "manual"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "IND") { + item = "independent"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "MD") { + item = "vip"; + value = record.get('out').get('value'); + } + else if (record.get('name') == "DNO") { + item = "automatic"; + value = record.get('out').get('value'); + } + + if (item != null && item != "") { + if (_index == 0) + _ss += '{"item":"' + item + '", "value":"' + value + '"}'; + else + _ss += ',{"item":"' + item + '", "value":"' + value + '"}'; + _index++; + } + + + }, + after: function () { + _result += '{' + '"count": ' + _index + ', "data":['; + _result += _ss; + _result += ']}'; + if (typeof callback === 'function') { + callback(_result); + } + } + }); + }); + }); +} From 7aeaf4b117903f76233fc8bf35a18523092c25df Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 22 Nov 2022 11:02:51 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=AD=B7=E5=8F=B2?= =?UTF-8?q?=E8=B3=87=E6=96=99=E5=88=97=E8=A1=A8=E9=A1=AF=E7=A4=BA,=20?= =?UTF-8?q?=E8=B3=87=E6=96=99=E9=A1=AF=E7=A4=BA=E6=9C=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_historyData.html | 162 ++++++++++++++++++ Frontend/index.html | 2 +- .../ApiControllers/DeviceManageController.cs | 8 +- .../ApiControllers/HistoryController.cs | 24 +-- FrontendWebApi/Models/HistoryClass.cs | 4 + 5 files changed, 184 insertions(+), 16 deletions(-) create mode 100644 Frontend/_historyData.html diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html new file mode 100644 index 0000000..aedb623 --- /dev/null +++ b/Frontend/_historyData.html @@ -0,0 +1,162 @@ +
+
+
+
+
+ + +
+ + +
+
+ +
+
+

歷史資料瀏覽

+
+
+
+ + + +
+
+
+
+ + +
+
+
+
+ +
+
+ +
+ +
+
+ + + +
+
+ +
+
+ + + + + + + + + + + + + + + +
設備名稱數值紀錄時間
儲冰設備A0127.02021-08-01 23:55:00
+
+
+ +
+ +
+
+ + \ No newline at end of file diff --git a/Frontend/index.html b/Frontend/index.html index f7bd99e..af5ffcf 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -1147,7 +1147,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index ad78366..135e395 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -61,16 +61,16 @@ namespace FrontendWebApi.ApiControllers { var dbsub = await frontendRepository.GetAllAsync( @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority, - dk.device_normal_color, dk.device_close_color, dk.device_error_color, - di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram, - di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link + dk.device_normal_color, dk.device_close_color, dk.device_error_color + -- di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram, + -- di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link from role_auth a join auth_page b on a.AuthCode = b.AuthCode join userinfo c on c.role_guid = a.role_guid join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag - left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0 + -- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0 where c.account = @account order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag }); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 649b40c..9daf30a 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -91,11 +91,6 @@ namespace FrontendWebApi.ApiControllers sheet.SetColumnWidth(0, 4 * 160 * 12); sheet.SetColumnWidth(1, 4 * 160 * 12); sheet.SetColumnWidth(2, 4 * 160 * 12); - sheet.SetColumnWidth(3, 4 * 160 * 12); - sheet.SetColumnWidth(4, 4 * 160 * 12); - sheet.SetColumnWidth(5, 4 * 160 * 12); - sheet.SetColumnWidth(6, 4 * 160 * 12); - sheet.SetColumnWidth(7, 4 * 160 * 12); ICell cell = row.CreateCell(0); cell.SetCellValue("設備名稱"); cell.CellStyle = styleLine12; @@ -152,7 +147,7 @@ namespace FrontendWebApi.ApiControllers /// [HttpPost] [Route("api/History/GetMainSub")] - public async Task>> GetMainSub() + public async Task>> GetMainSub([FromBody] HistoryFind hf) { ApiResult apiResult = new ApiResult(jwt_str); if (!jwtlife) @@ -160,6 +155,13 @@ namespace FrontendWebApi.ApiControllers apiResult.Code = "5000"; return BadRequest(apiResult); } + else if (string.IsNullOrEmpty(hf.building_tag)) + { + apiResult.Code = "0002"; + apiResult.Msg = "必須選擇東別"; + return apiResult; + } + try { var dbsub = await frontendRepository.GetAllAsync( @@ -176,9 +178,9 @@ namespace FrontendWebApi.ApiControllers join auth_page b on a.AuthCode = b.AuthCode join userinfo c on c.role_guid = a.role_guid join building d on d.building_tag = b.building_tag - where c.account = '{myUser.account}' + where c.account = @account and d.building_tag = @building_tag order by d.priority - ", new { @account = myUser.account }); + ", new { @account = myUser.account, @building_tag = hf.building_tag }); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); apiResult.Data = new History_MainSubBuildFloor(); apiResult.Data.history_Main_Systems = new List(); @@ -189,12 +191,12 @@ namespace FrontendWebApi.ApiControllers history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault(); history_Main_System.History_Sub_systems = new List(); - var subs = main.GroupBy(a => a.main_system_tag).ToList(); + var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList(); foreach (var sub in subs) { History_Sub_system history_Sub_System = new History_Sub_system(); - history_Sub_System.full_name = sub.Select(a => a.sub_name).FirstOrDefault(); - history_Sub_System.sub_system_tag = sub.Select(a => a.sub_system_tag).FirstOrDefault(); + history_Sub_System.full_name = sub.sub_name; + history_Sub_System.sub_system_tag = sub.sub_system_tag; history_Main_System.History_Sub_systems.Add(history_Sub_System); } apiResult.Data.history_Main_Systems.Add(history_Main_System); diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index 519ea79..802dea2 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -72,6 +72,10 @@ namespace FrontendWebApi.Models public byte device_item_is_link { get; set; } } + public class HistoryFind + { + public string building_tag { get; set; } + } public class BuildingFloorRawData { public string building_guid { get; set; } From f02a8f8bc889e0aa7318ca20592bab702d919c34 Mon Sep 17 00:00:00 2001 From: SinoroWu Date: Tue, 22 Nov 2022 12:09:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?index.html=20=E4=B8=AD=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=9C=96=E8=B3=87=E7=AE=A1=E7=90=86=E9=A0=81=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=5FgraphManagement.html=20=E5=9C=96?= =?UTF-8?q?=E8=B3=87=E7=AE=A1=E7=90=86=E9=A0=81=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_graphManagement.html | 352 +++++----- Frontend/index.html | 1093 ++++++++++++++++++++++---------- 2 files changed, 925 insertions(+), 520 deletions(-) diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index 8cc44db..4ab4c59 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -1,197 +1,201 @@ - +
- +
+
- - - - - - - - - - - - - - - - - - - - - - - - - +

圖資管理

- - -
- -
-
- -

圖資管理

- -
-
-
- - - - -
-
- -
-
- -
-
- -
- 查詢 -
-
-
- -
-
- 全選 -
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
+
+
+
+ + + +
-
-
- + 上傳 +
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
圖號圖名原設計竣工圖功能
TEST03TEST03A-01.dwg - 編輯 - 刪除 -
TEST06TEST06A-01.dwgAS-01.dwg - 編輯 - 刪除 -
+
+ 查詢 +
+
-
-
- - - - - -
+ + + + + + + + + + -