This commit is contained in:
張家睿 2024-01-31 14:10:15 +08:00
commit 7d3292ad24

View File

@ -493,7 +493,7 @@ namespace FrontendWebApi.ApiControllers
try
{
List<string> wheres = new List<string>();
wheres.Add("d.deleted = 0");
wheres.Add("d.deleted = 0 and d.is_link = 1");
if (postDevice.SelectBuildings != null && postDevice.SelectBuildings.Count() > 0)
{
wheres.Add("d.device_building_tag in @builds");
@ -525,7 +525,8 @@ namespace FrontendWebApi.ApiControllers
a.device_number
from (SELECT *
FROM device d
WHERE {wheres_str}) a
WHERE {wheres_str}
) a
join building b on b.building_tag = a.device_building_tag
join variable v1 on v1.system_value = a.device_system_tag and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
join variable v2 on v2.system_value = a.device_name_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
@ -1158,9 +1159,21 @@ namespace FrontendWebApi.ApiControllers
var device_number_point = historyItem.Device_number_point.Replace(":", "_");
if (tagQuantity.Equals("5"))
station = await frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
where device_building_tag = '{device_number_point.Split("_")[0]}' and device_floor_tag = '{device_number_point.Split("_")[2]}'
and device_name_tag = '{device_number_point.Split("_")[1]}' and device_point_name = '{device_number_point.Split("_")[5]}'");
{
if (device_number_point.Split("_")[1].Equals("S") || device_number_point.Split("_")[1].Equals("CWB") || device_number_point.Split("_")[1].Equals("B") ||
device_number_point.Split("_")[1].Equals("FM") || device_number_point.Split("_")[1].Equals("APS") || device_number_point.Split("_")[1].Equals("VICL"))
{
station = await frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
where device_building_tag = '{device_number_point.Split("_")[0]}' and device_floor_tag = '{device_number_point.Split("_")[2]}'
and device_name_tag = '{device_number_point.Split("_")[3]}' and device_point_name = '{device_number_point.Split("_")[5]}'");
}
else
{
station = await frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
where device_building_tag = '{device_number_point.Split("_")[0]}' and device_floor_tag = '{device_number_point.Split("_")[2]}'
and device_name_tag = '{device_number_point.Split("_")[1]}' and device_point_name = '{device_number_point.Split("_")[5]}'");
}
}
else
station = frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history
where device_building_tag = '{device_number_point.Split("_")[1].Replace("$3", "")}' and