[後端] 修改getsubmain
This commit is contained in:
		
							parent
							
								
									117b7bae3c
								
							
						
					
					
						commit
						05d7f7ea0f
					
				@ -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<Device>() : null;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user