1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 销售发货看板 查询
        /// <summary>
        /// 返回应收单列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [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<DataTable> tableList = new List<DataTable>();
 
                List<object> columnNameListSum = new List<object>();
                List<object> columnNameList0 = new List<object>();
 
                //获取 销售发货看板 数据
                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
    }
}