Quellcode durchsuchen

修改待处理/已处理工单列表接口

machenyang vor 8 Jahren
Ursprung
Commit
b0a0aeaaf6

+ 112 - 120
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -23,103 +23,103 @@ namespace CallCenterApi.Interface.Controllers.workorder
23 23
             //ActionResult res = NoToken("未知错误,请重新登录");
24 24
             //if (Request.IsAuthenticated)
25 25
             //{
26
-                string sql = " and isdel=0 ";
27
-                DataTable dt = new DataTable();
28
-
29
-                string strorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("orderid"));
30
-                string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
31
-                string strtype = HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
32
-                string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
33
-                string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
34
-                string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
35
-                string strcode = HttpUtility.UrlDecode(RequestString.GetQueryString("code"));
36
-                string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
37
-                string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
38
-
39
-                string strpageindex = RequestString.GetQueryString("page");
40
-                int pageindex = 1;
41
-                string strpagesize = RequestString.GetQueryString("pagesize");
42
-                int pagesize = 10;
43
-
44
-                if (strorderid.Trim() != "" && strorderid != "undefined")
45
-                {
46
-                    sql += " and WorkOrderID like '%" + strorderid.Trim() + "%' ";
47
-                }
48
-                if (strstate.Trim() != "" && strstate != "undefined")
49
-                {
50
-                    sql += " and State = '" + strstate.Trim() + "' ";
51
-                }
52
-                if (strtype.Trim() != "" && strtype != "undefined")
53
-                {
54
-                    sql += " and Type = '" + strtype.Trim() + "' ";
55
-                }
56
-                if (strkey.Trim() != "" && strkey != "undefined")
57
-                {
58
-                    sql += " and Detail like '%" + strkey.Trim() + "%' ";
59
-                }
60
-                if (strcode.Trim() != "" && strcode != "undefined")
61
-                {
62
-                    sql += " and CreateUser = '" + strcode.Trim() + "' ";
63
-                }
64
-                if (strname.Trim() != "" && strname != "undefined")
65
-                {
66
-                    sql += " and Customer like '%" + strname.Trim() + "%' ";
67
-                }
68
-                if (strtel.Trim() != "" && strtel != "undefined")
69
-                {
70
-                    sql += " and CustomerTel like '%" + strtel + "%'  ";
71
-                }
72
-                if (strstarttime.Trim() != "" && strstarttime != "undefined")
73
-                {
74
-                    sql += " and datediff(day,CreateTime,'" + strstarttime + "')<=0 ";
75
-                }
76
-                if (strendtime.Trim() != "" && strendtime != "undefined")
77
-                {
78
-                    sql += " and datediff(day,CreateTime,'" + strendtime + "')>=0   ";
79
-                }
26
+            string sql = " and isdel=0 ";
27
+            DataTable dt = new DataTable();
28
+
29
+            string strorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("orderid"));
30
+            string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
31
+            string strtype = HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
32
+            string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
33
+            string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
34
+            string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
35
+            string strcode = HttpUtility.UrlDecode(RequestString.GetQueryString("code"));
36
+            string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
37
+            string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
38
+
39
+            string strpageindex = RequestString.GetQueryString("page");
40
+            int pageindex = 1;
41
+            string strpagesize = RequestString.GetQueryString("pagesize");
42
+            int pagesize = 10;
43
+
44
+            if (strorderid.Trim() != "" && strorderid != "undefined")
45
+            {
46
+                sql += " and WorkOrderID like '%" + strorderid.Trim() + "%' ";
47
+            }
48
+            if (strstate.Trim() != "" && strstate != "undefined")
49
+            {
50
+                sql += " and State = '" + strstate.Trim() + "' ";
51
+            }
52
+            if (strtype.Trim() != "" && strtype != "undefined")
53
+            {
54
+                sql += " and Type = '" + strtype.Trim() + "' ";
55
+            }
56
+            if (strkey.Trim() != "" && strkey != "undefined")
57
+            {
58
+                sql += " and Detail like '%" + strkey.Trim() + "%' ";
59
+            }
60
+            if (strcode.Trim() != "" && strcode != "undefined")
61
+            {
62
+                sql += " and CreateUser = '" + strcode.Trim() + "' ";
63
+            }
64
+            if (strname.Trim() != "" && strname != "undefined")
65
+            {
66
+                sql += " and Customer like '%" + strname.Trim() + "%' ";
67
+            }
68
+            if (strtel.Trim() != "" && strtel != "undefined")
69
+            {
70
+                sql += " and CustomerTel like '%" + strtel + "%'  ";
71
+            }
72
+            if (strstarttime.Trim() != "" && strstarttime != "undefined")
73
+            {
74
+                sql += " and datediff(day,CreateTime,'" + strstarttime + "')<=0 ";
75
+            }
76
+            if (strendtime.Trim() != "" && strendtime != "undefined")
77
+            {
78
+                sql += " and datediff(day,CreateTime,'" + strendtime + "')>=0   ";
79
+            }
80 80
 
81
-                if (strpageindex.Trim() != "")
82
-                {
83
-                    pageindex = Convert.ToInt32(strpageindex);
84
-                }
81
+            if (strpageindex.Trim() != "")
82
+            {
83
+                pageindex = Convert.ToInt32(strpageindex);
84
+            }
85 85
 
86
-                if (strpagesize.Trim() != "")
87
-                {
88
-                    pagesize = Convert.ToInt32(strpagesize);
89
-                }
90
-                int recordCount = 0;
91
-                dt = BLL.PagerBLL.GetListPager(
92
-                    "T_Wo_WorkOrder",
93
-                    "T_Wo_WorkOrder.ID",
94
-                    "*,dbo.GetDictionaryName(TypeClass) as TypeClassName,dbo.GetUserName(CreateUser) as CreateUserName, dbo.GetDeptName(ResponDept) as ResponDeptName,dbo.GetUserName(ResponUser) as ResponUserName,convert(decimal(18,2),DATEDIFF(minute, CreateTime, ISNULL(LastDealTime, GETDATE()))/60.00) as totalhour",
95
-                    sql,
96
-                    "ORDER BY T_Wo_WorkOrder.ID desc",
97
-                    pagesize,
98
-                    pageindex,
99
-                    true,
100
-                    out recordCount);
101
-                dt.Columns.Add("CLDeptName", typeof(String));
102
-                dt.Columns.Add("CLUserName", typeof(String));
103
-                foreach (DataRow dr in dt.Rows)
86
+            if (strpagesize.Trim() != "")
87
+            {
88
+                pagesize = Convert.ToInt32(strpagesize);
89
+            }
90
+            int recordCount = 0;
91
+            dt = BLL.PagerBLL.GetListPager(
92
+                "T_Wo_WorkOrder",
93
+                "T_Wo_WorkOrder.ID",
94
+                "*,dbo.GetDictionaryName(TypeClass) as TypeClassName,dbo.GetUserName(CreateUser) as CreateUserName, dbo.GetDeptName(ResponDept) as ResponDeptName,dbo.GetUserName(ResponUser) as ResponUserName,convert(decimal(18,2),DATEDIFF(minute, CreateTime, ISNULL(LastDealTime, GETDATE()))/60.00) as totalhour",
95
+                sql,
96
+                "ORDER BY T_Wo_WorkOrder.ID desc",
97
+                pagesize,
98
+                pageindex,
99
+                true,
100
+                out recordCount);
101
+            dt.Columns.Add("CLDeptName", typeof(String));
102
+            dt.Columns.Add("CLUserName", typeof(String));
103
+            foreach (DataRow dr in dt.Rows)
104
+            {
105
+                string sqlitem = "select top 1 dbo.GetUserName(ToUser) as ToUserName, dbo.GetDeptName(ToDept) as ToDeptName from T_Wo_WorkOrderItem where WorkOrderID ='" + dr["WorkOrderID"].ToString() + "' and IsDel=0 and Type=1 order by ID desc";
106
+                var item = DbHelperSQL.Query(sqlitem).Tables[0];
107
+                if (item.Rows.Count > 0)
104 108
                 {
105
-                    string sqlitem = "select top 1 dbo.GetUserName(ToUser) as ToUserName, dbo.GetDeptName(ToDept) as ToDeptName from T_Wo_WorkOrderItem where WorkOrderID ='" + dr["WorkOrderID"].ToString() + "' and IsDel=0 and Type=1 order by ID desc";
106
-                    var item = DbHelperSQL.Query(sqlitem).Tables[0];
107
-                    if (item.Rows.Count > 0)
108
-                    {
109
-                        dr["CLUserName"] = item.Rows[0]["ToUserName"].ToString();
110
-                        dr["CLDeptName"] = item.Rows[0]["ToDeptName"].ToString();
111
-                    }
109
+                    dr["CLUserName"] = item.Rows[0]["ToUserName"].ToString();
110
+                    dr["CLDeptName"] = item.Rows[0]["ToDeptName"].ToString();
112 111
                 }
112
+            }
113 113
 
114
-                var obj = new
115
-                {
116
-                    state = "success",
117
-                    message = "成功",
118
-                    rows = dt,
119
-                    total = recordCount
120
-                };
114
+            var obj = new
115
+            {
116
+                state = "success",
117
+                message = "成功",
118
+                rows = dt,
119
+                total = recordCount
120
+            };
121 121
 
122
-                return Content(obj.ToJson());
122
+            return Content(obj.ToJson());
123 123
 
124 124
             //}
125 125
             //return res;
@@ -143,20 +143,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
143 143
                     Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
144 144
                     if (ua != null)
145 145
                     {
146
-                        //string strorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("orderid"));
147 146
                         //工单状态
148
-                        string strltype = HttpUtility.UrlDecode(RequestString.GetQueryString("ltype"));
147
+                        string strltype = HttpUtility.UrlDecode(RequestString.GetFormString("ltype"));
149 148
                         //工单来源
150
-                        string strtype = HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
149
+                        string strtype = HttpUtility.UrlDecode(RequestString.GetFormString("type"));
151 150
                         //工单类型
152
-                        string strtypeclass = HttpUtility.UrlDecode(RequestString.GetQueryString("typeclass"));
153
-                        //string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
154
-                        //string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
155
-                        //string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
151
+                        string strtypeclass = HttpUtility.UrlDecode(RequestString.GetFormString("typeclass"));
156 152
                         //工单起止时间
157
-                        string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
158
-                        string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
159
-
153
+                        string strstarttime = HttpUtility.UrlDecode(RequestString.GetFormString("starttime"));
154
+                        string strendtime = HttpUtility.UrlDecode(RequestString.GetFormString("endtime"));
155
+                        //客户分类
156
+                        string lddep = HttpUtility.UrlDecode(RequestString.GetFormString("lddep"));
157
+                        //坐席
158
+                        int uid = RequestString.GetFormInt("userid", 0);
160 159
                         string strpageindex = RequestString.GetQueryString("page");
161 160
                         int pageindex = 1;
162 161
                         string strpagesize = RequestString.GetQueryString("pagesize");
@@ -181,17 +180,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
181 180
                             //    sql += " and (CreateUser= '" + ua.F_UserCode + "' or WorkOrderID in ( '" + GetCYWorkOrderID(ua.F_UserCode) + "')) ";
182 181
                             //    break;
183 182
                             case "0"://待处理
184
-                                sql += " and State ='0' and CreateUser= '" + ua.F_UserCode + "' ";
183
+                                sql += " and State =0 ";
184
+                                if (ua.F_RoleId != 17)
185
+                                    sql += " and CreateUser = '" + ua.F_UserCode + "' ";
185 186
                                 break;
186 187
                             case "1"://已处理
187
-                                sql += " and State ='1' and LastDealUser = '" + ua.F_UserCode + "' ";
188
+                                sql += " and State =1 ";
189
+                                if (ua.F_RoleId != 17)
190
+                                    sql += " and LastDealUser = '" + ua.F_UserCode + "' ";
188 191
                                 break;
189 192
                         }
190
-
191
-                        //if (strorderid.Trim() != "" && strorderid != "undefined")
192
-                        //{
193
-                        //    sql += " and WorkOrderID like '%" + strorderid.Trim() + "%' ";
194
-                        //}
195 193
                         if (strtype.Trim() != "" && strtype != "undefined")
196 194
                         {
197 195
                             sql += " and Type = '" + strtype.Trim() + "' ";
@@ -200,18 +198,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
200 198
                         {
201 199
                             sql += " and TypeClass = '" + strtype.Trim() + "' ";
202 200
                         }
203
-                        //if (strkey.Trim() != "" && strkey != "undefined")
204
-                        //{
205
-                        //    sql += " and Detail like '%" + strkey.Trim() + "%' ";
206
-                        //}
207
-                        //if (strname.Trim() != "" && strname != "undefined")
208
-                        //{
209
-                        //    sql += " and Customer like '%" + strname.Trim() + "%' ";
210
-                        //}
211
-                        //if (strtel.Trim() != "" && strtel != "undefined")
212
-                        //{
213
-                        //    sql += " and CustomerTel like '%" + strtel + "%'  ";
214
-                        //}
201
+                        if (lddep.Trim() != "" && lddep != "undefined")
202
+                        {
203
+                            sql += " and Customer = '" + lddep.Trim() + "' ";
204
+                        }
215 205
                         if (strstarttime.Trim() != "" && strstarttime != "undefined")
216 206
                         {
217 207
                             sql += " and datediff(day,CreateTime,'" + strstarttime + "')<=0 ";
@@ -220,6 +210,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
220 210
                         {
221 211
                             sql += " and datediff(day,CreateTime,'" + strendtime + "')>=0   ";
222 212
                         }
213
+                        if (ua.F_RoleId == 17)
214
+                            sql += " and CreateUserID = " + uid + "";
223 215
 
224 216
                         if (strpageindex.Trim() != "")
225 217
                         {