Sfoglia il codice sorgente

工单报表按钮等调整

zhaozhiqiang 3 anni fa
parent
commit
5401275609

+ 477 - 36
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -46,6 +46,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
46 46
         /// </summary>
47 47
         /// <returns></returns>
48 48
         //[Authority]
49
+        #region MyRegion
49 50
         public ActionResult GetList(int isdc = 0)
50 51
         {
51 52
             int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
@@ -84,22 +85,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
84 85
             int IsExport = RequestString.GetInt("isexport", -1);
85 86
             if (IsExport > -1)
86 87
             {
87
-                if (IsExport==0)
88
+                if (IsExport == 0)
88 89
                     sql += " and (IsExport != '" + 1 + "'or IsExport is null) ";
89
-                else 
90
-                sql += " and IsExport = '" + IsExport + "' ";
90
+                else
91
+                    sql += " and IsExport = '" + IsExport + "' ";
91 92
             }
92
-           
93
+
93 94
             #region sql 语句相关处理
94 95
             if (strstate.Trim() != "" && strstate != "undefined")
95 96
             {
96
-                if (strstate.Trim() == ((int)EnumWorkState.neworder).ToString() )
97
+                if (strstate.Trim() == ((int)EnumWorkState.neworder).ToString())
97 98
                     sql += " and F_WorkState in (" + (int)EnumWorkState.neworder + "," + (int)EnumWorkState.audit + ") ";
98 99
                 else
99 100
                     sql += " and F_WorkState = '" + strstate.Trim() + "' ";
100 101
 
101 102
             }
102
-            if (files>1)
103
+            if (files > 1)
103 104
             {
104 105
                 sql += " and F_Files  is not null and F_Files!='' ";
105 106
             }
@@ -108,7 +109,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
108 109
                 sql += " and (F_WorkOrderId like '%" + strworkid + "%'or F_OldWorkOrderId like  '%" + strworkid + "%')";
109 110
             }
110 111
 
111
-            
112
+
112 113
             if (strname.Trim() != "" && strname != "undefined")
113 114
             {
114 115
                 sql += " and F_CusName like '%" + strname + "%' ";
@@ -120,10 +121,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
120 121
             if (strkey.Trim() != "" && strkey != "undefined")
121 122
             {
122 123
                 sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
123
-               
124
+
124 125
             }
125
-           
126
-           
126
+
127
+
127 128
             if (strusercode.Trim() != "" && strusercode != "undefined")
128 129
             {//坐席
129 130
                 var usercode = strusercode.Trim().Split(',');
@@ -160,7 +161,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
160 161
             {
161 162
                 sql += " and F_InfoSource = '" + source + "' ";
162 163
             }
163
-            if (satisfaction >-1)
164
+            if (satisfaction > -1)
164 165
             {
165 166
                 sql += " and F_Satisfaction = '" + satisfaction + "' ";
166 167
             }
@@ -170,7 +171,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
170 171
             }
171 172
             else if (userModel.F_RoleCode == "DFZF")
172 173
             {
173
-                sql += " and F_CreateUser ='"+ userModel .F_UserCode + "' ";
174
+                sql += " and F_CreateUser ='" + userModel.F_UserCode + "' ";
174 175
             }
175 176
             if (type != 0)
176 177
             {
@@ -265,10 +266,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
265 266
                 var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
266 267
                 if (msg == "")
267 268
                 {
268
-                   //if ( strstate.Trim() == ((int)EnumWorkState.finish).ToString())
269
-                   // {
270
-                       // var dtex= DbHelperSQL.Query("update T_Bus_WorkOrder set IsExport=1 where 1=1 " + sql ).Tables[0];
271
-                  //  }
269
+                    //if ( strstate.Trim() == ((int)EnumWorkState.finish).ToString())
270
+                    // {
271
+                    // var dtex= DbHelperSQL.Query("update T_Bus_WorkOrder set IsExport=1 where 1=1 " + sql ).Tables[0];
272
+                    //  }
272 273
                     return Success("导出成功");
273 274
                 }
274 275
                 else
@@ -276,7 +277,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
276 277
                     return Error("导出失败");
277 278
                 }
278 279
             }
279
-            
280
+
280 281
             #endregion
281 282
             int recordCount = 0;
282 283
             dt = BLL.PagerBLL.GetListPager(
@@ -403,12 +404,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
403 404
                             ispd = dtjb.Rows[0]["F_IsNext"] != null ? dtjb.Rows[0]["F_IsNext"].ToString() : "";
404 405
                             dr["PDState"] = ispd;
405 406
                         }
406
-                       
407
-                        if (state == (int)EnumWorkState.finish|| state == (int)EnumWorkState.closed)
407
+
408
+                        if (state == (int)EnumWorkState.finish || state == (int)EnumWorkState.closed)
408 409
                         {
409 410
                             var closetime = dr["F_DealTime"].ToString();//关闭工单时间
410
-                            if (!string.IsNullOrEmpty (closetime)) {
411
-                              var   dttime = DateTime.Parse(closetime);
411
+                            if (!string.IsNullOrEmpty(closetime))
412
+                            {
413
+                                var dttime = DateTime.Parse(closetime);
412 414
 
413 415
                                 if (!string.IsNullOrEmpty(lt))
414 416
                                 {
@@ -425,12 +427,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
425 427
                                 }
426 428
 
427 429
                             }
428
-                            
430
+
429 431
                         }
430 432
                         #endregion
431 433
                     }
432 434
                 }
433
-                
435
+
434 436
                 if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
435 437
                 {
436 438
                     dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
@@ -442,26 +444,464 @@ namespace CallCenterApi.Interface.Controllers.workorder
442 444
 
443 445
                 if (dr["F_Files"] != null && dr["F_Files"].ToString() != "")
444 446
                 {
445
-                    if (!string .IsNullOrEmpty (dr["F_Files"].ToString()))
446
-                      dr["IsFiles"] = 1;
447
+                    if (!string.IsNullOrEmpty(dr["F_Files"].ToString()))
448
+                        dr["IsFiles"] = 1;
447 449
                     else
448
-                       dr["IsFiles"] = 0;
450
+                        dr["IsFiles"] = 0;
449 451
                 }
450 452
                 else
451 453
                 {
452
-                    dr["IsFiles"] =0;
454
+                    dr["IsFiles"] = 0;
453 455
                 }
454
-                var buttons= ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw, ispd, dr["IsExport"].ToString());
456
+                var buttons = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw, ispd, dr["IsExport"].ToString());
455 457
                 #region 判断是否存在待督办
456 458
                 var recount = reminds.Where(r => r.F_WorkOrderId.Equals(dr["F_WorkOrderId"].ToString())).Count();
457 459
                 var butt = buttons.Find(c => c.key == ButtonGroup.turnsee().key);
458
-                
459
-                if (userModel.F_RoleCode.ToUpper()== "GLY"|| userModel.F_RoleCode.ToUpper() == "ZXLD" )
460
+
461
+                if (userModel.F_RoleCode.ToUpper() == "GLY" || userModel.F_RoleCode.ToUpper() == "ZXLD")
460 462
                 {
461
-                    buttons.Add(ButtonGroup.delete() );
463
+                    buttons.Add(ButtonGroup.delete());
462 464
                 }
463
-               
464
-                if (recount > 0 && butt!=null)
465
+
466
+                if (recount > 0 && butt != null)
467
+                    buttons.Remove(butt);
468
+                #endregion
469
+                dr["Buttons"] = buttons;
470
+            }
471
+            #endregion
472
+
473
+            var obj = new
474
+            {
475
+                state = "success",
476
+                message = "成功",
477
+                rows = dt,
478
+                total = recordCount
479
+            };
480
+            return Content(obj.ToJson());
481
+
482
+        }
483
+        #endregion
484
+
485
+        #region MyRegion
486
+        public ActionResult GetListTimeOut(int isdc = 0)
487
+        {
488
+            int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
489
+            Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
490
+
491
+            DataTable dt = new DataTable();
492
+            string sql = " and F_IsDelete=0 and (F_LimitTime>= DATEADD(hh,4,F_LimitTime) or F_LimitTime<GETDATE())  and (F_WorkState<6 or F_WorkState=8) ";
493
+            string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
494
+            string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
495
+            string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
496
+            string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
497
+            string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
498
+            string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
499
+            string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
500
+            string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
501
+            string strddusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("ddusercode"));//调度员
502
+            int source = RequestString.GetInt("source", 0);
503
+            int keyid = RequestString.GetInt("keyid", 0);
504
+            int type = RequestString.GetInt("type", 0);
505
+            int bigtype = RequestString.GetInt("bigtype", 0);
506
+            int smalltype = RequestString.GetInt("smalltype", 0);
507
+            int sourcearea = RequestString.GetInt("sourcearea", 0);
508
+            int files = RequestString.GetInt("files", 0);
509
+            int deptid = RequestString.GetInt("deptid", 0);
510
+            int dealtype = RequestString.GetInt("dealtype", -1);
511
+            int issend = RequestString.GetInt("issend", -1);
512
+            int deptlevel = RequestString.GetInt("deptlevel", 0);
513
+            int satisfaction = RequestString.GetInt("satisfaction", -1);
514
+            int timesort = RequestString.GetInt("timesort", -1);
515
+
516
+
517
+            string strpageindex = RequestString.GetQueryString("page");
518
+            int pageindex = 1;
519
+            string strpagesize = RequestString.GetQueryString("pagesize");
520
+            int pagesize = 10;
521
+            int IsExport = RequestString.GetInt("isexport", -1);
522
+            if (IsExport > -1)
523
+            {
524
+                if (IsExport == 0)
525
+                    sql += " and (IsExport != '" + 1 + "'or IsExport is null) ";
526
+                else
527
+                    sql += " and IsExport = '" + IsExport + "' ";
528
+            }
529
+
530
+            #region sql 语句相关处理
531
+            if (strstate.Trim() != "" && strstate != "undefined")
532
+            {
533
+                if (strstate.Trim() == ((int)EnumWorkState.neworder).ToString())
534
+                    sql += " and F_WorkState in (" + (int)EnumWorkState.neworder + "," + (int)EnumWorkState.audit + ") ";
535
+                else
536
+                    sql += " and F_WorkState = '" + strstate.Trim() + "' ";
537
+
538
+            }
539
+            if (files > 1)
540
+            {
541
+                sql += " and F_Files  is not null and F_Files!='' ";
542
+            }
543
+            if (strworkid.Trim() != "" && strworkid != "undefined")
544
+            {
545
+                sql += " and (F_WorkOrderId like '%" + strworkid + "%'or F_OldWorkOrderId like  '%" + strworkid + "%')";
546
+            }
547
+
548
+
549
+            if (strname.Trim() != "" && strname != "undefined")
550
+            {
551
+                sql += " and F_CusName like '%" + strname + "%' ";
552
+            }
553
+            if (strtel.Trim() != "" && strtel != "undefined")
554
+            {
555
+                sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
556
+            }
557
+            if (strkey.Trim() != "" && strkey != "undefined")
558
+            {
559
+                sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
560
+
561
+            }
562
+
563
+
564
+            if (strusercode.Trim() != "" && strusercode != "undefined")
565
+            {//坐席
566
+                var usercode = strusercode.Trim().Split(',');
567
+                var newusercode = "";
568
+                foreach (var item in usercode)
569
+                {
570
+                    if (!string.IsNullOrWhiteSpace(item.Trim()))
571
+                        newusercode += "'" + item + "',";
572
+                }
573
+                newusercode = newusercode.Trim(',');
574
+                if (newusercode.Trim() != "" && newusercode != "undefined")
575
+                {
576
+                    sql += " and F_CreateUser in (" + newusercode + ") ";
577
+                    //sql += " and F_CreateUser ='" + strusercode + "' ";
578
+                }
579
+            }
580
+            if (strddusercode.Trim() != "" && strddusercode != "undefined")
581
+            {//调度员
582
+                var ddusercode = strddusercode.Trim().Split(',');
583
+                var newusercode = "";
584
+                foreach (var item in ddusercode)
585
+                {
586
+                    if (!string.IsNullOrWhiteSpace(item.Trim()))
587
+                        newusercode += "'" + item + "',";
588
+                }
589
+                newusercode = newusercode.Trim(',');
590
+                if (newusercode.Trim() != "" && newusercode != "undefined")
591
+                {
592
+                    sql += " and F_AssignUser in(" + newusercode + ") ";
593
+                    //sql += " and F_AssignUser = '" + strddusercode + "' ";
594
+                }
595
+            }
596
+            if (source != 0)
597
+            {
598
+                sql += " and F_InfoSource = '" + source + "' ";
599
+            }
600
+            if (satisfaction > -1)
601
+            {
602
+                sql += " and F_Satisfaction = '" + satisfaction + "' ";
603
+            }
604
+            if (keyid != 0)
605
+            {
606
+                sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
607
+            }
608
+            else if (userModel.F_RoleCode == "DFZF")
609
+            {
610
+                sql += " and F_CreateUser ='" + userModel.F_UserCode + "' ";
611
+            }
612
+            if (type != 0)
613
+            {
614
+                sql += " and F_InfoType = '" + type + "' ";
615
+            }
616
+            if (bigtype != 0)
617
+            {
618
+                sql += " and F_InfoConBigType = '" + bigtype + "' ";
619
+            }
620
+            if (smalltype != 0)
621
+            {
622
+                sql += " and F_InfoConSmallType = '" + smalltype + "' ";
623
+            }
624
+
625
+            if (sourcearea != 0)
626
+            {
627
+                sql += " and F_SourceArea = '" + sourcearea + "' ";
628
+            }
629
+
630
+            if (deptid != 0)
631
+            {
632
+                //sql += " and ',' + F_MainDeptID + ',' like '%," + deptid.ToString() + ",%'";
633
+                //sql += " and isnull(F_MainDeptId,null)='"+ deptid + "'";
634
+                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
635
+                #region 20190924 zhengbingbing 主办单位查询以最后办理单位为准
636
+                //if (deptlevel == 0)
637
+                //{
638
+                //    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
639
+                //    sql += " and F_WorkOrderID in(" + sqlwhere + ")";
640
+                //}
641
+                //else
642
+                //{
643
+                //    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo_Next where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
644
+                //    sql += " and F_WorkOrderID in(" + sqlwhere + ")";
645
+                //}
646
+                #endregion
647
+            }
648
+            if (dealtype != -1)
649
+            {
650
+                sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
651
+            }
652
+            if (issend != -1)
653
+            {
654
+                sql += " and isnull(F_IsRelease,0) = '" + issend + "' ";
655
+            }
656
+
657
+            if (strstarttime.Trim() != "" && strstarttime != "undefined")
658
+            {
659
+                sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
660
+            }
661
+            if (strendtime.Trim() != "" && strendtime != "undefined")
662
+            {
663
+                sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0   ";
664
+            }
665
+            #endregion
666
+
667
+            if (strpageindex.Trim() != "")
668
+            {
669
+                pageindex = Convert.ToInt32(strpageindex);
670
+            }
671
+
672
+            if (strpagesize.Trim() != "")
673
+            {
674
+                pagesize = Convert.ToInt32(strpagesize);
675
+            }
676
+            //string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetOverState(F_WorkOrderId) as OverState,"
677
+            //    + "dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetWorkOrderAssign(F_WorkOrderId) as DeptName ,dbo.GetLimitTime(F_WorkOrderId) as LimitTime";
678
+            //string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName";
679
+            string sort = "ORDER BY F_CreateTime ASC";
680
+            if (timesort == 0)
681
+                sort = "ORDER BY LimitTime ASC";
682
+            else if (timesort == 1)
683
+                sort = "ORDER BY F_CreateTime DESC";
684
+            string cols = "F_OldWorkOrderId,F_WorkOrderId,F_Scanning,F_ComTitle,F_WorkState,F_MainDeptId,F_OtherDeptIds,F_DealTime,F_LeaveRecordId,F_CallRecordId,F_IsResult,F_IsProtect,F_IsReturn,F_CreateTime,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName,IsExport,F_Files,F_WorkRemarks";
685
+            #region 导出
686
+            if (isdc > 0)
687
+            {
688
+                var top = " "; var orderby = " order by F_CreateTime";
689
+                if (sql == " and F_IsDelete=0 ")
690
+                {
691
+                    top = " top 1000 "; orderby += " desc ";
692
+                }
693
+                sql+= " and (F_LimitTime>= DATEADD(hh,4,F_LimitTime) or F_LimitTime<GETDATE())  and (F_WorkState<6 or F_WorkState=8) ";
694
+
695
+                //20190715调整导出字段 zhengbingbing
696
+                //日期,工单号,诉求标题,诉求内容,承办单位,办理结果,是否满意,备注
697
+                var dtdc = DbHelperSQL.Query(" select " + top + " F_CreateTime 日期, F_OldWorkOrderId 工单号,F_ComTitle 诉求标题,F_CusName 反映人,F_CusPhone 电话号码,F_ComContent 诉求内容,dbo.GetDictionaryName(F_Key) 主题词, "
698
+                   + " dbo.GetDeptNames(F_MainDeptId) 承办单位, "
699
+                   + " (select top 1 F_Situation from T_Bus_Feedback WITH(NOLOCK) where F_State=1 and F_Type!=3 and F_IsDelete=0 and  F_WorkOrderId =wo.F_WorkOrderId order by F_CreateTime) 办理结果,"
700
+                   + " (select top 1 (case F_IsSatisfie when 1 then'满意' when 0 then '不满意'when 2 then '基本满意' else '未评价' end) F_Satisfie from T_Bus_VisitResult WITH(NOLOCK) where F_State = 1 and F_IsDelete = 0 and F_WorkOrderId = wo.F_WorkOrderId order by F_Id desc) 承办单位回访结果, case F_Satisfaction when 0 then '不满意'when 1 then" +
701
+                   "'基本满意' when 2 then '满意' else '未评价'end 郑州回访结果"
702
+                   + " from T_Bus_WorkOrder wo WITH(NOLOCK) where 1=1 " + sql + sort).Tables[0];
703
+
704
+                var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
705
+                if (msg == "")
706
+                {
707
+                    //if ( strstate.Trim() == ((int)EnumWorkState.finish).ToString())
708
+                    // {
709
+                    // var dtex= DbHelperSQL.Query("update T_Bus_WorkOrder set IsExport=1 where 1=1 " + sql ).Tables[0];
710
+                    //  }
711
+                    return Success("导出成功");
712
+                }
713
+                else
714
+                {
715
+                    return Error("导出失败");
716
+                }
717
+            }
718
+
719
+            #endregion
720
+            int recordCount = 0;
721
+            dt = BLL.PagerBLL.GetListPager(
722
+                "T_Bus_WorkOrder WITH(NOLOCK)",
723
+                "F_WorkOrderId",
724
+                cols,
725
+                sql,
726
+               sort,
727
+                pagesize,
728
+                pageindex,
729
+                true,
730
+                out recordCount);
731
+
732
+            #region 声音文件和交办超时
733
+            dt.Columns.Add("DeptName", typeof(string));//交办单位
734
+            dt.Columns.Add("AssignTime", typeof(string));//交办时间
735
+            dt.Columns.Add("OtherDeptName", typeof(string));//协办单位
736
+            dt.Columns.Add("OverState", typeof(string));//超时状态
737
+            dt.Columns.Add("LimitTime", typeof(string));//限制时间
738
+            dt.Columns.Add("GapTime", typeof(string));//时间差
739
+            dt.Columns.Add("PDState", typeof(string));//派单状态
740
+            dt.Columns.Add("FilePath", typeof(string));//语音文件路径
741
+            dt.Columns.Add("Buttons", typeof(object));//操作按钮
742
+            dt.Columns.Add("FilePaths", typeof(object));//操作按钮
743
+            dt.Columns.Add("IsFiles", typeof(object));//操作按钮
744
+            var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
745
+            var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
746
+            var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
747
+            var reminds = remindBLL.GetModelList(" F_State=0 and F_IsDelete=0 and F_Type =1").ToList();
748
+            foreach (DataRow dr in dt.Rows)
749
+            {
750
+                string iszbdw = "0";
751
+                string ispd = "";
752
+
753
+                int state = Int32.Parse(dr["F_WorkState"].ToString());
754
+                if (state > 1)
755
+                {
756
+                    //获取最新交办信息
757
+                    string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WITH(NOLOCK) WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure<>3   ORDER BY F_Id DESC";
758
+                    var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
759
+                    if (dtjb.Rows.Count > 0)
760
+                    {
761
+                        //if (dtjb.Rows[0]["F_MainDeptId"].ToString().Split(',').Contains(userModel.F_DeptId.ToString())) { iszbdw = "1"; }
762
+                        if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
763
+                        dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dr["F_MainDeptId"].ToString() + "')");
764
+                        if (dr["F_OtherDeptIds"] != null && dr["F_OtherDeptIds"].ToString() != "")
765
+                        {
766
+                            dr["OtherDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dr["F_OtherDeptIds"].ToString() + "')");
767
+                        }
768
+                        #region 20191016
769
+                        //if (dtjb.Rows[0]["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
770
+                        //dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_MainDeptId"].ToString() + "')");
771
+                        //if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
772
+                        //{
773
+                        //    dr["OtherDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_OtherDeptIds"].ToString() + "')");
774
+                        //}
775
+                        #endregion
776
+                        dr["AssignTime"] = dtjb.Rows[0]["F_CreateTime"].ToString();
777
+                        #region
778
+                        //int did = Int32.Parse(dtjb.Rows[0]["F_MainDeptId"].ToString());
779
+                        //var deptinfo = new BLL.T_Sys_Department().GetModel(did);
780
+                        //if (deptinfo != null)
781
+                        //{
782
+                        //    if (did == userModel.F_DeptId) { iszbdw = "1"; }
783
+                        //    dr["DeptName"] = deptinfo.F_DeptName;//交办单位
784
+                        //}
785
+                        //if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
786
+                        //{
787
+                        //    string[] strids = dtjb.Rows[0]["F_OtherDeptIds"].ToString().Split(',');
788
+                        //    string dns = string.Empty;
789
+                        //    foreach (string strid in strids)
790
+                        //    {
791
+                        //        var dinfo = new BLL.T_Sys_Department().GetModel(Int32.Parse(strid));
792
+                        //        if (dinfo != null)
793
+                        //        {
794
+                        //            if (string.IsNullOrEmpty(dns))
795
+                        //            {
796
+                        //                dns = dinfo.F_DeptName;//交办单位
797
+                        //            }
798
+                        //            else
799
+                        //            {
800
+                        //                dns += "," + dinfo.F_DeptName;//交办单位
801
+                        //            }
802
+                        //        }
803
+                        //    }
804
+                        //    dr["OtherDeptName"] = dns;
805
+                        //}
806
+                        #endregion
807
+                        var lt = dtjb.Rows[0]["F_LimitTime"].ToString();//限制时间
808
+                        dr["LimitTime"] = lt;
809
+                        #region 超时时限
810
+                        //if (state < 6 || state == 8)
811
+                        if (state < (int)EnumWorkState.dealed || state == (int)EnumWorkState.reload)
812
+                        {
813
+                            if (!string.IsNullOrWhiteSpace(lt))
814
+                            {
815
+                                var ltime = DateTime.Parse(lt);
816
+                                TimeSpan ts = ltime.Subtract(DateTime.Now);
817
+                                int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
818
+                                if (tss < 0) { tss = -tss; }
819
+                                string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
820
+                                if (ltime > DateTime.Now)
821
+                                {
822
+                                    if (configcs != null)
823
+                                    {
824
+                                        int cs = Int32.Parse(configcs.F_ParamValue);
825
+                                        if (ts.TotalHours > cs)
826
+                                        {
827
+                                            dr["OverState"] = 1;
828
+                                        }
829
+                                        else
830
+                                        {
831
+                                            dr["OverState"] = 2;
832
+                                        }
833
+                                    }
834
+                                    dr["GapTime"] = "剩余" + gshsj;
835
+                                }
836
+                                else
837
+                                {
838
+                                    dr["OverState"] = 3;
839
+                                    dr["GapTime"] = "超时" + gshsj;
840
+                                }
841
+                            }
842
+                            ispd = dtjb.Rows[0]["F_IsNext"] != null ? dtjb.Rows[0]["F_IsNext"].ToString() : "";
843
+                            dr["PDState"] = ispd;
844
+                        }
845
+
846
+                        if (state == (int)EnumWorkState.finish || state == (int)EnumWorkState.closed)
847
+                        {
848
+                            var closetime = dr["F_DealTime"].ToString();//关闭工单时间
849
+                            if (!string.IsNullOrEmpty(closetime))
850
+                            {
851
+                                var dttime = DateTime.Parse(closetime);
852
+
853
+                                if (!string.IsNullOrEmpty(lt))
854
+                                {
855
+                                    var ltime = DateTime.Parse(lt);
856
+                                    TimeSpan ts = ltime.Subtract(dttime);
857
+                                    int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
858
+                                    if (tss < 0) { tss = -tss; }
859
+                                    string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
860
+                                    if (ltime < dttime)
861
+                                    {
862
+                                        dr["OverState"] = 3;
863
+                                        dr["GapTime"] = "超时" + gshsj;
864
+                                    }
865
+                                }
866
+
867
+                            }
868
+
869
+                        }
870
+                        #endregion
871
+                    }
872
+                }
873
+
874
+                if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
875
+                {
876
+                    dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
877
+                }
878
+                else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
879
+                {
880
+                    dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
881
+                }
882
+
883
+                if (dr["F_Files"] != null && dr["F_Files"].ToString() != "")
884
+                {
885
+                    if (!string.IsNullOrEmpty(dr["F_Files"].ToString()))
886
+                        dr["IsFiles"] = 1;
887
+                    else
888
+                        dr["IsFiles"] = 0;
889
+                }
890
+                else
891
+                {
892
+                    dr["IsFiles"] = 0;
893
+                }
894
+                var buttons = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw, ispd, dr["IsExport"].ToString());
895
+                #region 判断是否存在待督办
896
+                var recount = reminds.Where(r => r.F_WorkOrderId.Equals(dr["F_WorkOrderId"].ToString())).Count();
897
+                var butt = buttons.Find(c => c.key == ButtonGroup.turnsee().key);
898
+
899
+                if (userModel.F_RoleCode.ToUpper() == "GLY" || userModel.F_RoleCode.ToUpper() == "ZXLD")
900
+                {
901
+                    buttons.Add(ButtonGroup.delete());
902
+                }
903
+
904
+                if (recount > 0 && butt != null)
465 905
                     buttons.Remove(butt);
466 906
                 #endregion
467 907
                 dr["Buttons"] = buttons;
@@ -478,6 +918,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
478 918
             return Content(obj.ToJson());
479 919
 
480 920
         }
921
+        #endregion
481 922
 
482 923
         public ActionResult GetTimeOutList()
483 924
         {
@@ -7366,11 +7807,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
7366 7807
                          #endregion
7367 7808
                         if(isover==1)
7368 7809
                         {
7369
-                            oper.F_Message = " 修改办理内容并结案了工单";
7810
+                            oper.F_Message = userModel.F_UserCode+ " 修改办理内容并结案了工单";
7370 7811
                         }
7371 7812
                         else  
7372 7813
                         {
7373
-                            oper.F_Message = " 修改了办理内容";
7814
+                            oper.F_Message = userModel.F_UserCode+ " 修改了办理内容";
7374 7815
                         }
7375 7816
                         oper.F_CreateUser = userModel.F_UserCode;
7376 7817
                         oper.F_CreateTime = DateTime.Now;
@@ -8358,7 +8799,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8358 8799
                                         {
8359 8800
                                             string count = "你有新的工单,工单号" + modelT_Bus_WorkOrder.F_WorkOrderId + ",请及时查收。";
8360 8801
                                             string[] mag = { modelT_Bus_WorkOrder.F_WorkOrderId };
8361
-                                            bool n = new SMSController().AddSmS(833958, userId, count, mag, u.F_Mobile);
8802
+                                            bool  n = new SMSController().AddSmS(833958, userId, count, mag, u.F_Mobile);
8362 8803
                                         }
8363 8804
                                         if (!string.IsNullOrEmpty(u.F_Telephone))
8364 8805
                                         {

+ 3 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Common/ButtonGroup.cs

@@ -277,8 +277,9 @@ namespace CallCenterApi.Interface.Models.Common
277 277
                        // buttons.Add(approval());
278 278
                         buttons.Add(takeback());
279 279
                         buttons.Add(Reminder());
280
-                   //     buttons.Add(turnsee()); //buttons.Add(oversee());
281
-                   //     buttons.Add(supervision());
280
+                        buttons.Add(Runsend());
281
+                        //     buttons.Add(turnsee()); //buttons.Add(oversee());
282
+                        //     buttons.Add(supervision());
282 283
                     }
283 284
                     //质检专员
284 285
                  //   if (code == "ZJZY")