Browse Source

报表明细

duhongyu 4 years ago
parent
commit
0b3d52b6f4

File diff suppressed because it is too large
+ 6 - 6
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/WebChart/InfoNewController.cs


+ 163 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WorkOrderReportController.cs

431
             }
431
             }
432
             return Success("成功", obj);
432
             return Success("成功", obj);
433
         }
433
         }
434
+
435
+        public ActionResult WorkOrdrList()
436
+        {
437
+            DataTable dt = new DataTable();
438
+            string sql = " and F_IsDelete=0 ";
439
+         
440
+            int sourceArea = RequestString.GetInt("sourceArea", 0);
441
+            int keyid = RequestString.GetInt("keyid", 0);
442
+            int deptid = RequestString.GetInt("deptid", 0);
443
+            int key = RequestString.GetInt("key", 0);
444
+            int timetype = RequestString.GetInt("timetype", 0);
445
+            int ishf = RequestString.GetInt("ishf", 0);
446
+            int area = RequestString.GetInt("area", 0);
447
+            int state = RequestString.GetInt("state", -1);
448
+            int type = RequestString.GetInt("type", 0);
449
+            int source = RequestString.GetInt("source", 0);
450
+            string mobile = RequestString.GetQueryString("mobile");
451
+            int dbdb = RequestString.GetInt("dbdb", 0);
452
+            int db = RequestString.GetInt("db", 0);
453
+            string dbusercode = RequestString.GetQueryString("dbusercode");
454
+            string strpageindex = RequestString.GetQueryString("page");
455
+            string strpagesize = RequestString.GetQueryString("pagesize");
456
+            string usercode = RequestString.GetQueryString("usercode");
457
+            string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
458
+            string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
459
+            int pageindex = 1;
460
+            int pagesize = 10;
461
+            if (strpageindex.Trim() != "")
462
+            {
463
+                pageindex = Convert.ToInt32(strpageindex);
464
+            }
465
+            if (strpagesize.Trim() != "")
466
+            {
467
+                pagesize = Convert.ToInt32(strpagesize);
468
+            }
469
+            if (!string .IsNullOrEmpty (usercode))
470
+            {
471
+                sql += " and F_CreateUser='"+ usercode + "' ";
472
+            }
473
+            if (string .IsNullOrEmpty (strstarttime)&& string.IsNullOrEmpty(strendtime))
474
+            {
475
+                if (timetype == 1)
476
+                {
477
+                    sql += "and datediff(DAY ,a.F_CreateTime ,getdate())=0 ";
478
+                }
479
+                else if (timetype == 2)
480
+                {
481
+                    sql += "and datediff(WEEK ,a.F_CreateTime ,getdate())=0 ";
482
+                }
483
+                else
484
+                {
485
+                    sql += " and datediff(MONTH ,a.F_CreateTime ,getdate())=0 ";
486
+                }
487
+              
488
+            }
489
+            else
490
+            {
491
+                if (!string .IsNullOrEmpty (strstarttime))
492
+                {
493
+                    sql += "and datediff(SS ,F_CreateTime,'"+ strstarttime + "')<=0 ";
494
+                }
495
+                 if (!string.IsNullOrEmpty(strendtime))
496
+                {
497
+                    sql += " and and datediff(SS ,F_CreateTime,'"+ strendtime + "')>=0";
498
+                }
499
+            }
500
+            if (dbdb>0)
501
+            {
502
+                sql += "   F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type= 1 and F_IsDelete = 0  and F_State = 0 and (Supervisor ='' or  Supervisor is null )) and F_WorkState  != '9'";
503
+            }
504
+            if(db>0)
505
+            {
506
+                string value = "";
507
+                if (!string .IsNullOrEmpty (dbusercode))
508
+                {
509
+                    value += "and Supervisor='" + dbusercode + "'";
510
+                }
511
+                if (db==1)
512
+                {
513
+                    sql += "   F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type= 1 and F_IsDelete = 0  "+ value + " ) and F_WorkState  != '9'";
514
+                }
515
+                else if (db == 2)
516
+                {
517
+                    sql += "   F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type= 1 and F_State = 1 " + value + " ) and F_WorkState  != '9'";
518
+                }
519
+                else if (db == 3)
520
+                {
521
+                    sql += "   F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type= 1 and F_State = 2 " + value + " ) and F_WorkState  != '9'";
522
+                }
523
+                else if (db == 4)
524
+                {
525
+                    sql += "   F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type= 1  " + value + " ) and F_WorkState  = '9'";
526
+                }
527
+            }
528
+
529
+             if (!string .IsNullOrEmpty (mobile ))
530
+            {
531
+                sql += "and a.F_CusPhone = " + mobile + "";
532
+            }
533
+            if (area  > 0)
534
+            {
535
+                sql += "and a.F_SourceArea='" + area + "'";
536
+            }
537
+            if (state>-1)
538
+            {
539
+                sql += "and a.F_WorkState='" + state + "'";
540
+            }
541
+            if (type > 0)
542
+            {
543
+                sql += "and a.F_InfoType='" + type + "'";
544
+            }
545
+            if (source > 0)
546
+            {
547
+                sql += "and a.F_InfoSource='" + source + "'";
548
+            }
549
+            if (ishf>0)
550
+            {
551
+                string value = "";
552
+                if (string.IsNullOrEmpty(strstarttime) && string.IsNullOrEmpty(strendtime))
553
+                {
554
+                    value += " and datediff(MONTH ,a.F_CreateTime ,getdate())=0 ";
555
+                }
556
+                else
557
+                {
558
+                    if (!string.IsNullOrEmpty(strstarttime))
559
+                    {
560
+                        value += "and datediff(SS ,F_CreateTime,'" + strstarttime + "')<=0 ";
561
+                    }
562
+                }
563
+                if (ishf==1)
564
+                {
565
+                    sql += "and  F_WorkOrderId  in (select F_WorkOrderId from  T_Bus_VisitResult WITH(NOLOCK) " +
566
+                        "and  F_IsDelete =0 "+ value + "  )   ";
567
+              
568
+                }
569
+                else
570
+                {
571
+                    sql += "and  F_WorkOrderId not  in (select F_WorkOrderId from  T_Bus_VisitResult WITH(NOLOCK) " +
572
+                           "and  F_IsDelete =0 " + value + "  and F_IsSms !=1  )   ";
573
+                }
574
+            }
575
+            string cols = "DISTINCT  a.F_WorkOrderId,F_ComTitle,F_WorkState,F_MainDeptId,F_IsResult,a.F_CreateTime,dbo.GetUserName(a.F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetDictionaryName(F_Key) KeyName,dbo.GetDeptNames(F_MainDeptId) as DeptName,F_CloseTime,F_LimitTime as LimitTime,F_ComContent";
576
+            int recordCount = 0;
577
+            dt = BLL.PagerBLL.GetListPager(
578
+                "T_Bus_WorkOrder a WITH(NOLOCK)" ,
579
+                "a.F_WorkOrderId",
580
+                cols,
581
+                sql,
582
+                "ORDER BY a.F_CreateTime DESC",
583
+                pagesize,
584
+                pageindex,
585
+                true,
586
+                out recordCount);
587
+            var obj = new
588
+            {
589
+                state = "success",
590
+                message = "成功",
591
+                rows = dt,
592
+                total = recordCount
593
+            };
594
+            return Content(obj.ToJson());
595
+        }
434
         /// <summary>
596
         /// <summary>
435
         /// 逾期未回复统计
597
         /// 逾期未回复统计
436
         /// </summary>
598
         /// </summary>
744
             paras.Add("@sdate", starttime);
906
             paras.Add("@sdate", starttime);
745
             paras.Add("@edate", endtime);
907
             paras.Add("@edate", endtime);
746
             var obj1 = DbHelperSQL.RunProcedure("P_DBReportform", paras, "DBReportform").Tables[0];
908
             var obj1 = DbHelperSQL.RunProcedure("P_DBReportform", paras, "DBReportform").Tables[0];
747
-            string sqlarea = "  select COUNT(1) from T_Bus_WorkOrder where F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_Type=1 and F_IsDelete=0 and (F_IsExamine !='1' or F_IsExamine is null) and F_State =0) and F_WorkState  !='9'";
909
+            string sqlarea = "  select COUNT(1) from T_Bus_WorkOrder where F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord WITH(NOLOCK) where F_Type=1 and F_IsDelete=0  and F_State =0 and (Supervisor ='' or  Supervisor is null )) and F_WorkState  !='9'and F_IsDelete =0";
748
             DataTable dttype = DbHelperSQL.Query(sqlarea).Tables[0];
910
             DataTable dttype = DbHelperSQL.Query(sqlarea).Tables[0];
749
             var obj = new
911
             var obj = new
750
             {
912
             {