Procházet zdrojové kódy

工单流转更新

zhupei %!s(int64=4) %!d(string=před) roky
rodič
revize
b09414acbb

+ 21 - 12
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/App_Start/AuthorizeAttribute.cs

28
                 var controller = controllerDescriptor.ControllerName;
28
                 var controller = controllerDescriptor.ControllerName;
29
                 var action = actionDescriptor.ActionName;
29
                 var action = actionDescriptor.ActionName;
30
                 var token = filterContext.HttpContext.Request["token"];
30
                 var token = filterContext.HttpContext.Request["token"];
31
-
32
-                var userData = CacheHelper.Get<Cache.Models.CurrentUserInfo>(token);
33
-                var roleId = userData.F_RoleId;
34
-                var role = new BLL.T_Sys_RoleInfo().GetModel(roleId);
35
-                if (role != null)
31
+                if (token != null)
36
                 {
32
                 {
37
-                    var roleFunctionList = roleFunctionBLL.DataTableToList(roleFunctionBLL.GetList(" F_RoleId=" + role.F_RoleId).Tables[0]);
38
-                    //var str = string.Join(",", roleFunctionList.Select(x => x.F_FunctionId).ToArray());
39
-                    var moduleFunction = new BLL.T_Sys_ModuleFunctions().GetModel(controller, action);
40
-                    if (moduleFunction != null)
33
+                    var userData = CacheHelper.Get<Cache.Models.CurrentUserInfo>(token);
34
+                    var roleId = userData.F_RoleId;
35
+                    var role = new BLL.T_Sys_RoleInfo().GetModel(roleId);
36
+                    if (role != null)
41
                     {
37
                     {
42
-                        var single = roleFunctionList.SingleOrDefault(x => x.F_FunctionId == moduleFunction.F_FunctionId);
43
-                        if (single != null)
38
+                        var roleFunctionList = roleFunctionBLL.DataTableToList(roleFunctionBLL.GetList(" F_RoleId=" + role.F_RoleId).Tables[0]);
39
+                        //var str = string.Join(",", roleFunctionList.Select(x => x.F_FunctionId).ToArray());
40
+                        var moduleFunction = new BLL.T_Sys_ModuleFunctions().GetModel(controller, action);
41
+                        if (moduleFunction != null)
44
                         {
42
                         {
45
-                            isAuth = true;
43
+                            var single = roleFunctionList.SingleOrDefault(x => x.F_FunctionId == moduleFunction.F_FunctionId);
44
+                            if (single != null)
45
+                            {
46
+                                isAuth = true;
47
+                            }
46
                         }
48
                         }
47
                     }
49
                     }
48
                 }
50
                 }
51
+                else
52
+                {
53
+                    filterContext.HttpContext.Response.StatusCode = 200;
54
+                    filterContext.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "未传入token,请重新登录。" }.ToJson() };
55
+                    WriteLog(filterContext);
56
+                    return;
57
+                }
49
             }
58
             }
50
             else
59
             else
51
             {
60
             {

+ 8 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Base/BaseController.cs

14
         {
14
         {
15
             get
15
             get
16
             {
16
             {
17
-                return (FormsPrincipal<Cache.Models.CurrentUserInfo>)base.User;
17
+                try
18
+                {
19
+                    return (FormsPrincipal<Cache.Models.CurrentUserInfo>)base.User;
20
+                }
21
+                catch
22
+                {
23
+                    return null;
24
+                }
18
             }
25
             }
19
         }
26
         }
20
         /// <summary>
27
         /// <summary>

+ 155 - 98
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

2081
                 else
2081
                 else
2082
                 {
2082
                 {
2083
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
2083
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
2084
-                    if (ro.F_RoleCode == "DQJL")
2084
+                    if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL")
2085
                     {
2085
                     {
2086
                         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_ID desc").FirstOrDefault();
2086
                         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_ID desc").FirstOrDefault();
2087
                         if (itemlast != null)
2087
                         if (itemlast != null)
2216
                 deptname = deptmodel1.F_DeptName;
2216
                 deptname = deptmodel1.F_DeptName;
2217
             }
2217
             }
2218
             int isbl = 0;
2218
             int isbl = 0;
2219
-            if (dapt != 0)
2220
-            {
2221
-                if (dapt == 11)
2219
+            Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2220
+            //if (dapt != 0)
2221
+            //{
2222
+                if (CirculMarket(ua.F_DeptId, 11))
2222
                 {
2223
                 {
2223
                     isbl = 1;
2224
                     isbl = 1;
2224
                     nextda = 37;
2225
                     nextda = 37;
2225
                     opt = "流转市场管理科";
2226
                     opt = "流转市场管理科";
2226
                 }
2227
                 }
2227
-                else if (dapt == 14)
2228
+                else if (CirculMarket(ua.F_DeptId, 14))
2228
                 {
2229
                 {
2229
                     isbl = 1;
2230
                     isbl = 1;
2230
                     nextda = 57;
2231
                     nextda = 57;
2231
                     opt = "流转营销管理处";
2232
                     opt = "流转营销管理处";
2232
                 }
2233
                 }
2233
-                else if (dapt == 15)
2234
+                else if (CirculMarket(ua.F_DeptId, 15))
2234
                 {
2235
                 {
2235
                     isbl = 1;
2236
                     isbl = 1;
2236
                     nextda = 74;
2237
                     nextda = 74;
2237
                     opt = "流转策划推广";
2238
                     opt = "流转策划推广";
2238
                 }
2239
                 }
2239
-                else if (dapt == 16)
2240
+                else if (CirculMarket(ua.F_DeptId, 16))
2240
                 {
2241
                 {
2241
                     isbl = 1;
2242
                     isbl = 1;
2242
                     nextda = 88;
2243
                     nextda = 88;
2243
                     opt = "流转销售部";
2244
                     opt = "流转销售部";
2244
                 }
2245
                 }
2245
-                else if (dapt == 18)
2246
+                else if (CirculMarket(ua.F_DeptId, 18))
2246
                 {
2247
                 {
2247
                     nextda = 268;
2248
                     nextda = 268;
2248
                     opt = "流转车用尿素";
2249
                     opt = "流转车用尿素";
2249
 
2250
 
2250
                 }
2251
                 }
2251
-
2252
-                else if (dapt == 20)
2252
+                else if (CirculMarket(ua.F_DeptId, 20))
2253
                 {
2253
                 {
2254
                     nextda = 295;
2254
                     nextda = 295;
2255
                     opt = "流转新乡黑科质检";
2255
                     opt = "流转新乡黑科质检";
2256
                 }
2256
                 }
2257
-                else if (dapt == 332)
2257
+                else if (CirculMarket(ua.F_DeptId, 332))
2258
                 {
2258
                 {
2259
                     nextda = 339;
2259
                     nextda = 339;
2260
                     opt = "流转营销管理处";
2260
                     opt = "流转营销管理处";
2261
 
2261
 
2262
-
2263
                 }
2262
                 }
2264
                 else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
2263
                 else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
2265
                 {
2264
                 {
2268
                     opt = "流转" + deptname;
2267
                     opt = "流转" + deptname;
2269
                 }
2268
                 }
2270
 
2269
 
2271
-            }
2270
+            //}
2272
             if (istrue)
2271
             if (istrue)
2273
             {
2272
             {
2274
-                cont = "大区经理已审批:" + AuditCont + "," + opt;
2273
+                if (ro.F_RoleCode == "DQJL")
2274
+                {
2275
+                    cont = "大区经理已审批:" + AuditCont + "," + opt;
2276
+                }
2277
+                else cont = "分公司经理已审批:" + AuditCont + "," + opt;
2275
             }
2278
             }
2276
             else
2279
             else
2277
             {
2280
             {
2278
-                cont = "大区经理未审批" + opt;
2281
+                if (ro.F_RoleCode == "DQJL")
2282
+                {
2283
+                    cont = "大区经理未审批" + opt;
2284
+                }
2285
+                else
2286
+                    cont = "分公司经理未审批" + opt;
2279
             }
2287
             }
2280
             if (nextda != 0)
2288
             if (nextda != 0)
2281
             {
2289
             {
2287
                 return false;
2295
                 return false;
2288
             }
2296
             }
2289
         }
2297
         }
2298
+
2299
+        /// <summary>
2300
+        /// 判断市场管理科
2301
+        /// </summary>
2302
+        /// <param name="deptid"></param>
2303
+        /// <param name="pdeptid"></param>
2304
+        /// <returns></returns>
2305
+        public bool CirculMarket(int deptid, int pdeptid)
2306
+        {
2307
+            string sql = " F_State=1 ";
2308
+            string dptcode = departmentBLL.GetModel(pdeptid).F_DeptCode;
2309
+            string arrsql = " select F_DeptCode from T_Sys_Department where F_DeptCode LIKE '" + dptcode + "%' ";
2310
+            sql += $" and F_DeptCode in ({arrsql}) and F_DeptId=" + deptid;
2311
+            var modellist = departmentBLL.GetModelList(sql);
2312
+            if (modellist.Count > 0)
2313
+                return true;
2314
+            else return false;
2315
+        }
2290
         /// <summary>
2316
         /// <summary>
2291
         /// 查询工单详情
2317
         /// 查询工单详情
2292
         /// </summary>
2318
         /// </summary>
2471
                  overtime = int.Parse(it.F_LimitTime);
2497
                  overtime = int.Parse(it.F_LimitTime);
2472
                 }
2498
                 }
2473
                 int sms = int.Parse (it.F_IsSMS.ToString ());
2499
                 int sms = int.Parse (it.F_IsSMS.ToString ());
2474
-                if (F_RoleCode == "DQJL")
2500
+                if (F_RoleCode == "DQJL" || F_RoleCode == "FGSJL")
2475
                 {
2501
                 {
2476
                     if (hours >= 24)
2502
                     if (hours >= 24)
2477
                     {
2503
                     {
2485
                 }
2511
                 }
2486
                 else
2512
                 else
2487
                 {
2513
                 {
2488
-                    var user = GetUser(OpenId);
2489
-                    string deptname = "";
2490
-                    string deptmodelsname = "";
2491
-                    var deptmodel = departmentBLL.GetModel(user.F_DeptId);
2492
-                    var deptmodels = departmentBLL.GetModel(ua.F_DeptId);
2493
-                    if (deptmodel != null)
2494
-                    {
2495
-                        deptname = deptmodel.F_DeptName + "-";
2496
-                    }
2497
-                    if (deptmodels != null)
2498
-                    {
2499
-                        deptmodelsname = deptmodels.F_DeptName + "-";
2500
-                    }
2514
+                    //var user = GetUser(OpenId);
2515
+                    //string deptname = "";
2516
+                    //string deptmodelsname = "";
2517
+                    //var deptmodel = departmentBLL.GetModel(user.F_DeptId);
2518
+                    //var deptmodels = departmentBLL.GetModel(ua.F_DeptId);
2519
+                    //if (deptmodel != null)
2520
+                    //{
2521
+                    //    deptname = deptmodel.F_DeptName + "-";
2522
+                    //}
2523
+                    //if (deptmodels != null)
2524
+                    //{
2525
+                    //    deptmodelsname = deptmodels.F_DeptName + "-";
2526
+                    //}
2501
                     if (hours >= 24)
2527
                     if (hours >= 24)
2502
                     {
2528
                     {
2529
+                        var user = GetUser(OpenId);
2530
+                        string deptname = "";
2531
+                        string deptmodelsname = "";
2532
+                        string namestr = "";
2533
+                        Model.T_Sys_RoleInfo ro = rolebll.GetModel(user.F_RoleId);
2534
+                        if (ro.F_RoleCode == "DQJL")
2535
+                        {
2536
+                            namestr = "大区经理";
2537
+                        }
2538
+                        else
2539
+                        {
2540
+                            namestr = "分公司经理";
2541
+                        }
2542
+                        var deptmodel = departmentBLL.GetModel(user.F_DeptId);
2543
+                        var deptmodels = departmentBLL.GetModel(ua.F_DeptId);
2544
+                        if (deptmodel != null)
2545
+                        {
2546
+                            deptname = deptmodel.F_DeptName + "-";
2547
+                        }
2548
+                        if (deptmodels != null)
2549
+                        {
2550
+                            deptmodelsname = deptmodels.F_DeptName + "-";
2551
+                        }
2503
                         DateTime time = DateTime.Parse(it.F_CreateTime.ToString()).AddHours(24);
2552
                         DateTime time = DateTime.Parse(it.F_CreateTime.ToString()).AddHours(24);
2504
                         Model.T_Wo_WorkOrder model = woBLL.GetModel(it.F_WoID);
2553
                         Model.T_Wo_WorkOrder model = woBLL.GetModel(it.F_WoID);
2505
-                        AddLog(model.F_ID, model.F_State.Value, deptmodelsname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "未审批流转大区经理", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, overtime, sms );
2554
+                        AddLog(model.F_ID, model.F_State.Value, deptmodelsname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "未审批流转"+ namestr + "", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, overtime, sms);
2506
                         AddLog(model.F_ID, model.F_State.Value, deptname + user.F_UserName + "(" + user.F_WorkNumber + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, user, overtime, sms);
2555
                         AddLog(model.F_ID, model.F_State.Value, deptname + user.F_UserName + "(" + user.F_WorkNumber + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, user, overtime, sms);
2507
                     }
2556
                     }
2508
                     else if (hours >= 48)
2557
                     else if (hours >= 48)
2509
                     {
2558
                     {
2559
+                        var user = GetUser(OpenId);
2510
                         GetDaQucirCulation("", user, it.F_CreateTime.ToString(), it.F_WoID, false);
2560
                         GetDaQucirCulation("", user, it.F_CreateTime.ToString(), it.F_WoID, false);
2511
                     }
2561
                     }
2512
                     else
2562
                     else
3140
                     {
3190
                     {
3141
                         if (deptmodel != null)
3191
                         if (deptmodel != null)
3142
                         {
3192
                         {
3143
-                            if (deptmodel.F_Layer == 2)
3144
-                            {
3145
-                                Model.T_Sys_UserAccount userModel = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
3146
-                             if (userModel!=null )
3193
+                            Model.T_Sys_UserAccount userModel = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
3194
+                            if (userModel != null)
3147
                                 return userModel;
3195
                                 return userModel;
3148
-                             else
3149
-                                {
3150
-                                    var dept = departmentBLL.GetModel(deptmodel.F_ParentId);
3151
-                                    if (dept != null)
3152
-                                    {
3153
-                                        Model.T_Sys_UserAccount userModel1 = userAccountBLL.GetModelList(" F_DeptId=" + dept.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
3154
-                                        return userModel1;
3155
-                                    }
3156
-                                }
3157
-
3158
-                            }
3159
-                            if (deptmodel.F_Layer == 1)
3196
+                            else
3160
                             {
3197
                             {
3161
-                                Model.T_Sys_UserAccount userModel = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
3162
-                                return userModel;
3198
+                                Model.T_Sys_UserAccount userModel1 = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
3199
+                                return userModel1;
3163
                             }
3200
                             }
3201
+                            //if (deptmodel.F_Layer == 2)
3202
+                            //{
3203
+                            //    Model.T_Sys_UserAccount userModel = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
3204
+                            // if (userModel!=null )
3205
+                            //    return userModel;
3206
+                            // else
3207
+                            //    {
3208
+                            //        var dept = departmentBLL.GetModel(deptmodel.F_ParentId);
3209
+                            //        if (dept != null)
3210
+                            //        {
3211
+                            //            Model.T_Sys_UserAccount userModel1 = userAccountBLL.GetModelList(" F_DeptId=" + dept.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
3212
+                            //            return userModel1;
3213
+                            //        }
3214
+                            //    }
3215
+
3216
+                            //}
3217
+                            //if (deptmodel.F_Layer == 1)
3218
+                            //{
3219
+                            //    Model.T_Sys_UserAccount userModel = userAccountBLL.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
3220
+                            //    return userModel;
3221
+                            //}
3164
                         }
3222
                         }
3165
                         else
3223
                         else
3166
                         {
3224
                         {
4026
                                 }
4084
                                 }
4027
                                 AddLog(modlelist.F_ID, 0, deptname1 + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, overtime, sms);
4085
                                 AddLog(modlelist.F_ID, 0, deptname1 + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, overtime, sms);
4028
                                 string opt = "";
4086
                                 string opt = "";
4029
-                                if (dapt != 0)
4087
+                                //if (dapt != 0)
4088
+                                //{
4089
+                                if (CirculMarket(ua.F_DeptId, 11))
4030
                                 {
4090
                                 {
4031
-                                    if (dapt == 11)
4032
-                                    {
4033
-                                        nextda = 37;
4034
-                                        opt = "流转市场管理科";
4035
-                                    }
4036
-                                    else if (dapt == 14)
4037
-                                    {
4038
-                                        nextda = 57;
4039
-                                        opt = "流转营销管理处";
4040
-                                    }
4041
-                                    else if (dapt == 15)
4042
-                                    {
4043
-                                        nextda = 74;
4044
-                                        opt = "流转策划推广";
4045
-                                    }
4046
-                                    else if (dapt == 16)
4047
-                                    {
4048
-                                        nextda = 88;
4049
-                                        opt = "流转销售部";
4050
-                                    }
4051
-                                    else if (dapt == 18)
4052
-                                    {
4053
-                                        nextda = 268;
4054
-                                        opt = "流转车用尿素";
4091
+                                    nextda = 37;
4092
+                                    opt = "流转市场管理科";
4093
+                                }
4094
+                                else if (CirculMarket(ua.F_DeptId, 14))
4095
+                                {
4096
+                                    nextda = 57;
4097
+                                    opt = "流转营销管理处";
4098
+                                }
4099
+                                else if (CirculMarket(ua.F_DeptId, 15))
4100
+                                {
4101
+                                    nextda = 74;
4102
+                                    opt = "流转策划推广";
4103
+                                }
4104
+                                else if (CirculMarket(ua.F_DeptId, 16))
4105
+                                {
4106
+                                    nextda = 88;
4107
+                                    opt = "流转销售部";
4108
+                                }
4109
+                                else if (CirculMarket(ua.F_DeptId, 18))
4110
+                                {
4111
+                                    nextda = 268;
4112
+                                    opt = "流转车用尿素";
4055
 
4113
 
4056
-                                    }
4114
+                                }
4057
 
4115
 
4058
-                                    else if (dapt == 20)
4059
-                                    {
4060
-                                        nextda = 295;
4061
-                                        opt = "流转新乡黑科质检";
4062
-                                    }
4063
-                                    else if (dapt == 332)
4064
-                                    {
4065
-                                        nextda = 339;
4066
-                                        opt = "流转营销管理处";
4116
+                                else if (CirculMarket(ua.F_DeptId, 20))
4117
+                                {
4118
+                                    nextda = 295;
4119
+                                    opt = "流转新乡黑科质检";
4120
+                                }
4121
+                                else if (CirculMarket(ua.F_DeptId, 332))
4122
+                                {
4123
+                                    nextda = 339;
4124
+                                    opt = "流转营销管理处";
4067
 
4125
 
4068
 
4126
 
4069
-                                    }
4070
-                                    else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
4127
+                                } 
4128
+                                else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
4071
                                     {
4129
                                     {
4072
                                         nextda = ua.F_DeptId;
4130
                                         nextda = ua.F_DeptId;
4073
                                         opt = "流转" + deptment;
4131
                                         opt = "流转" + deptment;
4074
                                     }
4132
                                     }
4075
-                                }
4133
+                                //}
4076
                                 if (nextda != 0)
4134
                                 if (nextda != 0)
4077
                                 {
4135
                                 {
4078
                                     var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, overtime, sms,0,0,0,"",1);
4136
                                     var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, overtime, sms,0,0,0,"",1);
4086
                                     return Error("流转失败!");
4144
                                     return Error("流转失败!");
4087
                                 }
4145
                                 }
4088
 
4146
 
4089
-                            }
4090
                         }
4147
                         }
4148
+                    }
4091
                         else
4149
                         else
4092
                         {
4150
                         {
4093
                             AddLog(modlelist.F_ID, 0, "客户" + "创建工单", (int)EnumItemType.deal, (int)EnumItemOpt.create, "", 0, null, overtime, sms);
4151
                             AddLog(modlelist.F_ID, 0, "客户" + "创建工单", (int)EnumItemType.deal, (int)EnumItemOpt.create, "", 0, null, overtime, sms);
5608
                             deptname1 = deptmodel1.F_DeptName ;
5666
                             deptname1 = deptmodel1.F_DeptName ;
5609
                             dapt = deptmodel1.F_ParentId;
5667
                             dapt = deptmodel1.F_ParentId;
5610
                         }
5668
                         }
5611
-                        if (dapt != 0)
5612
-                        {
5613
-                            if (dapt == 11)
5669
+                        //if (dapt != 0)
5670
+                        //{
5671
+                            if (CirculMarket(ua.F_DeptId, 11))
5614
                             {
5672
                             {
5615
                                 nextda = 37;
5673
                                 nextda = 37;
5616
                                 opt = "流转市场管理科";
5674
                                 opt = "流转市场管理科";
5617
                             }
5675
                             }
5618
-                            else if (dapt == 14)
5676
+                            else if (CirculMarket(ua.F_DeptId, 14))
5619
                             {
5677
                             {
5620
                                 nextda = 57;
5678
                                 nextda = 57;
5621
                                 opt = "流转营销管理处";
5679
                                 opt = "流转营销管理处";
5622
                             }
5680
                             }
5623
-                            else if (dapt == 15)
5681
+                            else if (CirculMarket(ua.F_DeptId, 15))
5624
                             {
5682
                             {
5625
                                 nextda = 74;
5683
                                 nextda = 74;
5626
                                 opt = "流转策划推广";
5684
                                 opt = "流转策划推广";
5627
                             }
5685
                             }
5628
-                            else if (dapt == 16)
5686
+                            else if (CirculMarket(ua.F_DeptId, 16))
5629
                             {
5687
                             {
5630
                                 nextda = 88;
5688
                                 nextda = 88;
5631
                                 opt = "流转销售部";
5689
                                 opt = "流转销售部";
5632
                             }
5690
                             }
5633
-                            else if (dapt == 18)
5691
+                            else if (CirculMarket(ua.F_DeptId, 18))
5634
                             {
5692
                             {
5635
                                 nextda = 268;
5693
                                 nextda = 268;
5636
                                 opt = "流转车用尿素";
5694
                                 opt = "流转车用尿素";
5637
 
5695
 
5638
                             }
5696
                             }
5639
 
5697
 
5640
-                            else if (dapt == 20)
5698
+                            else if (CirculMarket(ua.F_DeptId, 20))
5641
                             {
5699
                             {
5642
                                 nextda = 295;
5700
                                 nextda = 295;
5643
                                 opt = "流转新乡黑科质检";
5701
                                 opt = "流转新乡黑科质检";
5644
                             }
5702
                             }
5645
-                            else if (dapt == 332)
5703
+                            else if (CirculMarket(ua.F_DeptId, 332))
5646
                             {
5704
                             {
5647
                                 nextda = 339;
5705
                                 nextda = 339;
5648
                                 opt = "流转营销管理处";
5706
                                 opt = "流转营销管理处";
5649
 
5707
 
5650
-
5651
                             }
5708
                             }
5652
                             else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
5709
                             else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
5653
                             {
5710
                             {
5654
                                 nextda = ua.F_DeptId;
5711
                                 nextda = ua.F_DeptId;
5655
                                 opt = "流转" + deptname1;
5712
                                 opt = "流转" + deptname1;
5656
                             }
5713
                             }
5657
-                        }
5714
+                        //}
5658
                         if (nextda != 0)
5715
                         if (nextda != 0)
5659
                         {
5716
                         {
5660
                             var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms,0,0,0,"",1 );
5717
                             var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms,0,0,0,"",1 );

+ 167 - 88
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

1319
                 else
1319
                 else
1320
                 {
1320
                 {
1321
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
1321
                     Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
1322
-                    if (ro.F_RoleCode == "DQJL")
1322
+                    if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL")
1323
                     {
1323
                     {
1324
                         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_ID desc").FirstOrDefault();
1324
                         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_ID desc").FirstOrDefault();
1325
                         if (itemlast != null)
1325
                         if (itemlast != null)
1473
                 deptname = deptmodel1.F_DeptName;
1473
                 deptname = deptmodel1.F_DeptName;
1474
             }
1474
             }
1475
             int isbl = 0;
1475
             int isbl = 0;
1476
-            if (dapt != 0)
1477
-            {
1478
-                if (dapt == 11)
1476
+            Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
1477
+            //if (dapt != 0)
1478
+            //{
1479
+            if (CirculMarket(ua.F_DeptId, 11))
1479
                 {
1480
                 {
1480
                     isbl = 1;
1481
                     isbl = 1;
1481
                     nextda = 37;
1482
                     nextda = 37;
1482
                     opt = "流转市场管理科";
1483
                     opt = "流转市场管理科";
1483
                 }
1484
                 }
1484
-                else if (dapt == 14)
1485
+                else if (CirculMarket(ua.F_DeptId, 14))
1485
                 {
1486
                 {
1486
                     isbl = 1;
1487
                     isbl = 1;
1487
                     nextda = 57;
1488
                     nextda = 57;
1488
                     opt = "流转营销管理处";
1489
                     opt = "流转营销管理处";
1489
                 }
1490
                 }
1490
-                else if (dapt == 15)
1491
+                else if (CirculMarket(ua.F_DeptId, 15))
1491
                 {
1492
                 {
1492
                     isbl = 1;
1493
                     isbl = 1;
1493
                     nextda = 74;
1494
                     nextda = 74;
1494
                     opt = "流转策划推广";
1495
                     opt = "流转策划推广";
1495
                 }
1496
                 }
1496
-                else if (dapt == 16)
1497
+                else if (CirculMarket(ua.F_DeptId, 16))
1497
                 {
1498
                 {
1498
                     isbl = 1;
1499
                     isbl = 1;
1499
                     nextda = 88;
1500
                     nextda = 88;
1500
                     opt = "流转销售部";
1501
                     opt = "流转销售部";
1501
                 }
1502
                 }
1502
-                else if (dapt == 18)
1503
+                else if (CirculMarket(ua.F_DeptId, 18))
1503
                 {
1504
                 {
1504
                     nextda = 268;
1505
                     nextda = 268;
1505
                     opt = "流转车用尿素";
1506
                     opt = "流转车用尿素";
1506
 
1507
 
1507
                 }
1508
                 }
1508
-                else if (dapt == 20)
1509
+                else if (CirculMarket(ua.F_DeptId, 20))
1509
                 {
1510
                 {
1510
                     nextda = 295;
1511
                     nextda = 295;
1511
                     opt = "流转新乡黑科质检";
1512
                     opt = "流转新乡黑科质检";
1512
                 }
1513
                 }
1513
-                else if (dapt == 332)
1514
+                else if (CirculMarket(ua.F_DeptId, 332))
1514
                 {
1515
                 {
1515
                     nextda = 339;
1516
                     nextda = 339;
1516
                     opt = "流转营销管理处";
1517
                     opt = "流转营销管理处";
1521
                     isbl = 1;
1522
                     isbl = 1;
1522
                     nextda = ua.F_DeptId;
1523
                     nextda = ua.F_DeptId;
1523
                     opt = "流转" + deptname;
1524
                     opt = "流转" + deptname;
1524
-                }
1525
+                //}
1525
                 //else
1526
                 //else
1526
                 //{
1527
                 //{
1527
                 //    nextda = ua.F_DeptId;
1528
                 //    nextda = ua.F_DeptId;
1531
             }
1532
             }
1532
             if (istrue)
1533
             if (istrue)
1533
             {
1534
             {
1534
-                cont = "大区经理已审批:"+ AuditCont+"," + opt;
1535
+                if (ro.F_RoleCode == "DQJL")
1536
+                {
1537
+                    cont = "大区经理已审批:" + AuditCont + "," + opt;
1538
+                }
1539
+                else cont = "分公司经理已审批:" + AuditCont + "," + opt;
1535
             }
1540
             }
1536
             else
1541
             else
1537
             {
1542
             {
1538
-                cont = "大区经理未审批" + opt;
1543
+                if (ro.F_RoleCode == "DQJL")
1544
+                {
1545
+                    cont = "大区经理未审批" + opt;
1546
+                }
1547
+                else
1548
+                  cont = "分公司经理未审批" + opt;
1539
             }
1549
             }
1540
             if (nextda != 0)
1550
             if (nextda != 0)
1541
             {
1551
             {
1570
                     overtime = int.Parse(it.F_LimitTime);
1580
                     overtime = int.Parse(it.F_LimitTime);
1571
                 }
1581
                 }
1572
                 int sms = int.Parse(it.F_IsSMS.ToString());
1582
                 int sms = int.Parse(it.F_IsSMS.ToString());
1573
-                if (F_RoleCode == "DQJL")
1583
+                if (F_RoleCode == "DQJL" || F_RoleCode == "FGSJL")
1574
                 {
1584
                 {
1575
                     if (hours >= 24)
1585
                     if (hours >= 24)
1576
                     {
1586
                     {
1584
                 }
1594
                 }
1585
                 else
1595
                 else
1586
                 {
1596
                 {
1587
-                    var user = GetUser(ua);
1588
-                    string deptname = "";
1589
-                    string deptmodelsname = "";
1590
-                    var deptmodel = departmentBLL.GetModel(user.F_DeptId);
1591
-                    var deptmodels = departmentBLL.GetModel(ua.F_DeptId);
1592
-                    if (deptmodel != null)
1593
-                    {
1594
-                        deptname = deptmodel.F_DeptName + "-";
1595
-                    }
1596
-                    if (deptmodels != null)
1597
-                    {
1598
-                        deptmodelsname = deptmodels.F_DeptName + "-";
1599
-                    }
1600
                     if (hours >= 24)
1597
                     if (hours >= 24)
1601
                     {
1598
                     {
1599
+                        var user = GetUser(ua);
1600
+                        string deptname = "";
1601
+                        string deptmodelsname = "";
1602
+                        string namestr = "";
1603
+                        Model.T_Sys_RoleInfo ro = rolebll.GetModel(user.F_RoleId);
1604
+                        if (ro.F_RoleCode == "DQJL")
1605
+                        {
1606
+                            namestr = "大区经理";
1607
+                        }
1608
+                        else
1609
+                        {
1610
+                            namestr = "分公司经理";
1611
+                        }
1612
+                        var deptmodel = departmentBLL.GetModel(user.F_DeptId);
1613
+                        var deptmodels = departmentBLL.GetModel(ua.F_DeptId);
1614
+                        if (deptmodel != null)
1615
+                        {
1616
+                            deptname = deptmodel.F_DeptName + "-";
1617
+                        }
1618
+                        if (deptmodels != null)
1619
+                        {
1620
+                            deptmodelsname = deptmodels.F_DeptName + "-";
1621
+                        }
1602
                         DateTime time = DateTime.Parse(it.F_CreateTime.ToString()).AddHours(24);
1622
                         DateTime time = DateTime.Parse(it.F_CreateTime.ToString()).AddHours(24);
1603
-                        Model.T_Wo_WorkOrder model = workOrder .GetModel(it.F_WoID);
1604
-                        AddLog(model.F_ID, model.F_State.Value, deptmodelsname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "未审批流转大区经理", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, overtime, sms);
1623
+                        Model.T_Wo_WorkOrder model = workOrder.GetModel(it.F_WoID);
1624
+                        AddLog(model.F_ID, model.F_State.Value, deptmodelsname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "未审批流转"+ namestr + "", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, overtime, sms);
1605
                         AddLog(model.F_ID, model.F_State.Value, deptname + user.F_UserName + "(" + user.F_WorkNumber + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, user, overtime, sms);
1625
                         AddLog(model.F_ID, model.F_State.Value, deptname + user.F_UserName + "(" + user.F_WorkNumber + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, user, overtime, sms);
1606
                     }
1626
                     }
1607
                     else if (hours >= 48)
1627
                     else if (hours >= 48)
1608
                     {
1628
                     {
1609
-                        GetDaQucirCulation("",user, it.F_CreateTime.ToString(), it.F_WoID, false);
1629
+                        var user = GetUser(ua);
1630
+                        GetDaQucirCulation("", user, it.F_CreateTime.ToString(), it.F_WoID, false);
1610
                     }
1631
                     }
1611
                     else
1632
                     else
1612
                     {
1633
                     {
2230
         /// 获取问题类别
2251
         /// 获取问题类别
2231
         /// </summary>
2252
         /// </summary>
2232
         /// <returns></returns>
2253
         /// <returns></returns>
2233
-        public string GetComplaint(string msg)
2254
+        public string GetComplaint(string msg, int type = 0)
2234
         {
2255
         {
2235
             string str = "";
2256
             string str = "";
2236
-            string str1 = " select F_Id from T_Wo_QuestionManage where F_QuestionName in(" + msg + ")";
2237
-          string str3 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str1 + ")";
2238
-        var dept = quesBLL.GetModelList("F_ParentId in(" + str3 + ")");
2257
+            string str1 = "";
2258
+            string str3 = "";
2259
+            if (type == 0)
2260
+            {
2261
+                str1 = " select F_Id from T_Wo_QuestionManage where F_QuestionName in(" + msg + ")";
2262
+                str3 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str1 + ")";
2263
+            }
2264
+            else if (type == 1)
2265
+            {
2266
+                str3 = " select F_Id from T_Wo_QuestionManage where F_QuestionName in(" + msg + ")";
2267
+            }
2268
+            var dept = quesBLL.GetModelList("F_ParentId in(" + str3 + ")");
2239
             if (dept != null)
2269
             if (dept != null)
2240
-           {
2270
+            {
2241
                 foreach (var it in dept)
2271
                 foreach (var it in dept)
2242
-               {
2272
+                {
2243
 
2273
 
2244
                     if (str != "")
2274
                     if (str != "")
2245
-                      str += "','" + it.F_Id;
2246
-                   else
2247
-                       str += it.F_Id;
2248
-           
2275
+                        str += "','" + it.F_Id;
2276
+                    else
2277
+                        str += it.F_Id;
2278
+
2249
                 }
2279
                 }
2250
-           }
2251
-           //  string str4 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str3 + ")";
2280
+            }
2281
+            //  string str4 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str3 + ")";
2252
             return str;
2282
             return str;
2253
         }
2283
         }
2254
 
2284
 
2285
+
2255
         /// <summary>
2286
         /// <summary>
2256
         ///综合查询列表
2287
         ///综合查询列表
2257
         /// </summary>
2288
         /// </summary>
2258
         public ActionResult GetComprehensive(string description,string code, string cusname,string createby, string starttime, string endtime, string keywords, string cusphone, string companyname, string province, string city,
2289
         public ActionResult GetComprehensive(string description,string code, string cusname,string createby, string starttime, string endtime, string keywords, string cusphone, string companyname, string province, string city,
2259
-            string country, string township,string category,string salebase, string touser,string visitby, string visitresult, string question,int isdc=0,int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
2290
+            string country, string township,string category,string salebase, string touser,string visitby, string visitresult, string question,int isdc=0,int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10, string question1="",string question2="")
2260
         {
2291
         {
2261
             int userId = CurrentUser.UserData.F_UserId;
2292
             int userId = CurrentUser.UserData.F_UserId;
2262
             if (userId != 0)
2293
             if (userId != 0)
2299
                     {
2330
                     {
2300
                         if (QuestionManage.F_Type == EnumWOType.Complaint.ToString())
2331
                         if (QuestionManage.F_Type == EnumWOType.Complaint.ToString())
2301
                         {
2332
                         {
2302
-                            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ('" + GetComplaint("'"+ question+"'") + "')"; ; 
2333
+                            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ('" + GetComplaint("'"+ question+"'",0) + "')"; ; 
2303
                         }
2334
                         }
2304
                         else
2335
                         else
2305
                             sql += $"  and T_Wo_WorkOrder.F_QuestionType  ='"+QuestionManage .F_Id +"'"; ;
2336
                             sql += $"  and T_Wo_WorkOrder.F_QuestionType  ='"+QuestionManage .F_Id +"'"; ;
2306
                     }
2337
                     }
2307
-                  //  
2338
+                }
2339
+                if (!string.IsNullOrEmpty(question1))
2340
+                {
2341
+                    var QuestionManage = quesBLL.GetModelList("F_QuestionName='" + question1 + "'").FirstOrDefault();
2342
+                    if (QuestionManage != null)
2343
+                    {
2344
+                        if (QuestionManage.F_Type == EnumWOType.Complaint.ToString())
2345
+                        {
2346
+                            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ('" + GetComplaint("'" + question + "'",1) + "')"; ;
2347
+                        }                      
2348
+                    }
2349
+                }
2350
+                if (!string.IsNullOrEmpty(question2))
2351
+                {
2352
+                    var QuestionManage = quesBLL.GetModelList("F_QuestionName='" + question2 + "'").FirstOrDefault();
2353
+                    if (QuestionManage != null)
2354
+                    {
2355
+                        if (QuestionManage.F_Type == EnumWOType.Complaint.ToString())
2356
+                        {
2357
+                            sql += $"  and T_Wo_WorkOrder.F_QuestionType  ='" + QuestionManage.F_Id + "'"; ;
2358
+                        }                   
2359
+                    }
2360
+                    //  
2308
                 }
2361
                 }
2309
                 if (source > 0)//工单来源
2362
                 if (source > 0)//工单来源
2310
                 {
2363
                 {
4214
                 {
4267
                 {
4215
                     if (deptmodel != null)
4268
                     if (deptmodel != null)
4216
                     {
4269
                     {
4217
-                        if (deptmodel.F_Layer == 2)
4218
-                        {
4219
-                            Model.T_Sys_UserAccount userModel = sysUserAccountBll .GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
4220
-                            if (userModel != null)
4221
-                                return userModel;
4222
-                            else
4223
-                            {
4224
-                                var dept = departmentBLL.GetModel(deptmodel.F_ParentId);
4225
-                                if (dept != null)
4226
-                                {
4227
-                                    Model.T_Sys_UserAccount userModel1 = sysUserAccountBll.GetModelList(" F_DeptId=" + dept.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
4228
-                                    return userModel1;
4229
-                                }
4230
-                            }
4231
-                        }
4232
-                        if (deptmodel.F_Layer == 1)
4233
-                        {
4234
-                            Model.T_Sys_UserAccount userModel = sysUserAccountBll.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
4270
+                        Model.T_Sys_UserAccount userModel = sysUserAccountBll.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
4271
+                        if (userModel != null)
4235
                             return userModel;
4272
                             return userModel;
4273
+                        else
4274
+                        {
4275
+                            Model.T_Sys_UserAccount userModel1 = sysUserAccountBll.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
4276
+                            return userModel1;
4236
                         }
4277
                         }
4278
+                        //if (deptmodel.F_Layer == 2)
4279
+                        //{
4280
+                        //    Model.T_Sys_UserAccount userModel = sysUserAccountBll.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=60 ").FirstOrDefault();
4281
+                        //    if (userModel != null)
4282
+                        //        return userModel;
4283
+                        //    else
4284
+                        //    {
4285
+                        //        var dept = departmentBLL.GetModel(deptmodel.F_ParentId);
4286
+                        //        if (dept != null)
4287
+                        //        {
4288
+                        //            Model.T_Sys_UserAccount userModel1 = sysUserAccountBll.GetModelList(" F_DeptId=" + dept.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
4289
+                        //            return userModel1;
4290
+                        //        }
4291
+                        //    }
4292
+                        //}
4293
+                        //if (deptmodel.F_Layer == 1)
4294
+                        //{
4295
+                        //    Model.T_Sys_UserAccount userModel = sysUserAccountBll.GetModelList(" F_DeptId=" + deptmodel.F_DeptId + " and F_RoleId=62  ").FirstOrDefault();
4296
+                        //    return userModel;
4297
+                        //}
4237
                     }
4298
                     }
4238
                     else
4299
                     else
4239
                     {
4300
                     {
4419
                             AddLog(modlelist.F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, overtime, sms);
4480
                             AddLog(modlelist.F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, overtime, sms);
4420
                             string opt = "";
4481
                             string opt = "";
4421
 
4482
 
4422
-                            if (dapt != 0)
4423
-                            {
4424
-                                if (dapt == 11)
4483
+                            //if (dapt != 0)
4484
+                            //{
4485
+                                if (CirculMarket(ua.F_DeptId,11))
4425
                                 {
4486
                                 {
4426
                                     nextda = 37;
4487
                                     nextda = 37;
4427
                                     opt = "流转市场管理科";
4488
                                     opt = "流转市场管理科";
4428
                                 }
4489
                                 }
4429
-                                else if (dapt == 14)
4490
+                                else if (CirculMarket(ua.F_DeptId, 14))
4430
                                 {
4491
                                 {
4431
                                     nextda = 57;
4492
                                     nextda = 57;
4432
                                     opt = "流转营销管理处";
4493
                                     opt = "流转营销管理处";
4433
                                 }
4494
                                 }
4434
-                                else if (dapt == 15)
4495
+                                else if (CirculMarket(ua.F_DeptId, 15))
4435
                                 {
4496
                                 {
4436
                                     nextda = 74;
4497
                                     nextda = 74;
4437
                                     opt = "流转策划推广";
4498
                                     opt = "流转策划推广";
4438
                                 }
4499
                                 }
4439
-                                else if (dapt == 16)
4500
+                                else if (CirculMarket(ua.F_DeptId, 16))
4440
                                 {
4501
                                 {
4441
                                     nextda = 88;
4502
                                     nextda = 88;
4442
                                     opt = "流转销售部";
4503
                                     opt = "流转销售部";
4443
                                 }
4504
                                 }
4444
-                                else if (dapt == 18)
4505
+                                else if (CirculMarket(ua.F_DeptId, 18))
4445
                                 {
4506
                                 {
4446
                                     nextda = 268;
4507
                                     nextda = 268;
4447
                                     opt = "流转车用尿素";
4508
                                     opt = "流转车用尿素";
4448
 
4509
 
4449
                                 }
4510
                                 }
4450
 
4511
 
4451
-                                else if (dapt == 20)
4512
+                                else if (CirculMarket(ua.F_DeptId, 20))
4452
                                 {
4513
                                 {
4453
                                     nextda = 295;
4514
                                     nextda = 295;
4454
                                     opt = "流转新乡黑科质检";
4515
                                     opt = "流转新乡黑科质检";
4455
                                 }
4516
                                 }
4456
-                                else if (dapt == 332)
4517
+                                else if (CirculMarket(ua.F_DeptId, 332))
4457
                                 {
4518
                                 {
4458
                                     nextda = 339;
4519
                                     nextda = 339;
4459
                                     opt = "流转营销管理处";
4520
                                     opt = "流转营销管理处";
4465
                                     nextda = ua.F_DeptId;
4526
                                     nextda = ua.F_DeptId;
4466
                                     opt = "流转" + deptname;
4527
                                     opt = "流转" + deptname;
4467
                                 }
4528
                                 }
4468
-                            }
4529
+                            //}
4469
                             if (nextda != 0)
4530
                             if (nextda != 0)
4470
                             {
4531
                             {
4471
                                 var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, 0, 0, 0, 0, 0, "", 1);
4532
                                 var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, 0, 0, 0, 0, 0, "", 1);
4495
                 return Error("无操作权限!");
4556
                 return Error("无操作权限!");
4496
             }
4557
             }
4497
         }
4558
         }
4559
+
4560
+        /// <summary>
4561
+        /// 判断市场管理科
4562
+        /// </summary>
4563
+        /// <param name="deptid"></param>
4564
+        /// <param name="pdeptid"></param>
4565
+        /// <returns></returns>
4566
+        public bool CirculMarket(int deptid, int pdeptid)
4567
+        {
4568
+            string sql = " F_State=1 ";
4569
+            string dptcode = departmentBLL.GetModel(pdeptid).F_DeptCode;
4570
+            string arrsql = " select F_DeptCode from T_Sys_Department where F_DeptCode LIKE '" + dptcode + "%' ";
4571
+            sql += $" and F_DeptCode in ({arrsql}) and F_DeptId=" + deptid;
4572
+            var modellist = departmentBLL.GetModelList(sql);
4573
+            if (modellist.Count > 0)
4574
+                return true;
4575
+            else return false;
4576
+        }
4498
         /// <summary>
4577
         /// <summary>
4499
         /// 添加客户
4578
         /// 添加客户
4500
         /// </summary>
4579
         /// </summary>
4800
                                     deptname1 = deptmodel1.F_DeptName ;
4879
                                     deptname1 = deptmodel1.F_DeptName ;
4801
                                     dapt = deptmodel1.F_ParentId;
4880
                                     dapt = deptmodel1.F_ParentId;
4802
                                 }
4881
                                 }
4803
-                                if (dapt != 0)
4804
-                                {
4805
-                                    if (dapt == 11)
4882
+                                //if (dapt != 0)
4883
+                                //{
4884
+                                    if (CirculMarket(ua.F_DeptId, 11))
4806
                                     {
4885
                                     {
4807
                                         nextda = 37;
4886
                                         nextda = 37;
4808
                                         opt = "流转市场管理科";
4887
                                         opt = "流转市场管理科";
4809
                                     }
4888
                                     }
4810
-                                    else if (dapt == 14)
4889
+                                    else if (CirculMarket(ua.F_DeptId, 14))
4811
                                     {
4890
                                     {
4812
                                         nextda = 57;
4891
                                         nextda = 57;
4813
                                         opt = "流转营销管理处";
4892
                                         opt = "流转营销管理处";
4814
                                     }
4893
                                     }
4815
-                                    else if (dapt == 15)
4894
+                                    else if (CirculMarket(ua.F_DeptId, 15))
4816
                                     {
4895
                                     {
4817
                                         nextda = 74;
4896
                                         nextda = 74;
4818
                                         opt = "流转策划推广";
4897
                                         opt = "流转策划推广";
4819
                                     }
4898
                                     }
4820
-                                    else if (dapt == 16)
4899
+                                    else if (CirculMarket(ua.F_DeptId, 16))
4821
                                     {
4900
                                     {
4822
                                         nextda = 88;
4901
                                         nextda = 88;
4823
                                         opt = "流转销售部";
4902
                                         opt = "流转销售部";
4824
                                     }
4903
                                     }
4825
-                                    else if (dapt == 18)
4904
+                                    else if (CirculMarket(ua.F_DeptId, 18))
4826
                                     {
4905
                                     {
4827
                                         nextda = 268;
4906
                                         nextda = 268;
4828
                                         opt = "流转车用尿素";
4907
                                         opt = "流转车用尿素";
4829
 
4908
 
4830
                                     }
4909
                                     }
4831
 
4910
 
4832
-                                    else if (dapt == 20)
4911
+                                    else if (CirculMarket(ua.F_DeptId, 20))
4833
                                     {
4912
                                     {
4834
                                         nextda = 295;
4913
                                         nextda = 295;
4835
                                         opt = "流转新乡黑科质检";
4914
                                         opt = "流转新乡黑科质检";
4836
                                     }
4915
                                     }
4837
-                                    else if (dapt == 332)
4916
+                                    else if (CirculMarket(ua.F_DeptId, 332))
4838
                                     {
4917
                                     {
4839
                                         nextda = 339;
4918
                                         nextda = 339;
4840
                                         opt = "流转营销管理处";
4919
                                         opt = "流转营销管理处";
4841
 
4920
 
4842
-
4843
                                     }
4921
                                     }
4844
                                     else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
4922
                                     else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
4845
                                     {
4923
                                     {
4846
                                         nextda = ua.F_DeptId;
4924
                                         nextda = ua.F_DeptId;
4847
                                         opt = "流转" + deptname1;
4925
                                         opt = "流转" + deptname1;
4848
                                     }
4926
                                     }
4849
-
4850
-                                }
4927
+                                //}
4851
                                 if (nextda != 0)
4928
                                 if (nextda != 0)
4852
                                 {
4929
                                 {
4853
                                     var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, 0,0,0,0,"",1);
4930
                                     var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, 0,0,0,0,"",1);
6066
                                         else if (deptmodel.F_DeptId == 12)
6143
                                         else if (deptmodel.F_DeptId == 12)
6067
                                         {
6144
                                         {
6068
                                         inputs.F_IsVisit = isvisit.ToString();
6145
                                         inputs.F_IsVisit = isvisit.ToString();
6069
-                                    inputs.F_ZL_CJ_IsRecord = deptment.IsRecord;//质量管理科-抽检-未备案、已备案
6146
+                                        inputs.F_ZL_CJ_IsRecord = deptment.IsRecord;//质量管理科-抽检-未备案、已备案
6070
                                         inputs.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
6147
                                         inputs.F_ZL_ClaimAmount = deptment.ClaimAmount;// 质量管理科-索赔金额(单位元,对应责任单位)
6071
                                         }
6148
                                         }
6072
                                     }
6149
                                     }
7640
         /// </summary>
7717
         /// </summary>
7641
         public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int  overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "",int isbl=0)
7718
         public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int  overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "",int isbl=0)
7642
         {
7719
         {
7643
-            if (model.F_limit > 0)
7644
-                overtime = model.F_limit;
7720
+            #region 系统升级派单时限可修改2021/12/24
7721
+            //if (model.F_limit > 0)
7722
+            //    overtime = model.F_limit;
7723
+            #endregion
7645
             string smscont = "";
7724
             string smscont = "";
7646
             if (model.F_Type == "1")
7725
             if (model.F_Type == "1")
7647
             {
7726
             {