更新 device 資料表 room_dbid, room_name

This commit is contained in:
Celeste6666 2023-01-16 11:03:53 +08:00
parent 6d57a2b200
commit d3df21b0b9
5 changed files with 714 additions and 693 deletions

File diff suppressed because it is too large Load Diff

View File

@ -269,6 +269,7 @@ namespace Backend.Models
public string device_number { get; set; } public string device_number { get; set; }
public string device_coordinate_3d { get; set; } public string device_coordinate_3d { get; set; }
public int forge_dbid { get; set; } public int forge_dbid { get; set; }
public string room_name { get; set; }
} }
public class ImportForgeRoom public class ImportForgeRoom

View File

@ -246,9 +246,9 @@
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk'); //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk');
launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6LW1vZGVsX3Rlc3QxMTIxLyVFMyU4MCU5MCVFNSU4RiVCMCVFNSU4QyU5NyVFNCVCOCVBRCVFOCU4RiVCMSVFNSVBNCVBNyVFNiVBOCU5MyVFMyU4MCU5MUFSQyVFOSU5QiU5OSVFNiVBOCVBMSVFNSVCQyU4RitNRVAlRTYlOEIlODYlRTclQjMlQkIlRTclQjUlQjFfJUU1JTg4JUFBJUU3JTg3JTg4JUU1JTg1JUI3XzIwMjNfMDFfMDYubndk'); launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dGEzaHFzZmZ6cWJub3V4a3BsZGt1a3NldzRzajIxdzUtYmltc19tb2RlbHMvJUUzJTgwJTkwJUU1JThGJUIwJUU1JThDJTk3JUU0JUI4JUFEJUU4JThGJUIxJUU1JUE0JUE3JUU2JUE4JTkzJUUzJTgwJTkxQVJDJUU5JTlCJTk5JUU2JUE4JUExJUU1JUJDJThGK01FUCVFNiU4QiU4NiVFNyVCMyVCQiVFNyVCNSVCMV8wMTEwLm53ZA==');
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlFX2ZvcmdlX3Rlc3QvJUUzJFTgwJTkwQVJDJUUzJTgwJTkxXzIwMjJfMTJfMTMubndk');//new ARC
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwTUVQJUUzJTgwJTkxXzIwMjJfMTJfMTMubndj');//new MEP
//launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC //launchViewer('dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6dnNjb2RlX2ZvcmdlX3Rlc3QvJUUzJTgwJTkwQVJDJUUzJTgwJTkxJUU1JTg1JUE4JUU2JUEzJTlGXzIwMjJfMTJfMTMubndj');//全棟 ARC

View File

@ -269,43 +269,50 @@ function onDocumentLoadSuccess(doc) {
//}) //})
allDbIdsStr.forEach((dbId) => { allDbIdsStr.forEach((dbId) => {
curDbId = parseInt(dbId); curDbId = parseInt(dbId);
viewer.getProperties(curDbId, function (e) { viewer.getProperties(curDbId, function (e) {
e.properties.forEach(function (item) { e.properties.forEach(function (item) {
if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】 if (item.displayName == "【tag_id】") { // Tag_name tag_id 【tag_id】
if (item.displayValue != "") { if (item.displayValue != "") {
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10 ////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {// TPE_B1_ME_M10
//console.log("--------------------------------------------------"); //console.log("--------------------------------------------------");
//console.log("Tag_name dbid: " + e.dbId); //console.log("Tag_name dbid: " + e.dbId);
//console.log("value: " + item.displayValue); //console.log("value: " + item.displayValue);
////} ////}
var str = item.displayValue.split('_'); var str = item.displayValue.split('_');
if (str.length == 2) { //兩段為房間 ex: U7F_01 if (str.length == 2) { //兩段為房間 ex: U7F_01
roomDataList.push({ room_id: e.dbId, room_name: item.displayValue }); roomDataList.push({ room_id: e.dbId, room_name: item.displayValue });
} }
else if (str.length == 8) { //八段為設備 ex: TPE_B1_ME_M10_U7F_NA_FCU_N1 else if (str.length == 8) { //八段為設備 ex: TPE_B1_ME_M10_U7F_NA_FCU_N1
//取得座標 //取得座標
let bounds = new THREE.Box3(); let bounds = new THREE.Box3();
instanceTree.enumNodeFragments(e.dbId, (fragId) => { instanceTree.enumNodeFragments(e.dbId, (fragId) => {
let box = new THREE.Box3(); let box = new THREE.Box3();
fragList.getWorldBounds(fragId, box); fragList.getWorldBounds(fragId, box);
bounds.union(box); bounds.union(box);
}, true); }, true);
var position = bounds.center(); var position = bounds.center();
////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) { ////if ((item.displayValue).indexOf('TPE_B1_LT_L1') > -1) {
//console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")"); //console.log("position: (" + (position.x).toFixed(2) + ", " + (position.y).toFixed(2) + ", " + (position.z).toFixed(2) + ")");
//console.log("--------------------------------------------------"); //console.log("--------------------------------------------------");
////} ////}
tagIdDevList.push({ device_number: item.displayValue, device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', forge_dbid: e.dbId }); tagIdDevList.push({ device_number: item.displayValue, device_coordinate_3d: '{ "x": ' + (position.x).toFixed(2) + ', "y": ' + (position.y).toFixed(2) + ', "z": ' + (position.z).toFixed(2) + ' }', forge_dbid: e.dbId, room_name: "" });
} }
} }
}
} if (item.displayName == "【room_id】") {
}); tagIdDevList = tagIdDevList.map(tagItem => {
}) if (tagItem.forge_dbid === e.dbId) {
tagItem = { ...tagItem, room_name: item.displayValue }
}
return tagItem
})
}
});
}) })
})
//---------------------- end --------------------------------------------------- //---------------------- end ---------------------------------------------------