yxj
1 天以前 5c56ef18d5e5da81d6d51f1b5f925b405d4ead7d
WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
@@ -330,6 +330,66 @@
        }
        #endregion
        #region 返回仓库列表 分页 含 组织筛选
        /// <summary>
        /// 返回仓库列表 分页
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Gy_StockPlace/list2Page")]
        [HttpGet]
        public object list2Page(string sWhere, string user, int page, int size)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Warehouse", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn($@"exec h_p_IF_StockPlaceListPage {page}, {size}, ''", "h_p_IF_StockPlaceListPage");
                }
                else
                {
                    sWhere = sWhere.Replace("'", "''");
                    ds = oCN.RunProcReturn($@"exec h_p_IF_StockPlaceListPage {page}, {size}, '{sWhere}'", "h_p_IF_StockPlaceListPage");
                }
                //添加列名
                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 = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                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
        /// <summary>
        /// 返回仓位列表