[前台] 後端修改針對兩個小類資料處理 緊急扣壓和閃光喇叭

This commit is contained in:
dev02 2023-05-30 17:17:30 +08:00
parent 59cb26ba3d
commit 2441d84354

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))
{ {