From 82f7ef088753d7dedb30e2a2b858ed2d65c5dc46 Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 23 Nov 2022 09:08:46 +0800 Subject: [PATCH 01/11] =?UTF-8?q?[Frontend][=E7=B3=BB=E7=B5=B1=E7=9B=A3?= =?UTF-8?q?=E6=8E=A7]=20Card=20=E9=97=9C=E9=96=89=E6=8C=89=E9=88=95?= =?UTF-8?q?=E8=88=87tab=E5=90=8C=E5=88=97=20|=20card=E5=85=A7=E5=AE=B9?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E6=8B=89=E5=AF=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysMonAll.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index f8ffc8a..29d1b1e 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -195,10 +195,7 @@ let devName = $(ele).data("name"); //full_name $(ele).YTTooltip({ html: `
-
- -
-
+
@@ -208,6 +205,7 @@ +
From 821d787ceb7110d6a2cb65abc60ab8d63deae51b Mon Sep 17 00:00:00 2001 From: wanli Date: Wed, 23 Nov 2022 11:11:40 +0800 Subject: [PATCH 02/11] =?UTF-8?q?[Frontend]=20=E9=80=8F=E9=81=8Ebaja=20?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E8=A8=AD=E5=82=99=E7=9A=84=E7=95=B0=E5=B8=B8?= =?UTF-8?q?=E8=B3=87=E8=A8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysMonAll.html | 71 ++++++++++------------------------- Frontend/js/n4js/alarmbaja.js | 37 ++---------------- 2 files changed, 23 insertions(+), 85 deletions(-) diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index 29d1b1e..51cd5d7 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -232,9 +232,8 @@ console.log($(oriEle).data("number")) //基本資料tab block $("#info").html(drawInfoTabBlo(devGuid)); + loadErr($(oriEle).data("number")); loadOpeRecTable(devGuid); - //loadErrRecTable2($(oriEle).data("number")); - loadErrRecTable(); } }) }) @@ -285,10 +284,20 @@ let opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi"); } - function loadErrRecTable() { + function loadErr(allPath) { + if (allPath != undefined && allPath != null) { + let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1 + let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5]; + getOneDeviceAlarmTop10ByBaja(_devicePath, callbackForErr); + } + else { + console.log("no device"); + } + } + + function callbackForErr(result) { let tag = "#errRecTable"; let datas; - //getOneDeviceAlarmTop10ByBaja(_devicePath, callback); let column_defs = [ { "targets": [0], "width": "15%", "sortable": true }, @@ -312,61 +321,19 @@ "data": "ackState", }, { - "title": "發生/賦歸時間", - "data": "timestamp", - "width": "45%", + "title": "發生/完成時間", + "data": "normalTime", + "render": function (data, type, row) { + return row.timestamp + "
" + data; + }, }, ]; - //let callback = function (result) { - // datas = result; - //} - let result = '{"count": 2,"data":[{ "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00"},{"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00"}]}'; let json_object = JSON.parse(result); datas = json_object['data']; errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "tpi"); + } - //function loadErrRecTable2(allPath) { - // if (allPath != undefined && allPath != null) { - // let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1 - // let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5]; - // //getOneDeviceAlarmTop10ByBaja(_devicePath, callback); - // console.log("devicePath: " + _devicePath); - // let result = '{"count": 2,"0": { "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "1","msgText": "","ackState": "1","normalTime": "1970-Jan-1 08:00:00.000 AM UTC+08:00"},"1": {"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "0","msgText": "","ackState": "1","normalTime": "2022-Nov-16 10:15:24.939 AM UTC+08:00"}}'; - // let result_Json = JSON.parse(result) - // var eachTable = $('.each-table tbody'); - - // for (var i = 0; i < result_Json['count']; i++) - // { - // item = result_Json[i.toString()]; - // eachTable.append( - // '' + - // '' + item.uuid + '' + - // '' + item.msgText + '' + - // '' + (item.ackState = 1 ? item.normalTime : '未確認') + '' + - // '' + item.timestamp + '' + - // ''); - // } - - // } - - // let callback = function (result) { - // var eachTable = $('.each-table tbody'); - // $.each(result, function (index, element) { - // eachTable.append( - // '' + - // '' + element[index].uuid + '' + - // '' + element[index].msgText + '' + - // '' + (element[index].ackState = 1 ? element[index].normalTime : '未確認') + '' + - // '' + element[index].timestamp + '' + - // ''); - // }); - // } - //} - // } - - - \ No newline at end of file diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index c75b46f..8daf612 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -88,35 +88,6 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i * @param {any} devicePath * @param {any} callback */ -// function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { -// var _result = ""; -// var _ss = ""; -// var _index = 0; -// //{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]} -// require(['baja!'], function (baja) { -// baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() -// .then(function (table) { -// return table.cursor({ -// each: function (record) { -// if (_index == 0) -// _ss += '{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}'; -// else -// _ss += ',{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}'; -// _index++; -// }, -// after: function () { -// _result += '{' + '"count": ' + _index +', "data":['; - -// _result += _ss+']'; -// _result += '}'; -// if (typeof callback === 'function') { -// callback(_result); -// } -// } -// }); -// }); -// }); -// } function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { var _result = ""; var _ss = ""; @@ -136,16 +107,16 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { var _timestampTemp = new Date(record.get('timestamp').toString()); _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString(); - //var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString(); var _normaltime = new Date(record.get('normalTime').toString()); _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString(); - var _msgText = record.get('alarmData').get('msgText') == 1 ? _occurrenceTime : "未確認"; + var _msgText = record.get('alarmData').get('msgText'); + var _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認"; if (_index == 0) - _ss += '{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}'; + _ss += '{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}'; else - _ss += ',{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}'; + _ss += ',{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}'; _index++; }, after: function () { From e5c7b5077d3afab1bfe016312d0df858b610c49f Mon Sep 17 00:00:00 2001 From: wanli Date: Wed, 23 Nov 2022 12:39:17 +0800 Subject: [PATCH 03/11] =?UTF-8?q?[Backend]=20N4=E5=90=8C=E6=AD=A5=E8=B3=87?= =?UTF-8?q?=E6=96=99=20=E6=94=B9=E5=8F=96=E7=B7=9A=E4=B8=8A=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NiagaraDataSynchronizeController.cs | 5 +++-- .../Services/Implement/webRequestService.cs | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Backend/Controllers/NiagaraDataSynchronizeController.cs b/Backend/Controllers/NiagaraDataSynchronizeController.cs index 5687558..17027ae 100644 --- a/Backend/Controllers/NiagaraDataSynchronizeController.cs +++ b/Backend/Controllers/NiagaraDataSynchronizeController.cs @@ -40,11 +40,12 @@ namespace Backend.Controllers try { List ds; - string url_slot = "slot:/Arena/H|"; + string url_slot = "slot:/TPE/B1|"; string top100 = " top 100 "; webRequestService svc = new webRequestService(); string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint "; - 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/Arena/Program/ObixQuery/query/", bql); + ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql); apiResult.Code = "0000"; apiResult.Data = ds; diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index 57022a0..51bdae0 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -11,6 +11,7 @@ using System.Text; using System.Xml.Linq; using Repository.BackendRepository.Implement; using Repository.BackendRepository; +using Ubiety.Dns.Core; namespace Backend.Services.Implement { @@ -24,9 +25,24 @@ namespace Backend.Services.Implement String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password)); String API_Url = urlString; + + HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(API_Url); + Postrequest.Method = "POST"; + Postrequest.Headers.Add("Authorization", "Basic " + encoded); + Postrequest.PreAuthenticate = true; + + using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream())) + { + string json = ""; + + streamWriter.Write(json); + } + HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse(); + var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); + XmlDocument xmlDoc = new XmlDocument(); - //xmlDoc.LoadXml(responseString); - xmlDoc.Load("N4v1021.xml");//N4v1021 + xmlDoc.LoadXml(responseString); + //xmlDoc.Load("N4v1021.xml");//N4v1021 //xmlDoc.Save("N4.xml"); From acd7906d2c982442baebb6bc106c67f307214d68 Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 23 Nov 2022 15:36:59 +0800 Subject: [PATCH 04/11] =?UTF-8?q?[FrontendWebApi]=20DeviceManagement=20Get?= =?UTF-8?q?MainSub=20=E5=A2=9E=E5=8A=A0=20device=5Fkind=20flashing=20?= =?UTF-8?q?=E6=AC=84=E4=BD=8D=20|=20GetDeivceList=20=E5=A2=9E=E5=8A=A0=20d?= =?UTF-8?q?evice=5Fkind=20=E9=BB=9E=E4=BD=8D=E5=90=8D=E7=A8=B1=E6=AC=84?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/DeviceManageController.cs | 11 +++++++---- FrontendWebApi/Models/Device.cs | 3 +++ FrontendWebApi/Models/HistoryClass.cs | 7 +++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 135e395..2e85807 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -61,7 +61,7 @@ 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 + dk.device_normal_color, dk.device_close_color, dk.device_error_color,dk.device_normal_flashing, dk.device_close_flashing, dk.device_error_flashing -- 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 @@ -93,6 +93,9 @@ namespace FrontendWebApi.ApiControllers history_Sub_System.device_normal_color = sub.device_normal_color; history_Sub_System.device_close_color = sub.device_close_color; history_Sub_System.device_error_color = sub.device_error_color; + history_Sub_System.device_normal_flashing = sub.device_normal_flashing; + history_Sub_System.device_close_flashing = sub.device_close_flashing; + history_Sub_System.device_error_flashing = sub.device_error_flashing; history_Main_System.History_Sub_systems.Add(history_Sub_System); } @@ -224,9 +227,9 @@ namespace FrontendWebApi.ApiControllers { List dl = new List(); sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number, CONCAT('{baseURL}', '{deviceKindFilePath}', dk.device_image) AS device_image_url, - dk.device_normal_point_id, dk.device_normal_point_guid, dk.device_normal_point_col, dk.device_normal_point_value, dk.device_normal_flashing, - dk.device_close_point_id, dk.device_close_point_guid, dk.device_close_point_col, dk.device_close_point_value, dk.device_close_flashing, - dk.device_error_point_id, dk.device_error_point_guid, dk.device_error_point_col, dk.device_error_point_value, dk.device_error_flashing + dk.device_normal_point_id, dk.device_normal_point_guid, dk.device_normal_point_col, dk.device_normal_point_value, dk.device_normal_flashing, dk.device_normal_point_name, + dk.device_close_point_id, dk.device_close_point_guid, dk.device_close_point_col, dk.device_close_point_value, dk.device_close_flashing, dk.device_close_point_name, + dk.device_error_point_id, dk.device_error_point_guid, dk.device_error_point_col, dk.device_error_point_value, dk.device_error_flashing, dk.device_error_point_name from device d left join device_kind dk on d.device_building_tag = dk.device_building_tag and d.device_system_tag = dk.device_system_tag and d.device_name_tag = dk.device_name_tag diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs index c0f4595..810ca87 100644 --- a/FrontendWebApi/Models/Device.cs +++ b/FrontendWebApi/Models/Device.cs @@ -54,16 +54,19 @@ namespace FrontendWebApi.Models public string device_normal_point_id { get; set; } public string device_normal_point_guid { get; set; } public string device_normal_point_col { get; set; } + public string device_normal_point_name { get; set; } public string device_normal_point_value { get; set; } public string device_normal_flashing { get; set; } public string device_close_point_id { get; set; } public string device_close_point_guid { get; set; } public string device_close_point_col { get; set; } + public string device_close_point_name { get; set; } public string device_close_point_value { get; set; } public string device_close_flashing { get; set; } public string device_error_point_id { get; set; } public string device_error_point_guid { get; set; } public string device_error_point_col { get; set; } + public string device_error_point_name { get; set; } public string device_error_point_value { get; set; } public string device_error_flashing { get; set; } public List Device_nodes { get; set; } diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index 802dea2..048b3c6 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -70,6 +70,10 @@ namespace FrontendWebApi.Models public byte device_item_is_controll { get; set; } public byte device_item_is_bool { get; set; } public byte device_item_is_link { get; set; } + + public string device_normal_flashing { get; set; } + public string device_close_flashing { get; set; } + public string device_error_flashing { get; set; } } public class HistoryFind @@ -114,6 +118,9 @@ namespace FrontendWebApi.Models public string device_normal_color { get; set; } public string device_close_color { get; set; } public string device_error_color { get; set; } + public string device_normal_flashing { get; set; } + public string device_close_flashing { get; set; } + public string device_error_flashing { get; set; } } public class History_PostDevice { From 2c248f485a0fbef2e059e0493c7eadfb66d0706e Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 23 Nov 2022 15:38:52 +0800 Subject: [PATCH 05/11] =?UTF-8?q?[Frontend][=E7=B3=BB=E7=B5=B1=E7=9B=A3?= =?UTF-8?q?=E6=8E=A7]=20niagara=20=E8=A8=82=E9=96=B1=E4=B8=B2=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysElevator.html | 78 +++++++----------------------- Frontend/_sysMonAll.html | 98 +++++++++++++++++++++++++++++++++++--- Frontend/index.html | 1 + 3 files changed, 109 insertions(+), 68 deletions(-) diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 0ed4f28..b807e7f 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -8,8 +8,8 @@ } table.elevator-build td { padding: 0.2rem 0.5rem; - height: 40px; - width: 55px; + height: 50px; + width: 45px; border: 1px solid #000; } elevator .elevator-body, elevator .elevator-header { @@ -27,9 +27,11 @@
- - -
+
+ +
+
+
-
+
@@ -879,9 +879,164 @@ \ No newline at end of file diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index c89460c..d549608 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -1,13 +1,5 @@ 
@@ -51,10 +43,11 @@ getFloDevList(); setLightColor(); - initSub(); + subDevice(); }) - function initSub() { + //baja 訂閱設備 + function subDevice() { myBaja = new subscriptionDevices(); var ordPath = { "building_tag": pageAct.buiTag, @@ -72,7 +65,6 @@ if (data.point_name == norDevPoiName && data.value == matchDevice.device_normal_point_value) { //顯示正常燈號 $(`#${matchDevice.device_number}_status`).attr("data-light-type", "normal").data("light-type", "normal"); - } else if (data.point_name == cloDevPoiName && data.value == matchDevice.device_close_point_value) { $(`#${matchDevice.device_number}_status`).attr("data-light-type", "close").data("light-type", "close"); } else if (data.point_name == errDevPoiName && data.value == matchDevice.device_error_point_value) { @@ -104,19 +96,26 @@ function setLightColor() { $("[data-light-type]").each((index, ele) => { let type = $(ele).data("light-type"); + let isFlashing = false; let color = "#000"; switch (type) { case "normal": color = pageAct.sysSubObj.device_normal_color ?? "var(--theme-success)"; + isFlashing = pageAct.sysSubObj.device_normal_flashing == "1" break; case "close": color = pageAct.sysSubObj.device_close_color ?? "var(--theme-secondary)"; + isFlashing = pageAct.sysSubObj.device_close_flashing == "1" break; case "error": color = pageAct.sysSubObj.device_error_color ?? "var(--theme-danger)"; + isFlashing = pageAct.sysSubObj.device_error_flashing == "1" break; } $(ele).css("background-color", color); + if (isFlashing) { + $(ele).parents(".card.device-wrap").addClass("light-flash"); + } }) } @@ -140,6 +139,7 @@ $.each(floObj.device_list, (index2, devObj) => { console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon); allDevList.push(devObj); + strHtml += `
@@ -226,10 +226,8 @@ let devName = $(ele).data("name"); //full_name $(ele).YTTooltip({ html: `
-
- -
-
+ +
@@ -239,6 +237,7 @@ +
@@ -265,11 +264,10 @@ console.log($(oriEle).data("number")) //基本資料tab block $("#info").html(drawInfoTabBlo(devGuid)); - loadErr($(oriEle).data("number")); loadOpeRecTable(devGuid); //loadErrRecTable2($(oriEle).data("number")); //loadErrRecTable(); - + loadErr($(oriEle).data("number")); } }) }) @@ -320,6 +318,49 @@ let opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, null, null, null, null, null, null, "tpi"); } + function loadErrRecTable() { + let tag = "#errRecTable"; + let datas; + //getOneDeviceAlarmTop10ByBaja(_devicePath, callback); + + let column_defs = [ + { "targets": [0], "width": "15%", "sortable": true }, + { "targets": [1], "width": "25%", "sortable": true }, + { "targets": [2], "width": "25%", "sortable": true }, + { "targets": [3], "width": "35%", "sortable": true }, + ]; + + let columns = [ + { + "title": "異常ID", + "data": "uuid", + + }, + { + "title": "異常原因", + "data": "msgText", + }, + { + "title": "ACK確認", + "data": "ackState", + }, + { + "title": "發生/賦歸時間", + "data": "timestamp", + "width": "45%", + }, + + ]; + + //let callback = function (result) { + // datas = result; + //} + let result = '{"count": 2,"data":[{ "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00"},{"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00"}]}'; + let json_object = JSON.parse(result); + datas = json_object['data']; + errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "tpi"); + } + function loadErr(allPath) { if (allPath != undefined && allPath != null) { let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1 @@ -372,4 +413,45 @@ } + //function loadErrRecTable2(allPath) { + // if (allPath != undefined && allPath != null) { + // let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1 + // let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5]; + // //getOneDeviceAlarmTop10ByBaja(_devicePath, callback); + // console.log("devicePath: " + _devicePath); + // let result = '{"count": 2,"0": { "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "1","msgText": "","ackState": "1","normalTime": "1970-Jan-1 08:00:00.000 AM UTC+08:00"},"1": {"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "0","msgText": "","ackState": "1","normalTime": "2022-Nov-16 10:15:24.939 AM UTC+08:00"}}'; + // let result_Json = JSON.parse(result) + // var eachTable = $('.each-table tbody'); + + // for (var i = 0; i < result_Json['count']; i++) + // { + // item = result_Json[i.toString()]; + // eachTable.append( + // '' + + // '' + item.uuid + '' + + // '' + item.msgText + '' + + // '' + (item.ackState = 1 ? item.normalTime : '未確認') + '' + + // '' + item.timestamp + '' + + // ''); + // } + + // } + + // let callback = function (result) { + // var eachTable = $('.each-table tbody'); + // $.each(result, function (index, element) { + // eachTable.append( + // '' + + // '' + element[index].uuid + '' + + // '' + element[index].msgText + '' + + // '' + (element[index].ackState = 1 ? element[index].normalTime : '未確認') + '' + + // '' + element[index].timestamp + '' + + // ''); + // }); + // } + //} + // } + + + \ No newline at end of file diff --git a/Frontend/css/site.css b/Frontend/css/site.css index a4c5944..d30980c 100644 --- a/Frontend/css/site.css +++ b/Frontend/css/site.css @@ -11,8 +11,8 @@ --yt-gray-4: #dddddd; --yt-pink: #ff95d0; --yt-pink-hover: #ef84c0; - --yt-red-2:#d34949; - --yt-yellow-1:#ffc902; + --yt-red-2: #d34949; + --yt-yellow-1: #ffc902; } @@ -25,113 +25,351 @@ } .table.dataTable td { - word-break:break-all; + word-break: break-all; } label[id$='-error'].error { color: var(--yt-red-2); } +[id^=yt_tooltip] { + width: 650px; +} + +.circle-light { + width: 25px; + height: 25px; + border-radius: 50px; +} + +.light-flash { + animation: flashing 0.5s linear infinite; +} + +@keyframes flashing { + 0% { + background: #ffa100; + } + + 49% { + background: #ffa100; + } + + 50% { + background: #26272b; + } + + 99% { + background: #26272b; + } +} + /* ================================================================ */ /* 單一方法 */ /* ================================================================ */ /* cursor */ -.cur-def { cursor:default !important;} -.cur-poi { cursor:pointer !important;} +.cur-def { + cursor: default !important; +} + +.cur-poi { + cursor: pointer !important; +} /*left 距離*/ -.left-05 { left: 0.5rem !important; } -.left-04 { left: 0.4rem !important; } -.left-03 { left: 0.3rem !important; } -.left-02 { left: 0.2rem !important; } -.left-01 { left: 0.1rem !important; } +.left-05 { + left: 0.5rem !important; +} + +.left-04 { + left: 0.4rem !important; +} + +.left-03 { + left: 0.3rem !important; +} + +.left-02 { + left: 0.2rem !important; +} + +.left-01 { + left: 0.1rem !important; +} /*right 距離*/ -.right-05 { right: 0.5rem !important; } -.right-04 { right: 0.4rem !important; } -.right-03 { right: 0.3rem !important; } -.right-02 { right: 0.2rem !important; } -.right-01 { right: 0.1rem !important; } +.right-05 { + right: 0.5rem !important; +} + +.right-04 { + right: 0.4rem !important; +} + +.right-03 { + right: 0.3rem !important; +} + +.right-02 { + right: 0.2rem !important; +} + +.right-01 { + right: 0.1rem !important; +} /*bottom 0.5rem*/ -.bm-05 { bottom: 0.5rem !important; } -.bm-04 { bottom: 0.4rem !important; } -.bm-03 { bottom: 0.3rem !important; } -.bm-02 { bottom: 0.2rem !important; } -.bm-01 { bottom: 0.1rem !important; } +.bm-05 { + bottom: 0.5rem !important; +} + +.bm-04 { + bottom: 0.4rem !important; +} + +.bm-03 { + bottom: 0.3rem !important; +} + +.bm-02 { + bottom: 0.2rem !important; +} + +.bm-01 { + bottom: 0.1rem !important; +} /*top 0.5rem*/ -.tp-05 { top: 0.5rem !important; } -.tp-04 { top: 0.4rem !important; } -.tp-03 { top: 0.3rem !important; } -.tp-02 { top: 0.2rem !important; } -.tp-01 { top: 0.1rem !important; } +.tp-05 { + top: 0.5rem !important; +} + +.tp-04 { + top: 0.4rem !important; +} + +.tp-03 { + top: 0.3rem !important; +} + +.tp-02 { + top: 0.2rem !important; +} + +.tp-01 { + top: 0.1rem !important; +} /* font-weight */ -.fw-1 { font-weight: 100; } -.fw-2 { font-weight: 200; } -.fw-3 { font-weight: 300; } -.fw-4 { font-weight: 400; } -.fw-5 { font-weight: 500; } -.fw-6 { font-weight: 600; } -.fw-7 { font-weight: 700; } -.fw-8 { font-weight: 800; } -.fw-9 { font-weight: 900; } +.fw-1 { + font-weight: 100; +} + +.fw-2 { + font-weight: 200; +} + +.fw-3 { + font-weight: 300; +} + +.fw-4 { + font-weight: 400; +} + +.fw-5 { + font-weight: 500; +} + +.fw-6 { + font-weight: 600; +} + +.fw-7 { + font-weight: 700; +} + +.fw-8 { + font-weight: 800; +} + +.fw-9 { + font-weight: 900; +} /* font-size */ -.fs-05 { font-size: 0.5rem; } -.fs-075 { font-size: 0.75rem; } -.fs-09 { font-size: 0.9rem; } -.fs-1-05 { font-size: 1.05rem; } -.fs-1-1 { font-size: 1.1rem; } -.fs-1-2 { font-size: 1.2rem; } -.fs-1-3 { font-size: 1.3rem; } -.fs-1-5 { font-size: 1.5rem; } -.fs-2 { font-size: 2rem; } -.fs-2-5 { font-size: 2.5rem; } +.fs-05 { + font-size: 0.5rem; +} + +.fs-075 { + font-size: 0.75rem; +} + +.fs-09 { + font-size: 0.9rem; +} + +.fs-1-05 { + font-size: 1.05rem; +} + +.fs-1-1 { + font-size: 1.1rem; +} + +.fs-1-2 { + font-size: 1.2rem; +} + +.fs-1-3 { + font-size: 1.3rem; +} + +.fs-1-5 { + font-size: 1.5rem; +} + +.fs-2 { + font-size: 2rem; +} + +.fs-2-5 { + font-size: 2.5rem; +} /* border width */ -.bd-0 { border-width: 0px; } -.bd-1 { border-width: 1px; } -.bd-2 { border-width: 2px; } +.bd-0 { + border-width: 0px; +} + +.bd-1 { + border-width: 1px; +} + +.bd-2 { + border-width: 2px; +} /* border direction */ -.bd-l { border-left-style:solid;} -.bd-r { border-right-style:solid;} -.bd-t { border-top-style:solid;} -.bd-b { border-bottom-style:solid;} +.bd-l { + border-left-style: solid; +} + +.bd-r { + border-right-style: solid; +} + +.bd-t { + border-top-style: solid; +} + +.bd-b { + border-bottom-style: solid; +} /* border radius */ -.br-1 { border-radius: 1px; } -.br-2 { border-radius: 2px; } -.br-3 { border-radius: 3px; } -.br-4 { border-radius: 4px; } -.br-5 { border-radius: 5px; } +.br-1 { + border-radius: 1px; +} + +.br-2 { + border-radius: 2px; +} + +.br-3 { + border-radius: 3px; +} + +.br-4 { + border-radius: 4px; +} + +.br-5 { + border-radius: 5px; +} /* flex-gap */ -.gap-1 { gap: 1px;} -.gap-2 { gap: 2px;} -.gap-3 { gap: 3px;} -.gap-4 { gap: 4px;} -.gap-5 { gap: 5px;} +.gap-1 { + gap: 1px; +} + +.gap-2 { + gap: 2px; +} + +.gap-3 { + gap: 3px; +} + +.gap-4 { + gap: 4px; +} + +.gap-5 { + gap: 5px; +} /* vertical-align */ -.va-t {vertical-align: top;} -.va-m {vertical-align: middle;} -.va-b {vertical-align: bottom;} +.va-t { + vertical-align: top; +} + +.va-m { + vertical-align: middle; +} + +.va-b { + vertical-align: bottom; +} /* text color */ -.t-main-purple { color: #623c80 !important; } -.t-black { color: #000 !important; } -.t-white { color:#fff !important;} -.t-fb-blue { color: #466ac2 !important; } -.t-line-green { color: #54C814 !important; } -.t-red { color: #db0000 !important;} -.t-red-2 { color:var(--yt-red-2) !important;} -.t-gray { color:var(--yt-gray); } -.t-main-gray { color: var(--yt-main-gray); } -.t-gray-2 { color: var(--yt-gray-2) !important; } -.t-gray-3 { color: var(--yt-gray-3); } -.t-yellow { color: var(--yt-yellow-1);} +.t-main-purple { + color: #623c80 !important; +} + +.t-black { + color: #000 !important; +} + +.t-white { + color: #fff !important; +} + +.t-fb-blue { + color: #466ac2 !important; +} + +.t-line-green { + color: #54C814 !important; +} + +.t-red { + color: #db0000 !important; +} + +.t-red-2 { + color: var(--yt-red-2) !important; +} + +.t-gray { + color: var(--yt-gray); +} + +.t-main-gray { + color: var(--yt-main-gray); +} + +.t-gray-2 { + color: var(--yt-gray-2) !important; +} + +.t-gray-3 { + color: var(--yt-gray-3); +} + +.t-yellow { + color: var(--yt-yellow-1); +} diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 2e85807..3d3b8c8 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -226,7 +226,7 @@ namespace FrontendWebApi.ApiControllers foreach (var f in fl) { List dl = new List(); - sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number, CONCAT('{baseURL}', '{deviceKindFilePath}', dk.device_image) AS device_image_url, + sqlString = $@"select d.device_guid, d.full_name, d.device_coordinate, dk.device_image, d.device_number, CONCAT('{baseURL}', '{deviceKindFilePath}', dk.device_image) AS device_image_url,d.status, dk.device_normal_point_id, dk.device_normal_point_guid, dk.device_normal_point_col, dk.device_normal_point_value, dk.device_normal_flashing, dk.device_normal_point_name, dk.device_close_point_id, dk.device_close_point_guid, dk.device_close_point_col, dk.device_close_point_value, dk.device_close_flashing, dk.device_close_point_name, dk.device_error_point_id, dk.device_error_point_guid, dk.device_error_point_col, dk.device_error_point_value, dk.device_error_flashing, dk.device_error_point_name diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs index 810ca87..59a6a85 100644 --- a/FrontendWebApi/Models/Device.cs +++ b/FrontendWebApi/Models/Device.cs @@ -36,19 +36,19 @@ namespace FrontendWebApi.Models public string device_coordinate { get; set; } public string device_coordinate_3d { get; set; } public string status { get; set; } - //public string device_status - //{ - // get - // { - // Dictionary name = new Dictionary() - // { - // { "0", "關閉"}, - // { "1", "正常"}, - // { "2", "異常"} - // }; - // return name[status]; - // } - //} + public string device_status + { + get + { + Dictionary name = new Dictionary() + { + { "0", "關閉"}, + { "1", "正常"}, + { "2", "異常"} + }; + return name[status]; + } + } public string device_image { get; set; } public string device_image_url { get; set; } public string device_normal_point_id { get; set; } From f1d67fb62ee6bb0bf46173ac82ef75869e971512 Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 23 Nov 2022 17:26:25 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=AD=B7=E5=8F=B2=E8=B3=87=E6=96=99?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=8D=B2=E5=8F=96=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_historyData.html | 50 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html index 4f8e54e..5aa86ac 100644 --- a/Frontend/_historyData.html +++ b/Frontend/_historyData.html @@ -59,11 +59,6 @@ - - 儲冰設備A01 - 27.0 - 2021-08-01 23:55:00 -
@@ -123,7 +118,7 @@ $.each(val2.device, function (index3, val3) { strHtml += `
  • - + ${val3.full_name} ${val3.device_serial_tag} @@ -131,8 +126,9 @@
  • `; if (index == i1 && index2 == i2 && first) { + first = false; pageAct.deviceNumber = val3.device_number; - pageAct.deviceSerialTag = val3.device_serial_tag; + pageAct.deviceName = val3.full_name; devPointsList(); } }); @@ -160,7 +156,7 @@ if (index == 0) { pageAct.deviceItem = val.points; - //getData(); + getData(); } }); @@ -169,24 +165,31 @@ ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); } - function getData() { - // var dt = new Date(); - // console.log(dt); - // var start = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate()).toString() + "T00:00:00Z"; - //var end = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate() + 1).toString() + "T00:00:00Z"; - // console.log(new Date(start).getTime()); - // console.log(new Date(end).getTime()); - //getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem, - // 1666396800000, - // 1666483200000, - // pageAct.deviceName, - // "Mitsubishi_Sup", - // callBackFromHistory); + function getData(start = null, end = null) { + var sdt = new Date(); + var edt = new Date(new Date().setDate(sdt.getDate() + 1)); + start = start ?? sdt.toLocaleDateString(); + end = end ?? edt.toLocaleDateString(); + getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem, + new Date(start).getTime(), + new Date(end).getTime(), + pageAct.deviceName, + "Mitsubishi_Sup", + callBackFromHistory); } function callBackFromHistory(res) { - //$('#tableData tbody').html(); - console.log(res) + let strHtml = ``; + res = JSON.parse(res); + console.log(res); + $.each(res.data, function (index, val) { + strHtml += ` + ${val.deviceName} + ${val.value} + ${displayDate(val.timestamp)} + `; + }); + $('#tableData tbody').html(strHtml); } function setValue(deviceNumber, deviceName, deviceItem) { @@ -197,6 +200,7 @@ } else if (deviceItem != null && deviceItem != undefined) { pageAct.deviceItem = deviceItem; + getData(); } } \ No newline at end of file From 6565685b5cd4dea3a2775acd6a7b7e5f4ec31fbc Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 23 Nov 2022 17:27:42 +0800 Subject: [PATCH 09/11] =?UTF-8?q?[Frontend][=E5=85=A8=E5=9F=9F=E5=8A=9F?= =?UTF-8?q?=E8=83=BD]=20displayDate=20Function=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/js/style.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Frontend/js/style.js b/Frontend/js/style.js index c505182..f784a36 100644 --- a/Frontend/js/style.js +++ b/Frontend/js/style.js @@ -288,20 +288,20 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') { dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : ""; } else if (dateType == "date") { year = d.getFullYear(); - month = String(d.getMonth() + 1).padStart(2, '0'); - day = String(d.getDate()).padStart(2, '0'); + month = d.getMonth() + 1; + day = d.getDate(); } else if (dateType == "time") { - hour = String(d.getHours()).padStart(2, '0'); - minute = String(d.getMinutes()).padStart(2, '0'); + hour = d.getHours(); + minute = d.getMinutes(); } else if (dateType == "datetime") { year = d.getFullYear(); - month = String(d.getMonth() + 1).padStart(2, '0'); - day = String(d.getDate()).padStart(2, '0'); - hour = String(d.getHours()).padStart(2, '0'); - minute = String(d.getMinutes()).padStart(2, '0'); + month = d.getMonth() + 1; + day = d.getDate(); + hour = d.getHours(); + minute = d.getMinutes(); } - date = [year, month, day].filter(n => n).join("/"); - time = [hour, minute, second, millisecond].filter(n => n).join(":"); + date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/"); + time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].filter(n => n).join(":"); result = date.toString() + " " + time.toString(); if (dateType == "date") { From 50488578fafcb9f5f23c97d708709f504a991d7b Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 23 Nov 2022 18:28:51 +0800 Subject: [PATCH 10/11] =?UTF-8?q?[Frontend][=E9=9B=BB=E6=A2=AF=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1]=20=E5=8D=A1=E7=89=87=20niagara=20=E7=8B=80=E6=85=8B?= =?UTF-8?q?=E8=A8=82=E9=96=B1=20|=20card=20=E5=8D=B3=E6=99=82=E8=B3=87?= =?UTF-8?q?=E8=A8=8A=20=E5=85=A9=E9=82=8Atable=E4=BB=8B=E9=9D=A2=E5=BB=BA?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_sysElevator.html | 114 +++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 18 deletions(-) diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index 884d548..cf08805 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -1,17 +1,20 @@