duhongyu лет назад: 6
Родитель
Сommit
f677c4fa7c

Разница между файлами не показана из-за своего большого размера
+ 16 - 7
codegit/CallCenterApi/CallCenterApi.DAL/T_Wo_WorkOrder.cs


+ 2 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/RegionCategoryController.cs

@@ -36,7 +36,8 @@ namespace CallCenterApi.Interface.Controllers.customer
36 36
                     return Success("获取失败,内容为空");
37 37
                 }
38 38
             }
39
-            var entityJson = new BLL.T_RegionCategory().GetModelList("F_Layer = " + F_Layer + "AND F_ParentId=" + F_RegionId);
39
+            var entityJson = new BLL.T_RegionCategory().GetModelList("F_Layer = " + F_Layer + "AND F_ParentId=" + F_RegionId + "order by F_Sort" );
40
+         
40 41
             if (entityJson.Count > 0)
41 42
             {
42 43
                 return Success("加载成功", entityJson);

+ 281 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -4,6 +4,7 @@ using CallCenterApi.Interface.App_Start;
4 4
 using CallCenterApi.Interface.Controllers.Base;
5 5
 using CallCenterApi.Interface.Controllers.workorder;
6 6
 using CallCenterApi.Interface.Models.Enum;
7
+using CallCenterApi.Interface.Models.Input;
7 8
 using CallCenterAPI.WechatSDK;
8 9
 using CallCenterAPI.WechatSDK.Models;
9 10
 using System;
@@ -11,6 +12,7 @@ using System.Collections.Generic;
11 12
 using System.Data;
12 13
 using System.IO;
13 14
 using System.Linq;
15
+using System.Text.RegularExpressions;
14 16
 using System.Web;
15 17
 using System.Web.Mvc;
16 18
 
@@ -23,7 +25,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
23 25
         private readonly BLL.T_Cus_CustomerBaseNew customerBaseBLL = new BLL.T_Cus_CustomerBaseNew();
24 26
         private readonly BLL.T_Cus_CustomerFinance finbll = new BLL.T_Cus_CustomerFinance();
25 27
         private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
26
-        //private readonly BLL.T_Cus_RegionCategory bllCus = new T_Cus_RegionCategory();
28
+        private readonly BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
29
+        private readonly BLL.T_Wo_WorkOrderItem_New itembll = new BLL.T_Wo_WorkOrderItem_New();
30
+        private readonly BLL.T_Wo_WorkOrder_Logs blllogs = new BLL.T_Wo_WorkOrder_Logs();
27 31
 
28 32
         ///// <summary>
29 33
         ///// 绑定微信号
@@ -476,7 +480,283 @@ namespace CallCenterApi.Interface.Controllers.weixin
476 480
             }
477 481
             return Error("重置密码失败");
478 482
         }
483
+        /// <summary>
484
+        /// 验证生产批次号为15位
485
+        /// </summary>
486
+        private bool vaBatchNumber(string code)
487
+        {
488
+            var res = false;
489
+            //11位数字
490
+            if (code.Length == 15)
491
+                res = true;
492
+            return res;
493
+        }
494
+        /// <summary>
495
+        /// 验证物料编码为10位纯数字
496
+        /// </summary>
497
+        private bool valcode(string code, int number)
498
+        {
499
+            var res = false;
500
+            //11位数字
501
+            if (code.Length == number && Regex.IsMatch(code, @"^\d{" + number + "}$"))
502
+                res = true;
503
+            return res;
504
+        }
505
+        /// <summary>
506
+        /// 根据传入的对象和input的内容返回对象(添加修改使用)
507
+        /// </summary>
508
+        private Model.T_Wo_WorkOrder inputtoobj(Model.T_Wo_WorkOrder model, WorkOrderNewInput input, int type)
509
+        {
510
+            string usercode = CurrentUser.UserData.F_UserCode;
511
+            var newmodel = model;
512
+            if (input.F_ID != 0)
513
+                model.F_ID = input.F_ID;
514
+            else
515
+                model.F_ID = model.F_ID;//工单ID
516
+            if (!string.IsNullOrWhiteSpace(input.F_WorkOrderCode))
517
+                model.F_WorkOrderCode = input.F_WorkOrderCode;//工单编号
518
+            else
519
+                model.F_WorkOrderCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");  //工单编号  
520
+            #region 基本字段
521
+            model.F_Source = input.F_Source.ToString();//工单来源
522
+            model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
523
+            model.F_WxOpenId = input.F_WxOpenId;
524
+            model.F_CusName = input.F_CusName;//客户姓名
525
+            model.F_CusPhone = input.F_CusPhone;//客户电话
526
+            model.F_CompanyName = input.F_CompanyName;//公司名称
527
+            model.F_IncidentProvince = input.F_IncidentProvince;//事发地-省
528
+            model.F_IncidentCity = input.F_IncidentCity;//事发地-市
529
+            model.F_IncidentCountry = input.F_IncidentCountry;//事发地-县
530
+            model.F_IncidentTownship = input.F_IncidentTownship;//事发地-乡
531
+            model.F_IncidentDetailed = input.F_IncidentDetailed;//事发地-详细
532
+            model.F_SalesBase = input.F_SalesBase;//销售基地:新乡、新疆、九江、东北、其他(其它手动输入别的点选)
533
+            model.F_Description = input.F_Description;//问题描述
534
+            model.F_Files = "0";//附件上传ids
535
+            model.F_DealType = input.F_DealType;//处理方式:当即办理、电话转接、网络转办(点选)
536
+            #endregion
537
+            model.F_QuestionType = input.F_QuestionType;//问题类别(投诉抽捡和咨询类别不一样)
538
+            model.F_CustomerID = input.F_CustomerID;//客户编号为10为纯数字
539
+            model.F_MaterialID = input.F_MaterialID.ToString();//物料编码为11为纯数字
540
+            #region 投诉类
541
+            model.F_BatchNumber = input.F_BatchNumber;//生产批次号
542
+            model.F_TS_Formula = input.F_TS_Formula;// 投诉-配方
543
+            model.F_TS_Category = input.F_TS_Category;//投诉-产品种类:化肥、化工、其他
544
+            model.F_TS_Quantity = input.F_TS_Quantity;//投诉-问题数量(吨)
545
+            model.F_TS_Level = input.F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
546
+            #endregion
547
+            #region 咨询类
548
+          //  model.F_ZX_ProName = input.F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
549
+            model.F_ZX_Quantity = input.F_ZX_Quantity;// 咨询-问题数量(吨)
550
+            model.F_ZX_Area = input.F_ZX_Area;// 咨询-大区
551
+            model.F_ZX_Branch = input.F_ZX_Branch;// 咨询-分公司
552
+            #endregion
553
+            #region 抽检类
554
+            model.F_CJ_Time = input.F_CJ_Time;// 抽检-抽检时间
555
+            model.F_CJ_Level = input.F_CJ_Level;// 抽检-抽检级别:乡镇级、县级、市级、省级及以上、个人送检
556
+            model.F_CJ_Unit = input.F_CJ_Unit;// 抽检-抽检单位:市场监督、农业部、土肥站、工商、联合执法、其他
557
+            model.F_CJ_TestUnit = input.F_CJ_TestUnit;//抽检-化验单位
558
+            model.F_CJ_Tonnage = input.F_CJ_Tonnage;//抽检-抽检吨数
559
+            model.F_CJ_BagNo = input.F_CJ_BagNo;//抽检-抽检袋数
560
+            model.F_CJ_Outlay = input.F_CJ_Outlay;//抽检-公关费用金额:单位元】
561
+            if (!string.IsNullOrEmpty(input.F_BatchNumber))
562
+            {
563
+                if (type == 1)
564
+                {
565
+                    model.F_SC_QualityMonth = new WorkOrderController().GetProTime(input.F_BatchNumber, DateTime.Parse(input.F_CreateOn.ToString())).ToString();
566
+                }
567
+                else
568
+                {
569
+                    model.F_SC_QualityMonth = new WorkOrderController().GetProTime(input.F_BatchNumber, DateTime.Now).ToString();
570
+                }
571
+            }
572
+
573
+            if (type == 1)
574
+            {
575
+                model.F_State = input.F_State;//工单状态
576
+                model.F_CreateOn = input.F_CreateOn;//添加时间
577
+                model.F_CreateBy = input.F_CreateBy;//添加人
578
+                model.F_UpdateBy = usercode;//修改人工号
579
+                model.F_UpdateOn = DateTime.Now;//修改人工号
580
+                if (input.F_UpdateCount != null)
581
+                {
582
+                    model.F_UpdateCount = input.F_UpdateCount + 1;//修改次数
583
+                }
584
+                else
585
+                {
586
+                    model.F_UpdateCount = 1;//修改次数
587
+                }
588
+            }
589
+            else
590
+            {
591
+                model.F_State = (int)EnumWorkOrderState.neworder;
592
+                model.F_CreateBy = usercode;
593
+                model.F_CreateOn = DateTime.Now;
594
+            }
595
+            model.F_IsVisit = 1;
596
+            model.F_IsDelete = 0;
597
+            model.F_IsOver = 0;
598
+            #endregion
599
+            return model;
600
+        }
601
+        /// <summary>
602
+        /// 添加工单
603
+        /// </summary>
604
+        /// <returns></returns>
605
+        public ActionResult Add(WorkOrderNewInput input)
606
+        {
607
+          
608
+            if (!string.IsNullOrEmpty (input.F_WxOpenId ))
609
+            {
610
+                var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + input.F_WxOpenId + "'").FirstOrDefault();
611
+                //     string usercode = CurrentUser.UserData.F_UserCode;
612
+                //   Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
613
+                if (ua != null)
614
+                {
615
+                    #region 添加验证判断
616
+                    if (!(input.F_Type > 0 && input.F_Type < 5))
617
+                        return Error("工单类型错误!");
618
+                    if (input.F_State == 2 && !vaBatchNumber(input.F_BatchNumber))
619
+                        return Error("请输入正确的工单批次号!");
620
+                    #endregion
621
+                    var model = new Model.T_Wo_WorkOrder();
622
+                    #region 保存客户基本信息
623
+                    model = inputtoobj(model, input, 2);
624
+                  
625
+                    #endregion
626
+                    long n = woBLL.Add(model);
627
+                    if (n > 0)
628
+                    {
629
+                        string deptname = "";
630
+                        var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
631
+                        if (deptmodel != null)
632
+                        {
633
+                            deptname = deptmodel.F_DeptName + "-";
634
+                        }
635
+                        return Success("添加成功!");
636
+
637
+                    }
638
+                    else
639
+                        return Error("添加失败!");
640
+                }
641
+                else
642
+                {
643
+                    return Error("无操作权限!");
644
+                }
645
+             
646
+            }
647
+            else
648
+            {
649
+                return Error("OpenId不能为空!");
650
+            }
651
+        }
652
+        /// <summary>
653
+        /// 修改工单
654
+        /// </summary>
655
+        /// <returns></returns>
656
+        public ActionResult Update(WorkOrderNewInput input)
657
+        {
658
+            var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + input.F_WxOpenId + "'").FirstOrDefault();
659
+            if (ua != null )
660
+            {
661
+                #region 添加验证判断
662
+                if (input.F_ID <= 0)
663
+                    return Error("参数错误!");
664
+                if (!(input.F_Type > 0 && input.F_Type < 5))
665
+                    return Error("工单类型错误!");
666
+                if (input.F_State == 2 && !vaBatchNumber(input.F_BatchNumber))
667
+                    return Error("请输入正确的工单批次号!");
668
+                if (input.F_Type == 1 || input.F_Type == 3)
669
+                {
670
+                    if (input.F_CustomerID > 0)
671
+                    {
672
+                        if (!valcode(input.F_CustomerID.ToString(), 10))
673
+                        {
674
+                            return Error("客户编号为10为纯数字!");
675
+                        }
676
+                    }
677
+                    if (input.F_MaterialID > 0)
678
+                    {
679
+                        if (!valcode(input.F_MaterialID.ToString(), 11))
680
+                        {
681
+                            return Error("物料编码为11为纯数字!");
682
+                        }
683
+                    }
479 684
 
685
+                }
686
+                #endregion
687
+                var model = woBLL.GetModel(input.F_ID);
688
+                #region 保存客户基本信息
689
+                model = inputtoobj(model, input, 1);
690
+                #endregion
691
+                bool n = woBLL.Update(model);
692
+                if (n)
693
+                {
694
+                    WriteWorkOrderLog(model.F_WorkOrderCode, ua.F_UserCode, 0, "", 1, "修改工单");
695
+                    #region 读取当前登录人的部门
696
+                    string deptname = "";
697
+                    var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
698
+                    if (deptmodel != null)
699
+                    {
700
+                        deptname = deptmodel.F_DeptName + "-";
701
+                    }
702
+                    #endregion
703
+                    AddLog(input.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "修改工单", (int)EnumItemType.update, (int)EnumItemOpt.update, "", 0, ua, 0, 0);
704
+                    return Success("保存成功!");
705
+                }
706
+                else
707
+                    return Error("保存失败!");
708
+            }
709
+            else
710
+            {
711
+                return Error("OpenId不能为空!!");
712
+            }
713
+        }
714
+        public void WriteWorkOrderLog(string WorkOrderID, string UserCode, int IsDelete, string DelUserCode, int TypeId, string Remark)
715
+        {
716
+            var model = new Model.T_Wo_WorkOrder_Logs();
717
+            model.WorkOrderID = WorkOrderID;        //工单编号
718
+            model.UserCode = UserCode;              //修改人code
719
+            model.AddTime = DateTime.Now;           //添加时间
720
+            model.IsDelete = IsDelete;              //是否删除(0正常1删除)
721
+            model.DelUserCode = DelUserCode;        //删除人code
722
+            model.TypeId = TypeId;                  //类型(0添加,1修改)
723
+            model.Remark = Remark;                  //备注
724
+            blllogs.Add(model);
725
+        }
726
+        /// <summary>
727
+        /// 添加工单记录
728
+        /// </summary>
729
+        public long AddLog(long woid, int wostate, string content, int itemtype, int opttype, string nextuser, int nextdept, Model.T_Sys_UserAccount nowUser, float overtime, int sms)
730
+        {
731
+            Model.T_Wo_WorkOrderItem_New itemModel = new Model.T_Wo_WorkOrderItem_New();
732
+            #region 
733
+            //处理当前工单的记录之前的记录过期
734
+            var itemlast = itembll.GetModelList(" isnull(F_IsUsed,'0')='0' and F_ItemType=" + itemtype + " and  F_WoID=" + woid + " ");
735
+            if (itemlast.Count > 0)
736
+            {
737
+                foreach (var it in itemlast)
738
+                {
739
+                    it.F_IsUsed = 1;
740
+                    it.F_LimitTime = overtime.ToString();
741
+                    itembll.Update(it);
742
+                }
743
+            }
744
+            #endregion
745
+            itemModel.F_WoID = woid;
746
+            itemModel.F_IsSMS = sms;
747
+            itemModel.F_WoState = wostate;
748
+            itemModel.F_ItemType = itemtype;
749
+            itemModel.F_OptType = opttype;
750
+            itemModel.F_OptContent = content;
751
+            itemModel.F_NextUser = nextuser;
752
+            itemModel.F_NextDept = nextdept;
753
+            itemModel.F_IsUsed = 0;
754
+            itemModel.F_LimitTime = overtime.ToString();
755
+            itemModel.F_CreateUser = nowUser.F_UserCode;
756
+            itemModel.F_CreateTime = DateTime.Now;
757
+            var res = itembll.Add(itemModel);
758
+            return res;
759
+        }
480 760
         #region
481 761
         //workorder.WoBillController blcon = new WoBillController();
482 762
         ///// <summary>

+ 401 - 99
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -5,6 +5,7 @@ using CallCenterApi.Interface.Controllers.Base;
5 5
 using CallCenterApi.Interface.Models.Enum;
6 6
 using CallCenterApi.Interface.Models.Input;
7 7
 using CallCenterApi.Model;
8
+using CallCenterAPI.WechatSDK;
8 9
 using System;
9 10
 using System.Collections.Generic;
10 11
 using System.Data;
@@ -26,7 +27,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
26 27
         BLL.T_Wo_WorkOrder_Logs blllogs = new BLL.T_Wo_WorkOrder_Logs();
27 28
         BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
28 29
         BLL.T_Sys_RoleInfo rolebll = new BLL.T_Sys_RoleInfo();
29
-        
30
+        BLL.T_Sys_DictionaryValue dicvalueBll = new BLL.T_Sys_DictionaryValue();
31
+
30 32
         // GET: WorkOrderNew
31 33
         /// <summary>
32 34
         /// 获取工单列表
@@ -42,7 +44,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
42 44
                 string sql = $" and F_IsDelete=0";
43 45
                 DataTable dt = new DataTable();
44 46
                 #region 筛选条件
45
-                if (type > 0 && type < 4)//工单类型
47
+                if (type > 0 && type < 5)//工单类型
46 48
                     sql += $" and F_Type=" + type;
47 49
                 if (source > 0)//工单来源
48 50
                     sql += $" and F_Source=" + source;
@@ -422,7 +424,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
422 424
         ///综合查询列表
423 425
         /// </summary>
424 426
         public ActionResult GetComprehensive(string code, string cusname,string keywords, string cusphone, string companyname, string province, string city,
425
-            string country, string township, string touser, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
427
+            string country, string township,string category,string salebase, string touser, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
426 428
         {
427 429
             int userId = CurrentUser.UserData.F_UserId;
428 430
             if (userId != 0)
@@ -430,7 +432,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
430 432
                 string sql = $" and F_IsDelete=0";
431 433
                 DataTable dt = new DataTable();
432 434
                 #region 筛选条件
433
-                if (type > 0 && type < 4)//工单类型
435
+                if (type > 0 && type < 5)//工单类型
434 436
                     sql += $" and F_Type=" + type;
435 437
               if (state >= 0)//工单状态
436 438
                    sql += $" and F_State=" + state;
@@ -441,13 +443,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
441 443
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
442 444
                     sql += $" and F_WorkOrderCode like '%" + code.Trim() + "%'";
443 445
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
444
-                    sql += $"  and F_WorkOrderCode like '%" + keywords.Trim() + "%' or F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%'  ";
446
+                    sql += $"  and F_WorkOrderCode like '%" + keywords.Trim() + "%' or F_QuestionType like '%" + keywords.Trim()
447
+                         + "%' or F_ZX_Area like '%" + keywords.Trim() + "%' or F_ZX_Branch like '%" + keywords.Trim() 
448
+                         + "%' or F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%'  ";
445 449
                 if (!string.IsNullOrWhiteSpace(cusname))//客户姓名
446 450
                     sql += $" and F_CusName like '%" + cusname.Trim() + "%'";
447 451
                 if (!string.IsNullOrWhiteSpace(cusphone))//客户电话
448 452
                     sql += $" and F_CusPhone like '%" + cusphone.Trim() + "%'";
449 453
                 if (!string.IsNullOrWhiteSpace(companyname))//公司名称
450 454
                     sql += $" and F_CompanyName like '%" + companyname.Trim() + "%'";
455
+                if (!string.IsNullOrWhiteSpace(category))//产品名称
456
+                    sql += $" and F_TS_Category like '%" + category.Trim() + "%'";
457
+                if (!string.IsNullOrWhiteSpace(salebase))//销售基地
458
+                    sql += $" and F_SalesBase like '%" + salebase.Trim() + "%'";
451 459
                 if (!string.IsNullOrWhiteSpace(province))//省
452 460
                     sql += $" and F_IncidentProvince like '%" + province.Trim() + "%'";
453 461
                 if (!string.IsNullOrWhiteSpace(province))//市
@@ -562,7 +570,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
562 570
                 string sql = $" and F_IsDelete=0";
563 571
                 DataTable dt = new DataTable();
564 572
                 #region 筛选条件
565
-                if (type > 0 && type < 4)//工单类型
573
+                if (type > 0 && type < 5)//工单类型
566 574
                     sql += $" and F_Type=" + type;
567 575
                 if (source > 0)//工单来源
568 576
                     sql += $" and F_Source=" + source;
@@ -967,7 +975,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
967 975
               
968 976
                 DataTable dt = new DataTable();
969 977
                 #region 筛选条件
970
-                if (type > 0 && type < 4)//工单类型
978
+                if (type > 0 && type < 5)//工单类型
971 979
                     sql += $" and F_Type=" + type;
972 980
                 if (state >= 0)//工单状态
973 981
                     sql += $" and F_State=" + state;
@@ -1069,7 +1077,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1069 1077
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
1070 1078
 
1071 1079
                 #region 添加验证判断
1072
-                if (!(input.F_Type> 0 && input.F_Type < 4))
1080
+                if (!(input.F_Type> 0 && input.F_Type < 5))
1073 1081
                     return Error("工单类型错误!");
1074 1082
                 if (input .F_State ==2&&!vaBatchNumber(input .F_BatchNumber ))
1075 1083
                     return Error("请输入正确的工单批次号!");
@@ -1168,7 +1176,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1168 1176
                 #region 添加验证判断
1169 1177
                 if (input.F_ID <= 0)
1170 1178
                     return Error("参数错误!");
1171
-                if (!(input.F_Type> 0 && input.F_Type < 4))
1179
+                if (!(input.F_Type> 0 && input.F_Type < 5))
1172 1180
                     return Error("工单类型错误!");
1173 1181
                 if (input.F_State== 2 && !vaBatchNumber(input.F_BatchNumber))
1174 1182
                     return Error("请输入正确的工单批次号!");
@@ -1326,10 +1334,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
1326 1334
                     {
1327 1335
                         model.F_TypeName = "投诉";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
1328 1336
                     }
1329
-                    else
1337
+                    else if (model1[i].F_Type == "3")
1330 1338
                     {
1331 1339
                         model.F_TypeName = "抽检";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
1332 1340
                     }
1341
+                    else
1342
+                   {
1343
+                        model.F_TypeName = "建议及其他";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
1344
+                    }
1333 1345
                     model.F_State = model1[i].F_State;
1334 1346
                     if (model1[i].F_State ==0)//工单状态
1335 1347
                     {
@@ -1398,7 +1410,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1398 1410
                     model.F_TS_Level = model1[i].F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
1399 1411
                     #endregion
1400 1412
                     #region 咨询类
1401
-                    model.F_ZX_ProName = model1[i].F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
1413
+                  //  model.F_ZX_ProName = model1[i].F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
1402 1414
                     model.F_ZX_Quantity = model1[i].F_ZX_Quantity;// 咨询-问题数量(吨)
1403 1415
                     model.F_ZX_Area = model1[i].F_ZX_Area;// 咨询-大区
1404 1416
                     model.F_ZX_Branch = model1[i].F_ZX_Branch;// 咨询-分公司
@@ -1630,6 +1642,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
1630 1642
             model.F_IncidentDetailed = input.F_IncidentDetailed;//事发地-详细
1631 1643
             model.F_SalesBase = input.F_SalesBase;//销售基地:新乡、新疆、九江、东北、其他(其它手动输入别的点选)
1632 1644
             model.F_Description = input.F_Description;//问题描述
1645
+            model.F_ZX_Area = input.F_ZX_Area;// 大区
1646
+            model.F_ZX_Branch = input.F_ZX_Branch;//分公司
1633 1647
             model.F_Files = "0";//附件上传ids
1634 1648
             model.F_DealType = input.F_DealType;//处理方式:当即办理、电话转接、网络转办(点选)
1635 1649
             #endregion
@@ -1644,10 +1658,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
1644 1658
             model.F_TS_Level = input.F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
1645 1659
             #endregion
1646 1660
             #region 咨询类
1647
-            model.F_ZX_ProName = input.F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
1661
+         //   model.F_ZX_ProName = input.F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
1648 1662
             model.F_ZX_Quantity = input.F_ZX_Quantity;// 咨询-问题数量(吨)
1649
-            model.F_ZX_Area = input.F_ZX_Area;// 咨询-大区
1650
-            model.F_ZX_Branch = input.F_ZX_Branch;// 咨询-分公司
1663
+          
1651 1664
             #endregion
1652 1665
             #region 抽检类
1653 1666
             model.F_CJ_Time = input.F_CJ_Time;// 抽检-抽检时间
@@ -1661,11 +1674,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
1661 1674
             {
1662 1675
                 if (type == 1)
1663 1676
                 {
1664
-                    model.F_SC_QualityMonth = GetProTime(input.F_BatchNumber,DateTime .Parse (input.F_CreateOn.ToString ())).ToString ();
1677
+                    model.F_SC_QualityMonth = new WorkOrderController().GetProTime(input.F_BatchNumber, DateTime.Parse(input.F_CreateOn.ToString())).ToString();
1665 1678
                  }
1666 1679
                 else
1667 1680
                 {
1668
-                    model.F_SC_QualityMonth = GetProTime(input.F_BatchNumber, DateTime.Now).ToString();
1681
+                    model.F_SC_QualityMonth = new WorkOrderController().GetProTime(input.F_BatchNumber, DateTime.Now).ToString();
1669 1682
                 }
1670 1683
             }
1671 1684
           
@@ -1744,22 +1757,125 @@ namespace CallCenterApi.Interface.Controllers.workorder
1744 1757
             blllogs.Add(model);
1745 1758
         }
1746 1759
         /// <summary>
1747
-        /// 根据生产批次号获取超出质保期限
1748
-        /// 质保期限以月为单位
1760
+        /// 创建工单时指派
1749 1761
         /// </summary>
1750
-        /// <param name="BatchNumber">生产批次号</param>
1751
-        /// <param name="createtime">工单创建时间</param>
1752
-        public int GetProTime(string BatchNumber, DateTime createtime)
1762
+        /// <returns></returns>
1763
+          public ActionResult Createass(WorkOrderNewInput input, string cont, WorkOrdeDeptment deptment, int isvisit = 1,
1764
+            float overtime = 0, int sms = 0, int clbm = 0, int clid = 0)
1753 1765
         {
1754
-            //生产批次号截取前六位日期
1755
-            var prono = BatchNumber.Substring(0, 6);
1756
-            //转为生产日期格式
1757
-            var pronos = DateTime.ParseExact(prono, "yyMMdd", null).ToString("yyyy-MM-dd");
1758
-            var protime = Convert.ToDateTime(pronos);
1759
-            TimeSpan ts = createtime - protime;
1760
-            var days = ts.TotalDays;
1761
-            var month = (int)Math.Ceiling((days / 30));//以30天为一月计算几个月并且有余数取整
1762
-            return month;
1766
+            int userId = CurrentUser.UserData.F_UserId;
1767
+            if (userId != 0)
1768
+            {
1769
+                string usercode = CurrentUser.UserData.F_UserCode;
1770
+                Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
1771
+
1772
+                #region 添加验证判断
1773
+                if (!(input.F_Type > 0 && input.F_Type < 5))
1774
+                    return Error("工单类型错误!");
1775
+                if (input.F_State == 2 && !vaBatchNumber(input.F_BatchNumber))
1776
+                    return Error("请输入正确的工单批次号!");
1777
+                #endregion
1778
+                var model = new Model.T_Wo_WorkOrder();
1779
+                #region 保存客户基本信息
1780
+                model = inputtoobj(model, input, 2);
1781
+
1782
+                #endregion
1783
+                long n = workOrder.Add(model);
1784
+                if (n > 0)
1785
+                {
1786
+                    DataTable dt = new DataTable();
1787
+                    dt = new BLL.T_Wo_WorkOrder().GetList(1,"", "F_ID desc").Tables [0];
1788
+                    List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
1789
+                    WorkOrderNewInput inputs = new WorkOrderNewInput();
1790
+                        if (clbm == 0 && clid == 0)
1791
+                        {
1792
+                            return Error("请选择接收人");
1793
+                        }
1794
+                        else
1795
+                        {
1796
+                            var deptmodel = departmentBLL.GetModel(clbm);
1797
+                            if (deptmodel != null)
1798
+                            {
1799
+                                if (modlelist != null&& modlelist.Count >0)
1800
+                                {
1801
+                                    if (modlelist[0].F_Type == "2")
1802
+                                    {
1803
+                                        if (deptmodel.F_DeptId == 37)
1804
+                                        {
1805
+                                        inputs.F_SC_PreliminaryOpinion = deptment.PreliminaryOpinion;//市场管理科-初审意见:退货、换货、补偿、自行处理
1806
+                                        }
1807
+                                        else if (deptmodel.F_DeptId == 12)
1808
+                                        {
1809
+                                        inputs.F_IsVisit = isvisit;
1810
+                                        inputs.F_ZL_QualityEventLevel = deptment.QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
1811
+                                        inputs.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1812
+                                        inputs.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
1813
+                                        inputs.F_ZL_ApprovalOpinions = deptment.ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
1814
+                                        inputs.F_ZL_ApprovalDisagree = deptment.ApprovalDisagree;// 质量管理科-审批不同意意见
1815
+                                        inputs.F_ZL_CompensationMethod = deptment.CompensationMethod;// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
1816
+                                        inputs.F_ZL_CompensationMoney = deptment.CompensationMoney;// 质量管理科-补偿钱款
1817
+                                        inputs.F_ZL_CResponsibleUnits = deptment.CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
1818
+                                        inputs.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
1819
+                                        inputs.F_ZL_ImprovementRequirements = deptment.ImprovementRequirements;//  质量管理科-改进要求
1820
+                                        inputs.F_ZL_CApprovalNo = deptment.CApprovalNo;// 质量管理科-对应审批工作流单号
1821
+
1822
+                                        }
1823
+                                    }
1824
+                                    else if (modlelist[0].F_Type == "3")
1825
+                                    {
1826
+                                        if (deptmodel.F_DeptId == 37)
1827
+                                        {
1828
+                                        inputs.F_SC_CJ_SpotResult = deptment.SpotResult;//市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
1829
+                                        inputs.F_SC_CJ_SelfResult = deptment.SelfResult;//市场管理科-抽检-自检结果
1830
+                                        inputs.F_SC_CJ_ApprovalNo = deptment.ApprovalNo;//市场管理科-抽检-对应审批工作流单号
1831
+                                        inputs.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//市场管理科-抽检-确认返账金额
1832
+                                        }
1833
+                                        else if (deptmodel.F_DeptId == 12)
1834
+                                        {
1835
+                                        inputs.F_ZL_CJ_IsRecord = deptment.IsRecord;//质量管理科-抽检-未备案、已备案
1836
+                                        inputs.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1837
+                                        }
1838
+                                    }
1839
+                                    if (deptmodel.F_DeptId == 25)
1840
+                                    {
1841
+
1842
+                                    inputs.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//销售内勤-确认返账金额
1843
+                                    }
1844
+                                    else if (deptmodel.F_DeptId == 36)
1845
+                                    {
1846
+                                    inputs.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
1847
+                                    }
1848
+                                }
1849
+                                else
1850
+                                    return Error("工单不存在!");
1851
+                            }
1852
+                            else
1853
+                            {
1854
+                                return Error("请选择接收部门");
1855
+                            }
1856
+                        }
1857
+
1858
+                        if (modlelist[0] != null&& modlelist.Count >0)
1859
+                        {
1860
+                            var res = AssignWO(ua, modlelist[0], input, cont, clbm, clid, overtime, sms);
1861
+                            if (res)
1862
+                                return Success("转派成功");
1863
+                            else
1864
+                                return Error("转派失败!");
1865
+                        }
1866
+                        else
1867
+                            return Error("工单不存在!");
1868
+
1869
+                  
1870
+
1871
+                }
1872
+                else
1873
+                    return Error("添加失败!");
1874
+            }
1875
+            else
1876
+            {
1877
+                return Error("无操作权限!");
1878
+            }
1763 1879
         }
1764 1880
         /// <summary>
1765 1881
         /// 指派/转派工单
@@ -1769,11 +1885,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
1769 1885
         ///  <param name="clid">指派人</param>
1770 1886
         /// </summary>
1771 1887
         /// <returns></returns>
1772
-
1773 1888
         [Authority]
1774
-        public ActionResult AssignWorkOrder(long orderid, string cont, string PreliminaryOpinion, string QualityEventLevel, string ClaimAmount, string ResponsibleUnit, string ApprovalOpinions,
1775
-            string ApprovalDisagree, string CompensationMethod, string CompensationMoney, string CResponsibleUnits, string Fquantity, string ImprovementRequirements, string CApprovalNo, 
1776
-            string SpotResult, string SelfResult, string ApprovalNo, string ReturnAccount, string IsRecord,int isvisit=1,
1889
+        public ActionResult AssignWorkOrder(long orderid, string cont, WorkOrdeDeptment deptment, int isvisit=1,
1777 1890
             float overtime =0,int sms=0,int clbm = 0, int clid = 0)
1778 1891
         {
1779 1892
             int userId = CurrentUser.UserData.F_UserId;
@@ -1781,7 +1894,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
1781 1894
             if (userId != 0)
1782 1895
             {
1783 1896
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
1784
-                Model.T_Wo_WorkOrder order = workOrder .GetModel(orderid);
1785 1897
                 Model.T_Wo_WorkOrder model = workOrder.GetModel(orderid);
1786 1898
                 WorkOrderNewInput input = new WorkOrderNewInput();
1787 1899
               
@@ -1803,22 +1915,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
1803 1915
                                     if (deptmodel.F_DeptId  == 37)
1804 1916
                                     {
1805 1917
                                        // input. F_SC_QualityMonth = QualityMonth;//市场管理科-超出质保期限
1806
-                                        input.F_SC_PreliminaryOpinion = PreliminaryOpinion;//市场管理科-初审意见:退货、换货、补偿、自行处理
1918
+                                        input.F_SC_PreliminaryOpinion = deptment. PreliminaryOpinion;//市场管理科-初审意见:退货、换货、补偿、自行处理
1807 1919
                                     }
1808 1920
                                     else if (deptmodel.F_DeptId  == 12)
1809 1921
                                     {
1810 1922
                                         input.F_IsVisit = isvisit;
1811
-                                        input.F_ZL_QualityEventLevel = QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
1812
-                                        input.F_ZL_ClaimAmount = ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1813
-                                        input.F_ZL_ResponsibleUnit = ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
1814
-                                        input.F_ZL_ApprovalOpinions = ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
1815
-                                        input.F_ZL_ApprovalDisagree = ApprovalDisagree;// 质量管理科-审批不同意意见
1816
-                                        input.F_ZL_CompensationMethod = CompensationMethod;// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
1817
-                                        input.F_ZL_CompensationMoney = CompensationMoney;// 质量管理科-补偿钱款
1818
-                                        input.F_ZL_CResponsibleUnits = CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
1819
-                                        input.F_ZL_Fquantity = Fquantity;//质量管理科-确认实收数量(吨)
1820
-                                        input.F_ZL_ImprovementRequirements = ImprovementRequirements;//  质量管理科-改进要求
1821
-                                        input.F_ZL_CApprovalNo = CApprovalNo;// 质量管理科-对应审批工作流单号
1923
+                                        input.F_ZL_QualityEventLevel = deptment.QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
1924
+                                        input.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1925
+                                        input.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
1926
+                                        input.F_ZL_ApprovalOpinions = deptment.ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
1927
+                                        input.F_ZL_ApprovalDisagree = deptment.ApprovalDisagree;// 质量管理科-审批不同意意见
1928
+                                        input.F_ZL_CompensationMethod = deptment.CompensationMethod;// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
1929
+                                        input.F_ZL_CompensationMoney = deptment.CompensationMoney;// 质量管理科-补偿钱款
1930
+                                        input.F_ZL_CResponsibleUnits = deptment.CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
1931
+                                        input.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
1932
+                                        input.F_ZL_ImprovementRequirements = deptment.ImprovementRequirements;//  质量管理科-改进要求
1933
+                                        input.F_ZL_CApprovalNo = deptment.CApprovalNo;// 质量管理科-对应审批工作流单号
1822 1934
 
1823 1935
                                     }
1824 1936
 
@@ -1828,17 +1940,26 @@ namespace CallCenterApi.Interface.Controllers.workorder
1828 1940
                                     if (deptmodel.F_DeptId == 37)
1829 1941
                                     {
1830 1942
                                      
1831
-                                        input.F_SC_CJ_SpotResult = SpotResult;//市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
1832
-                                        input.F_SC_CJ_SelfResult = SelfResult;//市场管理科-抽检-自检结果
1833
-                                        input.F_SC_CJ_ApprovalNo = ApprovalNo;//市场管理科-抽检-对应审批工作流单号
1834
-                                        input.F_SC_CJ_ReturnAccount = ReturnAccount;//市场管理科-抽检-对应审批工作流单号
1943
+                                        input.F_SC_CJ_SpotResult = deptment.SpotResult;//市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
1944
+                                        input.F_SC_CJ_SelfResult = deptment.SelfResult;//市场管理科-抽检-自检结果
1945
+                                        input.F_SC_CJ_ApprovalNo = deptment.ApprovalNo;//市场管理科-抽检-对应审批工作流单号
1946
+                                        input.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//市场管理科-抽检-确认返账金额
1835 1947
                                     }
1836 1948
                                     else if (deptmodel.F_DeptId == 12)
1837 1949
                                     {
1838
-                                        input.F_ZL_CJ_IsRecord = IsRecord;//质量管理科-抽检-未备案、已备案
1839
-                                        input.F_ZL_ClaimAmount = ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1950
+                                        input.F_ZL_CJ_IsRecord = deptment.IsRecord;//质量管理科-抽检-未备案、已备案
1951
+                                        input.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1840 1952
                                     }
1841 1953
                                 }
1954
+                                if (deptmodel.F_DeptId == 25)
1955
+                                {
1956
+
1957
+                                    input.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//销售内勤-确认返账金额
1958
+                                }
1959
+                                else if (deptmodel.F_DeptId == 36)
1960
+                                {
1961
+                                    input.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
1962
+                                }
1842 1963
                             }
1843 1964
                             else
1844 1965
                                 return Error("工单不存在!");
@@ -1918,10 +2039,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1918 2039
         /// </summary>
1919 2040
         /// <returns></returns>
1920 2041
         [Authority]
1921
-        public ActionResult DealWorkOrder(long orderid, string cont, string ProductBase, string CResponsibleUnits,
1922
-            string QualityEventLevel, string ClaimAmount, string ResponsibleUnit, string ApprovalOpinions, string ApprovalDisagree, string CompensationMethod,
1923
-            string CompensationMoney, string SpotResult, string Fquantity, string ImprovementRequirements, string CApprovalNo, string SelfResult,
1924
-            string ApprovalNo, string ReturnAccount, string IsRecord,
2042
+        public ActionResult DealWorkOrder(long orderid, string cont, WorkOrdeDeptment deptment,
1925 2043
             string uncont="",
1926 2044
           int isvisit=0,  int isover = 0)
1927 2045
         {
@@ -1944,23 +2062,23 @@ namespace CallCenterApi.Interface.Controllers.workorder
1944 2062
                             {
1945 2063
                                 if (deptmodel.F_DeptId == 37)
1946 2064
                                 {
1947
-                                    input.F_SC_ProductBase = ProductBase;//
2065
+                                    input.F_SC_ProductBase = deptment. ProductBase;//
1948 2066
 
1949 2067
                                 }
1950 2068
                                 else if (deptmodel.F_DeptId ==12)
1951 2069
                                 {
1952 2070
                                     input.F_IsVisit = isvisit;
1953
-                                    input.F_ZL_QualityEventLevel = QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
1954
-                                    input.F_ZL_ClaimAmount = ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
1955
-                                    input.F_ZL_ResponsibleUnit = ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
1956
-                                    input.F_ZL_ApprovalOpinions = ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
1957
-                                    input.F_ZL_ApprovalDisagree = ApprovalDisagree;// 质量管理科-审批不同意意见
1958
-                                    input.F_ZL_CompensationMethod = CompensationMethod;// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
1959
-                                    input.F_ZL_CompensationMoney = CompensationMoney;// 质量管理科-补偿钱款
1960
-                                    input.F_ZL_CResponsibleUnits = CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
1961
-                                    input.F_ZL_Fquantity = Fquantity;//质量管理科-确认实收数量(吨)
1962
-                                    input.F_ZL_ImprovementRequirements = ImprovementRequirements;//  质量管理科-改进要求
1963
-                                    input.F_ZL_CApprovalNo = CApprovalNo;// 质量管理科-对应审批工作流单号
2071
+                                    input.F_ZL_QualityEventLevel = deptment.QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
2072
+                                    input.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
2073
+                                    input.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
2074
+                                    input.F_ZL_ApprovalOpinions = deptment.ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
2075
+                                    input.F_ZL_ApprovalDisagree = deptment.ApprovalDisagree;// 质量管理科-审批不同意意见
2076
+                                    input.F_ZL_CompensationMethod = deptment.CompensationMethod;// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
2077
+                                    input.F_ZL_CompensationMoney = deptment.CompensationMoney;// 质量管理科-补偿钱款
2078
+                                    input.F_ZL_CResponsibleUnits = deptment.CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
2079
+                                    input.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
2080
+                                    input.F_ZL_ImprovementRequirements = deptment.ImprovementRequirements;//  质量管理科-改进要求
2081
+                                    input.F_ZL_CApprovalNo = deptment.CApprovalNo;// 质量管理科-对应审批工作流单号
1964 2082
                                 }
1965 2083
 
1966 2084
                             }
@@ -1968,13 +2086,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
1968 2086
                             {
1969 2087
                                 if (deptmodel.F_DeptId ==37)
1970 2088
                                 {
1971
-                                    input.F_SC_ProductBase = ProductBase;//
2089
+                                    input.F_SC_ProductBase = deptment.ProductBase;//
1972 2090
                                 }
1973 2091
                                 else if (deptmodel.F_DeptId == 12)
1974 2092
                                 {
1975
-                                    input.F_ZL_CJ_IsRecord = IsRecord;//质量管理科-抽检-未备案、已备案
2093
+                                    input.F_ZL_CJ_IsRecord = deptment.IsRecord;//质量管理科-抽检-未备案、已备案
1976 2094
                                 }
1977 2095
                             }
2096
+                            if (deptmodel.F_DeptId == 25)
2097
+                            {
2098
+
2099
+                                input.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//销售内勤-确认返账金额
2100
+                            }
2101
+                            else if (deptmodel.F_DeptId == 36)
2102
+                            {
2103
+                                input.F_ZL_Fquantity = deptment.Fquantity;//质量管理科-确认实收数量(吨)
2104
+                            }
1978 2105
                         }
1979 2106
                         else
1980 2107
                             return Error("工单不存在!");
@@ -2121,10 +2248,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
2121 2248
                     {
2122 2249
                         sendsysmsg(model, nowUser, touser, Int32.Parse(itemid.ToString()), "催办");
2123 2250
                         var tousers = sysUserAccountBll.GetModel(touser);
2124
-                      //  if (tousers != null && !string.IsNullOrWhiteSpace(tousers.F_WxOpenId))
2125
-                       // {
2126
-                          //  sendwxmsg(model, tousers.F_WxOpenId, nowUser, "催办");
2127
-                       // }
2251
+                        if (tousers != null && !string.IsNullOrWhiteSpace(tousers.F_WxOpenId))
2252
+                        {
2253
+                            sendwxmsg(model, tousers.F_WxOpenId, nowUser, "催办");
2254
+                        }
2128 2255
                     }
2129 2256
                     return true;
2130 2257
                 }
@@ -2238,9 +2365,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
2238 2365
                 if (!string.IsNullOrWhiteSpace(touser) && touser != nowUser.F_UserCode)
2239 2366
                 {//排除上一级指派人是自己
2240 2367
                     sendsysmsg(model, nowUser, touser, (int)itemid, opt);
2241
-               //     var lastUser = sysUserAccountBll.GetModel(touser);
2242
-                   // if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2243
-                       // sendwxmsg(model, lastUser.F_WxOpenId, nowUser, opt);
2368
+               var lastUser = sysUserAccountBll.GetModel(touser);
2369
+                    if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2370
+                       sendwxmsg(model, lastUser.F_WxOpenId, nowUser, opt);
2244 2371
                 }
2245 2372
                 #endregion
2246 2373
                 #endregion
@@ -2319,10 +2446,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
2319 2446
                     var createmodel = sysUserAccountBll.GetModel(model.F_CreateBy);  //被指派人
2320 2447
                     if (createmodel != null)
2321 2448
                     {
2322
-                     //   if (!string.IsNullOrEmpty(createmodel.F_WxOpenId))
2323
-                       // {
2324
-                          //  sendwxmsg(model, createmodel.F_WxOpenId, nowUser, opt);
2325
-                       // }
2449
+                     if (!string.IsNullOrEmpty(createmodel.F_WxOpenId))
2450
+                       {
2451
+                           sendwxmsg(model, createmodel.F_WxOpenId, nowUser, opt);
2452
+                       }
2326 2453
                     }
2327 2454
                 }
2328 2455
                 #endregion
@@ -2332,22 +2459,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
2332 2459
                 {
2333 2460
                     sendsysmsg(model, nowUser, itemlast.F_CreateUser, (int)itemid, opt);
2334 2461
                     var lastUser = sysUserAccountBll.GetModel(itemlast.F_CreateUser);
2335
-                //    if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2336
-                   //     sendwxmsg(model, lastUser.F_WxOpenId, nowUser, opt);
2462
+                    if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2463
+                       sendwxmsg(model, lastUser.F_WxOpenId, nowUser, opt);
2337 2464
                 }
2338 2465
                 #endregion
2339 2466
                 #region 办理完结向客户发送消息
2340
-                //if (model.F_State  == (int)EnumWorkOrderState.finish)
2341
-                //{
2342
-                //    if (model.CustomerID != null)
2343
-                //    {
2344
-                //        var cusmodel = cusBll.GetModel(model.CustomerID.Value);
2345
-                //        if (cusmodel != null && !string.IsNullOrEmpty(cusmodel.F_WxOpenId))
2346
-                //        {
2347
-                //            sendwxmsg(model, cusmodel.F_WxOpenId, nowUser, opt);
2348
-                //        }
2349
-                //    }
2350
-                //}
2467
+                if (model.F_State  == (int)EnumWorkOrderState.finish)
2468
+               {
2469
+                   if (model.F_CustomerID != null)
2470
+                   {
2471
+                    var cusmodel = cusbll.GetModel(model.F_CustomerID.Value);
2472
+                     if (cusmodel != null && !string.IsNullOrEmpty(cusmodel.F_WxOpenId))
2473
+                       {
2474
+                          sendwxmsg(model, cusmodel.F_WxOpenId, nowUser, opt);
2475
+                      }
2476
+                   }
2477
+               }
2351 2478
                 #endregion
2352 2479
                 #endregion
2353 2480
                 return true;
@@ -2400,8 +2527,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
2400 2527
                 #region 给添加坐席推送系统消息和微信消息
2401 2528
                 sendsysmsg(model, nowUser, model.F_CreateBy , (int)itemid, "处理接单");
2402 2529
                 var createUser = sysUserAccountBll.GetModel(model.F_CreateBy);
2403
-              //  if (createUser != null && !string.IsNullOrEmpty(createUser.F_WxOpenId))
2404
-                 //   sendwxmsg(model, createUser.F_WxOpenId, nowUser, "接单");
2530
+               if (createUser != null && !string.IsNullOrEmpty(createUser.F_WxOpenId))
2531
+                    sendwxmsg(model, createUser.F_WxOpenId, nowUser, "接单");
2405 2532
                 #endregion
2406 2533
                 #region 读取上一级指派人员推送系统消息和微信消息
2407 2534
                 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();
@@ -2411,8 +2538,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
2411 2538
                     {
2412 2539
                         sendsysmsg(model, nowUser, itemlast.F_CreateUser, (int)itemid, "处理接单");
2413 2540
                         var lastUser = sysUserAccountBll.GetModel(itemlast.F_CreateUser);
2414
-                        //  if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2415
-                        //   sendwxmsg(model, lastUser.F_WxOpenId, nowUser, "接单");
2541
+                         if (lastUser != null && !string.IsNullOrEmpty(lastUser.F_WxOpenId))
2542
+                           sendwxmsg(model, lastUser.F_WxOpenId, nowUser, "接单");
2416 2543
                     }
2417 2544
                 }
2418 2545
                 #endregion
@@ -2527,12 +2654,28 @@ namespace CallCenterApi.Interface.Controllers.workorder
2527 2654
                 if (nowUser.F_UserCode != model.F_CreateBy)
2528 2655
                 {
2529 2656
                     sendsysmsg(model, nowUser, model.F_CreateBy, (int)model.F_ID , opt);//推送系统消息
2657
+                    var createmodel = sysUserAccountBll.GetModel(model.F_CreateBy);  //被指派人
2658
+                    if (createmodel != null)
2659
+                    {
2660
+                        if (!string.IsNullOrEmpty(createmodel.F_WxOpenId))
2661
+                        {
2662
+                            sendwxmsg(model, createmodel.F_WxOpenId, nowUser, opt);
2663
+                        }
2664
+                    }
2530 2665
                 }
2531 2666
                 #endregion
2532 2667
                 #region 向下一级操作人员推送消息
2533 2668
                 if (!string.IsNullOrWhiteSpace(touser))
2534 2669
                 {
2535 2670
                     sendsysmsg(model, nowUser, touser, (int)model.F_ID , opt);//推送系统消息
2671
+                    var modelUser2 = sysUserAccountBll.GetModel(touser);  //被指派人
2672
+                    if (modelUser2 != null)
2673
+                    {
2674
+                        if (!string.IsNullOrEmpty(modelUser2.F_WxOpenId))
2675
+                        {
2676
+                           sendwxmsg(model, modelUser2.F_WxOpenId, nowUser, "指派");
2677
+                        }
2678
+                    }
2536 2679
                 }
2537 2680
                 #endregion
2538 2681
                 #endregion
@@ -2561,5 +2704,164 @@ namespace CallCenterApi.Interface.Controllers.workorder
2561 2704
             new BLL.T_Msg_List().Add(msg);
2562 2705
             #endregion
2563 2706
         }
2707
+        //推送微信消息
2708
+        public void sendwxmsg(Model.T_Wo_WorkOrder womodel, string openid, Model.T_Sys_UserAccount nowUser, string opt)
2709
+        {
2710
+            #region 推送微信
2711
+            try
2712
+            {
2713
+                if (!string.IsNullOrEmpty(openid))
2714
+                {
2715
+                    var dicv = dicvalueBll.GetModel(int.Parse( womodel.F_Type));
2716
+                    string content = string.Empty;
2717
+                    var wotype = "";
2718
+                    if (dicv != null)
2719
+                    {
2720
+                        wotype = dicv.F_Name;
2721
+                    }
2722
+                    content = "编号" + womodel.F_WorkOrderCode  + "的工单已" + opt + ",操作人:" + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")";
2723
+                    var msg = WxHelper.SendWechatMsg1(womodel.F_WorkOrderCode, "你有工单已" + opt, wotype, womodel.F_State .ToString(), content, womodel.F_ID .ToString(), openid, "");
2724
+                    Error("推送微信::::::" + msg.ToString());
2725
+                }
2726
+            }
2727
+            catch { }
2728
+            #endregion
2729
+        }
2730
+    }
2731
+}
2732
+public class WorkOrdeDeptment
2733
+{
2734
+    /// <summary>
2735
+    /// 市场管理科-生产基地(新乡、新疆、九江、东北、贴牌、无法确定)
2736
+    /// </summary>
2737
+    public string ProductBase
2738
+    {
2739
+        get; set;
2740
+    }
2741
+    /// <summary>
2742
+    /// 市场管理科-初审意见:退货、换货、补偿、自行处理
2743
+    /// </summary>
2744
+    public string PreliminaryOpinion
2745
+    {
2746
+        get; set;
2747
+    }
2748
+    /// <summary>
2749
+    /// 市场管理科-超出质保期限(算法:工单创建日期-生产日期,生产日期根据生产批次号获取,单位:月)
2750
+    /// </summary>
2751
+    public string QualityMonth
2752
+    {
2753
+        get; set;
2754
+    }
2755
+    /// <summary>
2756
+    /// 市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
2757
+    /// </summary>
2758
+    public string SpotResult
2759
+    {
2760
+        get; set;
2761
+    }
2762
+    /// <summary>
2763
+    /// 市场管理科-抽检-自检结果
2764
+    /// </summary>
2765
+    public string SelfResult
2766
+    {
2767
+        get; set;
2768
+    }
2769
+    /// <summary>
2770
+    /// 市场管理科-抽检-对应审批工作流单号
2771
+    /// </summary>
2772
+    public string ApprovalNo
2773
+    {
2774
+        get; set;
2775
+    }
2776
+    /// <summary>
2777
+    /// 市场管理科-抽检-确认返账金额(元)
2778
+    /// </summary>
2779
+    public string ReturnAccount
2780
+    {
2781
+        get; set;
2782
+    }
2783
+    /// <summary>
2784
+    /// 质量管理科-质量事件等级(未遂、一般、较大、重大)
2785
+    /// </summary>
2786
+    public string QualityEventLevel
2787
+    {
2788
+        get; set;
2789
+    }
2790
+    /// <summary>
2791
+    /// 质量管理科-索赔金额(单位元,对应责任单位)
2792
+    /// </summary>
2793
+    public string ClaimAmount
2794
+    {
2795
+        get; set;
2796
+    }
2797
+    /// <summary>
2798
+    /// 质量管理科-责任单位(需列出,可选多个)
2799
+    /// </summary>
2800
+    public string ResponsibleUnit
2801
+    {
2802
+        get; set;
2803
+    }
2804
+    /// <summary>
2805
+    /// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
2806
+    /// </summary>
2807
+    public string ApprovalOpinions
2808
+    {
2809
+        get; set;
2810
+    }
2811
+    /// <summary>
2812
+    /// 质量管理科-审批不同意意见
2813
+    /// </summary>
2814
+    public string ApprovalDisagree
2815
+    {
2816
+        get; set;
2817
+    }
2818
+    /// <summary>
2819
+    /// 质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
2820
+    /// </summary>
2821
+    public string CompensationMethod
2822
+    {
2823
+        get; set;
2824
+    }
2825
+    /// <summary>
2826
+    /// 质量管理科-补偿钱款
2827
+    /// </summary>
2828
+    public string CompensationMoney
2829
+    {
2830
+        get; set;
2831
+    }
2832
+    /// <summary>
2833
+    /// 质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
2834
+    /// </summary>
2835
+    public string CResponsibleUnits
2836
+    {
2837
+        get; set;
2838
+    }
2839
+    /// <summary>
2840
+    /// 质量管理科-确认实收数量(吨)
2841
+    /// </summary>
2842
+    public string Fquantity
2843
+    {
2844
+        get; set;
2845
+    }
2846
+    /// <summary>
2847
+    /// 质量管理科-改进要求
2848
+    /// </summary>
2849
+    public string ImprovementRequirements
2850
+    {
2851
+        get; set;
2852
+    }
2853
+    /// <summary>
2854
+    /// 质量管理科-对应审批工作流单号
2855
+    /// </summary>
2856
+    public string  CApprovalNo
2857
+    {
2858
+        get; set;
2859
+    }
2860
+    /// <summary>
2861
+    /// 质量管理科-抽检-未备案、已备案
2862
+    /// </summary>
2863
+    public string  IsRecord
2864
+    {
2865
+        get; set;
2564 2866
     }
2565 2867
 }

+ 4 - 4
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Input/WorkOrderNewInput.cs

@@ -278,10 +278,10 @@ namespace CallCenterApi.Interface.Models.Input
278 278
         /// <summary>
279 279
         /// 咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
280 280
         /// </summary>
281
-        public string F_ZX_ProName
282
-        {
283
-            get; set;
284
-        }
281
+        //public string F_ZX_ProName
282
+        //{
283
+        //    get; set;
284
+        //}
285 285
         /// <summary>
286 286
         /// 咨询-问题数量
287 287
         /// </summary>

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Model/T_Wo_WorkOrder.cs

@@ -92,7 +92,7 @@ namespace CallCenterApi.Model
92 92
         private string _f_cusphone;
93 93
         private string _f_cusname;
94 94
         private string _f_companyname;
95
-        public string _f_wxopenid;
95
+        private string _f_wxopenid;
96 96
         /// <summary>
97 97
         /// 微信OpenId
98 98
         /// </summary>