|
|
@@ -1,5 +1,6 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
2
|
2
|
using CallCenterApi.Interface.Controllers.Base;
|
|
|
3
|
+using CallCenterApi.Interface.Models.Enum;
|
|
3
|
4
|
using CallCenterApi.Interface.Models.Input;
|
|
4
|
5
|
using System;
|
|
5
|
6
|
using System.Collections.Generic;
|
|
|
@@ -17,13 +18,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
17
|
18
|
BLL.T_Cus_CustomerBaseNew cusbll = new BLL.T_Cus_CustomerBaseNew();
|
|
18
|
19
|
BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
|
|
19
|
20
|
BLL.T_Wo_MaterialManage mmBLL = new BLL.T_Wo_MaterialManage();
|
|
|
21
|
+ BLL.T_Wo_WorkOrderItem_New itembll = new BLL.T_Wo_WorkOrderItem_New();
|
|
|
22
|
+ BLL.T_Wo_WorkOrder_Logs blllogs = new BLL.T_Wo_WorkOrder_Logs();
|
|
|
23
|
+ BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
|
|
20
|
24
|
// GET: WorkOrderNew
|
|
21
|
25
|
/// <summary>
|
|
22
|
26
|
/// 获取工单列表
|
|
23
|
27
|
/// </summary>
|
|
24
|
28
|
/// <returns></returns>
|
|
25
|
29
|
public ActionResult GetList(string code,int type, string cusname, string cusphone, string companyname, string province, string city,
|
|
26
|
|
- string country, string township, int pageindex = 1, int pagesize = 10)
|
|
|
30
|
+ string country, string township, string touser, int state=-1, int pageindex = 1,int pagesize = 10)
|
|
27
|
31
|
{
|
|
28
|
32
|
|
|
29
|
33
|
string sql = $" and F_IsDelete=0";
|
|
|
@@ -31,6 +35,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
31
|
35
|
#region 筛选条件
|
|
32
|
36
|
if (type > 0&& type <4)//工单类型
|
|
33
|
37
|
sql += $" and F_Type=" + type;
|
|
|
38
|
+ if (state>0)//工单状态
|
|
|
39
|
+ sql += $" and F_State=" + state;
|
|
|
40
|
+ if (!string.IsNullOrWhiteSpace(touser))//参与人
|
|
|
41
|
+ sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
|
|
34
|
42
|
if (!string.IsNullOrWhiteSpace(code))//工单编号
|
|
35
|
43
|
sql += $" and F_WorkOrderCode like '%" + code.Trim() + "%'";
|
|
36
|
44
|
if (!string.IsNullOrWhiteSpace(cusname))//客户姓名
|
|
|
@@ -48,7 +56,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
48
|
56
|
if (!string.IsNullOrWhiteSpace(province))//乡
|
|
49
|
57
|
sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
|
|
50
|
58
|
#endregion
|
|
51
|
|
-
|
|
52
|
59
|
int recordCount = 0;
|
|
53
|
60
|
if (!string.IsNullOrWhiteSpace(sql))
|
|
54
|
61
|
{
|
|
|
@@ -78,32 +85,41 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
78
|
85
|
/// <summary>
|
|
79
|
86
|
/// 查询工单详情
|
|
80
|
87
|
/// </summary>
|
|
81
|
|
- public ActionResult GetDetails(int id)
|
|
|
88
|
+ public ActionResult GetDetails(int id)
|
|
82
|
89
|
{
|
|
83
|
|
- string sql = "";
|
|
84
|
|
- if (id >0)
|
|
85
|
|
- {
|
|
86
|
|
- sql += $" ( F_ID like '%" + id + "%' ) ";
|
|
87
|
|
- }
|
|
88
|
|
- else
|
|
89
|
|
- return Error("请输入正确的id");
|
|
90
|
|
- var list = new List<Model.T_Wo_WorkOrder>();
|
|
91
|
|
- if (!string.IsNullOrWhiteSpace(sql))
|
|
92
|
|
- {
|
|
93
|
|
- sql += " and F_IsDelete=0";
|
|
94
|
|
- list = workOrder.GetModelList(sql);
|
|
95
|
|
- }
|
|
96
|
|
- if (list.Count >0)
|
|
|
90
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
91
|
+ if (userId != 0)
|
|
97
|
92
|
{
|
|
98
|
|
- List<WorkOrderNewInput> Input = modeltooip(list);
|
|
99
|
|
- if (Input!=null )
|
|
100
|
|
- return Success("获取工单详情成功", Input.FirstOrDefault());
|
|
|
93
|
+ Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
|
94
|
+ string sql = "";
|
|
|
95
|
+ if (id > 0)
|
|
|
96
|
+ {
|
|
|
97
|
+ sql += $" ( F_ID like '%" + id + "%' ) ";
|
|
|
98
|
+ }
|
|
|
99
|
+ else
|
|
|
100
|
+ return Error("请输入正确的id");
|
|
|
101
|
+ var list = new List<Model.T_Wo_WorkOrder>();
|
|
|
102
|
+ if (!string.IsNullOrWhiteSpace(sql))
|
|
|
103
|
+ {
|
|
|
104
|
+ sql += " and F_IsDelete=0";
|
|
|
105
|
+ list = workOrder.GetModelList(sql);
|
|
|
106
|
+ }
|
|
|
107
|
+ if (list.Count > 0)
|
|
|
108
|
+ {
|
|
|
109
|
+ List<WorkOrderNewInput> Input = modeltooip(list);
|
|
|
110
|
+ if (Input != null)
|
|
|
111
|
+ return Success("获取工单详情成功", Input.FirstOrDefault());
|
|
|
112
|
+ else
|
|
|
113
|
+ return Error("没有查询到此工单");
|
|
|
114
|
+ }
|
|
101
|
115
|
else
|
|
102
|
116
|
return Error("没有查询到此工单");
|
|
|
117
|
+
|
|
103
|
118
|
}
|
|
104
|
119
|
else
|
|
105
|
|
- return Error("没有查询到此工单");
|
|
106
|
|
-
|
|
|
120
|
+ {
|
|
|
121
|
+ return Error("无操作权限!");
|
|
|
122
|
+ }
|
|
107
|
123
|
}
|
|
108
|
124
|
/// <summary>
|
|
109
|
125
|
/// 添加工单
|
|
|
@@ -138,76 +154,103 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
138
|
154
|
/// <returns></returns>
|
|
139
|
155
|
public ActionResult DelWorkOrder(string[] ids)
|
|
140
|
156
|
{
|
|
141
|
|
- if (ids != null && ids.Length > 0)
|
|
|
157
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
158
|
+ if (userId != 0)
|
|
142
|
159
|
{
|
|
143
|
|
- string idd = " ";
|
|
144
|
|
- foreach (string str in ids)
|
|
|
160
|
+ if (ids != null && ids.Length > 0)
|
|
145
|
161
|
{
|
|
146
|
|
- idd += str + ",";
|
|
147
|
|
- }
|
|
148
|
|
- if (!string.IsNullOrEmpty(idd.Trim()))
|
|
149
|
|
- {
|
|
150
|
|
- if (workOrder.DeleteList(idd.TrimEnd(',')))
|
|
|
162
|
+ string idd = " ";
|
|
|
163
|
+ foreach (string str in ids)
|
|
151
|
164
|
{
|
|
152
|
|
- return Success("设置成功");
|
|
|
165
|
+ idd += str + ",";
|
|
|
166
|
+ }
|
|
|
167
|
+ if (!string.IsNullOrEmpty(idd.Trim()))
|
|
|
168
|
+ {
|
|
|
169
|
+ if (workOrder.DeleteList(idd.TrimEnd(',')))
|
|
|
170
|
+ {
|
|
|
171
|
+ return Success("设置成功");
|
|
|
172
|
+ }
|
|
|
173
|
+ else
|
|
|
174
|
+ {
|
|
|
175
|
+ return Error("设置失败");
|
|
|
176
|
+ }
|
|
153
|
177
|
}
|
|
154
|
178
|
else
|
|
155
|
179
|
{
|
|
156
|
|
- return Error("设置失败");
|
|
|
180
|
+ return Error("请选择用户");
|
|
157
|
181
|
}
|
|
158
|
182
|
}
|
|
159
|
183
|
else
|
|
160
|
184
|
{
|
|
161
|
|
- return Error("请选择用户");
|
|
|
185
|
+ return Error("获取参数失败");
|
|
162
|
186
|
}
|
|
163
|
187
|
}
|
|
164
|
188
|
else
|
|
165
|
189
|
{
|
|
166
|
|
- return Error("获取参数失败");
|
|
|
190
|
+ return Error("无操作权限!");
|
|
|
191
|
+ }
|
|
167
|
192
|
}
|
|
168
|
|
- }
|
|
169
|
193
|
/// <summary>
|
|
170
|
194
|
/// 修改工单
|
|
171
|
195
|
/// </summary>
|
|
172
|
196
|
/// <returns></returns>
|
|
173
|
197
|
public ActionResult Update(WorkOrderNewInput input)
|
|
174
|
198
|
{
|
|
175
|
|
- string usercode = CurrentUser.UserData.F_UserCode;
|
|
176
|
|
- #region 添加验证判断
|
|
177
|
|
- if (input.F_ID <= 0)
|
|
178
|
|
- return Error("参数错误!");
|
|
179
|
|
- if (!(input.F_Type > 0 && input.F_Type < 4))
|
|
180
|
|
- return Error("工单类型错误!");
|
|
181
|
|
- if (input.F_Type==1|| input.F_Type == 3)
|
|
|
199
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
200
|
+ if (userId != 0)
|
|
182
|
201
|
{
|
|
183
|
|
- if (input.F_CustomerID>0)
|
|
|
202
|
+ string usercode = CurrentUser.UserData.F_UserCode;
|
|
|
203
|
+ Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
|
204
|
+ #region 添加验证判断
|
|
|
205
|
+ if (input.F_ID <= 0)
|
|
|
206
|
+ return Error("参数错误!");
|
|
|
207
|
+ if (!(input.F_Type > 0 && input.F_Type < 4))
|
|
|
208
|
+ return Error("工单类型错误!");
|
|
|
209
|
+ if (input.F_Type == 1 || input.F_Type == 3)
|
|
184
|
210
|
{
|
|
185
|
|
- if (!valcode(input.F_CustomerID.ToString(), 10))
|
|
|
211
|
+ if (input.F_CustomerID > 0)
|
|
|
212
|
+ {
|
|
|
213
|
+ if (!valcode(input.F_CustomerID.ToString(), 10))
|
|
|
214
|
+ {
|
|
|
215
|
+ return Error("客户编号为10为纯数字!");
|
|
|
216
|
+ }
|
|
|
217
|
+ }
|
|
|
218
|
+ if (input.F_MaterialID > 0)
|
|
186
|
219
|
{
|
|
187
|
|
- return Error("客户编号为10为纯数字!");
|
|
|
220
|
+ if (!valcode(input.F_MaterialID.ToString(), 11))
|
|
|
221
|
+ {
|
|
|
222
|
+ return Error("物料编码为11为纯数字!");
|
|
|
223
|
+ }
|
|
188
|
224
|
}
|
|
|
225
|
+
|
|
189
|
226
|
}
|
|
190
|
|
- if (input.F_MaterialID>0)
|
|
|
227
|
+ #endregion
|
|
|
228
|
+ var model = workOrder.GetModel(input.F_ID);
|
|
|
229
|
+ #region 保存客户基本信息
|
|
|
230
|
+ model = inputtoobj(model, input);
|
|
|
231
|
+ #endregion
|
|
|
232
|
+ bool n = workOrder.Update(model);
|
|
|
233
|
+ if (n)
|
|
191
|
234
|
{
|
|
192
|
|
- if (!valcode(input.F_MaterialID.ToString(), 11))
|
|
|
235
|
+ WriteWorkOrderLog(model.F_WorkOrderCode, ua.F_UserCode, 0, "", 1, "修改工单");
|
|
|
236
|
+ #region 读取当前登录人的部门
|
|
|
237
|
+ string deptname = "";
|
|
|
238
|
+ var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
|
|
|
239
|
+ if (deptmodel != null)
|
|
193
|
240
|
{
|
|
194
|
|
- return Error("物料编码为11为纯数字!");
|
|
|
241
|
+ deptname = deptmodel.F_DeptName + "-";
|
|
195
|
242
|
}
|
|
|
243
|
+ #endregion
|
|
|
244
|
+ AddLog(input.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "修改工单", (int)EnumItemType.update, (int)EnumItemOpt.update, "", 0, ua);
|
|
|
245
|
+ return Success("保存成功!");
|
|
196
|
246
|
}
|
|
197
|
|
-
|
|
|
247
|
+ else
|
|
|
248
|
+ return Error("保存失败!");
|
|
198
|
249
|
}
|
|
199
|
|
- #endregion
|
|
200
|
|
- var model = workOrder.GetModel(input.F_ID);
|
|
201
|
|
- #region 保存客户基本信息
|
|
202
|
|
- model = inputtoobj(model, input);
|
|
203
|
|
- #endregion
|
|
204
|
|
- bool n = workOrder.Update(model);
|
|
205
|
|
- if (n)
|
|
|
250
|
+ else
|
|
206
|
251
|
{
|
|
207
|
|
- return Success("保存成功!");
|
|
|
252
|
+ return Error("无操作权限!");
|
|
208
|
253
|
}
|
|
209
|
|
- else
|
|
210
|
|
- return Error("保存失败!");
|
|
211
|
254
|
}
|
|
212
|
255
|
/// <summary>
|
|
213
|
256
|
/// 验证物料编码为10位纯数字
|
|
|
@@ -311,6 +354,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
311
|
354
|
model.F_CJ_Tonnage = model1[i].F_CJ_Tonnage;//抽检-抽检吨数
|
|
312
|
355
|
model.F_CJ_BagNo = model1[i].F_CJ_BagNo;//抽检-抽检袋数
|
|
313
|
356
|
model.F_CJ_Outlay = model1[i].F_CJ_Outlay;//抽检-公关费用金额:单位元
|
|
|
357
|
+ model.F_State = model1[i].F_State;//工单状态
|
|
314
|
358
|
#endregion
|
|
315
|
359
|
Input.Add(model);
|
|
316
|
360
|
|
|
|
@@ -377,18 +421,230 @@ namespace CallCenterApi.Interface.Controllers.workorder
|
|
377
|
421
|
model.F_CJ_TestUnit = input.F_CJ_TestUnit;//抽检-化验单位
|
|
378
|
422
|
model.F_CJ_Tonnage = input.F_CJ_Tonnage;//抽检-抽检吨数
|
|
379
|
423
|
model.F_CJ_BagNo = input.F_CJ_BagNo;//抽检-抽检袋数
|
|
380
|
|
- model.F_CJ_Outlay = input.F_CJ_Outlay;//抽检-公关费用金额:单位元
|
|
|
424
|
+ model.F_CJ_Outlay = input.F_CJ_Outlay;//抽检-公关费用金额:单位元】
|
|
|
425
|
+ if (input.F_State != null )
|
|
|
426
|
+ {
|
|
|
427
|
+ model.F_State = input.F_State;//抽检-公关费用金额:单位元】
|
|
|
428
|
+ }
|
|
|
429
|
+ else
|
|
|
430
|
+ {
|
|
|
431
|
+ model.F_State = (int)EnumWorkOrderState.neworder;
|
|
|
432
|
+ }
|
|
|
433
|
+
|
|
381
|
434
|
#endregion
|
|
382
|
435
|
return model;
|
|
383
|
436
|
}
|
|
384
|
437
|
/// <summary>
|
|
385
|
|
- /// 获取工单详情
|
|
|
438
|
+ /// 添加工单记录
|
|
|
439
|
+ /// </summary>
|
|
|
440
|
+ public long AddLog(long woid, int wostate, string content, int itemtype, int opttype, string nextuser, int nextdept, Model.T_Sys_UserAccount nowUser)
|
|
|
441
|
+ {
|
|
|
442
|
+ Model.T_Wo_WorkOrderItem_New itemModel = new Model.T_Wo_WorkOrderItem_New();
|
|
|
443
|
+ string starttime = "";string endtime = "";
|
|
|
444
|
+ #region
|
|
|
445
|
+ //处理当前工单的记录之前的记录过期
|
|
|
446
|
+ var itemlast = itembll.GetModelList(" isnull(F_IsUsed,'0')='0' and F_ItemType=" + itemtype + " and F_WoID=" + woid + " ");
|
|
|
447
|
+ if (itemlast.Count > 0)
|
|
|
448
|
+ {
|
|
|
449
|
+ foreach (var it in itemlast)
|
|
|
450
|
+ {
|
|
|
451
|
+ it.F_IsUsed = 1;
|
|
|
452
|
+ itembll.Update(it);
|
|
|
453
|
+ if ( it.F_WoState == 2)
|
|
|
454
|
+ {
|
|
|
455
|
+ starttime = it.F_CreateTime.ToString ();
|
|
|
456
|
+ }
|
|
|
457
|
+ if (it.F_WoState == 10)
|
|
|
458
|
+ {
|
|
|
459
|
+ endtime = it.F_CreateTime.ToString();
|
|
|
460
|
+ }
|
|
|
461
|
+ }
|
|
|
462
|
+ }
|
|
|
463
|
+ #endregion
|
|
|
464
|
+ itemModel.F_WoID = woid;
|
|
|
465
|
+ itemModel.F_WoState = wostate;
|
|
|
466
|
+ itemModel.F_ItemType = itemtype;
|
|
|
467
|
+ itemModel.F_OptType = opttype;
|
|
|
468
|
+ itemModel.F_OptContent = content;
|
|
|
469
|
+ itemModel.F_NextUser = nextuser;
|
|
|
470
|
+ itemModel.F_NextDept = nextdept;
|
|
|
471
|
+ itemModel.F_IsUsed = 0;
|
|
|
472
|
+ if (starttime!=""&& endtime!="")
|
|
|
473
|
+ {
|
|
|
474
|
+ itemModel.F_LimitTime = (DateTime.Parse(endtime) - DateTime.Parse(starttime)).ToString();
|
|
|
475
|
+ }
|
|
|
476
|
+ else
|
|
|
477
|
+ {
|
|
|
478
|
+ itemModel.F_LimitTime = "0";
|
|
|
479
|
+ }
|
|
|
480
|
+ itemModel.F_CreateUser = nowUser.F_UserCode;
|
|
|
481
|
+ itemModel.F_CreateTime = DateTime.Now;
|
|
|
482
|
+ var res = itembll.Add(itemModel);
|
|
|
483
|
+ return res;
|
|
|
484
|
+ }
|
|
|
485
|
+ public void WriteWorkOrderLog(string WorkOrderID, string UserCode, int IsDelete, string DelUserCode, int TypeId, string Remark)
|
|
|
486
|
+ {
|
|
|
487
|
+ var model = new Model.T_Wo_WorkOrder_Logs();
|
|
|
488
|
+ model.WorkOrderID = WorkOrderID; //工单编号
|
|
|
489
|
+ model.UserCode = UserCode; //修改人code
|
|
|
490
|
+ model.AddTime = DateTime.Now; //添加时间
|
|
|
491
|
+ model.IsDelete = IsDelete; //是否删除(0正常1删除)
|
|
|
492
|
+ model.DelUserCode = DelUserCode; //删除人code
|
|
|
493
|
+ model.TypeId = TypeId; //类型(0添加,1修改)
|
|
|
494
|
+ model.Remark = Remark; //备注
|
|
|
495
|
+ blllogs.Add(model);
|
|
|
496
|
+ }
|
|
|
497
|
+ /// <summary>
|
|
|
498
|
+ /// 获取待接单的工单编号
|
|
|
499
|
+ /// </summary>
|
|
|
500
|
+ /// <returns></returns>
|
|
|
501
|
+ public string GetDJDWorkOrderID(string user)
|
|
|
502
|
+ {
|
|
|
503
|
+ string str = string.Empty;
|
|
|
504
|
+ str = "select F_WoID from T_Wo_WorkOrder where F_ItemType=" + (int)EnumItemType.deal
|
|
|
505
|
+ + " and F_WoState=" + (int)EnumWorkOrderState.assign
|
|
|
506
|
+ + " and isnull(F_IsUsed,'0')='0' and F_NextUser='" + user + "' ";
|
|
|
507
|
+
|
|
|
508
|
+ return str;
|
|
|
509
|
+ }
|
|
|
510
|
+ /// <summary>
|
|
|
511
|
+ /// 指派/转派工单
|
|
|
512
|
+ /// <param name="orderid">工单编号</param>
|
|
|
513
|
+ /// <param name="cont">指派说明</param>
|
|
|
514
|
+ /// <param name="clbm">指派部门</param>
|
|
|
515
|
+ /// <param name="clid">指派人</param>
|
|
386
|
516
|
/// </summary>
|
|
387
|
517
|
/// <returns></returns>
|
|
388
|
|
- public ActionResult GetDetailes()
|
|
|
518
|
+ [Authority]
|
|
|
519
|
+ public ActionResult AssignWorkOrder(long orderid, string cont, int clbm = 0, int clid = 0)
|
|
|
520
|
+ {
|
|
|
521
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
522
|
+ string usercode = CurrentUser.UserData.F_UserCode;
|
|
|
523
|
+ if (userId != 0)
|
|
|
524
|
+ {
|
|
|
525
|
+ Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
|
|
|
526
|
+ if (ua != null)
|
|
|
527
|
+ {
|
|
|
528
|
+ if (clbm != 0 && clid == 0)
|
|
|
529
|
+ return Error("请选择接收人");
|
|
|
530
|
+ Model.T_Wo_WorkOrder model = workOrder.GetModel(orderid);
|
|
|
531
|
+ if (model != null)
|
|
|
532
|
+ {
|
|
|
533
|
+ var res = AssignWO(ua, model, cont, clbm, clid);
|
|
|
534
|
+ if (res)
|
|
|
535
|
+ return Success("转派成功");
|
|
|
536
|
+ else
|
|
|
537
|
+ return Error("转派失败!");
|
|
|
538
|
+ }
|
|
|
539
|
+ else
|
|
|
540
|
+ return Error("工单不存在!");
|
|
|
541
|
+ }
|
|
|
542
|
+ }
|
|
|
543
|
+ return Error("无操作权限!");
|
|
|
544
|
+ }
|
|
|
545
|
+ /// <summary>
|
|
|
546
|
+ /// 转派工单
|
|
|
547
|
+ ///
|
|
|
548
|
+ /// </summary>
|
|
|
549
|
+ public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string cont, int clbm = 0, int clid = 0)
|
|
|
550
|
+ {
|
|
|
551
|
+ string touser = ""; string tousername = "";
|
|
|
552
|
+ #region 获取接收人
|
|
|
553
|
+ if (clid != 0)
|
|
|
554
|
+ {
|
|
|
555
|
+ Model.T_Sys_UserAccount clus = sysUserAccountBll.GetModel(clid);
|
|
|
556
|
+ if (clus != null)
|
|
|
557
|
+ {
|
|
|
558
|
+ touser = clus.F_UserCode;
|
|
|
559
|
+ tousername = clus.F_UserName + "(" + touser + ")";
|
|
|
560
|
+ }
|
|
|
561
|
+ }
|
|
|
562
|
+ else
|
|
|
563
|
+ {
|
|
|
564
|
+ string users = string.Empty;
|
|
|
565
|
+ var list = sysUserAccountBll.GetModelList(" F_DeptId='" + clbm + "'");
|
|
|
566
|
+ foreach (var l in list)
|
|
|
567
|
+ {
|
|
|
568
|
+ if (string.IsNullOrEmpty(users))
|
|
|
569
|
+ {
|
|
|
570
|
+ users = l.F_UserCode;
|
|
|
571
|
+ tousername = l.F_UserName + "(" + l.F_UserCode + ")";
|
|
|
572
|
+ }
|
|
|
573
|
+ else
|
|
|
574
|
+ {
|
|
|
575
|
+ users = users + "," + l.F_UserCode;
|
|
|
576
|
+ tousername = tousername + "," + l.F_UserName + "(" + l.F_UserCode + ")";
|
|
|
577
|
+ }
|
|
|
578
|
+ }
|
|
|
579
|
+ touser = users;
|
|
|
580
|
+ }
|
|
|
581
|
+ #endregion
|
|
|
582
|
+ #region 工单处理
|
|
|
583
|
+ var opt = "指派";
|
|
|
584
|
+ int optbut = (int)EnumItemOpt.assign;
|
|
|
585
|
+ int wostate = (int)EnumWorkOrderState.assign;//已指派待接单
|
|
|
586
|
+ #region 读取当前登录人部门
|
|
|
587
|
+ string deptname = "";
|
|
|
588
|
+ var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
|
|
|
589
|
+ if (deptmodel != null)
|
|
|
590
|
+ {
|
|
|
591
|
+ deptname = deptmodel.F_DeptName + "-";
|
|
|
592
|
+ }
|
|
|
593
|
+ #endregion
|
|
|
594
|
+ var optcont = "";
|
|
|
595
|
+ if (!string.IsNullOrEmpty(cont))
|
|
|
596
|
+ optcont = ",说明:" + cont;
|
|
|
597
|
+ var content = deptname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + opt + "工单给 " + tousername + optcont;
|
|
|
598
|
+ var itemid = AddLog(model.F_ID , wostate, content, (int)EnumItemType.deal, optbut, touser, clbm, nowUser);
|
|
|
599
|
+ if (itemid > 0)
|
|
|
600
|
+ {
|
|
|
601
|
+ #region 处理工单
|
|
|
602
|
+ //工单完结要更新工单的状态
|
|
|
603
|
+ model.F_DealBy = touser;
|
|
|
604
|
+ model.F_State = wostate;
|
|
|
605
|
+ //处理内容
|
|
|
606
|
+ if (!string.IsNullOrEmpty(cont))
|
|
|
607
|
+ model.F_DealContent += cont + ";";
|
|
|
608
|
+ workOrder.Update(model);
|
|
|
609
|
+ #endregion
|
|
|
610
|
+ #region 推送消息
|
|
|
611
|
+ #region 推送消息给添加的坐席 -转派和处理
|
|
|
612
|
+ if (nowUser.F_UserCode != model.F_CreateBy)
|
|
|
613
|
+ {
|
|
|
614
|
+ sendsysmsg(model, nowUser, model.F_CreateBy, (int)model.F_ID , opt);//推送系统消息
|
|
|
615
|
+ }
|
|
|
616
|
+ #endregion
|
|
|
617
|
+ #region 向下一级操作人员推送消息
|
|
|
618
|
+ if (!string.IsNullOrWhiteSpace(touser))
|
|
|
619
|
+ {
|
|
|
620
|
+ sendsysmsg(model, nowUser, touser, (int)model.F_ID , opt);//推送系统消息
|
|
|
621
|
+ }
|
|
|
622
|
+ #endregion
|
|
|
623
|
+ #endregion
|
|
|
624
|
+ return true;
|
|
|
625
|
+ }
|
|
|
626
|
+ else
|
|
|
627
|
+ return false;
|
|
|
628
|
+ #endregion
|
|
|
629
|
+ }
|
|
|
630
|
+ //推送系统提醒
|
|
|
631
|
+ public void sendsysmsg(Model.T_Wo_WorkOrder womodel, Model.T_Sys_UserAccount nowUser, string touser, int toid, string opt)
|
|
389
|
632
|
{
|
|
|
633
|
+ #region 消息提醒
|
|
|
634
|
+ string strmsg = string.Empty;
|
|
|
635
|
+ strmsg = nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "操作" + opt + "工单";
|
|
|
636
|
+ Model.T_Msg_List msg = new Model.T_Msg_List();
|
|
|
637
|
+ msg.Type = (int)Model.MSGType.workorder;//处理
|
|
|
638
|
+ msg.ToUser = touser;
|
|
|
639
|
+ msg.ToID = toid;
|
|
|
640
|
+ msg.Detail = strmsg;
|
|
|
641
|
+ msg.State = 0;
|
|
|
642
|
+ msg.IsDel = 0;
|
|
|
643
|
+ msg.CreateUser = nowUser.F_UserCode;
|
|
|
644
|
+ msg.CreateDate = DateTime.Now;
|
|
390
|
645
|
|
|
391
|
|
- return View();
|
|
|
646
|
+ new BLL.T_Msg_List().Add(msg);
|
|
|
647
|
+ #endregion
|
|
392
|
648
|
}
|
|
393
|
649
|
}
|
|
394
|
650
|
}
|