This commit is contained in:
dev01 2023-05-30 18:30:03 +08:00
commit bfa2e59b87
7 changed files with 3274 additions and 3307 deletions

View File

@ -7,13 +7,13 @@
}
},
"BackgroundServiceCron": {
"ExecutionBackgroundServicePlanJob": "0 0 1 * * ?",
"MessageNotificationJob": "0 0 1 * * ?",
"DataDeliveryJob": "0 0 1 * * ?",
"RegularUpdateDBTableJob": "0 0 1 * * ?",
"ParkingJob": "0 0 1 * * ?",
"ArchiveElectricMeterHourJob": "0 0 1 * * ?",
"ArchiveElectricMeterDayJob": "0 0 1 * * ?",
"ExecutionBackgroundServicePlanJob": "0 0 2 * * ?",
"MessageNotificationJob": "0 0 2 * * ?",
"DataDeliveryJob": "0 0 2 * * ?",
"RegularUpdateDBTableJob": "0 0 2 * * ?",
"ParkingJob": "0 0 2 * * ?",
"ArchiveElectricMeterHourJob": "0 0 2 * * ?",
"ArchiveElectricMeterDayJob": "0 0 2 * * ?",
"WeatherAPIJob": "0/5 * * * * ?"
},
"DBConfig": {

View File

@ -55,7 +55,6 @@
$(function () {
$(loadEle).Loading("start");
getBuildMenu((arr, data) => {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@", arr, data);
buildMenuData = data;
if (arr.indexOf(4) != -1) {
getFloDevList(arr[0] == 4 ? "left" : "right");
@ -119,7 +118,7 @@
let deviceCloseArr = [];
myBaja.setSubscribeDevicesCallBack(function (data) {
// console.log(data)
console.log("subDevice 開始");
let matchDevice = allDevList.filter(
(x) => x.device_number == data.device_number_full
)[0];
@ -237,15 +236,10 @@
(device) => device.device_number === matchDevice.device_number
)
) {
if (pageAct.sysSubTag === "L1") {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-error-type", "error")
.data("light-error-type", "error");
} else {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-type", "error")
.data("light-type", "error");
}
$(`#${matchDevice.device_number}_status`)
.attr("data-light-error-type", "error")
.data("light-error-type", "error");
alarmDbIdList.push(matchDevice);
} else if (
data.point_name == errDevPoiName &&
@ -260,8 +254,21 @@
}
if (
allDevList.length ===
deviceNormalArr.length + deviceCloseArr.length + alarmDbIdList.length
deviceCloseArr.length === 0 &&
alarmDbIdList.some(
(device) => device.device_number === matchDevice.device_number
)
) {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-type", "error")
.data("light-type", "error");
}
if (
(!pageAct.floTag &&
allDevList.length ===
deviceNormalArr.length + deviceCloseArr.length) ||
allDevList.length === deviceNormalArr.length + alarmDbIdList.length
) {
changeColorForHotspot(
deviceNormalArr.map(({ spriteDbid }) => spriteDbid),
@ -292,166 +299,12 @@
if (data.findIndex((x) => x.point_name == "CO2") != -1) {
// 顯示溫度條
showHeatCO2("[name=forgeHeatBar]");
} else if (data.findIndex((x) => x.point_name == "Temp") != -1) {
} else if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) {
// 顯示溫度條
showHeat("[name=forgeHeatBar]");
}
});
}
// function subDevice() {
// let myBaja = new subscriptionDevices();
// var ordPath = {
// area_tag: pageAct.AreaTag,
// building_tag: pageAct.buiTag,
// system_tag: pageAct.sysMainTag,
// name_tag: pageAct.sysSubTag,
// };
// myBaja.setSubscribeDevicesByBql(ordPath);
// // 燈熱點用
// let lightOnHotColorArr = [];
// let lightOffHotColorArr = [];
// // 燈光圈用
// let lightOnGuidArr = [];
// let lightOffGuidArr = [];
// myBaja.setSubscribeDevicesCallBack(function (data) {
// // console.log(data)
// let matchDevice = allDevList.filter(
// (x) => x.device_number == data.device_number_full
// )[0];
// if (!matchDevice) {
// return false;
// }
// //將訂閱值塞入 subDeviceData
// if (
// subDeviceData.findIndex(
// (x) => x.device_number == matchDevice.device_number
// ) == -1
// ) {
// let obj = {};
// obj.device_number = matchDevice.device_number;
// obj.dbid = matchDevice.forge_dbid;
// subDeviceData.push(obj);
// }
// let subData = subDeviceData.filter(
// (x) => x.device_number == matchDevice.device_number
// )[0];
// 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 == "ONOFF" && pageAct.sysSubTag === "L1") {
// const lightOn = data.value.includes("true");
// setLightOpenOrClose(lightOn, matchDevice.device_guid);
// if (lightOn) {
// setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
// // changeColorForHotspot(matchDevice.spriteDbid, null, true)
// if (
// !lightOnHotColorArr.some(
// ({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
// )
// ) {
// lightOnHotColorArr.push(matchDevice);
// }
// lightOffHotColorArr = lightOffHotColorArr.filter(
// (light) => light.spriteDbid !== matchDevice.spriteDbid
// );
// heatMap?.changeTemp(matchDevice.device_number, 40);
// } else {
// setLightValues(matchDevice.device_guid, 0, 0xffffff);
// // changeColorForHotspot(matchDevice.spriteDbid)
// if (
// !lightOffHotColorArr.some(
// ({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid
// )
// ) {
// lightOffHotColorArr.push(matchDevice);
// }
// lightOnHotColorArr = lightOnHotColorArr.filter(
// (light) => light.spriteDbid !== matchDevice.spriteDbid
// );
// heatMap?.changeTemp(matchDevice.device_number, 0);
// }
// }
// if (data.point_name == "Temp") {
// heatMap?.changeTemp(
// data.device_number_full,
// !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0
// );
// let devIdx = allDevList.findIndex(
// (x) => x.device_number == data.device_number_full
// );
// allDevList[devIdx]._temp = !isNaN(parseInt(data.value))
// ? parseInt(data.value)
// : 0;
// }
// 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");
// }
// if (
// allDevList.length ===
// lightOnHotColorArr.length + lightOffHotColorArr.length
// ) {
// changeColorForHotspot(
// lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid),
// null,
// true
// );
// changeColorForHotspot(
// lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid),
// null,
// false
// );
// }
// $(loadEle).Loading("close");
// setLightColor();
// setForgeHotSpotColor(matchDevice);
// lightDevForgeSpotLig(matchDevice);
// // 從設備訂閱更新每個設備卡片即時點位
// setDevItemPoiValBySub(data);
// });
// myBaja.setSubscribeDeviceEndCallBack(function (data) {
// endPageLoading();
// if (data.findIndex((x) => x.point_name == "Temp") != -1) {
// // 顯示溫度條
// showHeat("[name=forgeHeatBar]");
// }
// });
// }
function lightDevForgeSpotLig(devObj) { }
@ -605,9 +458,9 @@
endPageLoading();
} else {
// 訂閱 baja 設備
if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") {
subDevice();
}
// if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") {
// subDevice();
// }
}
// 繪製 html
@ -865,14 +718,14 @@
.map((y) => x)
);
for (let sub of stSubArr) {
let matchDevice = allDevList.filter(
(x) => x.device_number == sub[0]?.device_number
)[0];
if (matchDevice) {
setForgeHotSpotColor(matchDevice);
}
}
// for (let sub of stSubArr) {
// let matchDevice = allDevList.filter(
// (x) => x.device_number == sub[0]?.device_number
// )[0];
// if (matchDevice) {
// setForgeHotSpotColor(matchDevice);
// }
// }
}
if (pageAct.sysSubTag == "W2") {
// console.log("@@",pageAct, pageAct.sub_system_tag)
@ -1036,11 +889,14 @@
allDevList.forEach((dev, idx) => {
if (dev.device_number == devNum) {
dev.spriteDbid = dbid;
setForgeHotSpotColor(dev);
// setForgeHotSpotColor(dev);
}
});
$(ele).data("dbId", dbid);
});
if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") {
subDevice();
}
});
onEvent("yt:tooltip:show", "[name=devItem]", function (e, obj) {

View File

@ -43,6 +43,7 @@
var zoomToggle = 1.3;
$(function () {
$(loadEle).Loading("start");
alarmDbIdList = [];
$("#topLight").html(setTopLight());
setLightColor();
initChart();
@ -442,7 +443,7 @@
});
cData._dbId = dbid;
cData.spriteDbid = dbid;
setForgeHotSpotColor(cData);
// setForgeHotSpotColor(cData);
});
});
floChart.setOption(option);
@ -597,9 +598,36 @@
heatMap?.changeTemp(matchDevice.device_number, 0);
}
}
if (
data.point_name == errDevPoiName &&
data.value !== matchDevice.device_error_point_value &&
alarmDbIdList.some(
({ device_number }) => matchDevice.device_number === device_number
)
) {
alarmDbIdList = alarmDbIdList.filter(
({ device_number }) => matchDevice.device_number === device_number
);
} else if (
data.point_name == errDevPoiName &&
data.value == matchDevice.device_error_point_value &&
!alarmDbIdList.some(
({ device_number }) => matchDevice.device_number === device_number
)
) {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-type", "error")
.data("light-type", "error");
alarmDbIdList.push(matchDevice);
}
if (
data.point_name == norDevPoiName &&
data.value == matchDevice.device_normal_point_value
data.value == matchDevice.device_normal_point_value &&
!deviceScatterNormalArr.some(
({ device_number }) => data.device_number_full === device_number
)
) {
//顯示正常燈號
$(`#${matchDevice.device_number}_status`)
@ -609,120 +637,114 @@
deviceScatterCloseArr = deviceScatterCloseArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
deviceScatterErrorArr = deviceScatterErrorArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
} else if (
data.point_name == cloDevPoiName &&
data.value == matchDevice.device_close_point_value
data.value == matchDevice.device_close_point_value &&
!deviceScatterCloseArr.some(
({ device_number }) => data.device_number_full === device_number
)
) {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-type", "close")
.data("light-type", "close");
deviceScatterCloseArr.push(matchDevice);
deviceScatterNormalArr = deviceScatterNormalArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
deviceScatterErrorArr = deviceScatterErrorArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
} 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");
deviceScatterErrorArr.push(matchDevice);
deviceScatterNormalArr = deviceScatterNormalArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
deviceScatterCloseArr = deviceScatterCloseArr.filter(
(device) => device.spriteDbid !== matchDevice.spriteDbid
);
}
console.log(deviceScatterCloseArr.length,
deviceScatterNormalArr.length,
deviceScatterErrorArr.length)
if (pageAct.sysSubTag === "L1" && lightControl === "node") {
alarmDbIdList = alarmDbIdList.filter(
({ device_node_guid }) =>
device_node_guid !== undefined && device_node_guid !== null
);
deviceScatterNormalArr = deviceScatterNormalArr.filter(
({ device_node_guid }) =>
device_node_guid !== undefined && device_node_guid !== null
);
deviceScatterCloseArr = deviceScatterCloseArr.filter(
({ device_node_guid }) =>
device_node_guid !== undefined && device_node_guid !== null
);
lightOnHotColorArr = lightOnHotColorArr.filter(
({ device_node_guid }) =>
device_node_guid !== undefined && device_node_guid !== null
);
lightOffHotColorArr = lightOffHotColorArr.filter(
({ device_node_guid }) =>
device_node_guid !== undefined && device_node_guid !== null
);
}
if (
option.series[0].data.length ===
lightOnHotColorArr.length + lightOffHotColorArr.length
deviceScatterCloseArr.length + deviceScatterNormalArr.length ===
option.series[0].data.length ||
deviceScatterCloseArr.length +
deviceScatterNormalArr.length +
alarmDbIdList.length ===
option.series[0].data.length
) {
lightOnHotColorArr.forEach((light) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === light.device_number
);
deviceScatterNormalArr.length &&
deviceScatterNormalArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const onColor = currentData.find(
({ device_number }) => device_number === light.device_number
).device_normal_color;
cur.itemStyle = { color: onColor };
});
lightOffHotColorArr.forEach((light) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === light.device_number
);
const offColor = currentData.find(
({ device_number }) => device_number === light.device_number
).device_close_color;
cur.itemStyle = { color: offColor };
});
floChart.setOption(option);
const normalColor = currentData.find(
({ device_number }) => device_number === device.device_number
).device_normal_color;
if (cur) {
cur.itemStyle = { color: normalColor };
}
});
changeColorForHotspot(
lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid),
deviceScatterNormalArr.map(({ spriteDbid }) => spriteDbid),
null,
true
);
deviceScatterCloseArr.length &&
deviceScatterCloseArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const closeColor = currentData.find(
({ device_number }) => device_number === device.device_number
).device_close_color;
if (cur) {
cur.itemStyle = { color: closeColor };
}
});
changeColorForHotspot(
lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid),
deviceScatterCloseArr.map(({ spriteDbid }) => spriteDbid),
null,
false
);
$(loadEle).Loading("close");
} else if (
deviceScatterCloseArr.length +
deviceScatterNormalArr.length +
deviceScatterErrorArr.length ===
option.series[0].data.length
) {
deviceScatterNormalArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const normalColor = currentData.find(
({ device_number }) => device_number === device.device_number
).device_normal_color;
cur.itemStyle = { color: normalColor };
});
alarmDbIdList.length &&
alarmDbIdList.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const errColor = currentData.find(
({ device_number }) => device_number === device.device_number
)?.device_error_color;
deviceScatterCloseArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const closeColor = currentData.find(
({ device_number }) => device_number === device.device_number
).device_close_color;
cur.itemStyle = { color: closeColor };
});
deviceScatterErrorArr.forEach((device) => {
const cur = option.series[0].data.find(
({ device_number }) => device_number === device.device_number
);
const errColor = currentData.find(
({ device_number }) => device_number === device.device_number
).device_error_color;
cur.itemStyle = { color: errColor };
});
if (cur) {
cur.itemStyle = { color: errColor };
}
});
changeColorForHotspot(
alarmDbIdList.map(({ spriteDbid }) => spriteDbid),
"error",
false
);
floChart.setOption(option);
setForgeHotSpotColor(matchDevice);
$(loadEle).Loading("close");
}
});
@ -1595,7 +1617,6 @@
});
};
}
if (pageAct.sysSubTag === "M12" && !elevatorShow) {
let sensorObjs = [];
addHotPoint(viewer);

File diff suppressed because it is too large Load Diff

View File

@ -922,9 +922,9 @@ async function addHotPoint(data) {
return;
} else {
spriteColor = new THREE.Color(0xffffff);
spriteIcon = "/file/img/forge/hotspot.svg";
spriteIcon = "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) {
spriteIcon = "/img/forge/hotspot.svg";
spriteIcon = "/img/forge/sensor_circle.svg";
}
}
@ -973,7 +973,7 @@ async function addHotPoint(data) {
// console.log(`Sprite clicked: ${event.dbId}`);
for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
!alarmDbIdList.some((dbId) => dbId == i) &&
!alarmDbIdList.some(({ spriteDbid }) => spriteDbid == i) &&
pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(i);
changeScaleForHotspot(i, true);
@ -990,7 +990,7 @@ async function addHotPoint(data) {
}
$(selector).trigger("autodesk:click:sprite", { event, myData });
} else {
!alarmDbIdList.some((dbId) => dbId == i) &&
!alarmDbIdList.some(({ spriteDbid }) => spriteDbid == event.dbId) &&
pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(event.dbId, null);
changeScaleForHotspot(event.dbId, false);
@ -1038,25 +1038,47 @@ async function addHotPoint(data) {
//}
}
//hex -> rgbsensor_circle
function hexToRgb(hex) {
return (
"rgb(" +
parseInt("0x" + hex.slice(1, 3)) +
"," +
parseInt("0x" + hex.slice(3, 5)) +
"," +
parseInt("0x" + hex.slice(5, 7)) +
")"
);
}
// 熱點 更換顏色
async function changeColorForHotspot(dbId, type = null, lightOn = false) {
async function changeColorForHotspot(dbId, type = null, OnOff = false) {
const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0xffffff);
if (pageAct.sysSubTag == "L1") {
spriteColorFocus = lightOn
? new THREE.Color(0xffd524)
: new THREE.Color(0x40525e);
if (lightOn) {
console.log(dbId);
}
} else if (type == "focus" && pageAct.sysSubTag !== "M12") {
spriteColorFocus = OnOff
? pageAct.sysSubObj.device_normal_color
? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_normal_color))
: new THREE.Color(0xffffff)
: pageAct.sysSubObj.device_close_color
? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_close_color))
: new THREE.Color(0xffffff);
if (type == "focus") {
spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") {
spriteColorFocus = new THREE.Color(0xff0000);
spriteColorFocus = new THREE.Color(
hexToRgb(pageAct.sysSubObj.device_error_color)
);
spriteErrIcon = baseForgeApiUrl + "/file/img/forge/sensor_circle.svg";
if (location.href.indexOf("localhost:5966") != -1) {
spriteErrIcon = baseForgeApiUrl + "/img/forge/sensor_circle.svg";
}
}
const viewablesToUpdate = dbId;
dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
return {
url: "/file/img/forge/sensor_circle.svg",
color: spriteColorFocus,
};
});

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
using FrontendWebApi.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface;
@ -252,6 +253,18 @@ namespace FrontendWebApi.ApiControllers
}
buildingMenus.Add(building1);
}
var projectName = await backendRepository.GetOneAsync<string>($"select system_value from variable where system_type = 'project_name' and deleted = 0");
if (!string.IsNullOrEmpty(projectName) && projectName.Contains("ibms_dome")) //處理安全系統 的緊急壓扣, 閃光喇叭小類
{
foreach(var bm in buildingMenus)
{
var safeSystem = bm.main_system.Where(x => x.main_system_tag == "S").FirstOrDefault();
var EmerBuckle = safeSystem.Sub_system.Where(x => x.sub_system_tag == "P").ToList();
EmerBuckle.AddRange(safeSystem.Sub_system.Where(x => x.sub_system_tag == "B").ToList());
safeSystem.Sub_system.RemoveAll(x => x.sub_system_tag == "B");
}
}
apiResult.Data = buildingMenus;
apiResult.Code = "0000";
}
@ -318,7 +331,6 @@ namespace FrontendWebApi.ApiControllers
}
sub_System.Floors = Floors;
apiResult.Data = sub_System;
apiResult.Code = "0000";
}
@ -425,6 +437,7 @@ namespace FrontendWebApi.ApiControllers
}
try
{
var projectName = await backendRepository.GetOneAsync<string>($"select system_value from variable where system_type = 'project_name' and deleted = 0");
var main_system_guidsql = "";
var sub_system_guidsql = "";
var disasterjoinsql = "";
@ -437,7 +450,10 @@ namespace FrontendWebApi.ApiControllers
}
if (!String.IsNullOrEmpty(post.sub_system_tag))
{
sub_system_guidsql = $" and d.device_name_tag = '{post.sub_system_tag}'";
if (!string.IsNullOrEmpty(projectName) && projectName.Contains("ibms_dome") && (post.main_system_tag == "S" && post.sub_system_tag == "P"))
sub_system_guidsql = $@" and (d.device_name_tag = '{post.sub_system_tag}' or d.device_name_tag = 'B')";
else
sub_system_guidsql = $" and d.device_name_tag = '{post.sub_system_tag}'";
}
if (!String.IsNullOrEmpty(post.device_system_category_layer3))
{