diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 289a63c..6d60f63 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1137,7 +1137,7 @@ namespace FrontendWebApi.ApiControllers and di.device_system_tag COLLATE utf8mb4_unicode_ci = d.device_system_tag and di.device_name_tag COLLATE utf8mb4_unicode_ci = d.device_name_tag and d.deleted = 0 - where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number + where di.deleted = 0 and di.unit is not null and d.device_number = @Device_number ) temp inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0 inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' @@ -1149,12 +1149,12 @@ namespace FrontendWebApi.ApiControllers var device_number = hi.Device_number_point.Split(":")[0]; var point = hi.Device_number_point.Split(":")[1]; //var tableName = await backgroundServiceMsSqlRepository.GetAllAsync($"select table_name from INFORMATION_SCHEMA.TABLES where table_name like '%{device_number}%'"); - var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = hi.Device_number_point }); + var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_number }); var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault(); var sql = $@"select '{device_item_info.Building_name}' as Building_name, '{device_item_info.Main_system_name}' as Main_system_name, - '{device_item_info.Sub_system_name}' as Sub_system_name', {device_item_info.Device_number}' as Device_number, + '{device_item_info.Sub_system_name}' as Sub_system_name, '{device_item_info.Device_number}' as Device_number, '{device_item_info.Device_name}' as Device_name, '{device_item_info.Item_name}' as Item_name, '{device_item_info.Points}' as Points, '{device_item_info.Unit}' as Unit, timestamp as Timestamp, round(value, 2) as Value from FIC_CENTER_{device_number}_{point} @@ -1167,7 +1167,7 @@ namespace FrontendWebApi.ApiControllers //{ //} } - + apiResult.Code = "0000"; apiResult.Data = apiResult.Data.OrderBy(x => x.Device_number).ThenBy(x => x.Timestamp).ToList(); } catch (Exception exception) diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index ebdf803..79bc3a1 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -264,6 +264,7 @@ namespace FrontendWebApi.Models public class HistoryItem { public string Device_number_point { get; set; } + public string Device_number { get; set; } public string Unit { get; set; } }