1
duhe
2024-08-12 f331a2915eebc492e872206d9aa7e13fc7f0861f
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
using System.Windows.Forms;
 
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Xt_CheckFlowProgressBillController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
        #region 审核进度列表
        [Route("Xt_CheckFlowProgressBill/getList_CheckFlowProgress")]
        [HttpGet]
        public object getList_CheckFlowProgress(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                ////查看权限
                //if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBackBillQuery", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无查看权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
 
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Xt_CheckFlowProcessList order by 审批项目次序 asc", "h_v_Xt_CheckFlowProcessList");
                }
                else
                {
                    string sql1 = "select * from h_v_Xt_CheckFlowProcessList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 审批项目次序 asc";
                    ds = oCN.RunProcReturn(sql, "h_v_Xt_CheckFlowProcessList");
                }
 
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Exception!当前单据未发起审批!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
 
                //添加列名
                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 = 1;
                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
 
        #region 根据单据类型与当前用户获取审批流列表
        [Route("Xt_CheckFlowProgressBill/getList_CheckFlowList")]
        [HttpGet]
        public object getList_CheckFlowList(string sWhere, string user)
        {
            try
            {
                string sql = "select distinct a.HInterID,a.HName 审批流,a.HStandard " +
                    "from Xt_CheckFlowMain as a " +
                    "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " +
                    "inner join Xt_CheckUserRight as c on b.HInterID = c.HCheckFlowInterID and b.HCheckItemID = c.HCheckItemID " +
                    "where 1=1 ";
 
                if (sWhere == null || sWhere.Equals(""))
                {
                    sql = sql + " order by a.HStandard desc";
                    ds = oCN.RunProcReturn(sql, "Xt_CheckFlowMain");
                }
                else
                {
                    sql = sql + sWhere + " order by a.HStandard desc";
                    ds = oCN.RunProcReturn(sql, "Xt_CheckFlowMain");
                }
 
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Exception!未查询到相关数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
 
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
 
    }
}