using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers { public class KB_XSFHController : ApiController { //获取系统参数 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 销售发货看板 查询 /// /// 返回应收单列表 ///参数:string sql。 ///返回值:object。 /// [Route("KB_XSFH/getData_XSFH")] [HttpGet] public object getData_XSFH(string sWhere, string user) { try { ////查看权限 //if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 1, false, user)) //{ // objJsonResult.code = "0"; // objJsonResult.count = 0; // objJsonResult.Message = "无查看权限!"; // objJsonResult.data = null; // return objJsonResult; //} List tableList = new List(); List columnNameListSum = new List(); List columnNameList0 = new List(); //获取 销售发货看板 数据 string sql0 = "exec h_p_KB_getXSFH_QueryData"; DataSet ds0 = oCN.RunProcReturn(sql0, "h_p_KB_getXSCK_QueryData"); if (ds0 == null || ds0.Tables.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!原因:获取数据失败!"; objJsonResult.data = null; return objJsonResult; } //获取 正常数据(当天) 列数据 foreach (DataColumn col in ds0.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } columnNameListSum.Add(columnNameList0); //获取 数据 for (int i = 0; i < ds0.Tables.Count; i++) { tableList.Add(ds0.Tables[i]); } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = tableList; objJsonResult.list = columnNameListSum; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }