1
wtt
2024-07-09 f40516fc59bbf54bfdae07924c6b5121c3e2ae82
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/KF_BarCodeStatusChangeBillController.cs
@@ -27,6 +27,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_KF_BarCodeStatusChangeBillList order by HMainID asc", "h_v_KF_BarCodeStatusChangeBillList");
@@ -37,11 +38,18 @@
                    string sql = sql1 + sWhere + " order by HMainID asc";
                    ds = oCN.RunProcReturn(sql, "h_v_KF_BarCodeStatusChangeBillList");
                }
                foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用
                {
                    Type dataType = col.DataType; //获取当前数据类型传入 è‡ªå®šä¹‰å˜é‡datadataType
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接         // å°†åˆ—名和数据类型信息拼接成一个JSON格式的字符串
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性
                objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性
                return objJsonResult;
            }
            catch (Exception e)