1
zrg
2024-09-13 73b70e9ebabbb3d9d81081f8c95de21373083d4b
WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -706,5 +706,45 @@
            }
        }
        #endregion
        #region 基础资料 获取数据
        [Route("Gy_GetBaseData/Gy_GetBaseData")]
        [HttpGet]
        public object Gy_GetBaseData(string sql,string tableView, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn(sql, tableView);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}