|
|
@@ -1,4 +1,5 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.DB;
|
|
2
|
3
|
using CallCenterApi.Interface.Controllers.Base;
|
|
3
|
4
|
using CallCenterApi.Interface.Models.Enum;
|
|
4
|
5
|
using CallCenterApi.Interface.Models.Input;
|
|
|
@@ -70,6 +71,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
70
|
71
|
true,
|
|
71
|
72
|
out recordCount);
|
|
72
|
73
|
}
|
|
|
74
|
+
|
|
73
|
75
|
List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
|
|
74
|
76
|
List<WorkOrderNewInput> Input = modeltooip(modlelist);
|
|
75
|
77
|
var obj = new
|
|
|
@@ -104,13 +106,27 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
104
|
106
|
sql += " and F_IsDelete=0";
|
|
105
|
107
|
list = workOrder.GetModelList(sql);
|
|
106
|
108
|
}
|
|
|
109
|
+ var itemlasts = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoID=" + id + " ");
|
|
|
110
|
+
|
|
107
|
111
|
if (list.Count > 0)
|
|
108
|
112
|
{
|
|
109
|
113
|
List<WorkOrderNewInput> Input = modeltooip(list);
|
|
110
|
|
- if (Input != null)
|
|
111
|
|
- return Success("获取工单详情成功", Input.FirstOrDefault());
|
|
|
114
|
+ if (Input !=null )
|
|
|
115
|
+ {
|
|
|
116
|
+ var obj = new
|
|
|
117
|
+ {
|
|
|
118
|
+ state = "success",
|
|
|
119
|
+ message = "成功",
|
|
|
120
|
+ rows = Input,
|
|
|
121
|
+ total= itemlasts,
|
|
|
122
|
+ };
|
|
|
123
|
+
|
|
|
124
|
+ return Content(obj.ToJson());
|
|
|
125
|
+ }
|
|
112
|
126
|
else
|
|
|
127
|
+ {
|
|
113
|
128
|
return Error("没有查询到此工单");
|
|
|
129
|
+ }
|
|
114
|
130
|
}
|
|
115
|
131
|
else
|
|
116
|
132
|
return Error("没有查询到此工单");
|
|
|
@@ -528,6 +544,100 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
528
|
544
|
return Error("无操作权限!");
|
|
529
|
545
|
}
|
|
530
|
546
|
/// <summary>
|
|
|
547
|
+ /// 接单 - 确认工单
|
|
|
548
|
+ /// </summary>
|
|
|
549
|
+ /// <returns></returns>
|
|
|
550
|
+ [Authority]
|
|
|
551
|
+ public ActionResult SureWorkOrder(long orderid)
|
|
|
552
|
+ {
|
|
|
553
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
554
|
+ if (userId != 0)
|
|
|
555
|
+ {
|
|
|
556
|
+ Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
|
557
|
+ if (ua != null)
|
|
|
558
|
+ {
|
|
|
559
|
+ Model.T_Wo_WorkOrder model = workOrder.GetModel(orderid);
|
|
|
560
|
+ if (model != null)
|
|
|
561
|
+ {
|
|
|
562
|
+ var res = SureWO(ua, model);
|
|
|
563
|
+ if (res)
|
|
|
564
|
+ return Success("接单成功");
|
|
|
565
|
+ else
|
|
|
566
|
+ return Error("接单失败");
|
|
|
567
|
+ }
|
|
|
568
|
+ else
|
|
|
569
|
+ return Error("工单不存在");
|
|
|
570
|
+ }
|
|
|
571
|
+ }
|
|
|
572
|
+ return Error("无操作权限");
|
|
|
573
|
+ }
|
|
|
574
|
+ /// <summary>
|
|
|
575
|
+ /// 接单
|
|
|
576
|
+ /// </summary>
|
|
|
577
|
+ public bool SureWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model)
|
|
|
578
|
+ {
|
|
|
579
|
+ int overtime=0, sms=0;
|
|
|
580
|
+ //处理当前工单的记录之前的记录过期
|
|
|
581
|
+ var itemlasts = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoID=" + id + " ");
|
|
|
582
|
+ if (itemlasts.Count > 0)
|
|
|
583
|
+ {
|
|
|
584
|
+ foreach (var it in itemlasts)
|
|
|
585
|
+ {
|
|
|
586
|
+ if (it .F_WoState ==1)
|
|
|
587
|
+ {
|
|
|
588
|
+ overtime =int .Parse ( it.F_LimitTime);
|
|
|
589
|
+ sms = int.Parse(it.F_IsSMS.ToString ());
|
|
|
590
|
+ }
|
|
|
591
|
+ }
|
|
|
592
|
+ }
|
|
|
593
|
+ #region 工单处理
|
|
|
594
|
+ var opt = "处理接单";
|
|
|
595
|
+ int optbut = (int)EnumItemOpt.receive;
|
|
|
596
|
+ int wostate = (int)EnumWorkOrderState.receive;
|
|
|
597
|
+
|
|
|
598
|
+ #region 读取当前登录人部门
|
|
|
599
|
+ string deptname = "";
|
|
|
600
|
+ var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
|
|
|
601
|
+ if (deptmodel != null)
|
|
|
602
|
+ {
|
|
|
603
|
+ deptname = deptmodel.F_DeptName + "-";
|
|
|
604
|
+ }
|
|
|
605
|
+ #endregion
|
|
|
606
|
+ var content = deptname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + opt;
|
|
|
607
|
+ var itemid = AddLog((int)model.F_ID , wostate, content, (int)EnumItemType.deal, optbut, "", 0, nowUser, overtime,sms );
|
|
|
608
|
+ if (itemid > 0)
|
|
|
609
|
+ {
|
|
|
610
|
+ #region 处理工单
|
|
|
611
|
+ model.F_State = wostate;//已接单待处理
|
|
|
612
|
+ workOrder.Update(model);
|
|
|
613
|
+ #endregion
|
|
|
614
|
+ #region 推送消息
|
|
|
615
|
+ //读取上一级指派人员以及添加坐席并推送系统消息和微信消息
|
|
|
616
|
+ #region 给添加坐席推送系统消息和微信消息
|
|
|
617
|
+ sendsysmsg(model, nowUser, model.F_CreateBy , (int)itemid, "处理接单");
|
|
|
618
|
+ var createUser = sysUserAccountBll.GetModel(model.F_CreateBy);
|
|
|
619
|
+ // if (createUser != null && !string.IsNullOrEmpty(createUser.F_WxOpenId))
|
|
|
620
|
+ // sendwxmsg(model, createUser.F_WxOpenId, nowUser, "接单");
|
|
|
621
|
+ #endregion
|
|
|
622
|
+ #region 读取上一级指派人员推送系统消息和微信消息
|
|
|
623
|
+ var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
|
|
|
624
|
+ if (itemlast.F_CreateUser != model.F_CreateBy)
|
|
|
625
|
+ {
|
|
|
626
|
+ sendsysmsg(model, nowUser, itemlast.F_CreateUser, (int)itemid, "处理接单");
|
|
|
627
|
+ var lastUser = sysUserAccountBll.GetModel(itemlast.F_CreateUser);
|
|
|
628
|
+ // if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
|
|
|
629
|
+ // sendwxmsg(model, lastUser.F_WxOpenId, nowUser, "接单");
|
|
|
630
|
+ }
|
|
|
631
|
+ #endregion
|
|
|
632
|
+ #endregion
|
|
|
633
|
+ return true;
|
|
|
634
|
+ }
|
|
|
635
|
+ else
|
|
|
636
|
+ return false;
|
|
|
637
|
+ #endregion
|
|
|
638
|
+ }
|
|
|
639
|
+
|
|
|
640
|
+ /// <summary>
|
|
531
|
641
|
/// 转派工单
|
|
532
|
642
|
/// </summary>
|
|
533
|
643
|
public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string cont, int clbm = 0, int clid = 0,int overtime = 0, int sms = 0)
|