[WebAPI] GetDevice 增加引數 device_number 可針對 device_number 進行 Filter | GetEmergencyDevice 平面圖網址動態抓 variable 取得 website config 組裝 url | [View] 緊急應變平面圖路徑調整
This commit is contained in:
parent
3bbdfb2913
commit
a37224647e
@ -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<string>();
|
||||
@ -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<DeviceFloor>(sql);
|
||||
var devicelist = await backendRepository.GetAllAsync<DeviceFloor>(sql,new { device_number = post.device_number });
|
||||
|
||||
//抓出該設備底下的子節點
|
||||
var sql_node = $@"SELECT
|
||||
|
@ -132,15 +132,18 @@ namespace FrontendWebApi.ApiControllers
|
||||
if (selectdevice.select_disasters == null || selectdevice.select_disasters.Count == 0)
|
||||
selectdevice.select_disasters = new List<int>();
|
||||
|
||||
var sqlString = $@"SELECT system_key as 'Name', system_value as 'Value' FROM variable where system_type = 'website_config' AND deleted = 0";
|
||||
List<KeyValue> webSiteConfig = await backendRepository.GetAllAsync<KeyValue>(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<deviceMenu>(sqlString, new { disasters= selectdevice.select_disasters, building_tag = selectdevice.selectbuilding,
|
||||
floor = selectdevice.select_Floors, layer3 = selectdevice.select_Layer3 });
|
||||
Variable = await backendRepository.GetAllAsync<deviceMenu>(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;
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -569,7 +569,7 @@
|
||||
`;*@
|
||||
|
||||
var html = `
|
||||
<a href="https://${row.ip_address}/file/BajascriptTest/_FloorMap.html?building_tag=${row.building_tag}&main_system_tag=${row.layer2}&floor_guid=${row.floorguid}&sub_system_tag=${row.layer3}&device_number=${data}&show_cctv=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
|
||||
<a href="${row.ip_address}/_FloorMap.html?building_tag=${row.building_tag}&main_system_tag=${row.layer2}&floor_guid=${row.floorguid}&sub_system_tag=${row.layer3}&device_number=${data}&show_cctv=1&isFromEmergency=1&jwt=${localStorage.getItem('JWT-Authorization')}" target="_blank">
|
||||
${data}
|
||||
</a>
|
||||
`;
|
||||
|
Loading…
Reference in New Issue
Block a user