修改系統列表
This commit is contained in:
		
							parent
							
								
									46e7515d44
								
							
						
					
					
						commit
						c779fd32f3
					
				@ -42,7 +42,7 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [Route("api/Device/GetMainSub")]
 | 
			
		||||
        public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub()
 | 
			
		||||
        public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub([FromBody] FindDevice fd)
 | 
			
		||||
        {
 | 
			
		||||
            ApiResult<History_MainSubBuildFloor> apiResult = new ApiResult<History_MainSubBuildFloor>(jwt_str);
 | 
			
		||||
            if (!jwtlife)
 | 
			
		||||
@ -50,17 +50,26 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                apiResult.Code = "5000";
 | 
			
		||||
                return BadRequest(apiResult);
 | 
			
		||||
            }
 | 
			
		||||
            else if (string.IsNullOrEmpty(fd.building_tag))
 | 
			
		||||
            {
 | 
			
		||||
                apiResult.Code = "0002";
 | 
			
		||||
                apiResult.Msg = "必須選擇東別";
 | 
			
		||||
                return apiResult;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
 | 
			
		||||
                    @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority
 | 
			
		||||
                    @$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
 | 
			
		||||
                                dk.device_normal_color, dk.device_error_color, dk.device_error_color
 | 
			
		||||
                        from role_auth a
 | 
			
		||||
                        join auth_page b on a.AuthCode = b.AuthCode
 | 
			
		||||
                        join userinfo c on c.role_guid = a.role_guid
 | 
			
		||||
                        join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
 | 
			
		||||
                        join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
 | 
			
		||||
                        left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
 | 
			
		||||
                        where c.account = @account
 | 
			
		||||
                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type });
 | 
			
		||||
                        order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
 | 
			
		||||
                var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
 | 
			
		||||
                apiResult.Data = new History_MainSubBuildFloor();
 | 
			
		||||
                apiResult.Data.history_Main_Systems = new List<History_Main_system>();
 | 
			
		||||
@ -78,6 +87,9 @@ namespace FrontendWebApi.ApiControllers
 | 
			
		||||
                        History_Sub_system history_Sub_System = new History_Sub_system();
 | 
			
		||||
                        history_Sub_System.sub_system_tag = sub.sub_system_tag;
 | 
			
		||||
                        history_Sub_System.full_name = sub.sub_name;
 | 
			
		||||
                        history_Sub_System.device_normal_color = sub.device_normal_color;
 | 
			
		||||
                        history_Sub_System.device_close_color = sub.device_close_color;
 | 
			
		||||
                        history_Sub_System.device_error_color = sub.device_error_color;
 | 
			
		||||
 | 
			
		||||
                        history_Main_System.History_Sub_systems.Add(history_Sub_System);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
@ -59,6 +59,9 @@ namespace FrontendWebApi.Models
 | 
			
		||||
        public string main_name { get; set; }
 | 
			
		||||
        public string sub_system_tag { get; set; }
 | 
			
		||||
        public string sub_name { get; set; }
 | 
			
		||||
        public string device_normal_color { get; set; }
 | 
			
		||||
        public string device_close_color { get; set; }
 | 
			
		||||
        public string device_error_color { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class BuildingFloorRawData
 | 
			
		||||
@ -96,6 +99,9 @@ namespace FrontendWebApi.Models
 | 
			
		||||
    {
 | 
			
		||||
        public string sub_system_tag { get; set; }
 | 
			
		||||
        public string full_name { get; set; }
 | 
			
		||||
        public string device_normal_color { get; set; }
 | 
			
		||||
        public string device_close_color { get; set; }
 | 
			
		||||
        public string device_error_color { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
    public class History_PostDevice
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user