From 2f64f48882e6bce92082b7cf822617c95a5057c0 Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 31 Jan 2024 12:12:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9statio?= =?UTF-8?q?n=E7=8D=B2=E5=8F=96=E5=95=8F=E9=A1=8C,=20=E4=BF=AE=E6=94=B9devi?= =?UTF-8?q?ce=E7=8D=B2=E5=8F=96islink=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/HistoryController.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 4480e65..f3a5740 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -493,7 +493,7 @@ namespace FrontendWebApi.ApiControllers try { List wheres = new List(); - 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($@"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($@"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($@"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($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number_point.Split("_")[1].Replace("$3", "")}' and