|
|
@@ -282,6 +282,205 @@ namespace RMYY_CallCenter_Api.Controllers
|
|
282
|
282
|
};
|
|
283
|
283
|
return Content(obj.ToJson());
|
|
284
|
284
|
}
|
|
|
285
|
+
|
|
|
286
|
+ public ActionResult GetButtons(int SMS_Id=0)
|
|
|
287
|
+ {
|
|
|
288
|
+ if (SMS_Id <= 0)
|
|
|
289
|
+ return Error("请选择消息");
|
|
|
290
|
+ DataTable datatable=new DataTable ();
|
|
|
291
|
+ var SMS = new BLL.T_SMS_InternalMessages().GetModel(SMS_Id);
|
|
|
292
|
+ List<Button> Buttons = new List<Button>();
|
|
|
293
|
+ if (SMS != null)
|
|
|
294
|
+ {
|
|
|
295
|
+ if (SMS.SMS_Type != 4 && SMS.SMS_Type != 3)
|
|
|
296
|
+ {
|
|
|
297
|
+ var dt = DbHelperSQL.Query
|
|
|
298
|
+ ($"select *from T_Wo_CommonBase where F_WoCode='{SMS.F_WorkOrderId }'")
|
|
|
299
|
+ .Tables[0];
|
|
|
300
|
+
|
|
|
301
|
+ if (dt != null && dt.Rows.Count > 0)
|
|
|
302
|
+ {
|
|
|
303
|
+ if (dt.Rows[0]["F_CreateUser"].ToString() == User.F_UserCode)
|
|
|
304
|
+ {
|
|
|
305
|
+ datatable = WorkOrderBase.SetOtherField(dt, MENUENUM.我的提交, User.F_RoleId);
|
|
|
306
|
+ }
|
|
|
307
|
+ else if (SMS.SMS_Type == 0)
|
|
|
308
|
+ {
|
|
|
309
|
+ datatable = WorkOrderBase.SetOtherField(dt, MENUENUM.工单列表, User.F_RoleId);
|
|
|
310
|
+ }
|
|
|
311
|
+ else if (SMS.SMS_Type == 1)
|
|
|
312
|
+ {
|
|
|
313
|
+ datatable = WorkOrderBase.SetOtherField(dt, MENUENUM.报修列表, User.F_RoleId);
|
|
|
314
|
+ }
|
|
|
315
|
+ else if (SMS.SMS_Type == 2)
|
|
|
316
|
+ {
|
|
|
317
|
+ datatable = WorkOrderBase.SetOtherField(dt, MENUENUM.调度工单列表, User.F_RoleId);
|
|
|
318
|
+ }
|
|
|
319
|
+ }
|
|
|
320
|
+ var obj = new
|
|
|
321
|
+ {
|
|
|
322
|
+ state = "success",
|
|
|
323
|
+ message = "成功",
|
|
|
324
|
+ rows = datatable
|
|
|
325
|
+
|
|
|
326
|
+ };
|
|
|
327
|
+ return Content(obj.ToJson());
|
|
|
328
|
+ }
|
|
|
329
|
+ else
|
|
|
330
|
+ {
|
|
|
331
|
+ if (SMS.SMS_Type == 4)
|
|
|
332
|
+ {
|
|
|
333
|
+ var model = new Bll.T_Car_WorkOrder().GetModelByCode(SMS.F_WorkOrderId);
|
|
|
334
|
+ string role="0";
|
|
|
335
|
+ if (model .F_CreateUser == User.F_RoleCode)
|
|
|
336
|
+ {
|
|
|
337
|
+ role = "1";
|
|
|
338
|
+ }
|
|
|
339
|
+ var button = GetButton(model.F_State.Value, role);
|
|
|
340
|
+ if (model.F_State == 0)
|
|
|
341
|
+ button.Add(distribution());
|
|
|
342
|
+ if (model != null)
|
|
|
343
|
+ {
|
|
|
344
|
+ var obj = new
|
|
|
345
|
+ {
|
|
|
346
|
+ state = "success",
|
|
|
347
|
+ message = "成功",
|
|
|
348
|
+ allButtons = button,
|
|
|
349
|
+ model = model
|
|
|
350
|
+ };
|
|
|
351
|
+ return Content(obj.ToJson());
|
|
|
352
|
+ }
|
|
|
353
|
+ }
|
|
|
354
|
+ else
|
|
|
355
|
+ {
|
|
|
356
|
+ var model = new BLL.T_Car_AssignWorkOrder ().GetModel (int .Parse ( SMS.F_WorkOrderId));
|
|
|
357
|
+ if (model != null)
|
|
|
358
|
+ {
|
|
|
359
|
+ var obj = new
|
|
|
360
|
+ {
|
|
|
361
|
+ state = "success",
|
|
|
362
|
+ message = "成功",
|
|
|
363
|
+ allButtons = GetButtons(model.F_State.Value, User.F_RoleCode),
|
|
|
364
|
+ model = model
|
|
|
365
|
+ };
|
|
|
366
|
+ return Content(obj.ToJson());
|
|
|
367
|
+ }
|
|
|
368
|
+ }
|
|
|
369
|
+ }
|
|
|
370
|
+ }
|
|
|
371
|
+ else
|
|
|
372
|
+ {
|
|
|
373
|
+ return Error("消息不存在");
|
|
|
374
|
+ }
|
|
|
375
|
+
|
|
|
376
|
+
|
|
|
377
|
+ return Success("获取成功", Buttons);
|
|
|
378
|
+
|
|
|
379
|
+ }
|
|
|
380
|
+ /// <summary>
|
|
|
381
|
+ /// 按钮
|
|
|
382
|
+ /// </summary>
|
|
|
383
|
+ public class button
|
|
|
384
|
+ {
|
|
|
385
|
+ public int key { get; set; }
|
|
|
386
|
+ public string value { get; set; }
|
|
|
387
|
+ public button(int _key, string _value)
|
|
|
388
|
+ {
|
|
|
389
|
+ key = _key;
|
|
|
390
|
+ value = _value;
|
|
|
391
|
+ }
|
|
|
392
|
+ }
|
|
|
393
|
+ public static button distribution()
|
|
|
394
|
+ {
|
|
|
395
|
+ return new button(1, "分配");
|
|
|
396
|
+ }
|
|
|
397
|
+ public static button withdraw()
|
|
|
398
|
+ {
|
|
|
399
|
+ return new button(2, "撤回");
|
|
|
400
|
+ }
|
|
|
401
|
+ public static button back()
|
|
|
402
|
+ {
|
|
|
403
|
+ return new button(3, "退回");
|
|
|
404
|
+ }
|
|
|
405
|
+ public static button receiving()
|
|
|
406
|
+ {
|
|
|
407
|
+ return new button(4, "接单");
|
|
|
408
|
+ }
|
|
|
409
|
+ public static button start()
|
|
|
410
|
+ {
|
|
|
411
|
+ return new button(5, "发车");
|
|
|
412
|
+ }
|
|
|
413
|
+ public static button end()
|
|
|
414
|
+ {
|
|
|
415
|
+ return new button(6, "抵达");
|
|
|
416
|
+ }
|
|
|
417
|
+ public static button evaluate()
|
|
|
418
|
+ {
|
|
|
419
|
+ return new button(7, "评价");
|
|
|
420
|
+ }
|
|
|
421
|
+ public static button edit()
|
|
|
422
|
+ {
|
|
|
423
|
+ return new button(8, "编辑");
|
|
|
424
|
+ }
|
|
|
425
|
+ public static button delete()
|
|
|
426
|
+ {
|
|
|
427
|
+ return new button(8, "删除");
|
|
|
428
|
+ }
|
|
|
429
|
+ public List<button> GetButton(int state, string role)
|
|
|
430
|
+ {
|
|
|
431
|
+ List<button> buttons = new List<button>();
|
|
|
432
|
+
|
|
|
433
|
+ if (role =="1")
|
|
|
434
|
+ {
|
|
|
435
|
+ switch (state)
|
|
|
436
|
+ {
|
|
|
437
|
+ case -1:
|
|
|
438
|
+ buttons.Add(edit());
|
|
|
439
|
+ buttons.Add(delete());
|
|
|
440
|
+
|
|
|
441
|
+ break;
|
|
|
442
|
+ case 0:
|
|
|
443
|
+ buttons.Add(withdraw());
|
|
|
444
|
+
|
|
|
445
|
+ break;
|
|
|
446
|
+ case 7:
|
|
|
447
|
+ buttons.Add(evaluate());
|
|
|
448
|
+ break;
|
|
|
449
|
+
|
|
|
450
|
+ }
|
|
|
451
|
+ }
|
|
|
452
|
+
|
|
|
453
|
+ return buttons;
|
|
|
454
|
+ }
|
|
|
455
|
+
|
|
|
456
|
+
|
|
|
457
|
+ public List<button> GetButtons(int state, string role)
|
|
|
458
|
+ {
|
|
|
459
|
+ List<button> buttons = new List<button>();
|
|
|
460
|
+ switch (state)
|
|
|
461
|
+ {
|
|
|
462
|
+ case 0:
|
|
|
463
|
+ if (role == "SJ")
|
|
|
464
|
+ {
|
|
|
465
|
+ buttons.Add(receiving());
|
|
|
466
|
+ }
|
|
|
467
|
+ break;
|
|
|
468
|
+ case 2:
|
|
|
469
|
+ if (role == "SJ")
|
|
|
470
|
+ {
|
|
|
471
|
+ buttons.Add(start());
|
|
|
472
|
+ }
|
|
|
473
|
+ break;
|
|
|
474
|
+ case 4:
|
|
|
475
|
+ if (role == "SJ")
|
|
|
476
|
+ {
|
|
|
477
|
+ buttons.Add(end());
|
|
|
478
|
+ }
|
|
|
479
|
+ break;
|
|
|
480
|
+
|
|
|
481
|
+ }
|
|
|
482
|
+ return buttons;
|
|
|
483
|
+ }
|
|
285
|
484
|
/// <summary>
|
|
286
|
485
|
/// 添加信息
|
|
287
|
486
|
/// </summary>
|
|
|
@@ -310,6 +509,7 @@ namespace RMYY_CallCenter_Api.Controllers
|
|
310
|
509
|
model.SMS_IsTop = smstop;
|
|
311
|
510
|
model.SMS_Type =(int ) smstype;//状态
|
|
312
|
511
|
model.F_WorkOrderId = workorderid;
|
|
|
512
|
+
|
|
313
|
513
|
int n = bll.Add(model);
|
|
314
|
514
|
if (n > 0)
|
|
315
|
515
|
{
|