|
|
@@ -460,110 +460,30 @@ namespace CallCenterApi.Interface.Controllers
|
|
460
|
460
|
if (ua != null)
|
|
461
|
461
|
{
|
|
462
|
462
|
#region 权限限制
|
|
463
|
|
- string sql = " and IsDel=0 ";
|
|
464
|
|
- ////部门信息
|
|
465
|
|
- //var modelDep = new BLL.T_Sys_Department().GetModel(deptid);
|
|
466
|
|
- //int depType = 0, depRegion = 0;
|
|
467
|
|
- //if (modelDep != null)
|
|
468
|
|
- //{
|
|
469
|
|
- // depType = modelDep.F_Type ?? 0; //部门操作权限:1接待部,2办理人员,3区域客服,4监管
|
|
470
|
|
- // depRegion = modelDep.F_Header ?? 0; //部门权限范围:9全部,1区域,2项目,3期
|
|
471
|
|
- //}
|
|
472
|
|
- //if (ua.F_RoleId != 17)
|
|
473
|
|
- //{
|
|
474
|
|
- // if (depType == 2)
|
|
475
|
|
- // {
|
|
476
|
|
- // if (depRegion == 1)
|
|
477
|
|
- // {
|
|
478
|
|
- // // 查看该区域工单
|
|
479
|
|
- // //sql += $" and IsUserSend = (SELECT TOP 1 F_ParentId FROM dbo.T_Cus_RegionCategory WHERE F_RegionId = {userRegionId}) ";
|
|
480
|
|
- // sql += $" and IsUserSend = {userRegionId} ";
|
|
481
|
|
- // }
|
|
482
|
|
- // else if (depRegion == 2)
|
|
483
|
|
- // {
|
|
484
|
|
- // // 查看该项目工单
|
|
485
|
|
- // sql += $" and IsAdminSend = {userRegionId} ";
|
|
486
|
|
- // }
|
|
487
|
|
- // }
|
|
488
|
|
- // else if (depType == 3)
|
|
489
|
|
- // {
|
|
490
|
|
- // if (depRegion == 1)
|
|
491
|
|
- // {
|
|
492
|
|
- // // 查看该区域工单
|
|
493
|
|
- // //sql += $" and IsUserSend = (SELECT TOP 1 F_ParentId FROM dbo.T_Cus_RegionCategory WHERE F_RegionId = {userRegionId}) ";
|
|
494
|
|
- // sql += $" and IsUserSend = {userRegionId} ";
|
|
495
|
|
- // }
|
|
496
|
|
- // }
|
|
497
|
|
- // else if (depType == 4)
|
|
498
|
|
- // {
|
|
499
|
|
- // if (depRegion == 2)
|
|
500
|
|
- // {
|
|
501
|
|
- // // 查看该项目工单
|
|
502
|
|
- // sql += $" and IsAdminSend = {userRegionId} ";
|
|
503
|
|
- // }
|
|
504
|
|
- // else if (depRegion == 9)
|
|
505
|
|
- // {
|
|
506
|
|
- // // 查看该部门工单(包括一级,二级)
|
|
507
|
|
- // string deptCodeNew = String.Empty;
|
|
508
|
|
- // int deptCodeIndex = 0; //变量声明
|
|
509
|
|
- // string deptCodeN = deptCode.TrimEnd('|'); //去掉最后一个|
|
|
510
|
|
- // deptCodeIndex = deptCodeN.LastIndexOf("|"); //获得|的索引
|
|
511
|
|
- // deptCodeNew = deptCodeN.Substring(0, deptCodeIndex + 1); //获得目标字符串(//去掉最后一个|后面的字符串)
|
|
512
|
|
- // //============== 部门权限条件 - 部门 ================
|
|
513
|
|
- // string arrUser = " select F_UserCode from T_Sys_UserAccount where F_DeptCode LIKE '" + deptCodeNew + "%' ";
|
|
514
|
|
- // sql += $" and WorkOrderID in (SELECT DISTINCT WorkOrderID FROM dbo.T_Wo_WorkOrderItem WHERE ToUser IN ({arrUser})) ";
|
|
515
|
|
- // }
|
|
516
|
|
- // }
|
|
517
|
|
- //}
|
|
|
463
|
+ string sql = " IsDelete=0 ";
|
|
|
464
|
+
|
|
518
|
465
|
#endregion
|
|
519
|
466
|
#region 工单各状态下数量
|
|
520
|
|
- BLL.T_Wo_WorkOrder bll = new BLL.T_Wo_WorkOrder();
|
|
521
|
|
- WorkOrderController woController = new WorkOrderController();
|
|
|
467
|
+ BLL.T_Wo_WorkOrderNew bll = new BLL.T_Wo_WorkOrderNew();
|
|
|
468
|
+
|
|
522
|
469
|
string uwhere = " 1=1 ";
|
|
523
|
|
- //1、待指派的
|
|
524
|
|
- if (ua.F_RoleId != 17)
|
|
|
470
|
+ var modellist = bll.GetModelList(sql);
|
|
|
471
|
+ int dcl=0, ycl = 0, zhcx = 0;
|
|
|
472
|
+ foreach (var it in modellist)
|
|
525
|
473
|
{
|
|
526
|
|
- uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
|
|
527
|
|
- uwhere += " and State =" + (int)EnumWorkOrderState.neworder + " ";
|
|
528
|
|
- //uwhere += " and State =0 ";
|
|
|
474
|
+ zhcx++;
|
|
|
475
|
+ if (it.F_State == 10)
|
|
|
476
|
+ ycl++;
|
|
|
477
|
+ else
|
|
|
478
|
+ dcl++;
|
|
529
|
479
|
}
|
|
530
|
|
- //2、待接单的
|
|
531
|
|
- string djdwhere = $" 1=1 and State =" + (int)EnumWorkOrderState.assign + " and T_Wo_WorkOrder.ID in ( " + woController.GetDJDWorkOrderID(ua.F_UserCode) + ") ";//" 1=1 and State =1 and WorkOrderID in ( " + woController.GetDJDWorkOrderID(ua.F_UserCode) + ") ";
|
|
532
|
|
- //3、待完成(处理)的
|
|
533
|
|
- string dclwhere = $" 1=1 and State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + ") and T_Wo_WorkOrder.ID in ( " + woController.GetDWCWorkOrderID(ua.F_UserCode) + ") ";//" 1=1 and State =1 and WorkOrderID in ( " + woController.GetDWCWorkOrderID(ua.F_UserCode) + ") ";
|
|
534
|
|
- //4、已处理的
|
|
535
|
|
- string yclwhere = $" 1=1 and State =" + (int)EnumWorkOrderState.finish + " and LastDealUser = '" + ua.F_UserCode + "' ";//" 1=1 and State =2 and LastDealUser = '" + ua.F_UserCode + "' ";
|
|
536
|
|
- //5、我参与的
|
|
537
|
|
- string wcywhere = $" 1=1 and (CreateUser= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.ID in ( " + woController.GetCYWorkOrderID(ua.F_UserCode) + ")) ";//" 1=1 and (CreateUser= '" + ua.F_UserCode + "' or WorkOrderID in ( " + woController.GetCYWorkOrderID(ua.F_UserCode) + ")) ";
|
|
538
|
|
- //5、超期工单
|
|
539
|
|
- string cqwhere = $" 1=1 and DATEADD(DAY,{days},CreateTime) < GETDATE() AND State < " + (int)EnumWorkOrderState.finish + " ";//$" 1=1 and DATEADD(DAY,{days},CreateTime) < GETDATE() AND State < 2 ";
|
|
540
|
|
- //5、未审核微信工单
|
|
541
|
|
- string wxwhere = $" 1=1 "; // ANd Type = (SELECT F_DictionaryValueId FROM dbo.T_Sys_DictionaryValue (NOLOCK) WHERE F_DictionaryFlag = 'GDLY' AND F_Name = '微信')
|
|
542
|
|
- #endregion
|
|
543
|
|
-
|
|
544
|
|
- #region 未处理开票数量
|
|
545
|
|
- var billcount = new BLL.T_Wo_Bill().GetRecordCount("F_IsDel=0 and F_DealBy='" + ua.F_UserCode+ "' and F_IsDeal="+ (int)EnumBillState.Received);
|
|
546
|
480
|
#endregion
|
|
547
|
481
|
|
|
548
|
482
|
var obj = new
|
|
549
|
483
|
{
|
|
550
|
|
- dpd = bll.GetList(uwhere + sql + " and State=" + (int)EnumWorkOrderState.neworder + " and IsAudit = 1 ").Tables[0].Rows.Count, //待指派的统计
|
|
551
|
|
- djd = bll.GetList(djdwhere + sql + " and State =" + (int)EnumWorkOrderState.assign + " and IsAudit = 1 ").Tables[0].Rows.Count, //待接单的统计
|
|
552
|
|
- dcl = bll.GetList(dclwhere + sql + " and State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + ") and IsAudit = 1 ").Tables[0].Rows.Count, //待处理的统计
|
|
553
|
|
- ycl = bll.GetList(yclwhere + sql + " and State =" + (int)EnumWorkOrderState.finish + " and IsAudit = 1 ").Tables[0].Rows.Count, //已处理的统计
|
|
554
|
|
- wyc = bll.GetList(wcywhere + sql + " and IsAudit = 1 ").Tables[0].Rows.Count, //我参与的的统计
|
|
555
|
|
- cq = bll.GetList(cqwhere + sql + " AND State < " + (int)EnumWorkOrderState.finish + " and IsAudit = 1 ").Tables[0].Rows.Count, //超期工单的统计
|
|
556
|
|
- wx = bll.GetList(wxwhere + sql + " and IsAudit = 0 ").Tables[0].Rows.Count, //微信工单的统计
|
|
557
|
|
- billcount = billcount,//开票管理未处理数量
|
|
558
|
|
- //dpd = bll.GetList(uwhere + sql+ " and State=0 and IsAudit = 1 ").Tables[0].Rows.Count, //待指派的统计
|
|
559
|
|
- //djd = bll.GetList(djdwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count, //待接单的统计
|
|
560
|
|
- //dcl = bll.GetList(dclwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count, //待处理的统计
|
|
561
|
|
- //ycl = bll.GetList(yclwhere + sql + " and State =2 and IsAudit = 1 ").Tables[0].Rows.Count, //已处理的统计
|
|
562
|
|
- //wyc = bll.GetList(wcywhere + sql + " and IsAudit = 1 ").Tables[0].Rows.Count, //我参与的的统计
|
|
563
|
|
- //cq = bll.GetList(cqwhere + sql + " AND State < 2 and IsAudit = 1 ").Tables[0].Rows.Count, //超期工单的统计
|
|
564
|
|
- //wx = bll.GetList(wxwhere + sql + " and IsAudit = 0 ").Tables[0].Rows.Count, //微信工单的统计
|
|
565
|
|
- //djd = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='0' and ','+ToUser+',' like '%," + ua.F_UserCode + ",%') ").Select(p => p.WorkOrderID).Distinct().Count(),
|
|
566
|
|
- //dcl = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='1' and SureUser='" + ua.F_UserCode + "') ").Select(p => p.WorkOrderID).Distinct().Count()
|
|
|
484
|
+ dcl,
|
|
|
485
|
+ ycl,
|
|
|
486
|
+ zhcx
|
|
567
|
487
|
};
|
|
568
|
488
|
res = Success("成功", obj);
|
|
569
|
489
|
}
|