[前台] 系統監控-照明系統 取消溫度顯示 | 能源管理介面更新 | 首頁 系統類別 icon 修正 | 告警頁面 時間顯示修正 | 帳號管理 文字修正 | forgemodel 電梯移動速度加快

This commit is contained in:
Celeste6666 2023-02-02 17:17:07 +08:00
parent 5d2d6f059a
commit cce47d4be7
31 changed files with 2315 additions and 1635 deletions

View File

@ -252,8 +252,10 @@
/* launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE2Lm53ZA")*/
/*新增軌道燈軌道*/
launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE5Lm53ZA")
/*launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTE5Lm53ZA")*/
/* 0201 更換好電梯順序 */
launchViewer("dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMjAxLm53ZA")
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlFX2ZvcmdlX3Rlc3QvJUUzJFTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 40 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -9,12 +9,12 @@
role="tab"><i class="fal fa-user mr-1"></i> 帳號管理</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-2"
role="tab"><i class="fal fa-users mr-1"></i> 群組管理</a>
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-2"
role="tab"><i class="fal fa-users mr-1"></i> 角色管理</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#tab_borders_icons-3"
role="tab"><i class="fal fa-cog mr-1"></i> 群組權限</a>
role="tab"><i class="fal fa-cog mr-1"></i> 角色權限</a>
</li>
</ul>
<div class="tab-content border border-top-0 p-3 w-100">
@ -328,7 +328,7 @@
},
];
let accManTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
let accManTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
}
function loadRolManTable() {

View File

@ -631,7 +631,7 @@
}
function callBackFromOneDeviceAlert(res) {
res = JSON.parse(res);
//res = JSON.parse(res);
refTable(res.data);
if (historyTable != null) {
let t = $('#alertTable').dataTable();
@ -673,7 +673,7 @@
"title": "發生時間",
"data": "timestamp",
"render": function (data) {
return displayDate(data, "datetime");
return new Date(data).toLocaleString('zh-tw', { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }), displayDate(data, "datetime");
}
},
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@
});
myBaja.setSubscribeDeviceEndCallBack(function (data) {
endPageLoading();
endPageLoading();
if (data.findIndex(x => x.point_name == "Temp") != -1) {
// 顯示溫度條
showHeat("[name=forgeHeatBar]");
@ -400,12 +400,14 @@
devices: devices,
}
if (pageAct.sysMainTag !== "LT") {
heatMap = new ADHeatMaps(option);
heatMap.onComplete = () => {
$.each(allDevList, (idx, dev) => {
heatMap.changeTemp(dev.device_number, dev._temp || 0);
})
$.each(allDevList, (idx, dev) => {
heatMap.changeTemp(dev.device_number, dev._temp || 0);
})
}
}
let elevOption = {
selector: "[name=forgeViewer]",

View File

@ -160,7 +160,7 @@ class elevator3D {
this.ele = option.element;
this.viewer = option.viewer;
this.nodeId = option.nodeId;
this.speed = option.speed ?? 0.03;
this.speed = option.speed ?? 0.07;
this.tagValue = option.tagValue ?? "";
this.fragProxys = [];
this.fragProxy = null;

View File

@ -1,6 +1,18 @@
var ytAjax = typeof YourTeam !== "undefined" ? new YourTeam.Ajax() : null; //公用AJAX初始化
var baseApiUrl = "http://localhost:3604";
var baseImgUrl = "https://localhost:44376";
var baseApiUrl = "http://localhost:3604"; // 本地開發用
var baseImgUrl = "https://localhost:44376"; // 本地開發用
// Mitsubishi
//var baseApiUrl = "http://220.132.206.5"; // production 用
//var baseImgUrl = "http://220.132.206.5:8848"; // production 用
// WSP
//var baseApiUrl = "http://220.132.206.5"; // production 用
//var baseImgUrl = "http://220.132.206.5:8849"; // production 用
//var baseApiUrl = "http://localhost";
//var baseImgUrl = "http://localhost:8848";
var varRegApiUrl = "/reg/api/"; //註冊API路徑
var varApiUrl = "/api/"; //API路徑
var varPathDevIcon = "/upload/device_icon/";
@ -18,8 +30,12 @@ var common = {
SysErr: "系統內部發生錯誤,請聯繫系統管理員"
}
var objSendData = { Data: null };
// Mitsubishi
var initAreaTag = "TPE";
var n4Sup = "Mitsubishi_Sup";
// WSP
//var initAreaTag = "NTPC";
//var n4Sup = "Banqiao";
var forgeTokenBase = {
url: baseApiUrl + '/api/forge/oauth/token',
res_access_token: ["dictionary", "access_token"],
@ -34,4 +50,4 @@ var redirectionUrl = window.location.origin + "/" +
//判斷url是否包含"ord",如果有重新轉址
if (temp_cuurent_Url_pathname.findIndex(x => x == "ord") > -1) {
document.location.href = redirectionUrl.substr(0, redirectionUrl.length - 1);
}
}

View File

@ -1,6 +1,6 @@
function addzero(num) {
return num < 10 ? '0' + num : num;
return num < 10 ? '0' + num : num;
}
/**
@ -85,45 +85,37 @@ function addzero(num) {
// });
// }
function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) {
let _sourceTmp;
var _result = "";
var _ss = "";
var _bfName = "";
var _sourceName = "";
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
if (_index == 0)
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '","ackedTime":"' + record.get('ackTime').$cEncStr
+ '"}';
else
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '","ackedTime":"' + record.get('ackTime').$cEncStr
+ '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
let _sourceTmp;
var _result = "";
var _ss = [];
var _bfName = "";
var _sourceName = "";
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
/*console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc")*/
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp asc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
_ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp').$cEncStr, alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime'), ackedTime: record.get('ackTime').$cEncStr })
_index++
},
after: function () {
_result = { count: _index, data: _ss }
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -161,50 +153,50 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
// });
// }
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
var _result = "";
var _ss = "";
var _occurrenceTime = "";
var _normalTime = "";
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) {
_occurrenceTime = "";
_normalTime = "";
var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60
var _result = "";
var _ss = "";
var _occurrenceTime = "";
var _normalTime = "";
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) {
_occurrenceTime = "";
_normalTime = "";
var _resultUuid = record.get('uuid').toString().split("-");//43dc7846-bd96-4be2-ab35-f11aec729c60
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 _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 _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 _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認";
var _msgText = record.get('alarmData').get('msgText');// == 1 ? _occurrenceTime : "未確認";
var _ackText = record.get('ackState') == 1 ? _occurrenceTime : "未確認";
if (_index == 0)
_ss += '{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
else
_ss += ',{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss + ']';
_result += '}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
if (_index == 0)
_ss += '{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
else
_ss += ',{"uuid":"' + _resultUuid[0] + '", "msgText":"' + _msgText + '", "ackState":"' + _ackText + '", "timestamp":"' + _occurrenceTime + '", "normalTime":"' + _normalTime + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss + ']';
_result += '}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -238,34 +230,34 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
// });
// }
function getOneSystemAlarmStateByBaja(systemPath, callback) {
var _result = "";
var _ss = "";
var _index = 0;
console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
else
_ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
var _result = "";
var _ss = "";
var _index = 0;
console.log("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc")
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
else
_ss += ',{"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -274,35 +266,35 @@ function getOneSystemAlarmStateByBaja(systemPath, callback) {
* @param {any} callback
*/
function getOneSystemStateByBaja(systemPath, callback) {
var _result = "";
var _ss = "";
var _index = 0;
var _result = "";
var _ss = "";
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
//if (_index == 0)
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
//else
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
_ss += '{"sourceState":"' + record.get('sourceState') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select top 1 alarmData, alarmData.sourceName, sourceState where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
//if (_index == 0)
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
//else
// _ss += '{"sourceState":"' + record.get('sourceState') + '"}';
_ss += '{"sourceState":"' + record.get('sourceState') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -310,27 +302,27 @@ function getOneSystemStateByBaja(systemPath, callback) {
* @param {any} callback
*/
function getAlarmCountByBaja(callback) {
var _result = { count: 0 };
var _index = 0;
var _result = { count: 0 };
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select sourceState where sourceState = 'offnormal'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -338,27 +330,27 @@ function getAlarmCountByBaja(callback) {
* @param {any} callback
*/
function getRecoverCountByBaja(callback) {
var _result = { count: 0 };
var _index = 0;
var _result = { count: 0 };
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select normalTime where normalTime != null").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -366,27 +358,27 @@ function getRecoverCountByBaja(callback) {
* @param {any} callback
*/
function getCheckedAckedCountByBaja(callback) {
var _result = { count: 0 };
var _index = 0;
var _result = { count: 0 };
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='acked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -394,27 +386,27 @@ function getCheckedAckedCountByBaja(callback) {
* @param {any} callback
*/
function getUnCheckedAckedCountByBaja(callback) {
var _result = { count: 0 };
var _index = 0;
var _result = { count: 0 };
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select ackState from openAlarms where ackState ='unacked'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
@ -422,32 +414,32 @@ function getUnCheckedAckedCountByBaja(callback) {
* @param {any} callback
*/
function getSystemAlarmByBaja(callback) {
var _result = { count: 0, data: [] };
var _index = 0;
require(['baja!'], function (baja) {
//baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get()
.then(function (table) {
return table.cursor({
each: function (record) {
let main = {};
main.alarmClass = record.get('alarmClass');
_result.data.push(main);
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
var _result = { count: 0, data: [] };
var _index = 0;
require(['baja!'], function (baja) {
//baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime where isAlarm").get()
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass where isAlarm").get()
.then(function (table) {
return table.cursor({
each: function (record) {
let main = {};
main.alarmClass = record.get('alarmClass');
_result.data.push(main);
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
// /**
@ -527,127 +519,179 @@ function getSystemAlarmByBaja(callback) {
* @param {any} devicePath
* @param {any} callback
*/
function getOneDeviceAlarmByBaja(devicePath, callback) {
let _sourceTmp;
var _result = "";
var _ss = "";
var _bfName = "";
var _sourceName = "";
var _index = 0;
function getOneDeviceAlarmByBaja(devicePath, callback) {
let _sourceTmp;
var _result = "";
var _ss = [];
var _bfName = "";
var _sourceName = "";
var _index = 0;
require(['baja!'], function (baja) {
console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
if (_index == 0)
_ss += '{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
else
_ss += ',{"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss + ']';
_result += '}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
console.log("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc");
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
_ss.push({ buildingFloorName_zh: _bfName, uuid: record.get('uuid'), timestamp: record.get('timestamp'), alarmClass: record.get('alarmClass'), sourceName_zh: _sourceName, msgText: record.get('alarmData').get('msgText'), ackState: record.get('ackState'), normalTime: record.get('normalTime') })
_index++
},
after: function () {
_result = { count: _index, data: _ss }
console.log(552, _result);
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
function getAllDeviceAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) {
var _result = { count: 0, data: [] };
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
var _result = { count: 0, data: [] };
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
require(['baja!'], function (baja) {
let startUrl = "";
if (startDate_millisecond) {
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
}
console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
require(['baja!'], function (baja) {
let startUrl = "";
if (startDate_millisecond) {
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
}
// console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
let main = {};
console.log(record.get('alarmData').get('sourceName'))
_sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[1];
console.log(_sourcePoint)
_sourceTmp = _sourcePoint.split("_");
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
main.buildingFloorName_zh = _bfName;
main.sourceName_zh = _sourceName;
main.uuid = record.get('uuid').$val;
main.timestamp = record.get('timestamp');
main.alarmClass = record.get('alarmClass');
main.point = _sourcePoint;
main.devicePath = _sourceTmp.slice(0, 8).join("_");;
main.msgText = record.get('alarmData').get('msgText');
main.normalTime = record.get('normalTime');
main.priority = record.get('priority');
main.ackedTime = record.get('ackTime').$cEncStr;
_result.data.push(main);
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
// console.log(record,record.get('alarmData').get('sourceName').split(':'))
let main = {};
console.log(record.get('alarmData').get('sourceName'), record.get('timestamp').$cEncStr)
_sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[0];
_sourceTmp = _sourcePoint.split("_");
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
main.buildingFloorName_zh = _bfName;
main.sourceName_zh = _sourceName;
main.uuid = record.get('uuid').$val;
main.timestamp = record.get('timestamp').$cEncStr;
main.alarmClass = record.get('alarmClass');
main.point = _sourcePoint;
main.devicePath = _sourceTmp.slice(0, 8).join("_");;
main.msgText = record.get('alarmData').get('msgText');
main.normalTime = record.get('normalTime');
main.priority = record.get('priority');
main.ackedTime = record.get('ackTime').$cEncStr;
_result.data.push(main);
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
console.log(_result)
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
function getDeviceAlarmCardByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, callback) {
var _result = { count: 0, data: [] };
var _index = 0;
var _recoverState = isRecover ? "!= null" : "= null";
var _ackState = isAck ? "= 'acked'" : "= 'unacked'";
require(['baja!'], function (baja) {
let startUrl = "";
if (startDate_millisecond) {
startUrl = "timestamp.millis >= " + startDate_millisecond + " and ";
}
console.log("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc");
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackTime, priority ,ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where " + startUrl + "timestamp.millis <= " + endDate_millisecond + " and normalTime " + _recoverState + " and ackState " + _ackState + " order by timestamp desc").get()
.then(function (table) {
return table.cursor({
each: function (record) {
let main = {};
console.log(record.get('alarmData').get('sourceName'))
_sourcePoint = (record.get('alarmData').get('sourceName')).toString().split(':')[1];
console.log(_sourcePoint)
_sourceTmp = _sourcePoint.split("_");
let _bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
let _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
main.buildingFloorName_zh = _bfName;
main.sourceName_zh = _sourceName;
main.uuid = record.get('uuid').$val;
main.timestamp = record.get('timestamp');
main.alarmClass = record.get('alarmClass');
main.point = _sourcePoint;
main.devicePath = _sourceTmp.slice(0, 8).join("_");;
main.msgText = record.get('alarmData').get('msgText');
main.normalTime = record.get('normalTime');
main.priority = record.get('priority');
main.ackedTime = record.get('ackTime').$cEncStr;
_result.data.push(main);
_index++;
},
after: function () {
_result.count = _index;
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}
/**
* [首頁] 圓餅圖資料 - 全部的異常
* @param {any} callback
*/
function getAlarmForChartDataByBaja(callback) {
var _result = "";
var _ss = "";
var _index = 0;
function getAlarmForChartDataByBaja(callback) {
var _result = "";
var _ss = "";
var _index = 0;
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass, ackState, normalTime where isAlarm").get()
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
else
_ss += ',{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmClass, ackState, normalTime where isAlarm").get()
.then(function (table) {
return table.cursor({
each: function (record) {
if (_index == 0)
_ss += '{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
else
_ss += ',{"alarmClass":"' + record.get('alarmClass') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
_index++;
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
},
limit: -1,
offset: 0
});
});
});
}

View File

@ -484,9 +484,14 @@ class Forge3DElevFull {
this.selector = option.selector ?? "#forgeViewer";
this.bajaChaCallback = option.bajaChaCallback ?? null;
this.bajaEndCallback = option.bajaEndCallback ?? null;
this.sensorObj = null
}
init = function () {
init = function () {
this.sensorObj = new Forge3DSensor({
viewer: this.viewer,
ordPath: { ...this.ordPath },
})
// 系統大類、小類固定
this.ordPath.system_tag = this.sysMainTag;
this.ordPath.name_tag = this.sysSubTag;
@ -670,4 +675,231 @@ class Forge3DElevFull {
getNodeIds = function () {
return this.elev3DObj.map(x => x.nodeId);
}
}
/**
* 取得資料庫溫度感測器
* 1. baja 取得溫度感測器改變顏色
* 2. 參數取得要移動到的電梯位置
* */
class Forge3DSensor {
constructor(option = {}) {
this.allSensorDevList = []; //溫度調節器設備清單
this.subDeviceData = []; //每個設備訂閱點位值
this.viewer = option.viewer ?? null;
this.ordPath = option.ordPath; // TPE_B1
this.sysMainTag = "ME";
this.sysSubTag = "M12";
this.selector = "#forgeViewer";
this.heatMap = null;
this.bajaChaCallback = option.bajaChaCallback ?? null;
this.bajaEndCallback = option.bajaEndCallback ?? null;
this.floorHeight = 0;
this.dataVizExtn = null;
this.#init();
}
#init = async function () {
// 系統大類、小類固定
this.ordPath.system_tag = this.sysMainTag;
this.ordPath.name_tag = this.sysSubTag;
this.dataVizExtn = await this.viewer.loadExtension("Autodesk.DataVisualization");
//this.getSensorDevList();
}
// 取得Sensor設備列表
getSensorDevList = function () {
let url = baseApiUrl + "/api/Device/GetDeviceList";
let sendData = {
sub_system_tag: this.ordPath.name_tag, // M12
building_tag: this.ordPath.building_tag, //B1
};
objSendData.Data = sendData;
ytAjax = new YourTeam.Ajax(url, objSendData, (res) => {
if (!res || res.code != "0000" || !res.data) {
} else {
$.each(res.data, (index, floObj) => {
$.each(floObj.device_list, (index2, devObj) => {
this.allSensorDevList.push(devObj);
})
})
let devices = this.allSensorDevList.map((x) => {
if (x.device_number.includes("ME_M12")) {
return {
roomDbId: 12879, // Bank2 電梯
id: x.device_number,
position: isJSON(x.device_coordinate_3d)
? JSON.parse(x.device_coordinate_3d)
: {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
sensorTypes: ["temperature", "humidity"],
};
}
});
//this.heatMap = new ADHeatMaps({
// devices
//});
//this.subSensorDevice();
}
}, null, "POST").send();
}
// 訂閱sensor設備
subSensorDevice = function () {
let myBaja = new subscriptionDevices();
let ordPath = this.ordPath;
myBaja.setSubscribeDevicesByBql(ordPath);
myBaja.setSubscribeDevicesCallBack((data) => {
this.bajaChaCallback ? this.bajaChaCallback(data) : "";
if (this.allSensorDevList.length == 0) {
return false;
}
data.device_number = data.device_number_full; // "TPE_B1_ME_M12_U1F_NA_TH_N1" (forge TPE_B1_ME_M12_R2F_NA_TH_N1)
let matchDevice = this.allSensorDevList.find(
(x) =>
x.device_number == data.device_number ||
x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
);
if (!matchDevice) {
return;
}
//將訂閱值塞入 subDeviceData
if (
this.subDeviceData.findIndex(d => d.device_number == matchDevice.device_number) == -1
) {
let obj = {};
obj.device_number = matchDevice.device_number;
obj.dbid = matchDevice.forge_dbid;
this.subDeviceData.push(obj);
}
let subData = this.subDeviceData.find(
(x) => x.device_number == matchDevice.device_number || x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1"
);
if (subData) {
subData[data.point_name] = data.value;
}
//let norDevPoiName = matchDevice.device_normal_point_name;
//let cloDevPoiName = matchDevice.device_close_point_name || "";
//let errDevPoiName = matchDevice.device_error_point_name;
if (data.point_name == "Temp" || data.point_name == "TEMP") {
this.heatMap?.changeTemp(
matchDevice.device_number,
!isNaN(parseInt(data.value)) ? parseInt(data.value) : 0,
);
let devIdx = this.allSensorDevList.findIndex(
(x) =>
x.device_number == data.device_number_full ||
x.device_number == "TPE_B1_ME_M12_R2F_NA_TH_N1",
);
this.allSensorDevList[devIdx]._temp = !isNaN(parseInt(data.value))
? parseInt(data.value)
: 0;
}
});
//myBaja.setSubscribeDeviceEndCallBack((data) => {
// if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
// // 顯示溫度條
// console.log(showHeat)
// showHeat("[name=forgeHeatBar]");
// }
//});
}
// 位置呈現
changeSensorPos = async function () {
this.dataVizExtn.removeAllViewables();
const DataVizCore = Autodesk.DataVisualization.Core;
const viewableType = DataVizCore.ViewableType.SPRITE;
const spriteColor = new THREE.Color(0x000000);
let spriteIcon = "/file/img/forge/hotspot.svg";
if (location.href.indexOf("localhost:5966") != -1) {
spriteIcon = "/img/forge/hotspot.svg";
} const style = new DataVizCore.ViewableStyle(viewableType, spriteColor, spriteIcon);
const viewableData = new DataVizCore.ViewableData();
viewableData.spriteSize = 30
// test 1
// const myDataList = [{ position: { x: 0, y: 0, z: this.floorHeight } }];
// myDataList.forEach((myData, index) => {
// const position = myData.position;
// const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
// console.log(viewable)
// viewableData.addViewable(viewable);
// });
// await viewableData.finish();
// this.dataVizExtn.addViewables(viewableData);
// console.log(this.floorHeight,this.dataVizExtn)
// test 2
const myDataList = [{ position: { x: 0, y: 0, z: 0 } }];
myDataList.forEach((myData, index) => {
const position = myData.position;
const viewable = new DataVizCore.SpriteViewable(position, style, 12982);
viewableData.addViewable(viewable);
});
await viewableData.finish();
this.dataVizExtn.addViewables(viewableData);
let spritesToUpdate = this.dataVizExtn.viewableData.viewables.map((v) => v.dbId);
this.dataVizExtn.invalidateViewables(spritesToUpdate, (viewable) => {
return {
// Move the viewable to a new location.
position: { x: 0, y: 0, z: 100 },
};
});
console.log(this.floorHeight, this.dataVizExtn)
console.log("site")
//let nodeIds = this.allSensorDevList
// .filter((x) => !isNaN(parseInt(x.forge_dbid)))
// .map((x) => {
// return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) };
// });
//console.log("sensor", nodeIds)
//$.each(nodeIds, (idx, node) => {
// let options = {
// element: $(this.selector),
// viewer: this.viewer,
// nodeId: node,
// floorHeight: this.floorHeight ?? [],
// inited: function () {
// }
// }
// let elevator3DObj = new elevator3D(options);
// elevator3DObj.init(() => {
// const frags = this.viewer.model.getFragmentList();
// let scale = new THREE.Vector3();
// let rotation = new THREE.Quaternion();
// let translation = new THREE.Vector3();
// frags.getAnimTransform(node.nodeId, scale, rotation, translation);
// console.log(frags.getAnimTransform(node.nodeId, scale, rotation, translation))
// translation.z = this.floorHeight;
// frags.updateAnimTransform(node.nodeId, scale, rotation, translation);
// console.log(frags, frags.getAnimTransform(node.nodeId, scale, rotation, translation))
// // let frags = elevator3DObj.fragProxys.filter(x => x.nodeId == node);
// // console.log("sensor",elevator3DObj, frags)
// // let fragProxy = this.viewer.impl.getFragmentProxy(this.viewer.model, node.nodeId)
// // fragProxy.position = new THREE.Vector3(0, 0, 0)
// // console.log(node,fragProxy)
// // fragProxy.position.z = this.floorHeight
// // fragProxy.updateAnimTransform()
// // frags.forEach((fragProxy) => {
// // console.log("sensor", this)
// // console.log("elev2")
// // fragProxy.frag.position.z = this.floorHeight
// // console.log("sensor", fragProxy, fragProxy.frag)
// // fragProxy.frag.updateAnimTransform()
// // })
// this.viewer.impl.sceneUpdated(true)
// })
//})
}
}