From 05d7f7ea0fe75992185dd74dbfcc060f1a0b8c98 Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 13 Jun 2023 16:11:10 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9getsub?= =?UTF-8?q?main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/HistoryController.cs | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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;