[後端] 修改獲取parent_path程序

This commit is contained in:
dev02 2024-02-29 09:56:57 +08:00
parent 788989a0e2
commit 987bedea78

View File

@ -1161,18 +1161,21 @@ namespace FrontendWebApi.ApiControllers
if (tagQuantity.Equals("5")) 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") ) //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<string>($@"select parent_path from import_niagara_item_history // 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]}' // 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]}'"); // and device_name_tag = '{device_number_point.Split("_")[3]}' and device_point_name = '{device_number_point.Split("_")[5]}'");
} //}
else //else
{ //{
station = await frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history // 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]}' // 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]}'"); // and device_name_tag = '{device_number_point.Split("_")[1]}' and device_point_name = '{device_number_point.Split("_")[5]}'");
} //}
station = await frontendRepository.GetOneAsync<string>($@"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 else
station = frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history station = frontendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history