From 2441d84354597d6fad0927c1874f70efdf03d914 Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 30 May 2023 17:17:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=89=8D=E5=8F=B0]=20=E5=BE=8C=E7=AB=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=9D=E5=B0=8D=E5=85=A9=E5=80=8B=E5=B0=8F?= =?UTF-8?q?=E9=A1=9E=E8=B3=87=E6=96=99=E8=99=95=E7=90=86=20=E7=B7=8A?= =?UTF-8?q?=E6=80=A5=E6=89=A3=E5=A3=93=E5=92=8C=E9=96=83=E5=85=89=E5=96=87?= =?UTF-8?q?=E5=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/BuildController.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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)) {