Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
8daac79a3a
@ -40,11 +40,12 @@ namespace Backend.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Device_value> ds;
|
List<Device_value> ds;
|
||||||
string url_slot = "slot:/Arena/H|";
|
string url_slot = "slot:/TPE/B1|";
|
||||||
string top100 = " top 100 ";
|
string top100 = " top 100 ";
|
||||||
webRequestService svc = new webRequestService();
|
webRequestService svc = new webRequestService();
|
||||||
string bql = url_slot + "bql:select " + top100 + " * from control:ControlPoint ";
|
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.Code = "0000";
|
||||||
apiResult.Data = ds;
|
apiResult.Data = ds;
|
||||||
|
@ -11,6 +11,7 @@ using System.Text;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Repository.BackendRepository.Implement;
|
using Repository.BackendRepository.Implement;
|
||||||
using Repository.BackendRepository;
|
using Repository.BackendRepository;
|
||||||
|
using Ubiety.Dns.Core;
|
||||||
|
|
||||||
namespace Backend.Services.Implement
|
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 encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||||
String API_Url = urlString;
|
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 = "<str val='" + bql + "'/>";
|
||||||
|
|
||||||
|
streamWriter.Write(json);
|
||||||
|
}
|
||||||
|
HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse();
|
||||||
|
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||||
|
|
||||||
XmlDocument xmlDoc = new XmlDocument();
|
XmlDocument xmlDoc = new XmlDocument();
|
||||||
//xmlDoc.LoadXml(responseString);
|
xmlDoc.LoadXml(responseString);
|
||||||
xmlDoc.Load("N4v1021.xml");//N4v1021
|
//xmlDoc.Load("N4v1021.xml");//N4v1021
|
||||||
|
|
||||||
//xmlDoc.Save("N4.xml");
|
//xmlDoc.Save("N4.xml");
|
||||||
|
|
||||||
|
@ -43,10 +43,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="btn-group">
|
<div id="devPointsList" class="btn-group">
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">溫度</button>
|
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">輸入電壓</button>
|
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">輸入電流</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -61,11 +59,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<td>儲冰設備A01</td>
|
|
||||||
<td>27.0</td>
|
|
||||||
<td>2021-08-01 23:55:00</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -77,7 +70,6 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
initList();
|
initList();
|
||||||
|
|
||||||
@ -101,9 +93,8 @@
|
|||||||
let url = baseApiUrl + "/api/History/GetMainSub";
|
let url = baseApiUrl + "/api/History/GetMainSub";
|
||||||
function success(res) {
|
function success(res) {
|
||||||
let strHtml = ``;
|
let strHtml = ``;
|
||||||
let sst = '';
|
let i1 = null, i2 = null, first = true;
|
||||||
let sstn = '';
|
|
||||||
let mst = '';
|
|
||||||
|
|
||||||
$.each(res.data.history_Main_Systems, function (index, val) {
|
$.each(res.data.history_Main_Systems, function (index, val) {
|
||||||
strHtml += `<li>
|
strHtml += `<li>
|
||||||
@ -112,54 +103,104 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul style="${index == 0 ? `display:block;` : ``}">`;
|
<ul style="${index == 0 ? `display:block;` : ``}">`;
|
||||||
|
|
||||||
|
i1 = (val.history_Sub_systems != null && i1 == null) ? index : null;
|
||||||
|
|
||||||
$.each(val.history_Sub_systems, function (index2, val2) {
|
$.each(val.history_Sub_systems, function (index2, val2) {
|
||||||
|
i2 = (val2.device != null && i2 == null) ? index2 : null;
|
||||||
|
|
||||||
strHtml += `<li>
|
strHtml += `<li>
|
||||||
<a href="#" onClick="getData('${val.main_system_tag}', '${val2.sub_system_tag}', '${val2.full_name}')" data-filter-tags="user interface buttons" data-subtag="${val2.sub_system_tag}">
|
<a href="#" data-filter-tags="user interface buttons" data-subtag="${val2.sub_system_tag}">
|
||||||
<span class="nav-link-text">
|
<span class="nav-link-text">
|
||||||
${val2.full_name} ${val2.sub_system_tag}
|
${val2.full_name} ${val2.sub_system_tag}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
<ul style="${index == i1 && index2 == i2 ? `display:block;` : ``}">`;
|
||||||
|
|
||||||
|
$.each(val2.device, function (index3, val3) {
|
||||||
|
strHtml += `<li>
|
||||||
|
<a href="#" onClick="setValue('${val3.device_number}', '${val3.full_name}', null)" data-filter-tags="user interface buttons" data-devnum="${val3.device_number}">
|
||||||
|
<span class="nav-link-text">
|
||||||
|
${val3.full_name} ${val3.device_serial_tag}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
</li>`;
|
</li>`;
|
||||||
|
|
||||||
if (index == 0 && index2 == 0) {
|
if (index == i1 && index2 == i2 && first) {
|
||||||
sst = val2.sub_system_tag;
|
first = false;
|
||||||
mst = val.main_system_tag;
|
pageAct.deviceNumber = val3.device_number;
|
||||||
sstn = val2.full_name;
|
pageAct.deviceName = val3.full_name;
|
||||||
|
devPointsList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
strHtml += `</ul> </li>`;
|
strHtml += `</ul> </li>`;
|
||||||
});
|
});
|
||||||
|
strHtml += `</ul> </li>`;
|
||||||
|
});
|
||||||
|
|
||||||
$('#js_nested_list').html(strHtml);
|
$('#js_nested_list').html(strHtml);
|
||||||
getData(mst, sst, sstn);
|
|
||||||
}
|
}
|
||||||
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getData(mst, sst, sstn) {
|
function devPointsList() {
|
||||||
//var dt = new Date();
|
let sendData = {
|
||||||
//console.log(dt);
|
device_number: pageAct.deviceNumber
|
||||||
// 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";
|
objSendData.Data = sendData;
|
||||||
// console.log(new Date(start).getTime());
|
let url = baseApiUrl + "/api/History/GetDevPoi";
|
||||||
// console.log(new Date(end).getTime());
|
function success(res) {
|
||||||
getHistoryDataByBaja("TPE_B1_EE_E4", //"TPE_" + pageAct.buiTag + "_" + mst + "_" + sst,
|
let strHtml = ``;
|
||||||
/*1666396800000,*/
|
|
||||||
//1666483200000,
|
$.each(res.data, function (index, val) {
|
||||||
1668927197000,
|
strHtml += `<button onClick="setValue(null, null, '${val.points}')" type="button" class="btn btn-secondary waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||||
1668963661000,
|
|
||||||
sstn,
|
if (index == 0) {
|
||||||
|
pageAct.deviceItem = val.points;
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#devPointsList').html(strHtml);
|
||||||
|
}
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
||||||
|
}
|
||||||
|
|
||||||
|
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",
|
"Mitsubishi_Sup",
|
||||||
callBackFromHistory);
|
callBackFromHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
function callBackFromHistory(res) {
|
function callBackFromHistory(res) {
|
||||||
//$('#tableData tbody').html();
|
let strHtml = ``;
|
||||||
console.log(res)
|
res = JSON.parse(res);
|
||||||
|
console.log(res);
|
||||||
|
$.each(res.data, function (index, val) {
|
||||||
|
strHtml += `<tr>
|
||||||
|
<td>${val.deviceName}</td>
|
||||||
|
<td>${val.value}</td>
|
||||||
|
<td>${displayDate(val.timestamp)}</td>
|
||||||
|
</tr>`;
|
||||||
|
});
|
||||||
|
$('#tableData tbody').html(strHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
function callbackForHistory(result) {
|
function setValue(deviceNumber, deviceName, deviceItem) {
|
||||||
console.log(result);
|
if ((deviceNumber != null && deviceNumber != undefined) && (deviceName != null && deviceName != undefined)) {
|
||||||
|
pageAct.deviceNumber = deviceNumber;
|
||||||
|
pageAct.deviceName = deviceName;
|
||||||
|
devPointsList();
|
||||||
|
}
|
||||||
|
else if (deviceItem != null && deviceItem != undefined) {
|
||||||
|
pageAct.deviceItem = deviceItem;
|
||||||
|
getData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -1,17 +1,20 @@
|
|||||||
<style>
|
<style>
|
||||||
.elevator {
|
.elevator {
|
||||||
background-color:#fff;
|
background-color: #fff;
|
||||||
height:520px;
|
height: 520px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.elevator-build {
|
table.elevator-build {
|
||||||
/*border: 1px double #000;*/
|
/*border: 1px double #000;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
table.elevator-build td {
|
table.elevator-build td {
|
||||||
padding: 0.2rem 0.5rem;
|
padding: 0.2rem 0.5rem;
|
||||||
height: 40px;
|
height: 50px;
|
||||||
width: 55px;
|
width: 45px;
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
elevator .elevator-body, elevator .elevator-header {
|
elevator .elevator-body, elevator .elevator-header {
|
||||||
padding: 0.7rem;
|
padding: 0.7rem;
|
||||||
}
|
}
|
||||||
@ -27,10 +30,12 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="elevator-body d-flex align-items-center justify-content-center h-100 yt-table-container">
|
<div class="elevator-body d-flex align-items-center justify-content-center h-100 yt-table-container">
|
||||||
|
<div id="floorTable_wrapper" class="elevator-build-container">
|
||||||
<table id="floorTable" class="elevator-build m-auto">
|
<table id="floorTable" class="elevator-build m-auto">
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div>
|
<!--<div>
|
||||||
<img src="img/elevator.jpg" class="img-fluid" style="min-height: 520px" />
|
<img src="img/elevator.jpg" class="img-fluid" style="min-height: 520px" />
|
||||||
@ -46,7 +51,7 @@
|
|||||||
<!-- End-左圖區 -->
|
<!-- End-左圖區 -->
|
||||||
<!-- 中間卡片區 -->
|
<!-- 中間卡片區 -->
|
||||||
<div class="col-7 my-3">
|
<div class="col-7 my-3">
|
||||||
<div class="row">
|
<div id="eleCards" class="row">
|
||||||
<div class="card text-white bg-info mx-1 mb-3 col-4" style="max-width: 18rem">
|
<div class="card text-white bg-info mx-1 mb-3 col-4" style="max-width: 18rem">
|
||||||
<div type="button" class="card-body" data-toggle="modal" data-target="#card1">
|
<div type="button" class="card-body" data-toggle="modal" data-target="#card1">
|
||||||
<span class="d-flex">
|
<span class="d-flex">
|
||||||
@ -877,11 +882,174 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
var floors = ["B2F", "B1F", "1F", "2F", "3F", "4F", "5F", "6F"]
|
var floors = ["B2F", "B1F", "1F", "2F", "3F", "4F", "5F", "6F"]
|
||||||
|
var allDevList = [];
|
||||||
$(function () {
|
$(function () {
|
||||||
setBuildFloor(floors.length,3);
|
setBuildFloor(floors.length, 3);
|
||||||
|
setCards();
|
||||||
|
subDevice();
|
||||||
|
})
|
||||||
|
function getFloDevList() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//baja 訂閱設備
|
||||||
|
function subDevice() {
|
||||||
|
myBaja = new subscriptionDevices();
|
||||||
|
var ordPath = {
|
||||||
|
"building_tag": pageAct.buiTag,
|
||||||
|
"system_tag": pageAct.sysMainTag,
|
||||||
|
"name_tag": pageAct.sysSubTag,
|
||||||
|
}
|
||||||
|
myBaja.setSubscribeDevicesByBql(ordPath);
|
||||||
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
||||||
|
console.log(data)
|
||||||
|
let matchDevice = allDevList.filter(x => x.device_number.split("_")[x.device_number.split("_").length - 1] == data.device_number)[0];
|
||||||
|
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 == "ST") {
|
||||||
|
$(`#${matchDevice.device_number}_card [name=devStatus]`).text(data.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.point_name == norDevPoiName && data.value == matchDevice.device_normal_point_value) {
|
||||||
|
//顯示正常燈號
|
||||||
|
$(`#${matchDevice.device_number}_card`).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}_card`).attr("data-light-type", "close").data("light-type", "close");
|
||||||
|
} else if (data.point_name == errDevPoiName && data.value == matchDevice.device_error_point_value) {
|
||||||
|
$(`#${matchDevice.device_number}_card`).attr("data-light-type", "error").data("light-type", "error");
|
||||||
|
}
|
||||||
|
setLightColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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).addClass("light-flash");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCards() {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
||||||
|
let sendData = {
|
||||||
|
sub_system_tag: pageAct.sysSubTag,
|
||||||
|
building_tag: pageAct.buiTag,
|
||||||
|
floor_tag: pageAct.floTag,
|
||||||
|
};
|
||||||
|
objSendData.Data = sendData;
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let strHtml = ``;
|
||||||
|
$.each(res.data, (index, floObj) => {
|
||||||
|
$.each(floObj.device_list, (index2, devObj) => {
|
||||||
|
allDevList.push(devObj);
|
||||||
|
|
||||||
|
strHtml += `<div id="${devObj.device_number}_card" class="card text-white mx-1 mb-3 col-4 " name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" style="max-width: 18rem;">
|
||||||
|
<div type="button" class="card-body">
|
||||||
|
<span class="d-flex">
|
||||||
|
<h5 class="card-title">號機別 : ${devObj.full_name}</h5>
|
||||||
|
<i class="fas fa-caret-up fa-3x ml-auto"></i>
|
||||||
|
</span>
|
||||||
|
<h4 class="d-flex justify-content-end">10F</h4>
|
||||||
|
<span class="d-flex">
|
||||||
|
<p class="card-text">狀態 : <span name="devStatus"></span></p>
|
||||||
|
<i class="fas fa-caret-down fa-3x ml-auto animate__animated animate__flash animate__infinite animate__slower"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
})
|
})
|
||||||
|
|
||||||
function setBuildFloor(floorCnt = 10,eleCnt = 3) {
|
})
|
||||||
|
$("#eleCards").html(strHtml);
|
||||||
|
initPopover();
|
||||||
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function initPopover() {
|
||||||
|
$("[name=devItem]").each((index, ele) => {
|
||||||
|
let devNum = $(ele).data("number"); //設備編號
|
||||||
|
let devGuid = $(ele).data("id"); //guid
|
||||||
|
let devName = $(ele).data("name"); //full_name
|
||||||
|
$(ele).YTTooltip({
|
||||||
|
html: `<div class="card m-1 border device-wrap">
|
||||||
|
|
||||||
|
<div class="card-header p-3">
|
||||||
|
|
||||||
|
<div class="position-absolute w-50" style="word-break: break-all;">
|
||||||
|
<label class="m-0 mt-2">${devName}</label>
|
||||||
|
</div>
|
||||||
|
<div id="card-tab" class="row justify-content-end nav nav-tabs" role="tablist">
|
||||||
|
<button type="button" id="state-tab" class="btn btn-icon nav-link active" role="tab" data-tabname="cardTab" data-target="#state"><i class="fa fa-desktop icon"></i></button>
|
||||||
|
<button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button>
|
||||||
|
<button type="button" id="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
|
||||||
|
<button type="button" id="opeRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#opeRec"><i class="fa fa-bars icon"></i></button>
|
||||||
|
<button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-2 tab-content">
|
||||||
|
|
||||||
|
<div id="state" class="show active" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-6">${drawImdStaBlock()}</div>
|
||||||
|
<div class="col-xl-6">${drawOpeModBlock()}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="errRec" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
${drawErrRecTabBlo()}
|
||||||
|
</div>
|
||||||
|
<div id="opeRec" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
${drawOpeRecTabBlo()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>`,
|
||||||
|
group: "device",
|
||||||
|
onShow: function (tooltipEle, oriEle) {
|
||||||
|
var tab = new YT.Tab({ tabName: "cardTab" })
|
||||||
|
console.log($(oriEle).data("number"))
|
||||||
|
//基本資料tab block
|
||||||
|
$("#info").html(drawInfoTabBlo(devGuid));
|
||||||
|
loadOpeRecTable(devGuid);
|
||||||
|
//loadErrRecTable2($(oriEle).data("number"));
|
||||||
|
//loadErrRecTable();
|
||||||
|
loadErr($(oriEle).data("number"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function setBuildFloor(floorCnt = 10, eleCnt = 3) {
|
||||||
let tbody = creEle("tbody");
|
let tbody = creEle("tbody");
|
||||||
//樓層從小到大
|
//樓層從小到大
|
||||||
let rfloors = floors.reverse();
|
let rfloors = floors.reverse();
|
||||||
@ -892,15 +1060,24 @@
|
|||||||
for (let e = 1; e <= eleCnt + 2; e++) {
|
for (let e = 1; e <= eleCnt + 2; e++) {
|
||||||
let td = creEle("td");
|
let td = creEle("td");
|
||||||
if (e == 1) {
|
if (e == 1) {
|
||||||
|
td.addClass("t-black")
|
||||||
td.text(rfloors[f - 1]);
|
td.text(rfloors[f - 1]);
|
||||||
|
} else if (e == eleCnt + 2) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let div = creDiv(["d-flex", "justify-content-center", "align-items-end", "h-100"]);
|
||||||
|
div.append(`<i class="fas fa-door-open fs-1-05"></i>`)
|
||||||
|
td.append(div)
|
||||||
}
|
}
|
||||||
tr.append(td);
|
tr.append(td);
|
||||||
}
|
}
|
||||||
tbody.append(tr);
|
tbody.append(tr);
|
||||||
|
$("#floorTable_wrapper").append(eleCircle)
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#floorTable").html(tbody);
|
$("#floorTable").html(tbody);
|
||||||
|
|
||||||
|
|
||||||
$("#floorTable tbody tr").each((index, tr) => {
|
$("#floorTable tbody tr").each((index, tr) => {
|
||||||
|
|
||||||
$(tr).find("td:eq(0)").css("border-left", "0");
|
$(tr).find("td:eq(0)").css("border-left", "0");
|
||||||
@ -919,61 +1096,267 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initYTTable(element) {
|
|
||||||
let obj = { init: null, SetContainer: null, Ele: element || $(".yt-table") };
|
|
||||||
|
|
||||||
obj.init = function () {
|
function drawStateTabBlo() {
|
||||||
this.SetContainer();
|
let strHtml = `<table class="table table-bordered table-striped text-center m-0" id="iframemodal">
|
||||||
this.SetBorder();
|
<div class="modal-body">
|
||||||
this.SetEndCellRightBorderRemove();
|
<iframe src="http://localhost:8080/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe>
|
||||||
this.SetEndCellBottomBorderRemove();
|
</div>
|
||||||
|
</table>`
|
||||||
|
return strHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.SetContainer = function () {
|
function drawImdStaBlock() {
|
||||||
$(this.Ele).each(function (index, value) {
|
let tabEle = $(`<table class="table table-bordered table-striped text-center m-0">`);
|
||||||
if ($(value).parent(".yt-table-container").length != 0) {
|
let tbody = tabEle.append("<tbody>");
|
||||||
$(value).unwrap(".yt-table-container");
|
let rows =
|
||||||
|
[
|
||||||
|
{ id: "devNum", text: "號機" },
|
||||||
|
{ id: "status", text: "狀態" },
|
||||||
|
{ id: "group", text: "組別" },
|
||||||
|
{ id: "weight", text: "載重" },
|
||||||
|
];
|
||||||
|
let cols = [
|
||||||
|
{ width: "30%" },
|
||||||
|
{ width: "40%" },
|
||||||
|
{ width: "30%" },
|
||||||
|
]
|
||||||
|
$.each(rows, (index, row) => {
|
||||||
|
let tr = $("<tr></tr>");
|
||||||
|
$.each(cols, (index2, col) => {
|
||||||
|
let td = $("<td></td>");
|
||||||
|
td.prop("id", row.id)
|
||||||
|
td.css("width", col.width)
|
||||||
|
if (index2 == 0) {
|
||||||
|
td.text(row.text);
|
||||||
}
|
}
|
||||||
let strHtml = $(`<div class="yt-table-container"></div>`);
|
tr.append(td);
|
||||||
$(value).wrap(strHtml);
|
|
||||||
$(value).parent(".yt-table-container").parent().addClass("table-div");
|
|
||||||
})
|
})
|
||||||
}
|
tbody.append(tr);
|
||||||
|
|
||||||
obj.SetBorder = function () {
|
|
||||||
console.log("123123", $(this.Ele))
|
|
||||||
$(`${$(this.Ele).selector}.th-td-br th,${$(this.Ele).selector}.th-td-br td`).css("border-right", "1px solid #adadad");
|
|
||||||
$(`${$(this.Ele).selector}.th-bd thead th`).css("border-bottom", "1px solid #adadad");
|
|
||||||
$(`${$(this.Ele).selector}.td-bd tbody td`).css("border-bottom", "1px solid #adadad");
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.SetEndCellRightBorderRemove = function () {
|
|
||||||
let notBorder = 0;
|
|
||||||
$(`${$(this.Ele).selector} thead th:last-child,.yt-table tbody td:last-child`).each(function (index, value) {
|
|
||||||
if (index >= notBorder) {
|
|
||||||
$(value).css("border-right", "0px");
|
|
||||||
}
|
|
||||||
if ($(value).attr("rowspan")) {
|
|
||||||
let rowspan = parseInt($(value).attr("rowspan"));
|
|
||||||
notBorder = index + rowspan;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.SetEndCellBottomBorderRemove = function () {
|
|
||||||
$(`${$(this.Ele).selector} tr:last-child td`).each(function (index, value) {
|
|
||||||
$(value).css("border-bottom", "0px");
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$(`${$(this.Ele).selector} tr td[rowspan]`).each(function (index, value) {
|
return tabEle.outerHtml();
|
||||||
let tr = $(value).closest("tr");
|
|
||||||
let oriTrInd = $(tr).index();
|
|
||||||
let lastTrInd = $(tr).parent("tbody").find("tr:last-child").index();
|
|
||||||
if (lastTrInd - oriTrInd == $(value).prop("rowspan") - 1) {
|
|
||||||
$(value).css("border-bottom", "0px");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function drawOpeModBlock() {
|
||||||
|
let tabEle = $(`<table id="opeModTable" class="table table-bordered table-striped text-center m-0">`);
|
||||||
|
let tbody = tabEle.append("<tbody>");
|
||||||
|
let rows =
|
||||||
|
[
|
||||||
|
{ id: "imdStaTabDevNum", text: "自動" },
|
||||||
|
{ id: "imdStaTabDevNumStatus", text: "VIP" },
|
||||||
|
{ id: "imdStaTabDevNumGroup", text: "獨立運轉" },
|
||||||
|
{ id: "imdStaTabDevNumWeight", text: "手動" },
|
||||||
|
{ id: "imdStaTabDevNumWeight", text: "運轉保養" },
|
||||||
|
{ id: "imdStaTabDevNumWeight", text: "回歸完了" },
|
||||||
|
{ id: "imdStaTabDevNumWeight", text: "不服務樓層" },
|
||||||
|
];
|
||||||
|
let cols = [
|
||||||
|
{ width: "30%" },
|
||||||
|
{ width: "40%" },
|
||||||
|
{ width: "30%" },
|
||||||
|
]
|
||||||
|
$.each(rows, (index, row) => {
|
||||||
|
let tr = $("<tr></tr>");
|
||||||
|
$.each(cols, (index2, col) => {
|
||||||
|
let td = $("<td></td>");
|
||||||
|
td.prop("id", row.id)
|
||||||
|
td.css("width", col.width)
|
||||||
|
if (index2 == 0) {
|
||||||
|
td.text(row.text);
|
||||||
|
}
|
||||||
|
tr.append(td);
|
||||||
})
|
})
|
||||||
|
tbody.append(tr);
|
||||||
|
})
|
||||||
|
|
||||||
|
return tabEle.outerHtml();
|
||||||
}
|
}
|
||||||
obj.init();
|
|
||||||
|
function drawInfoTabBlo(devGuid) {
|
||||||
|
let tabEle = $(`<table class="table table-bordered table-striped text-center m-0">`);
|
||||||
|
let tbody = tabEle.append("<tbody>");
|
||||||
|
let columnNames = ["設備編號", "設備名稱"];
|
||||||
|
|
||||||
|
$.each(columnNames, (index, colName) => {
|
||||||
|
let tr = $("<tr></tr>");
|
||||||
|
let td = $("<td></td>");
|
||||||
|
td.text(colName);
|
||||||
|
tr.append(td);
|
||||||
|
tbody.append(tr);
|
||||||
|
})
|
||||||
|
|
||||||
|
let url = baseApiUrl + "/api/Device/GetBaseDevice";
|
||||||
|
let sendData = {
|
||||||
|
device_guid: devGuid,
|
||||||
|
};
|
||||||
|
objSendData.Data = sendData;
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tbody.find("tr").eq(0).append(creEle("td", res.data.device_number));
|
||||||
|
tbody.find("tr").eq(1).append(creEle("td", res.data.full_name));
|
||||||
}
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
|
|
||||||
|
return tabEle.prop("outerHTML");
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawErrRecTabBlo() {
|
||||||
|
let strHtml = `<table id="errRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||||
|
|
||||||
|
</table>`
|
||||||
|
return strHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawOpeRecTabBlo() {
|
||||||
|
let strHtml = `<table id="opeRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||||
|
|
||||||
|
</table>`
|
||||||
|
return strHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function loadOpeRecTable(devGuid) {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetOpeDevice?device_guid=" + devGuid;
|
||||||
|
let tag = "#opeRecTable";
|
||||||
|
|
||||||
|
let column_defs = [
|
||||||
|
{ "targets": [0], "width": "8%", "sortable": true },
|
||||||
|
{ "targets": [1], "width": "8%", "sortable": true },
|
||||||
|
{ "targets": [2], "width": "7%", "sortable": true },
|
||||||
|
{ "targets": [3], "width": "7%", "sortable": true },
|
||||||
|
];
|
||||||
|
|
||||||
|
let columns = [
|
||||||
|
{
|
||||||
|
"title": "類型",
|
||||||
|
"data": "work_type_name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "項目",
|
||||||
|
"data": "fix_do",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "處理人員",
|
||||||
|
"data": "work_person_name",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "發生/完成時間",
|
||||||
|
"data": "finishTime",
|
||||||
|
"render": function (data, type, row) {
|
||||||
|
return row.createdAt + "<br>" + data;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//let callback = function () {
|
||||||
|
// $('#opeRecTable').wrap("<div class='scrolledTable'></div>"); //不採用datatable內建scrollbody,會導致thead跑掉
|
||||||
|
// let api = this.api();
|
||||||
|
// api.columns.adjust();
|
||||||
|
//}
|
||||||
|
|
||||||
|
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
|
||||||
|
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;
|
||||||
|
|
||||||
|
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": "normalTime",
|
||||||
|
"render": function (data, type, row) {
|
||||||
|
return row.timestamp + "<br>" + data;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -1,13 +1,5 @@
|
|||||||
<style>
|
<style>
|
||||||
[id^=yt_tooltip] {
|
|
||||||
width: 650px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.circle-light {
|
|
||||||
width: 25px;
|
|
||||||
height: 25px;
|
|
||||||
border-radius: 50px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -46,12 +38,43 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var allDevList = [];
|
||||||
$(function () {
|
$(function () {
|
||||||
getFloDevList();
|
getFloDevList();
|
||||||
setLightColor();
|
setLightColor();
|
||||||
|
|
||||||
|
subDevice();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//baja 訂閱設備
|
||||||
|
function subDevice() {
|
||||||
|
myBaja = new subscriptionDevices();
|
||||||
|
var ordPath = {
|
||||||
|
"building_tag": pageAct.buiTag,
|
||||||
|
"system_tag": pageAct.sysMainTag,
|
||||||
|
"name_tag": pageAct.sysSubTag,
|
||||||
|
}
|
||||||
|
myBaja.setSubscribeDevicesByBql(ordPath);
|
||||||
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
||||||
|
|
||||||
|
let matchDevice = allDevList.filter(x => x.device_number.split("_")[x.device_number.split("_").length - 1] == data.device_number)[0];
|
||||||
|
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 == 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) {
|
||||||
|
$(`#${matchDevice.device_number}_status`).attr("data-light-type", "error").data("light-type", "error");
|
||||||
|
}
|
||||||
|
setLightColor();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//function loadStaLight() {
|
//function loadStaLight() {
|
||||||
// if (pageAct.sysSubObj.device_normal_color) {
|
// if (pageAct.sysSubObj.device_normal_color) {
|
||||||
// $("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
|
// $("#sysNorLight").css("background-color", pageAct.sysSubObj.device_normal_color);
|
||||||
@ -73,19 +96,26 @@
|
|||||||
function setLightColor() {
|
function setLightColor() {
|
||||||
$("[data-light-type]").each((index, ele) => {
|
$("[data-light-type]").each((index, ele) => {
|
||||||
let type = $(ele).data("light-type");
|
let type = $(ele).data("light-type");
|
||||||
|
let isFlashing = false;
|
||||||
let color = "#000";
|
let color = "#000";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "normal":
|
case "normal":
|
||||||
color = pageAct.sysSubObj.device_normal_color ?? "var(--theme-success)";
|
color = pageAct.sysSubObj.device_normal_color ?? "var(--theme-success)";
|
||||||
|
isFlashing = pageAct.sysSubObj.device_normal_flashing == "1"
|
||||||
break;
|
break;
|
||||||
case "close":
|
case "close":
|
||||||
color = pageAct.sysSubObj.device_close_color ?? "var(--theme-secondary)";
|
color = pageAct.sysSubObj.device_close_color ?? "var(--theme-secondary)";
|
||||||
|
isFlashing = pageAct.sysSubObj.device_close_flashing == "1"
|
||||||
break;
|
break;
|
||||||
case "error":
|
case "error":
|
||||||
color = pageAct.sysSubObj.device_error_color ?? "var(--theme-danger)";
|
color = pageAct.sysSubObj.device_error_color ?? "var(--theme-danger)";
|
||||||
|
isFlashing = pageAct.sysSubObj.device_error_flashing == "1"
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$(ele).css("background-color", color);
|
$(ele).css("background-color", color);
|
||||||
|
if (isFlashing) {
|
||||||
|
$(ele).parents(".card.device-wrap").addClass("light-flash");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +138,7 @@
|
|||||||
|
|
||||||
$.each(floObj.device_list, (index2, devObj) => {
|
$.each(floObj.device_list, (index2, devObj) => {
|
||||||
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
|
||||||
|
allDevList.push(devObj);
|
||||||
|
|
||||||
strHtml += `<div class="card m-1 border device-wrap" style="width:300px">
|
strHtml += `<div class="card m-1 border device-wrap" style="width:300px">
|
||||||
<div class="card-body p-2">
|
<div class="card-body p-2">
|
||||||
@ -120,7 +151,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex mb-0 mt-2 align-items-center">
|
<div class="d-flex mb-0 mt-2 align-items-center">
|
||||||
<span id="${devObj.device_number}_status" class="circle-light" data-light-type="normal"></span>
|
<span id="${devObj.device_number}_status" class="circle-light"></span>
|
||||||
<span class="d-none">即時功率:</span>
|
<span class="d-none">即時功率:</span>
|
||||||
<a href="javascript:;" name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class=" ml-2 mb-0 ">詳細資料</a>
|
<a href="javascript:;" name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class=" ml-2 mb-0 ">詳細資料</a>
|
||||||
</div>
|
</div>
|
||||||
@ -195,10 +226,8 @@
|
|||||||
let devName = $(ele).data("name"); //full_name
|
let devName = $(ele).data("name"); //full_name
|
||||||
$(ele).YTTooltip({
|
$(ele).YTTooltip({
|
||||||
html: `<div class="card m-1 border device-wrap">
|
html: `<div class="card m-1 border device-wrap">
|
||||||
<div class="col-12 p-0 row justify-content-end m-0">
|
|
||||||
<button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
|
<div class="card-header p-3">
|
||||||
</div>
|
|
||||||
<div class="card-header p-2 px-3">
|
|
||||||
|
|
||||||
<div class="position-absolute w-50" style="word-break: break-all;">
|
<div class="position-absolute w-50" style="word-break: break-all;">
|
||||||
<label class="m-0 mt-2">${devName}</label>
|
<label class="m-0 mt-2">${devName}</label>
|
||||||
@ -208,6 +237,7 @@
|
|||||||
<button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button>
|
<button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button>
|
||||||
<button type="button" id="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
|
<button type="button" id="errRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#errRec"><i class="fas fa-exclamation-triangle"></i></button>
|
||||||
<button type="button" id="opeRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#opeRec"><i class="fa fa-bars icon"></i></button>
|
<button type="button" id="opeRec-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#opeRec"><i class="fa fa-bars icon"></i></button>
|
||||||
|
<button class="btn p-2"><i class="fas fa-times fs-1 text-white-50" data-close="yttooltip"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-2 tab-content">
|
<div class="card-body p-2 tab-content">
|
||||||
@ -236,7 +266,8 @@
|
|||||||
$("#info").html(drawInfoTabBlo(devGuid));
|
$("#info").html(drawInfoTabBlo(devGuid));
|
||||||
loadOpeRecTable(devGuid);
|
loadOpeRecTable(devGuid);
|
||||||
//loadErrRecTable2($(oriEle).data("number"));
|
//loadErrRecTable2($(oriEle).data("number"));
|
||||||
loadErrRecTable();
|
//loadErrRecTable();
|
||||||
|
loadErr($(oriEle).data("number"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -330,6 +361,58 @@
|
|||||||
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs, null, null, null, null, "tpi");
|
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
|
||||||
|
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;
|
||||||
|
|
||||||
|
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": "normalTime",
|
||||||
|
"render": function (data, type, row) {
|
||||||
|
return row.timestamp + "<br>" + data;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
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) {
|
//function loadErrRecTable2(allPath) {
|
||||||
// if (allPath != undefined && allPath != null) {
|
// if (allPath != undefined && allPath != null) {
|
||||||
// let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
// let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
--yt-gray-4: #dddddd;
|
--yt-gray-4: #dddddd;
|
||||||
--yt-pink: #ff95d0;
|
--yt-pink: #ff95d0;
|
||||||
--yt-pink-hover: #ef84c0;
|
--yt-pink-hover: #ef84c0;
|
||||||
--yt-red-2:#d34949;
|
--yt-red-2: #d34949;
|
||||||
--yt-yellow-1:#ffc902;
|
--yt-yellow-1: #ffc902;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -25,113 +25,351 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.table.dataTable td {
|
.table.dataTable td {
|
||||||
word-break:break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
label[id$='-error'].error {
|
label[id$='-error'].error {
|
||||||
color: var(--yt-red-2);
|
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 */
|
/* cursor */
|
||||||
.cur-def { cursor:default !important;}
|
.cur-def {
|
||||||
.cur-poi { cursor:pointer !important;}
|
cursor: default !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cur-poi {
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
|
|
||||||
/*left 距離*/
|
/*left 距離*/
|
||||||
.left-05 { left: 0.5rem !important; }
|
.left-05 {
|
||||||
.left-04 { left: 0.4rem !important; }
|
left: 0.5rem !important;
|
||||||
.left-03 { left: 0.3rem !important; }
|
}
|
||||||
.left-02 { left: 0.2rem !important; }
|
|
||||||
.left-01 { left: 0.1rem !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 距離*/
|
||||||
.right-05 { right: 0.5rem !important; }
|
.right-05 {
|
||||||
.right-04 { right: 0.4rem !important; }
|
right: 0.5rem !important;
|
||||||
.right-03 { right: 0.3rem !important; }
|
}
|
||||||
.right-02 { right: 0.2rem !important; }
|
|
||||||
.right-01 { right: 0.1rem !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*/
|
/*bottom 0.5rem*/
|
||||||
.bm-05 { bottom: 0.5rem !important; }
|
.bm-05 {
|
||||||
.bm-04 { bottom: 0.4rem !important; }
|
bottom: 0.5rem !important;
|
||||||
.bm-03 { bottom: 0.3rem !important; }
|
}
|
||||||
.bm-02 { bottom: 0.2rem !important; }
|
|
||||||
.bm-01 { bottom: 0.1rem !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*/
|
/*top 0.5rem*/
|
||||||
.tp-05 { top: 0.5rem !important; }
|
.tp-05 {
|
||||||
.tp-04 { top: 0.4rem !important; }
|
top: 0.5rem !important;
|
||||||
.tp-03 { top: 0.3rem !important; }
|
}
|
||||||
.tp-02 { top: 0.2rem !important; }
|
|
||||||
.tp-01 { top: 0.1rem !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 */
|
/* font-weight */
|
||||||
.fw-1 { font-weight: 100; }
|
.fw-1 {
|
||||||
.fw-2 { font-weight: 200; }
|
font-weight: 100;
|
||||||
.fw-3 { font-weight: 300; }
|
}
|
||||||
.fw-4 { font-weight: 400; }
|
|
||||||
.fw-5 { font-weight: 500; }
|
.fw-2 {
|
||||||
.fw-6 { font-weight: 600; }
|
font-weight: 200;
|
||||||
.fw-7 { font-weight: 700; }
|
}
|
||||||
.fw-8 { font-weight: 800; }
|
|
||||||
.fw-9 { font-weight: 900; }
|
.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 */
|
/* font-size */
|
||||||
.fs-05 { font-size: 0.5rem; }
|
.fs-05 {
|
||||||
.fs-075 { font-size: 0.75rem; }
|
font-size: 0.5rem;
|
||||||
.fs-09 { font-size: 0.9rem; }
|
}
|
||||||
.fs-1-05 { font-size: 1.05rem; }
|
|
||||||
.fs-1-1 { font-size: 1.1rem; }
|
.fs-075 {
|
||||||
.fs-1-2 { font-size: 1.2rem; }
|
font-size: 0.75rem;
|
||||||
.fs-1-3 { font-size: 1.3rem; }
|
}
|
||||||
.fs-1-5 { font-size: 1.5rem; }
|
|
||||||
.fs-2 { font-size: 2rem; }
|
.fs-09 {
|
||||||
.fs-2-5 { font-size: 2.5rem; }
|
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 */
|
/* border width */
|
||||||
.bd-0 { border-width: 0px; }
|
.bd-0 {
|
||||||
.bd-1 { border-width: 1px; }
|
border-width: 0px;
|
||||||
.bd-2 { border-width: 2px; }
|
}
|
||||||
|
|
||||||
|
.bd-1 {
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bd-2 {
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
/* border direction */
|
/* border direction */
|
||||||
.bd-l { border-left-style:solid;}
|
.bd-l {
|
||||||
.bd-r { border-right-style:solid;}
|
border-left-style: solid;
|
||||||
.bd-t { border-top-style:solid;}
|
}
|
||||||
.bd-b { border-bottom-style:solid;}
|
|
||||||
|
.bd-r {
|
||||||
|
border-right-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bd-t {
|
||||||
|
border-top-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bd-b {
|
||||||
|
border-bottom-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
/* border radius */
|
/* border radius */
|
||||||
.br-1 { border-radius: 1px; }
|
.br-1 {
|
||||||
.br-2 { border-radius: 2px; }
|
border-radius: 1px;
|
||||||
.br-3 { border-radius: 3px; }
|
}
|
||||||
.br-4 { border-radius: 4px; }
|
|
||||||
.br-5 { border-radius: 5px; }
|
.br-2 {
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.br-3 {
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.br-4 {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.br-5 {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* flex-gap */
|
/* flex-gap */
|
||||||
.gap-1 { gap: 1px;}
|
.gap-1 {
|
||||||
.gap-2 { gap: 2px;}
|
gap: 1px;
|
||||||
.gap-3 { gap: 3px;}
|
}
|
||||||
.gap-4 { gap: 4px;}
|
|
||||||
.gap-5 { gap: 5px;}
|
.gap-2 {
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-3 {
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-4 {
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-5 {
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* vertical-align */
|
/* vertical-align */
|
||||||
.va-t {vertical-align: top;}
|
.va-t {
|
||||||
.va-m {vertical-align: middle;}
|
vertical-align: top;
|
||||||
.va-b {vertical-align: bottom;}
|
}
|
||||||
|
|
||||||
|
.va-m {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.va-b {
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
/* text color */
|
/* text color */
|
||||||
.t-main-purple { color: #623c80 !important; }
|
.t-main-purple {
|
||||||
.t-black { color: #000 !important; }
|
color: #623c80 !important;
|
||||||
.t-white { color:#fff !important;}
|
}
|
||||||
.t-fb-blue { color: #466ac2 !important; }
|
|
||||||
.t-line-green { color: #54C814 !important; }
|
.t-black {
|
||||||
.t-red { color: #db0000 !important;}
|
color: #000 !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-white {
|
||||||
.t-gray-2 { color: var(--yt-gray-2) !important; }
|
color: #fff !important;
|
||||||
.t-gray-3 { color: var(--yt-gray-3); }
|
}
|
||||||
.t-yellow { color: var(--yt-yellow-1);}
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
@ -13,6 +13,16 @@
|
|||||||
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
|
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
|
||||||
|
|
||||||
|
|
||||||
|
<div id="MyControls" class="adsk control">
|
||||||
|
<p style="text-align: center; font-weight: bold;">Robot Controls</p>
|
||||||
|
<p id="id_printer">Selected_ID: </p>
|
||||||
|
<p id="all_id">All_ID: </p>
|
||||||
|
<button id="1F1oor" onclick="move1Floor()">1 Floor</button>
|
||||||
|
<button id="2F1oor" onclick="move2Floor()">2 Floor</button>
|
||||||
|
<button id="3F1oor" onclick="move3Floor()">3 Floor</button>
|
||||||
|
<!-- <input type="range">Main Axis</input> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div id="forgeViewer"></div>
|
<div id="forgeViewer"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -44,8 +54,26 @@
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU2JUIwJUI4JUU2JTk4JUE1JUU2JUEzJUE3JUUzJTgwJTkxJUUzJTgwJTkwTUVQJUUzJTgwJTkxVjMubndk');
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwJUU2JUIwJUI4JUU2JTk4JUE1JUU2JUEzJUE3JUUzJTgwJTkxJUUzJTgwJTkwTUVQJUUzJTgwJTkxVjMubndk');
|
||||||
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwVEVTVCVFMyU4MCU5MS5ud2Q');//[TEST].nwd
|
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxLm53Yw');//[TEST].nwd
|
||||||
|
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MFRFU1QlRTMlODAlOTEubndk');
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
function move1Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(0);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move2Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(1);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
function move3Floor() {
|
||||||
|
setElevatorSpeed(0.2);
|
||||||
|
setElevatorFloor(2);
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -2459,6 +2459,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script src="js/n4js/bajatest.js"></script>
|
||||||
<script src="js/bajascript/require.config.js"></script>
|
<script src="js/bajascript/require.config.js"></script>
|
||||||
<script src="js/FileSaver.js"></script>
|
<script src="js/FileSaver.js"></script>
|
||||||
|
|
||||||
|
@ -42,6 +42,9 @@ var sensorStyleDefinitions = {
|
|||||||
|
|
||||||
// Initialize sensor values
|
// Initialize sensor values
|
||||||
let sensorVals = [];
|
let sensorVals = [];
|
||||||
|
let fragProxy;
|
||||||
|
var targetFloorZ;
|
||||||
|
var elevatorSpeed;
|
||||||
for (let i = 0; i < devices.length; i++) {
|
for (let i = 0; i < devices.length; i++) {
|
||||||
sensorVals[i] = Math.random();
|
sensorVals[i] = Math.random();
|
||||||
}
|
}
|
||||||
@ -87,12 +90,168 @@ function launchViewer(urn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAllLeafComponents(viewer, callback) {
|
||||||
|
var cbCount = 0;
|
||||||
|
var tree;
|
||||||
|
var jsData = []
|
||||||
|
|
||||||
|
function getLeafComponentsRec(current, parent) {
|
||||||
|
cbCount++;
|
||||||
|
if (tree.getChildCount(current) != 0) {
|
||||||
|
tree.enumNodeChildren(current, function (children) {
|
||||||
|
getLeafComponentsRec(children, current);
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
var nodeName = viewer.model.getInstanceTree().getNodeName(current)
|
||||||
|
jsData.push({ id: current, parent: parent, text: nodeName })
|
||||||
|
|
||||||
|
if (--cbCount == 0) callback(jsData);
|
||||||
|
}
|
||||||
|
viewer.getObjectTree(function (objectTree) {
|
||||||
|
tree = objectTree;
|
||||||
|
var rootId = tree.getRootId()
|
||||||
|
var nodeName = viewer.model.getInstanceTree().getNodeName(rootId)
|
||||||
|
jsData.push({ id: rootId, parent: '#', text: nodeName })
|
||||||
|
var allLeafComponents = getLeafComponentsRec(rootId, '#');
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onDocumentLoadSuccess(doc) {
|
function onDocumentLoadSuccess(doc) {
|
||||||
var viewables = doc.getRoot().getDefaultGeometry();
|
var viewables = doc.getRoot().getDefaultGeometry();
|
||||||
viewer.loadDocumentNode(doc, viewables).then(i => {
|
viewer.loadDocumentNode(doc, viewables).then(i => {
|
||||||
// documented loaded, any action?
|
// documented loaded, any action?
|
||||||
});
|
});
|
||||||
|
viewer.addEventListener(Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, (args) => {
|
||||||
|
var currSelection = viewer.getSelection();
|
||||||
|
var domElem = document.getElementById('id_printer');
|
||||||
|
domElem.innerText = currSelection[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () {
|
||||||
|
var instanceTree = viewer.model.getData().instanceTree;
|
||||||
|
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
|
||||||
|
var domElem = document.getElementById('all_id');
|
||||||
|
domElem.innerText = allDbIdsStr;
|
||||||
|
//allDbIdsStr.map(function (id) { return parseInt(id) });
|
||||||
|
//getAllLeafComponents(viewer, function (jsonData) {
|
||||||
|
// console.log("data: " + jsonData);
|
||||||
|
//});
|
||||||
|
//var a = getAllDbIds(viewer);
|
||||||
|
//console.log("a: " + a);//10952
|
||||||
|
|
||||||
|
let tree = viewer.model.getData().instanceTree;
|
||||||
|
let nodeId = 10952;
|
||||||
|
|
||||||
|
tree.enumNodeFragments(nodeId, function (frag) {
|
||||||
|
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||||
|
fragProxy.getAnimTransform();
|
||||||
|
//fragProxy.quaternion = new THREE.Quaternion().setFromAxisAngle(
|
||||||
|
// new THREE.Vector3(0, 0.3, 0),
|
||||||
|
// -Math.PI / 2);
|
||||||
|
//fragProxy.quaternion = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0));
|
||||||
|
//fragProxy.quaternion = new THREE.Quaternion().setPosition(new THREE.Vector3(10, 5, 0), 5);
|
||||||
|
//fragProxy.updateAnimTransform();
|
||||||
|
//do some work with fragment proxy
|
||||||
|
|
||||||
|
|
||||||
|
//var fragPosition = new THREE.Vector3(
|
||||||
|
// 10 - fragProxy.offset.x,
|
||||||
|
// 10 - fragProxy.offset.y,
|
||||||
|
// 10 - fragProxy.offset.z)
|
||||||
|
|
||||||
|
|
||||||
|
let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26
|
||||||
|
|
||||||
|
fragProxy.position = fragPosition
|
||||||
|
|
||||||
|
fragProxy.updateAnimTransform()
|
||||||
|
|
||||||
|
});
|
||||||
|
viewer.impl.sceneUpdated(true);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function setElevatorFloor(floor) {
|
||||||
|
if (floor == 0)
|
||||||
|
targetFloorZ = 0;
|
||||||
|
else if (floor == 1)
|
||||||
|
targetFloorZ = 15;
|
||||||
|
else if (floor == 2)
|
||||||
|
targetFloorZ = 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setElevatorSpeed(speed) { //0.01 ~ 1
|
||||||
|
elevatorSpeed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
function movElevator() {
|
||||||
|
|
||||||
|
|
||||||
|
let tree = viewer.model.getData().instanceTree;
|
||||||
|
let nodeId = 10952;
|
||||||
|
let fragProxyZ = 0;
|
||||||
|
var movStatus = 0; // 0=no 1=up 2=down
|
||||||
|
|
||||||
|
|
||||||
|
if (fragProxy.position.z > targetFloorZ) {
|
||||||
|
movStatus = 2
|
||||||
|
}
|
||||||
|
else if (fragProxy.position.z < targetFloorZ) {
|
||||||
|
movStatus = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (movStatus == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tree.enumNodeFragments(nodeId, function (frag) {
|
||||||
|
fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag);
|
||||||
|
fragProxy.getAnimTransform();
|
||||||
|
//let fragPosition = new THREE.Vector3(0, 0, 15);// 一樓0 二樓15 三樓 26
|
||||||
|
if (movStatus == 2) {
|
||||||
|
fragProxy.position.z -= elevatorSpeed;
|
||||||
|
}
|
||||||
|
else if (movStatus == 1) {
|
||||||
|
fragProxy.position.z += elevatorSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
fragProxyZ = fragProxy.position.z;
|
||||||
|
fragProxy.updateAnimTransform()
|
||||||
|
|
||||||
|
});
|
||||||
|
viewer.impl.sceneUpdated(true);
|
||||||
|
|
||||||
|
if (movStatus == 2) {
|
||||||
|
if (fragProxyZ >= targetFloorZ) {
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (movStatus == 1) {
|
||||||
|
if (fragProxyZ <= targetFloorZ) {
|
||||||
|
requestAnimationFrame(movElevator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//let fragPosition = new THREE.Vector3(position);// 一樓0 二樓15 三樓 26
|
||||||
|
|
||||||
|
//fragProxy.position = fragPosition;
|
||||||
|
|
||||||
|
//fragProxy.updateAnimTransform();
|
||||||
|
|
||||||
|
//viewer.impl.sceneUpdated(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAllDbIds(viewer) {
|
||||||
|
var instanceTree = viewer.model.getData().instanceTree;
|
||||||
|
|
||||||
|
var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex);
|
||||||
|
|
||||||
|
return allDbIdsStr.map(function (id) { return parseInt(id) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,35 +88,6 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i
|
|||||||
* @param {any} devicePath
|
* @param {any} devicePath
|
||||||
* @param {any} callback
|
* @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) {
|
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||||
var _result = "";
|
var _result = "";
|
||||||
var _ss = "";
|
var _ss = "";
|
||||||
@ -136,16 +107,16 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
|||||||
var _timestampTemp = new Date(record.get('timestamp').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();
|
_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());
|
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();
|
_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)
|
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
|
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++;
|
_index++;
|
||||||
},
|
},
|
||||||
after: function () {
|
after: function () {
|
||||||
|
@ -288,20 +288,20 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
|
|||||||
dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : "";
|
dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : "";
|
||||||
} else if (dateType == "date") {
|
} else if (dateType == "date") {
|
||||||
year = d.getFullYear();
|
year = d.getFullYear();
|
||||||
month = String(d.getMonth() + 1).padStart(2, '0');
|
month = d.getMonth() + 1;
|
||||||
day = String(d.getDate()).padStart(2, '0');
|
day = d.getDate();
|
||||||
} else if (dateType == "time") {
|
} else if (dateType == "time") {
|
||||||
hour = String(d.getHours()).padStart(2, '0');
|
hour = d.getHours();
|
||||||
minute = String(d.getMinutes()).padStart(2, '0');
|
minute = d.getMinutes();
|
||||||
} else if (dateType == "datetime") {
|
} else if (dateType == "datetime") {
|
||||||
year = d.getFullYear();
|
year = d.getFullYear();
|
||||||
month = String(d.getMonth() + 1).padStart(2, '0');
|
month = d.getMonth() + 1;
|
||||||
day = String(d.getDate()).padStart(2, '0');
|
day = d.getDate();
|
||||||
hour = String(d.getHours()).padStart(2, '0');
|
hour = d.getHours();
|
||||||
minute = String(d.getMinutes()).padStart(2, '0');
|
minute = d.getMinutes();
|
||||||
}
|
}
|
||||||
date = [year, month, day].filter(n => n).join("/");
|
date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/");
|
||||||
time = [hour, minute, second, millisecond].filter(n => n).join(":");
|
time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].filter(n => n).join(":");
|
||||||
result = date.toString() + " " + time.toString();
|
result = date.toString() + " " + time.toString();
|
||||||
|
|
||||||
if (dateType == "date") {
|
if (dateType == "date") {
|
||||||
|
@ -61,7 +61,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
|
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
|
||||||
@$"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,
|
@$"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.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
|
-- 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
|
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_normal_color = sub.device_normal_color;
|
||||||
history_Sub_System.device_close_color = sub.device_close_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_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);
|
history_Main_System.History_Sub_systems.Add(history_Sub_System);
|
||||||
}
|
}
|
||||||
@ -223,10 +226,10 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
foreach (var f in fl)
|
foreach (var f in fl)
|
||||||
{
|
{
|
||||||
List<DeviceLists> dl = new List<DeviceLists>();
|
List<DeviceLists> dl = new List<DeviceLists>();
|
||||||
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_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_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_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
|
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
|
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
|
and d.device_name_tag = dk.device_name_tag
|
||||||
|
@ -165,12 +165,14 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
|
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
|
||||||
@$"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
|
@$"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,
|
||||||
|
d.device_number, d.full_name as device_full_name, d.device_serial_tag
|
||||||
from role_auth a
|
from role_auth a
|
||||||
join auth_page b on a.AuthCode = b.AuthCode
|
join auth_page b on a.AuthCode = b.AuthCode
|
||||||
join userinfo c on c.role_guid = a.role_guid
|
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 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
|
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
|
||||||
|
left join device d on v1.system_value = d.device_system_tag and v2.system_value = d.device_name_tag and d.deleted = 0
|
||||||
where c.account = @account
|
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 });
|
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
|
||||||
var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
|
var dbbuilding = await frontendRepository.GetAllAsync<History_Build>(
|
||||||
@ -189,21 +191,76 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
History_Main_system history_Main_System = new History_Main_system();
|
History_Main_system history_Main_System = new History_Main_system();
|
||||||
history_Main_System.main_system_tag = main.Select(a => a.main_system_tag).FirstOrDefault();
|
history_Main_System.main_system_tag = main.Select(a => a.main_system_tag).FirstOrDefault();
|
||||||
history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
|
history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
|
||||||
history_Main_System.History_Sub_systems = new List<History_Sub_system>();
|
|
||||||
|
|
||||||
var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList();
|
var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).GroupBy(x => x.sub_system_tag).ToList();
|
||||||
|
history_Main_System.History_Sub_systems = subs.Count > 0 ? new List<History_Sub_system>() : null;
|
||||||
foreach (var sub in subs)
|
foreach (var sub in subs)
|
||||||
{
|
{
|
||||||
History_Sub_system history_Sub_System = new History_Sub_system();
|
History_Sub_system history_Sub_System = new History_Sub_system();
|
||||||
history_Sub_System.full_name = sub.sub_name;
|
history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault();
|
||||||
history_Sub_System.sub_system_tag = sub.sub_system_tag;
|
history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
|
var devices = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault() && x.sub_system_tag == sub.Select(x => x.sub_system_tag).FirstOrDefault() && x.device_number != null).ToList();
|
||||||
|
history_Sub_System.device = devices.Count > 0 ? new List<Device>() : null;
|
||||||
|
foreach (var d in devices)
|
||||||
|
{
|
||||||
|
Device device = new Device();
|
||||||
|
device.device_number = d.device_number;
|
||||||
|
device.device_serial_tag = d.device_serial_tag;
|
||||||
|
device.full_name = d.device_full_name;
|
||||||
|
history_Sub_System.device.Add(device);
|
||||||
|
}
|
||||||
|
|
||||||
history_Main_System.History_Sub_systems.Add(history_Sub_System);
|
history_Main_System.History_Sub_systems.Add(history_Sub_System);
|
||||||
}
|
}
|
||||||
apiResult.Data.history_Main_Systems.Add(history_Main_System);
|
apiResult.Data.history_Main_Systems.Add(history_Main_System);
|
||||||
}
|
}
|
||||||
apiResult.Data.history_Builds = dbbuilding;
|
apiResult.Data.history_Builds = dbbuilding;
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 即時趨勢條件過濾條件面板
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="account"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("api/History/GetDevPoi")]
|
||||||
|
public async Task<ActionResult<ApiResult<List<DeviceItem>>>> GetDevPoi([FromBody] HistoryFind hf)
|
||||||
|
{
|
||||||
|
ApiResult<List<DeviceItem>> apiResult = new ApiResult<List<DeviceItem>>(jwt_str);
|
||||||
|
if (!jwtlife)
|
||||||
|
{
|
||||||
|
apiResult.Code = "5000";
|
||||||
|
return BadRequest(apiResult);
|
||||||
|
}
|
||||||
|
else if (string.IsNullOrEmpty(hf.device_number))
|
||||||
|
{
|
||||||
|
apiResult.Code = "0002";
|
||||||
|
apiResult.Msg = "必須選擇設備";
|
||||||
|
return apiResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<DeviceItem> deviceItems = new List<DeviceItem>();
|
||||||
|
var main_system_value = hf.device_number.Split('_')[2];
|
||||||
|
var sub_system_value = hf.device_number.Split('_')[3];
|
||||||
|
var sqlString = $@"select * from device_item where deleted = 0 and device_system_tag = @main_system_value and device_name_tag = @sub_system_value";
|
||||||
|
deviceItems = await frontendRepository.GetAllAsync<DeviceItem>(sqlString, new { @main_system_value = main_system_value, @sub_system_value = sub_system_value });
|
||||||
|
|
||||||
|
apiResult.Data = deviceItems;
|
||||||
|
apiResult.Code = "0000";
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
@ -161,6 +161,7 @@ namespace FrontendWebApi.Models
|
|||||||
public string device_floor_tag { get; set; }
|
public string device_floor_tag { get; set; }
|
||||||
public string device_name_tag { get; set; }
|
public string device_name_tag { get; set; }
|
||||||
public string device_serial_tag { get; set; }
|
public string device_serial_tag { get; set; }
|
||||||
|
public string device_last_name { get; set; }
|
||||||
public string device_system_category_layer3 { get; set; }
|
public string device_system_category_layer3 { get; set; }
|
||||||
public string device_ip { get; set; }
|
public string device_ip { get; set; }
|
||||||
public string device_port { get; set; }
|
public string device_port { get; set; }
|
||||||
|
@ -36,34 +36,37 @@ namespace FrontendWebApi.Models
|
|||||||
public string device_coordinate { get; set; }
|
public string device_coordinate { get; set; }
|
||||||
public string device_coordinate_3d { get; set; }
|
public string device_coordinate_3d { get; set; }
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
//public string device_status
|
public string device_status
|
||||||
//{
|
{
|
||||||
// get
|
get
|
||||||
// {
|
{
|
||||||
// Dictionary<string, string> name = new Dictionary<string, string>()
|
Dictionary<string, string> name = new Dictionary<string, string>()
|
||||||
// {
|
{
|
||||||
// { "0", "關閉"},
|
{ "0", "關閉"},
|
||||||
// { "1", "正常"},
|
{ "1", "正常"},
|
||||||
// { "2", "異常"}
|
{ "2", "異常"}
|
||||||
// };
|
};
|
||||||
// return name[status];
|
return name[status];
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
public string device_image { get; set; }
|
public string device_image { get; set; }
|
||||||
public string device_image_url { get; set; }
|
public string device_image_url { get; set; }
|
||||||
public string device_normal_point_id { get; set; }
|
public string device_normal_point_id { get; set; }
|
||||||
public string device_normal_point_guid { get; set; }
|
public string device_normal_point_guid { get; set; }
|
||||||
public string device_normal_point_col { 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_point_value { get; set; }
|
||||||
public string device_normal_flashing { get; set; }
|
public string device_normal_flashing { get; set; }
|
||||||
public string device_close_point_id { get; set; }
|
public string device_close_point_id { get; set; }
|
||||||
public string device_close_point_guid { get; set; }
|
public string device_close_point_guid { get; set; }
|
||||||
public string device_close_point_col { 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_point_value { get; set; }
|
||||||
public string device_close_flashing { get; set; }
|
public string device_close_flashing { get; set; }
|
||||||
public string device_error_point_id { get; set; }
|
public string device_error_point_id { get; set; }
|
||||||
public string device_error_point_guid { get; set; }
|
public string device_error_point_guid { get; set; }
|
||||||
public string device_error_point_col { 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_point_value { get; set; }
|
||||||
public string device_error_flashing { get; set; }
|
public string device_error_flashing { get; set; }
|
||||||
public List<DeviceNode> Device_nodes { get; set; }
|
public List<DeviceNode> Device_nodes { get; set; }
|
||||||
|
@ -59,6 +59,9 @@ namespace FrontendWebApi.Models
|
|||||||
public string main_name { get; set; }
|
public string main_name { get; set; }
|
||||||
public string sub_system_tag { get; set; }
|
public string sub_system_tag { get; set; }
|
||||||
public string sub_name { get; set; }
|
public string sub_name { get; set; }
|
||||||
|
public string device_number { get; set; }
|
||||||
|
public string device_full_name { get; set; }
|
||||||
|
public string device_serial_tag { get; set; }
|
||||||
public string device_normal_color { get; set; }
|
public string device_normal_color { get; set; }
|
||||||
public string device_close_color { get; set; }
|
public string device_close_color { get; set; }
|
||||||
public string device_error_color { get; set; }
|
public string device_error_color { get; set; }
|
||||||
@ -70,11 +73,16 @@ namespace FrontendWebApi.Models
|
|||||||
public byte device_item_is_controll { get; set; }
|
public byte device_item_is_controll { get; set; }
|
||||||
public byte device_item_is_bool { get; set; }
|
public byte device_item_is_bool { get; set; }
|
||||||
public byte device_item_is_link { 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
|
public class HistoryFind
|
||||||
{
|
{
|
||||||
public string building_tag { get; set; }
|
public string building_tag { get; set; }
|
||||||
|
public string device_number { get; set; }
|
||||||
}
|
}
|
||||||
public class BuildingFloorRawData
|
public class BuildingFloorRawData
|
||||||
{
|
{
|
||||||
@ -114,6 +122,10 @@ namespace FrontendWebApi.Models
|
|||||||
public string device_normal_color { get; set; }
|
public string device_normal_color { get; set; }
|
||||||
public string device_close_color { get; set; }
|
public string device_close_color { get; set; }
|
||||||
public string device_error_color { get; set; }
|
public string device_error_color { get; set; }
|
||||||
|
public List<Device> device { 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
|
public class History_PostDevice
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user