2022-11-22 01:30:30 +08:00
|
|
|
|
|
2022-12-04 01:03:47 +08:00
|
|
|
|
/**
|
|
|
|
|
* 取得電梯資料 by baja
|
|
|
|
|
* @param {any} path
|
|
|
|
|
* @param {any} callback
|
|
|
|
|
*/
|
2022-11-22 01:30:30 +08:00
|
|
|
|
function getElevatorInfoByBaja(path, callback) {
|
|
|
|
|
var _result = "";
|
|
|
|
|
var _ss = '{';
|
|
|
|
|
var _index = 0;
|
|
|
|
|
//
|
|
|
|
|
require(['baja!'], function (baja) {
|
2022-11-24 17:55:52 +08:00
|
|
|
|
baja.Ord.make("local:|foxs:|station:|slot:/" + path + "|bql:select name, displayName, out, out.value, slotPath, parent.name as 'device_number' from control:ControlPoint").get()
|
2022-11-22 01:30:30 +08:00
|
|
|
|
.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);
|
|
|
|
|
}
|
2022-11-24 17:55:52 +08:00
|
|
|
|
},
|
|
|
|
|
limit: -1,
|
|
|
|
|
offset: 0
|
2022-11-22 01:30:30 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|