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": { "BackgroundServiceCron": {
"ExecutionBackgroundServicePlanJob": "0 0 1 * * ?", "ExecutionBackgroundServicePlanJob": "0 0 2 * * ?",
"MessageNotificationJob": "0 0 1 * * ?", "MessageNotificationJob": "0 0 2 * * ?",
"DataDeliveryJob": "0 0 1 * * ?", "DataDeliveryJob": "0 0 2 * * ?",
"RegularUpdateDBTableJob": "0 0 1 * * ?", "RegularUpdateDBTableJob": "0 0 2 * * ?",
"ParkingJob": "0 0 1 * * ?", "ParkingJob": "0 0 2 * * ?",
"ArchiveElectricMeterHourJob": "0 0 1 * * ?", "ArchiveElectricMeterHourJob": "0 0 2 * * ?",
"ArchiveElectricMeterDayJob": "0 0 1 * * ?", "ArchiveElectricMeterDayJob": "0 0 2 * * ?",
"WeatherAPIJob": "0/5 * * * * ?" "WeatherAPIJob": "0/5 * * * * ?"
}, },
"DBConfig": { "DBConfig": {

View File

@ -55,7 +55,6 @@
$(function () { $(function () {
$(loadEle).Loading("start"); $(loadEle).Loading("start");
getBuildMenu((arr, data) => { getBuildMenu((arr, data) => {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@", arr, data);
buildMenuData = data; buildMenuData = data;
if (arr.indexOf(4) != -1) { if (arr.indexOf(4) != -1) {
getFloDevList(arr[0] == 4 ? "left" : "right"); getFloDevList(arr[0] == 4 ? "left" : "right");
@ -119,7 +118,7 @@
let deviceCloseArr = []; let deviceCloseArr = [];
myBaja.setSubscribeDevicesCallBack(function (data) { myBaja.setSubscribeDevicesCallBack(function (data) {
// console.log(data) console.log("subDevice 開始");
let matchDevice = allDevList.filter( let matchDevice = allDevList.filter(
(x) => x.device_number == data.device_number_full (x) => x.device_number == data.device_number_full
)[0]; )[0];
@ -237,15 +236,10 @@
(device) => device.device_number === matchDevice.device_number (device) => device.device_number === matchDevice.device_number
) )
) { ) {
if (pageAct.sysSubTag === "L1") { $(`#${matchDevice.device_number}_status`)
$(`#${matchDevice.device_number}_status`) .attr("data-light-error-type", "error")
.attr("data-light-error-type", "error") .data("light-error-type", "error");
.data("light-error-type", "error");
} else {
$(`#${matchDevice.device_number}_status`)
.attr("data-light-type", "error")
.data("light-type", "error");
}
alarmDbIdList.push(matchDevice); alarmDbIdList.push(matchDevice);
} else if ( } else if (
data.point_name == errDevPoiName && data.point_name == errDevPoiName &&
@ -260,8 +254,21 @@
} }
if ( if (
allDevList.length === deviceCloseArr.length === 0 &&
deviceNormalArr.length + deviceCloseArr.length + alarmDbIdList.length 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( changeColorForHotspot(
deviceNormalArr.map(({ spriteDbid }) => spriteDbid), deviceNormalArr.map(({ spriteDbid }) => spriteDbid),
@ -292,166 +299,12 @@
if (data.findIndex((x) => x.point_name == "CO2") != -1) { if (data.findIndex((x) => x.point_name == "CO2") != -1) {
// 顯示溫度條 // 顯示溫度條
showHeatCO2("[name=forgeHeatBar]"); 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]"); 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) { } function lightDevForgeSpotLig(devObj) { }
@ -605,9 +458,9 @@
endPageLoading(); endPageLoading();
} else { } else {
// 訂閱 baja 設備 // 訂閱 baja 設備
if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") { // if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") {
subDevice(); // subDevice();
} // }
} }
// 繪製 html // 繪製 html
@ -865,14 +718,14 @@
.map((y) => x) .map((y) => x)
); );
for (let sub of stSubArr) { // for (let sub of stSubArr) {
let matchDevice = allDevList.filter( // let matchDevice = allDevList.filter(
(x) => x.device_number == sub[0]?.device_number // (x) => x.device_number == sub[0]?.device_number
)[0]; // )[0];
if (matchDevice) { // if (matchDevice) {
setForgeHotSpotColor(matchDevice); // setForgeHotSpotColor(matchDevice);
} // }
} // }
} }
if (pageAct.sysSubTag == "W2") { if (pageAct.sysSubTag == "W2") {
// console.log("@@",pageAct, pageAct.sub_system_tag) // console.log("@@",pageAct, pageAct.sub_system_tag)
@ -1036,11 +889,14 @@
allDevList.forEach((dev, idx) => { allDevList.forEach((dev, idx) => {
if (dev.device_number == devNum) { if (dev.device_number == devNum) {
dev.spriteDbid = dbid; dev.spriteDbid = dbid;
setForgeHotSpotColor(dev); // setForgeHotSpotColor(dev);
} }
}); });
$(ele).data("dbId", dbid); $(ele).data("dbId", dbid);
}); });
if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") {
subDevice();
}
}); });
onEvent("yt:tooltip:show", "[name=devItem]", function (e, obj) { onEvent("yt:tooltip:show", "[name=devItem]", function (e, obj) {

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -922,9 +922,9 @@ async function addHotPoint(data) {
return; return;
} else { } else {
spriteColor = new THREE.Color(0xffffff); 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) { 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}`); // console.log(`Sprite clicked: ${event.dbId}`);
for (let i = dbIdStart; i <= myDataList.length + 10; i++) { for (let i = dbIdStart; i <= myDataList.length + 10; i++) {
!alarmDbIdList.some((dbId) => dbId == i) && !alarmDbIdList.some(({ spriteDbid }) => spriteDbid == i) &&
pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(i); changeColorForHotspot(i);
changeScaleForHotspot(i, true); changeScaleForHotspot(i, true);
@ -990,7 +990,7 @@ async function addHotPoint(data) {
} }
$(selector).trigger("autodesk:click:sprite", { event, myData }); $(selector).trigger("autodesk:click:sprite", { event, myData });
} else { } else {
!alarmDbIdList.some((dbId) => dbId == i) && !alarmDbIdList.some(({ spriteDbid }) => spriteDbid == event.dbId) &&
pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "L1" &&
changeColorForHotspot(event.dbId, null); changeColorForHotspot(event.dbId, null);
changeScaleForHotspot(event.dbId, false); 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"); const dataVizExtn = await viewer.loadExtension("Autodesk.DataVisualization");
let spriteColorFocus = new THREE.Color(0xffffff); let spriteColorFocus = new THREE.Color(0xffffff);
if (pageAct.sysSubTag == "L1") {
spriteColorFocus = lightOn spriteColorFocus = OnOff
? new THREE.Color(0xffd524) ? pageAct.sysSubObj.device_normal_color
: new THREE.Color(0x40525e); ? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_normal_color))
if (lightOn) { : new THREE.Color(0xffffff)
console.log(dbId); : pageAct.sysSubObj.device_close_color
} ? new THREE.Color(hexToRgb(pageAct.sysSubObj.device_close_color))
} else if (type == "focus" && pageAct.sysSubTag !== "M12") { : new THREE.Color(0xffffff);
if (type == "focus") {
spriteColorFocus = new THREE.Color(0x00ffe1); spriteColorFocus = new THREE.Color(0x00ffe1);
} else if (type == "error") { } 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; const viewablesToUpdate = dbId;
dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => { dataVizExtn.invalidateViewables(viewablesToUpdate, (viewable) => {
return { return {
url: "/file/img/forge/sensor_circle.svg",
color: spriteColorFocus, color: spriteColorFocus,
}; };
}); });

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
using FrontendWebApi.Models; using FrontendWebApi.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Repository.BackendRepository.Interface; using Repository.BackendRepository.Interface;
using Repository.FrontendRepository.Interface; using Repository.FrontendRepository.Interface;
@ -252,6 +253,18 @@ namespace FrontendWebApi.ApiControllers
} }
buildingMenus.Add(building1); 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.Data = buildingMenus;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }
@ -318,7 +331,6 @@ namespace FrontendWebApi.ApiControllers
} }
sub_System.Floors = Floors; sub_System.Floors = Floors;
apiResult.Data = sub_System; apiResult.Data = sub_System;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }
@ -425,6 +437,7 @@ namespace FrontendWebApi.ApiControllers
} }
try 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 main_system_guidsql = "";
var sub_system_guidsql = ""; var sub_system_guidsql = "";
var disasterjoinsql = ""; var disasterjoinsql = "";
@ -437,7 +450,10 @@ namespace FrontendWebApi.ApiControllers
} }
if (!String.IsNullOrEmpty(post.sub_system_tag)) 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)) if (!String.IsNullOrEmpty(post.device_system_category_layer3))
{ {