Procházet zdrojové kódy

修改工单催办接口

machenyang %!s(int64=8) %!d(string=před) roky
rodič
revize
b02d59d256

+ 241 - 8
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -20,9 +20,110 @@ namespace CallCenterApi.Interface.Controllers.workorder
20 20
         /// <returns></returns>
21 21
         public ActionResult GetListAll()
22 22
         {
23
-            //ActionResult res = NoToken("未知错误,请重新登录");
24
-            //if (Request.IsAuthenticated)
23
+            ////ActionResult res = NoToken("未知错误,请重新登录");
24
+            ////if (Request.IsAuthenticated)
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")
25 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
+
81
+            //if (strpageindex.Trim() != "")
82
+            //{
83
+            //    pageindex = Convert.ToInt32(strpageindex);
84
+            //}
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.GetGDLXName(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)
108
+            //    {
109
+            //        dr["CLUserName"] = item.Rows[0]["ToUserName"].ToString();
110
+            //        dr["CLDeptName"] = item.Rows[0]["ToDeptName"].ToString();
111
+            //    }
112
+            //}
113
+
114
+            //var obj = new
115
+            //{
116
+            //    state = "success",
117
+            //    message = "成功",
118
+            //    rows = dt,
119
+            //    total = recordCount
120
+            //};
121
+
122
+            //return Content(obj.ToJson());
123
+
124
+            ////}
125
+            ////return res;
126
+
26 127
             string sql = " and isdel=0 ";
27 128
             DataTable dt = new DataTable();
28 129
 
@@ -30,9 +131,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
30 131
             string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
31 132
             string strtype = HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
32 133
             string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
134
+            //来电号码
33 135
             string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
34 136
             string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
137
+            //坐席工号
35 138
             string strcode = HttpUtility.UrlDecode(RequestString.GetQueryString("code"));
139
+            //起止时间
36 140
             string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
37 141
             string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
38 142
 
@@ -41,6 +145,17 @@ namespace CallCenterApi.Interface.Controllers.workorder
41 145
             string strpagesize = RequestString.GetQueryString("pagesize");
42 146
             int pagesize = 10;
43 147
 
148
+            //if (Request.IsAuthenticated)
149
+            //{
150
+            //    int userId = CurrentUser.UserData.F_UserId;
151
+            //    if (userId != 0)
152
+            //    {
153
+            //        Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
154
+            //        if (ua != null)
155
+            //        { }
156
+            //    }
157
+            //}
158
+
44 159
             if (strorderid.Trim() != "" && strorderid != "undefined")
45 160
             {
46 161
                 sql += " and WorkOrderID like '%" + strorderid.Trim() + "%' ";
@@ -91,7 +206,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
91 206
             dt = BLL.PagerBLL.GetListPager(
92 207
                 "T_Wo_WorkOrder",
93 208
                 "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",
209
+                "*,dbo.GetGDLXName(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 210
                 sql,
96 211
                 "ORDER BY T_Wo_WorkOrder.ID desc",
97 212
                 pagesize,
@@ -120,9 +235,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
120 235
             };
121 236
 
122 237
             return Content(obj.ToJson());
123
-
124
-            //}
125
-            //return res;
126 238
         }
127 239
 
128 240
         /// <summary>
@@ -226,9 +338,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
226 338
                         if (ua.F_RoleId != 17)//管理员
227 339
                         {
228 340
                             if (gdstate == 0)//未处理
229
-                                sql += " and CreateUserID = " + uid + "";
341
+                                sql += " and CreateUserID = '" + uid + "'";
230 342
                             else
231
-                                sql += " and LastDealUser = " + uid + "";
343
+                                sql += " and LastDealUser = '" + uid + "'";
232 344
                         }
233 345
 
234 346
                         if (strpageindex.Trim() != "")
@@ -273,6 +385,127 @@ namespace CallCenterApi.Interface.Controllers.workorder
273 385
             return res;
274 386
         }
275 387
 
388
+        #region 20170129 新可催办工单列表
389
+        /// <summary>
390
+        /// 
391
+        /// </summary>
392
+        /// <returns></returns>
393
+        public ActionResult GetNotDoneWorkList()
394
+        {
395
+            ActionResult res = NoToken("未知错误,请重新登录");
396
+            if (Request.IsAuthenticated)
397
+            {
398
+                string sql = " and isdel=0 ";
399
+                DataTable dt = new DataTable();
400
+
401
+                int userId = CurrentUser.UserData.F_UserId;
402
+                if (userId != 0)
403
+                {
404
+                    Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
405
+                    if (ua != null)
406
+                    {
407
+                        //工单状态
408
+                        string strltype = HttpUtility.UrlDecode(RequestString.GetFormString("ltype"));
409
+                        //工单来源
410
+                        string strtype = HttpUtility.UrlDecode(RequestString.GetFormString("type"));
411
+                        //工单类型
412
+                        string strtypeclass = HttpUtility.UrlDecode(RequestString.GetFormString("typeclass"));
413
+                        //工单起止时间
414
+                        string strstarttime = HttpUtility.UrlDecode(RequestString.GetFormString("starttime"));
415
+                        string strendtime = HttpUtility.UrlDecode(RequestString.GetFormString("endtime"));
416
+                        //客户分类
417
+                        string lddep = HttpUtility.UrlDecode(RequestString.GetFormString("lddep"));
418
+                        //坐席
419
+                        int uid = RequestString.GetFormInt("userid", 0);
420
+                        string strpageindex = RequestString.GetQueryString("page");
421
+                        int pageindex = 1;
422
+                        string strpagesize = RequestString.GetQueryString("pagesize");
423
+                        int pagesize = 10;
424
+
425
+                        //int gdstate = 0;
426
+                        //if (strltype.Trim() != "" && strltype != "undefined")
427
+                        //{
428
+                        //    sql += " and State = " + strltype.Trim() + " ";
429
+                        //    Model.T_Sys_DictionaryValue gdstatemodel = new BLL.T_Sys_DictionaryValue().GetModel(int.Parse(strltype));
430
+                        //    if (gdstatemodel != null)
431
+                        //    {
432
+                        //        string gdname = gdstatemodel.F_Name;
433
+                        //        if (gdname == "已处理")
434
+                        //            gdstate = 1;
435
+                        //    }
436
+                        //}
437
+                        if (strtype.Trim() != "" && strtype != "undefined")
438
+                        {
439
+                            sql += " and Type = '" + strtype.Trim() + "' ";
440
+                        }
441
+                        if (strtypeclass.Trim() != "" && strtypeclass != "undefined")
442
+                        {
443
+                            sql += " and TypeClass = '" + strtype.Trim() + "' ";
444
+                        }
445
+                        if (lddep.Trim() != "" && lddep != "undefined")
446
+                        {
447
+                            sql += " and Customer = '" + lddep.Trim() + "' ";
448
+                        }
449
+                        if (strstarttime.Trim() != "" && strstarttime != "undefined")
450
+                        {
451
+                            sql += " and datediff(day,CreateTime,'" + strstarttime + "')<=0 ";
452
+                        }
453
+                        if (strendtime.Trim() != "" && strendtime != "undefined")
454
+                        {
455
+                            sql += " and datediff(day,CreateTime,'" + strendtime + "')>=0   ";
456
+                        }
457
+                        //if (ua.F_RoleId != 17)//管理员
458
+                        //{
459
+                        //    if (gdstate == 0)//未处理
460
+                        //        sql += " and CreateUserID = '" + uid + "'";
461
+                        //    else
462
+                        //        sql += " and LastDealUser = '" + uid + "'";
463
+                        //}
464
+
465
+                        if (strpageindex.Trim() != "")
466
+                        {
467
+                            pageindex = Convert.ToInt32(strpageindex);
468
+                        }
469
+
470
+                        if (strpagesize.Trim() != "")
471
+                        {
472
+                            pagesize = Convert.ToInt32(strpagesize);
473
+                        }
474
+                        //int recordCount = 0;
475
+                        //dt = BLL.PagerBLL.GetListPager(
476
+                        //    "T_Wo_WorkOrder",
477
+                        //    "T_Wo_WorkOrder.ID",
478
+                        //    "*,dbo.GetGDLXName(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",
479
+                        //    sql,
480
+                        //    "ORDER BY T_Wo_WorkOrder.ID desc",
481
+                        //    pagesize,
482
+                        //    pageindex,
483
+                        //    true,
484
+                        //    out recordCount);
485
+                        //dt.Columns.Add("CBCount", typeof(int));
486
+                        //foreach (DataRow dr in dt.Rows)
487
+                        //{
488
+                        //    var list = new BLL.T_Wo_WorkOrderItem().GetList(" WorkOrderID='" + dr["WorkOrderID"].ToString() + "' and IsDel=0 and Type=2 and ','+ToUser+',' like ',%" + ua.F_UserCode + "%,' ").Tables[0];
489
+                        //    dr["CBCount"] = list.Rows.Count;
490
+                        //}
491
+                        dt = DbHelperSQL.Query("select * from T_Wo_WorkOrder where createuser in (select u.F_UserCode from[dbo].[T_Sys_UserAccount] u,[dbo].[T_Sys_Department] d where u.F_DeptId = d.F_DeptId and d.F_DeptName = '客服部') and State = 0 " + sql + "union all select* from T_Wo_WorkOrder where createuser in (select u.F_UserCode from[dbo].[T_Sys_UserAccount] u,[dbo].[T_Sys_Department] d where u.F_DeptId=d.F_DeptId and d.F_DeptName='市场部') and Detail<>null" + sql).Tables[0];
492
+
493
+                        var obj = new
494
+                        {
495
+                            state = "success",
496
+                            message = "成功",
497
+                            rows = dt,
498
+                            total = dt.Rows.Count
499
+                        };
500
+
501
+                        res = Content(obj.ToJson());
502
+                    }
503
+                }
504
+            }
505
+            return res;
506
+        }
507
+        #endregion
508
+
276 509
         /// <summary>
277 510
         /// 获取可催办工单列表
278 511
         /// </summary>