diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 8ba7341..0a2f2f1 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -239,9 +239,26 @@ namespace FrontendWebApi.ApiControllers foreach (var sub in subs) { History_Sub_system history_Sub_System = new History_Sub_system(); - history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault(); - history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault(); - history_Sub_System.is_show_history = sub.Select(x => x.device_item_is_show_hsitory).FirstOrDefault(); + if (main.Select(x => x.main_system_tag).FirstOrDefault() != "S") + { + history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault(); + history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault(); + history_Sub_System.is_show_history = sub.Select(x => x.device_item_is_show_hsitory).FirstOrDefault(); + } + else + { + string name = sub.Select(x => x.sub_name).FirstOrDefault(); + bool check = true; + if (name == "人流計數") + check = sub.Any(x => x.sub_system_tag.StartsWith(hf.building_tag)); + + if (check) + { + history_Sub_System.full_name = sub.Select(x => x.sub_name).FirstOrDefault(); + history_Sub_System.sub_system_tag = sub.Select(x => x.sub_system_tag).FirstOrDefault(); + history_Sub_System.is_show_history = sub.Select(x => x.device_item_is_show_hsitory).FirstOrDefault(); + } + } var devices = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault() && x.sub_system_tag == sub.Select(x => x.sub_system_tag).FirstOrDefault() && x.device_number != null).OrderBy(x=>x.device_full_name.Length).ThenBy(x=>x.device_full_name).ToList(); history_Sub_System.device = devices.Count > 0 ? new List() : null;