diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 0e73864..5bb4334 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -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($"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($"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)) {