Browse Source

高层审批修改,物料导入修改

duhongyu 6 years ago
parent
commit
4537cc588b

+ 20 - 13
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -1048,7 +1048,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1048 1048
         public string GetHApproval(string user)
1049 1049
         {
1050 1050
             string str = string.Empty;
1051
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where isnull(F_IsUsed,'0')='0' and F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + user + "'";
1051
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where isnull(F_IsUsed,'0')='0' and F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + user + "'"+ "and F_IsUsed=2"; ;
1052 1052
             return str;
1053 1053
         }
1054 1054
         /// <summary>
@@ -1087,7 +1087,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1087 1087
             {
1088 1088
                 str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType=" + (int)EnumItemType.deal
1089 1089
                    + " and "
1090
-                       + "F_WoState in(" + (int)EnumWorkOrderState.assign + ") and F_NextDept =" + deptid + " "//办理中和接单状态的操作人
1090
+                       + "F_WoState in(" + (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.abreback + ") and F_NextDept =" + deptid + " "//办理中和接单状态的操作人
1091 1091
                         + " and isnull(F_IsUsed,'0')='0' ";
1092 1092
             }
1093 1093
 
@@ -1161,9 +1161,6 @@ namespace CallCenterApi.Interface.Controllers.weixin
1161 1161
             string deptmodelsname = "";
1162 1162
             int wostate = 0;
1163 1163
             var toussers = "";
1164
-            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
1165
-            if (itemlast != null)
1166
-                toussers = itemlast.F_CreateUser;
1167 1164
             #region 上报
1168 1165
             if (IsAudit!=0)
1169 1166
             {
@@ -1180,7 +1177,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
1180 1177
                     {
1181 1178
                         deptmodelsname = deptmodels.F_DeptName + "-";
1182 1179
                     }
1183
-
1180
+                    var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_CreateUser!=" + user.F_UserCode + " and  F_OptType=" + (int)EnumItemOpt.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
1181
+                    if (itemlast != null)
1182
+                        toussers = itemlast.F_CreateUser;
1184 1183
                     wostate = 16;
1185 1184
                     if (AuditState == 0)
1186 1185
                     {
@@ -1211,7 +1210,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
1211 1210
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
1212 1211
                     if (ro.F_RoleCode == "DQJL")
1213 1212
                     {
1214
-
1213
+                        var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
1214
+                        if (itemlast != null)
1215
+                            toussers = itemlast.F_CreateUser;
1215 1216
                         if (AuditState == 0)
1216 1217
                         {
1217 1218
                             opt = "同意上报";
@@ -2511,7 +2512,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2511 2512
                 {
2512 2513
                     return Error("无操作权限!");
2513 2514
                 }
2514
-                    if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
2515
+                    if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
2515 2516
                     {
2516 2517
                         return Error("请输入正确的生产批次号!");
2517 2518
                     }
@@ -2702,6 +2703,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
2702 2703
 
2703 2704
                 if (ua != null)
2704 2705
                 {
2706
+                    if (hclid == 0 && hclbm == 0 && isApprovalp != 0)
2707
+                    {
2708
+                        return Error("请选择接收部门");
2709
+                    }
2705 2710
                     if (clbm == 0 && clid == 0)
2706 2711
                     {
2707 2712
                         return Error("请选择接收部门");
@@ -2860,7 +2865,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2860 2865
                         }
2861 2866
                     }
2862 2867
                 }
2863
-                AddLog(model.F_ID, (int)EnumWorkOrderState.assign, "审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat);
2868
+                AddLog(model.F_ID, (int)EnumWorkOrderState.assign, "审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat,2);
2864 2869
             }
2865 2870
            
2866 2871
             #endregion
@@ -3533,6 +3538,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3533 3538
                 }
3534 3539
             }
3535 3540
             var opt = "退回";
3541
+            int F_OptType = 1;
3536 3542
             int optbut = (int)EnumItemOpt.reback;
3537 3543
             int wostate = (int)EnumWorkOrderState.reback;
3538 3544
             if (type == 1)
@@ -3540,6 +3546,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3540 3546
                 opt = "异常退回";
3541 3547
                 optbut = (int)EnumItemOpt.abreback;
3542 3548
                 wostate = (int)EnumWorkOrderState.abreback;
3549
+                F_OptType = 2;
3543 3550
             }
3544 3551
             #region 读取当前登录人部门
3545 3552
             string deptname = "";
@@ -3552,7 +3559,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3552 3559
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + opt + "工单,退回说明:" + cont;
3553 3560
             //获取上一级处理人员
3554 3561
             var touser = ""; var deptid = 0;
3555
-            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();
3562
+            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_NextDept =" + nowUser.F_DeptId + " and F_WoState =" + F_OptType + " and  F_WoID='" + model.F_ID + "' order by F_CreateTime desc").FirstOrDefault();
3556 3563
             if (itemlast != null)
3557 3564
             {
3558 3565
 
@@ -3570,7 +3577,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3570 3577
             if (itemid > 0)
3571 3578
             {
3572 3579
                 #region 处理工单
3573
-                if (model.F_State == (int)EnumWorkOrderState.assign)
3580
+                if (model.F_State == (int)EnumWorkOrderState.assign || model.F_State == (int)EnumWorkOrderState.abreback)
3574 3581
                 {
3575 3582
                     model.F_State = (int)EnumWorkOrderState.reassign;
3576 3583
                 }
@@ -3767,7 +3774,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3767 3774
                     return Error("请输入客户姓名!");
3768 3775
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3769 3776
                     return Error("请输入客户电话!");
3770
-                if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
3777
+                if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
3771 3778
                 {
3772 3779
                     return Error("请输入正确的生产批次号!");
3773 3780
                 }
@@ -3827,7 +3834,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3827 3834
                         }
3828 3835
                         var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
3829 3836
                       
3830
-                        AddLog(input.F_ID, input.F_State.Value, deptname1 + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3837
+                        AddLog(input.F_ID, model .F_State.Value, deptname1 + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3831 3838
                     }
3832 3839
                     else
3833 3840
                     {

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/MaterialManageController.cs

@@ -326,6 +326,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
326 326
                                 dModel.F_MaterialEffect = dr["复合肥肥效"].ToString();//复合肥肥效
327 327
                                 dModel.F_Pipeline = dr["产品线"].ToString();//产品线
328 328
                                 dModel.F_Craft = dr["工艺"].ToString();//工艺
329
+                                dModel.F_Remark  = dr["备注"].ToString();//工艺
329 330
                                 dModel.F_CreateBy = userscode;
330 331
                                 dModel.F_CreateOn = DateTime.Now;
331 332
                                 dModel.F_IsDelete = 0;

+ 143 - 93
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -918,9 +918,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
918 918
             string deptmodelsname = "";
919 919
             int wostate = 0;
920 920
             var toussers = "";
921
-            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
922
-            if (itemlast != null)
923
-                toussers = itemlast.F_CreateUser;
921
+          //  var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
922
+        //    if (itemlast != null)
923
+               // toussers = itemlast.F_CreateUser;
924 924
             #region 上报
925 925
             if (IsAudit != 0)
926 926
             {
@@ -937,7 +937,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
937 937
                     {
938 938
                         deptmodelsname = deptmodels.F_DeptName + "-";
939 939
                     }
940
-
940
+                    var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit + " and  F_CreateUser!=" + user.F_UserCode  + " and  F_OptType=" + (int)EnumItemOpt.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
941
+                    if (itemlast != null)
942
+                        toussers = itemlast.F_CreateUser;
941 943
                     wostate = 16;
942 944
                     if (AuditState == 0)
943 945
                     {
@@ -968,6 +970,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
968 970
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
969 971
                     if (ro.F_RoleCode == "DQJL")
970 972
                     {
973
+                        var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.audit  + " and  F_OptType=" + (int)EnumItemOpt.audit + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
974
+                        if (itemlast != null)
975
+                            toussers = itemlast.F_CreateUser;
971 976
 
972 977
                         if (AuditState == 0)
973 978
                         {
@@ -1859,7 +1864,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1859 1864
             {
1860 1865
                 str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType=" + (int)EnumItemType.deal
1861 1866
                    + " and "
1862
-                       + "F_WoState in(" + (int)EnumWorkOrderState.assign + ") and F_NextDept =" + deptid + " "//办理中和接单状态的操作人
1867
+                       + "F_WoState in(" + (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.abreback+ ") and F_NextDept =" + deptid + " "//办理中和接单状态的操作人
1863 1868
                         + " and isnull(F_IsUsed,'0')='0' ";
1864 1869
             }
1865 1870
 
@@ -2257,10 +2262,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
2257 2262
                 return Error("无操作权限!");
2258 2263
             }
2259 2264
         }
2265
+        /// <summary>
2266
+        /// 获取高层审批
2267
+        /// </summary>
2268
+        /// <param name="user"></param>
2269
+        /// <returns></returns>
2260 2270
         public string GetHApproval(string user)
2261 2271
         {
2262 2272
             string str = string.Empty;
2263
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where isnull(F_IsUsed,'0')='0' and F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + user + "'";
2273
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where   F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + user + "'"+ "and F_IsUsed=2";
2264 2274
             return str;
2265 2275
         }
2266 2276
         /// <summary>
@@ -3125,7 +3135,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3125 3135
                     return Error("请输入客户姓名!");
3126 3136
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3127 3137
                     return Error("请输入客户电话!");
3128
-                if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
3138
+                if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber.Trim ()))
3129 3139
                 {
3130 3140
                     return Error("请输入正确的生产批次号!");
3131 3141
                 }
@@ -3347,13 +3357,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
3347 3357
                     return Error("请输入客户姓名!");
3348 3358
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3349 3359
                     return Error("请输入客户电话!");
3350
-                if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
3360
+                if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber.Trim ()))
3351 3361
                 {
3352 3362
                     return Error("请输入正确的生产批次号!");
3353 3363
                 }
3354 3364
                 else
3355 3365
                 {
3356
-                    if (!string.IsNullOrEmpty(input.F_BatchNumber))
3366
+                    if (!string.IsNullOrEmpty(input.F_BatchNumber.Trim ()))
3357 3367
                     {
3358 3368
                         var prono = input.F_BatchNumber.Substring(0, 6);
3359 3369
                         try
@@ -3394,6 +3404,40 @@ namespace CallCenterApi.Interface.Controllers.workorder
3394 3404
                     }
3395 3405
                     #endregion
3396 3406
                     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);
3407
+                    Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
3408
+                    if (ro !=null )
3409
+                    {
3410
+                      if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL"|| ro.F_RoleCode == "YWY")
3411
+                        {
3412
+                            if (GetUser(ua) != null)
3413
+                            {
3414
+                                var user = GetUser(ua);
3415
+                                string deptname1 = "";
3416
+                                var deptmode = departmentBLL.GetModel(user.F_DeptId);
3417
+                                if (deptmode != null)
3418
+                                {
3419
+                                    deptname1 = deptmode.F_DeptName + "-";
3420
+                                }
3421
+                                var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
3422
+
3423
+                                AddLog(input.F_ID, model.F_State.Value, deptname1 + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3424
+                            }
3425
+                            else
3426
+                            {
3427
+                                string deptname1 = "";
3428
+                                var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
3429
+                                if (deptmodel1 != null)
3430
+                                {
3431
+                                    deptname1 = deptmodel1.F_DeptName + "-";
3432
+                                }
3433
+                                var res = AssignWO(ua, model, input, "流转市场管理科", 37, 0, model.F_limit, 0);
3434
+                                if (res)
3435
+                                    return Success("保存成功");
3436
+                                else
3437
+                                    return Error("市场管理科接收失败!");
3438
+                            }
3439
+                        }
3440
+                    }
3397 3441
                     return Success("保存成功!");
3398 3442
                 }
3399 3443
                 else
@@ -3547,83 +3591,83 @@ namespace CallCenterApi.Interface.Controllers.workorder
3547 3591
                     }
3548 3592
 
3549 3593
                     model.F_Type =int .Parse ( model1[i].F_Type);//工单来源
3550
-                   // if (model1[i].F_Type == "1")
3551
-                   // {
3552
-                   //     model.F_TypeName = "咨询";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3553
-                   // }
3554
-                   // else if (model1[i].F_Type == "2")
3555
-                   // {
3556
-                   //     model.F_TypeName = "投诉";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3557
-                   // }
3558
-                   // else if (model1[i].F_Type == "3")
3559
-                   // {
3560
-                   //     model.F_TypeName = "抽检";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3561
-                   // }
3562
-                   // else
3563
-                   //{
3564
-                   //     model.F_TypeName = "建议及其他";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3565
-                   // }
3566
-                   // model.F_State = model1[i].F_State;
3567
-                   // if (model1[i].F_State ==0)//工单状态
3568
-                   // {
3569
-                   //     model.F_StateName = "待指派";
3570
-                   // }
3571
-                   // else if (model1[i].F_State == 1)
3572
-                   // {
3573
-                   //     model.F_StateName = "待接单";
3574
-                   // }
3575
-                   // else if (model1[i].F_State == 2)
3576
-                   // {
3577
-                   //     model.F_StateName = "待处理";
3578
-                   // }
3579
-                   // else if (model1[i].F_State == 3)
3580
-                   // {
3581
-                   //     model.F_StateName = "已退回";
3582
-                   // }
3583
-                   // else if (model1[i].F_State == 4)
3584
-                   // {
3585
-                   //     model.F_StateName = "异常退回";
3586
-                   // }
3587
-                   // else if (model1[i].F_State == 5)
3588
-                   // {
3589
-                   //     model.F_StateName = "处理中";
3590
-                   // }
3591
-                   // else if (model1[i].F_State == 6)
3592
-                   // {
3593
-                   //     model.F_StateName = "待回访";
3594
-                   // }
3595
-                   // else if (model1[i].F_State == 7)
3596
-                   // {
3597
-                   //     model.F_StateName = "待完结";
3598
-                   // }
3599
-                   // else if (model1[i].F_State == 10)
3600
-                   // {
3601
-                   //     model.F_StateName = "已完结";
3602
-                   // }
3603
-                   // else if (model1[i].F_State == 11)
3604
-                   // {
3605
-                   //     model.F_StateName = "已评价";
3606
-                   // }
3607
-                   // else if (model1[i].F_State == 12)
3608
-                   // {
3609
-                   //     model.F_StateName = "已退回";
3610
-                   // }
3611
-                   // else if (model1[i].F_State == 13)
3612
-                   // {
3613
-                   //     model.F_StateName = "导入工单";
3614
-                   // }
3615
-                   // else if (model1[i].F_State == 14)
3616
-                   // {
3617
-                   //     model.F_StateName = "待审批";
3618
-                   // }
3619
-                   // else if (model1[i].F_State == 15)
3620
-                   // {
3621
-                   //     model.F_StateName = "微信未通过";
3622
-                   // }
3623
-                   // else if (model1[i].F_State == 16)
3624
-                   // {
3625
-                   //     model.F_StateName = "待审批";
3626
-                   // }
3594
+                    if (model1[i].F_Type == "1")
3595
+                    {
3596
+                        model.F_TypeName = "咨询";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3597
+                    }
3598
+                    else if (model1[i].F_Type == "2")
3599
+                    {
3600
+                        model.F_TypeName = "投诉";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3601
+                    }
3602
+                    else if (model1[i].F_Type == "3")
3603
+                    {
3604
+                        model.F_TypeName = "抽检";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3605
+                    }
3606
+                    else
3607
+                    {
3608
+                        model.F_TypeName = "建议及其他";//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
3609
+                    }
3610
+                    model.F_State = model1[i].F_State;
3611
+                    if (model1[i].F_State == 0)//工单状态
3612
+                    {
3613
+                        model.F_StateName = "待指派";
3614
+                    }
3615
+                    else if (model1[i].F_State == 1)
3616
+                    {
3617
+                        model.F_StateName = "待接单";
3618
+                    }
3619
+                    else if (model1[i].F_State == 2)
3620
+                    {
3621
+                        model.F_StateName = "待处理";
3622
+                    }
3623
+                    else if (model1[i].F_State == 3)
3624
+                    {
3625
+                        model.F_StateName = "已退回";
3626
+                    }
3627
+                    else if (model1[i].F_State == 4)
3628
+                    {
3629
+                        model.F_StateName = "异常退回";
3630
+                    }
3631
+                    else if (model1[i].F_State == 5)
3632
+                    {
3633
+                        model.F_StateName = "处理中";
3634
+                    }
3635
+                    else if (model1[i].F_State == 6)
3636
+                    {
3637
+                        model.F_StateName = "待回访";
3638
+                    }
3639
+                    else if (model1[i].F_State == 7)
3640
+                    {
3641
+                        model.F_StateName = "待完结";
3642
+                    }
3643
+                    else if (model1[i].F_State == 10)
3644
+                    {
3645
+                        model.F_StateName = "已完结";
3646
+                    }
3647
+                    else if (model1[i].F_State == 11)
3648
+                    {
3649
+                        model.F_StateName = "已评价";
3650
+                    }
3651
+                    else if (model1[i].F_State == 12)
3652
+                    {
3653
+                        model.F_StateName = "已退回";
3654
+                    }
3655
+                    else if (model1[i].F_State == 13)
3656
+                    {
3657
+                        model.F_StateName = "导入工单";
3658
+                    }
3659
+                    else if (model1[i].F_State == 14)
3660
+                    {
3661
+                        model.F_StateName = "待审批";
3662
+                    }
3663
+                    else if (model1[i].F_State == 15)
3664
+                    {
3665
+                        model.F_StateName = "微信未通过";
3666
+                    }
3667
+                    else if (model1[i].F_State == 16)
3668
+                    {
3669
+                        model.F_StateName = "待审批";
3670
+                    }
3627 3671
                     #endregion
3628 3672
                     model.F_CusName = model1[i].F_CusName;//客户姓名
3629 3673
                     model.F_CusPhone = model1[i].F_CusPhone;//客户电话
@@ -4236,8 +4280,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
4236 4280
                 #region 添加验证判断
4237 4281
                 if (!(input.F_Type > 0 && input.F_Type < 5))
4238 4282
                     return Error("工单类型错误!");
4239
-                if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
4240
-                    return Error("请输入正确的工单批次号!");
4283
+                if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
4284
+                    return Error("请输入正确的生产批次号!");
4241 4285
                 else
4242 4286
                 {
4243 4287
                     if (!string.IsNullOrEmpty(input.F_BatchNumber))
@@ -4398,8 +4442,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
4398 4442
                 #region 添加验证判断
4399 4443
                 if (!(input.F_Type > 0 && input.F_Type < 5))
4400 4444
                     return Error("工单类型错误!");
4401
-                if (!string.IsNullOrEmpty(input.F_BatchNumber) && vaBatchNumber(input.F_BatchNumber))
4402
-                    return Error("请输入正确的工单批次号!");
4445
+                if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber.Trim ()))
4446
+                    return Error("请输入正确的生产批次号!");
4403 4447
                 else
4404 4448
                 {
4405 4449
                     if (!string.IsNullOrEmpty(input.F_BatchNumber))
@@ -4522,6 +4566,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
4522 4566
               
4523 4567
                 if (ua != null)
4524 4568
                 {
4569
+                    if (hclid == 0 && hclbm == 0&& isApprovalp!=0)
4570
+                    {
4571
+                        return Error("请选择接收部门");
4572
+                    }
4525 4573
                     if (clbm == 0 && clid == 0)
4526 4574
                     {
4527 4575
                         return Error("请选择接收部门");
@@ -5105,6 +5153,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
5105 5153
                 }
5106 5154
             }
5107 5155
             var opt = "退回";
5156
+            int F_OptType = 1;
5108 5157
             int optbut = (int)EnumItemOpt.reback;
5109 5158
             int wostate = (int)EnumWorkOrderState.reback;
5110 5159
             if (type == 1)
@@ -5112,6 +5161,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
5112 5161
                 opt = "异常退回";
5113 5162
                 optbut = (int)EnumItemOpt.abreback;
5114 5163
                 wostate = (int)EnumWorkOrderState.abreback;
5164
+                F_OptType = 2;
5115 5165
             }
5116 5166
             #region 读取当前登录人部门
5117 5167
             string deptname = "";
@@ -5124,7 +5174,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
5124 5174
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + opt + "工单,退回说明:" + cont;
5125 5175
             //获取上一级处理人员
5126 5176
             var touser = ""; var deptid=0;
5127
-            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal+ " and F_OptType !=" + (int)EnumItemOpt.reback+" and F_OptType !=" + (int)EnumItemOpt.abreback + " and  F_WoID='" + model.F_ID  + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
5177
+            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_NextDept =" + nowUser.F_DeptId + " and F_WoState =" + F_OptType + " and  F_WoID='" + model.F_ID  + "' order by F_CreateTime desc").FirstOrDefault();
5128 5178
             if (itemlast != null)
5129 5179
             {
5130 5180
                 touser = itemlast.F_CreateUser;
@@ -5143,7 +5193,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
5143 5193
             if (itemid > 0)
5144 5194
             {
5145 5195
                 #region 处理工单
5146
-                if (model .F_State == (int)EnumWorkOrderState.assign) 
5196
+                if (model .F_State == (int)EnumWorkOrderState.assign|| model.F_State == (int)EnumWorkOrderState.abreback) 
5147 5197
                 {
5148 5198
                     model.F_State = (int)EnumWorkOrderState.reassign;
5149 5199
                 }
@@ -5607,7 +5657,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
5607 5657
                         }
5608 5658
                     }
5609 5659
                 }
5610
-                AddLog(model.F_ID, (int)EnumWorkOrderState.assign, "审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat);
5660
+                AddLog(model.F_ID, (int)EnumWorkOrderState.assign, "审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat,2);
5611 5661
             }
5612 5662
             #endregion
5613 5663
             #region 工单处理