yangle
2024-11-29 f76084c29964fb0bd45c7fd8da2d1837ae995608
WebAPI/Controllers/BaseSet/Gy_SupplierController.cs
@@ -9,6 +9,7 @@
using System.Web.Http;
using WebAPI.Models;
using System.Text.RegularExpressions;
using SyntacticSugar.constant;
namespace WebAPI.Controllers
{
    public class Gy_SupplierController : ApiController
@@ -79,7 +80,61 @@
            }
        }
        #region 供应商分页列表
        [Route("Gy_Supplier/page")]
        [HttpGet]
        public json Gy_SupplierPage(string sWhere, string user, int page, int size, string Organization)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere += ("and 组织名称 = '" + Organization + "'");
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_Gy_SupplierList " + page + "," + size + ",''", "h_p_Gy_SupplierList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Gy_SupplierList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_SupplierList");
                }
                //添加列名
                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列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        /// <summary>