wangxinhui
3 天以前 225d11e2ddaa55d1d482201cb4d89c9486cdba69
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/RouterController.cs
@@ -61,48 +61,48 @@
            }
            return content;        }
        [HttpPost, Route("GetBaseRouterInfo"), AllowAnonymous]
        public WebResponseContent GetBaseRouterInfo()
        {
            try
            {
                #region 鑾峰彇璺敱绫诲瀷
                List<object> routerTypes = new List<object>();
                Type routerType = typeof(RouterInOutType);
                List<int> routerIndexs = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList();
                int routerIndex = 0;
                foreach (var item in routerIndexs)
                {
                    FieldInfo? fieldInfo = routerType.GetField(((RouterInOutType)item).ToString());
                    DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
                    if (description != null)
                    {
                        routerTypes.Add(new { key = item.ToString(), value = description.Description });
                    }
                    else
                    {
                        routerTypes.Add(new { key = item.ToString(), value = item.ToString() });
                    }
                    routerIndex++;
                }
                #endregion
        //[HttpPost, Route("GetBaseRouterInfo"), AllowAnonymous]
        //public WebResponseContent GetBaseRouterInfo()
        //{
        //    try
        //    {
        //        #region 鑾峰彇璺敱绫诲瀷
        //        List<object> routerTypes = new List<object>();
        //        Type routerType = typeof(RouterInOutType);
        //        List<int> routerIndexs = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList();
        //        int routerIndex = 0;
        //        foreach (var item in routerIndexs)
        //        {
        //            FieldInfo? fieldInfo = routerType.GetField(((RouterInOutType)item).ToString());
        //            DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
        //            if (description != null)
        //            {
        //                routerTypes.Add(new { key = item.ToString(), value = description.Description });
        //            }
        //            else
        //            {
        //                routerTypes.Add(new { key = item.ToString(), value = item.ToString() });
        //            }
        //            routerIndex++;
        //        }
        //        #endregion
                #region 鑾峰彇璁惧缂栧彿
                object deviceCodes = _deviceProtocolRepository.QueryData(x => true).GroupBy(x => x.DeviceChildCode).Select(x => new { key = x.Key, value = x.Key }).ToList();
        //        #region 鑾峰彇璁惧缂栧彿
        //        object deviceCodes = _deviceProtocolRepository.QueryData(x => true).GroupBy(x => x.DeviceChildCode).Select(x => new { key = x.Key, value = x.Key }).ToList();
                object areaInfos = Enum.GetNames(typeof(AreaInfo)).Select(x => new { key = x, value = x }).ToList();
        //        object areaInfos = Enum.GetNames(typeof(AreaInfo)).Select(x => new { key = x, value = x }).ToList();
                #endregion
        //        #endregion
                return WebResponseContent.Instance.OK(data: new { routerTypes, deviceCodes, areaInfos });
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        //        return WebResponseContent.Instance.OK(data: new { routerTypes, deviceCodes, areaInfos });
        //    }
        //    catch (Exception ex)
        //    {
        //        return WebResponseContent.Instance.Error(ex.Message);
        //    }
        }
        //}
        [HttpPost, Route("AddRouters"), AllowAnonymous]
        public WebResponseContent AddRouters([FromBody] List<RoutersAddDTO> routersAddDTOs, int routerType)