diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 68f1054..def95f1 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -474,6 +474,7 @@ namespace FrontendWebApi.ApiControllers var sub_system_guidsql = ""; var disasterjoinsql = ""; var disastersql = ""; + var devicesql = ""; var layer3sql = ""; var sWhere = ""; if (!String.IsNullOrEmpty(post.main_system_tag)) @@ -496,7 +497,9 @@ namespace FrontendWebApi.ApiControllers disasterjoinsql = " left join device_disaster dd on dd.device_guid = d.device_guid"; disastersql = $" and dd.device_system_value = '{post.device_system_value}'"; } - + if (!String.IsNullOrEmpty(post.device_number)) { + devicesql = " and d.device_number = @device_number "; + } if (!String.IsNullOrEmpty(post.show_cctv) && post.show_cctv == "1") { var str_arr = new List(); @@ -516,7 +519,10 @@ namespace FrontendWebApi.ApiControllers { str_arr.Add($@"dd.device_system_value = '{post.device_system_value}'"); } - + if (!String.IsNullOrEmpty(post.device_number)) + { + str_arr.Add($@"d.device_number = @device_number"); + } if (str_arr.Count > 0) { sWhere = $@" AND ( @@ -534,7 +540,7 @@ namespace FrontendWebApi.ApiControllers } else { - sWhere = $@"{main_system_guidsql} {sub_system_guidsql} {disastersql} {layer3sql}"; + sWhere = $@"{main_system_guidsql} {sub_system_guidsql} {disastersql} {layer3sql} {devicesql}"; } var sql = $@"select @@ -595,7 +601,7 @@ namespace FrontendWebApi.ApiControllers where d.deleted = 0 and d.is_link = 1 and d.device_building_tag = '{post.building_tag}' {sWhere} order by d.priority ASC, left(device_serial_tag, LENGTH(device_serial_tag) - 1) ASC"; - var devicelist = await backendRepository.GetAllAsync(sql); + var devicelist = await backendRepository.GetAllAsync(sql,new { device_number = post.device_number }); //抓出該設備底下的子節點 var sql_node = $@"SELECT diff --git a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs index 3ea13d5..ea17216 100644 --- a/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs +++ b/FrontendWebApi/ApiControllers/EmergencyDeviceController.cs @@ -132,15 +132,18 @@ namespace FrontendWebApi.ApiControllers if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0) selectdevice.select_disasters = new List(); + var sqlString = $@"SELECT system_key as 'Name', system_value as 'Value' FROM variable where system_type = 'website_config' AND deleted = 0"; + List webSiteConfig = await backendRepository.GetAllAsync(sqlString); + deviceQue += $" AND d.device_building_tag in @building_tag "; disasQue = " where dd.device_system_value IN @disasters "; - var sqlString = @$"select + sqlString = @$"select d.device_guid, d.device_number, d.full_name AS device_name, d.device_building_tag AS building_tag, b.full_name AS building_name, - CONCAT(b.ip_address , ':', b.ip_port) AS ip_address, + CONCAT(@niagara_http, '://',b.ip_address , ':', b.ip_port,'/file/',@niagaraRootName) AS ip_address, v.layer2, v.layer2_name, v.system_value AS layer3, @@ -173,8 +176,15 @@ namespace FrontendWebApi.ApiControllers {disasQue} ORDER BY d.device_number "; - Variable = await backendRepository.GetAllAsync(sqlString, new { disasters= selectdevice.select_disasters, building_tag = selectdevice.selectbuilding, - floor = selectdevice.select_Floors, layer3 = selectdevice.select_Layer3 }); + Variable = await backendRepository.GetAllAsync(sqlString, new + { + disasters = selectdevice.select_disasters, + building_tag = selectdevice.selectbuilding, + floor = selectdevice.select_Floors, + layer3 = selectdevice.select_Layer3, + niagaraRootName = webSiteConfig.FirstOrDefault(w => w.Name == "frontend_niagara_root_name")?.Value, + niagara_http = webSiteConfig.FirstOrDefault(w => w.Name == "frontend_http")?.Value, + }); apiResult.Code = "0000"; apiResult.Data = Variable; diff --git a/FrontendWebApi/Models/Build.cs b/FrontendWebApi/Models/Build.cs index 462563e..0ecf5e2 100644 --- a/FrontendWebApi/Models/Build.cs +++ b/FrontendWebApi/Models/Build.cs @@ -66,6 +66,7 @@ namespace FrontendWebApi.Models public string sub_system_tag { get; set; } public string building_tag { get; set; } public string device_system_value { get; set; } + public string device_number { get; set; } public string device_system_category_layer3 { get; set; } public string show_cctv { get; set; } } diff --git a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml index 36810bb..e31a844 100644 --- a/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml +++ b/FrontendWebApi/Views/EmergencyDeviceMenu/Index.cshtml @@ -569,7 +569,7 @@ `;*@ var html = ` - + ${data} `;