diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index cebd90d..7b535f9 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1161,18 +1161,21 @@ namespace FrontendWebApi.ApiControllers if (tagQuantity.Equals("5")) { - if (device_number_point.Split("_")[1].Equals("S") || device_number_point.Split("_")[1].Equals("CWB") || device_number_point.Split("_")[1].Equals("B") ) - { - 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]}'"); - } + //if (device_number_point.Split("_")[1].Equals("S") || device_number_point.Split("_")[1].Equals("CWB") || device_number_point.Split("_")[1].Equals("B") ) + //{ + // 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]}'"); + //} + + station = await frontendRepository.GetOneAsync($@"select distinct parent_path from import_niagara_item_history + where device_building_tag = '{device_number_point.Split("_")[0].Replace("$3", "")}' and (parent_path != '' or parent_path is not null) limit 1;"); } else station = frontendRepository.GetOneAsync($@"select parent_path from import_niagara_item_history