Bladeren bron

Merge branch 'feat-liucheng'

zhupei 3 jaren geleden
bovenliggende
commit
037be0b32a

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/MsgController.cs

@@ -383,7 +383,7 @@ namespace CallCenterApi.Interface.Controllers
383 383
             //}
384 384
             #endregion
385 385
             
386
-            var msgListnew = new BLL.T_Msg_List().GetModelList(" ToUser='" + usercode + "' and Type in (2,8) and State=0 and IsDel=0 order by CreateDate desc");
386
+            var msgListnew = new BLL.T_Msg_List().GetModelList(" ToUser='" + usercode + "' and Type in (2,8,7) and State=0 and IsDel=0 order by CreateDate desc");
387 387
             return Success("获取消息", msgListnew);
388 388
         }
389 389
 

+ 8 - 3
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -534,16 +534,21 @@ namespace CallCenterApi.Interface.Controllers.customer
534 534
             string sql = $" F_DeleteFlag=0";
535 535
             if (!string.IsNullOrWhiteSpace(model.F_AddressCountry))//县
536 536
             {
537
-                sql += $" and F_Remark like '%{ model.F_AddressCountry.Trim()}%'";
537
+                sql += $" and (F_Remark like '%{ model.F_AddressCountry.Trim()}%'";
538
+                if (!string.IsNullOrWhiteSpace(model.F_AddressCity))//市
539
+                    sql += $" or F_Remark like '%{model.F_AddressCity.Trim()}%')";
540
+                else
541
+                    sql += $")";
538 542
             }
539 543
             else if (!string.IsNullOrWhiteSpace(model.F_AddressCity))//市
540 544
                 sql += $" and F_Remark like '%{model.F_AddressCity.Trim()}%'";
541 545
             else
542
-                sql += $"and 1!=1 ";
546
+                sql += $" and 1!=1";
543 547
             var modelist = new BLL.T_Sys_UserAccount().GetModelList(sql);
544 548
             var saleslist = modelist.Where(t => !string.IsNullOrEmpty(t.F_UserCode)).Select(p => new
545 549
             {
546
-                Salesman = new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName + "-" + p.F_UserName + "(" + p.F_UserCode + ")",              
550
+                //Salesman = new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName + "-" + p.F_UserName + "(" + p.F_UserCode + ")",              
551
+                Salesman = p.F_UserName +"-"+ new BLL.T_Sys_RoleInfo().GetModel(p.F_RoleId).F_RoleName + "-" + new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName,
547 552
                 SalesPhone = p.F_Mobile
548 553
             });
549 554
             var obj = new

+ 226 - 106
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -1093,8 +1093,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
1093 1093
                                 if (GetDeptUserCode(ua.F_DeptId) != "")
1094 1094
                                 {
1095 1095
                                     //sql += " and (F_State in(10,11) or  F_State2 in(10,11))";
1096
-                                    sql += " and ((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
1096
+                                    sql += " and (((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
1097 1097
                                     sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
1098
+                                    sql += " or T_Wo_WorkOrder.F_ID in (" + GetOverWo(ua.F_UserCode) + "))";
1098 1099
                                 }
1099 1100
                                 //  sql += " and F_State in(10,11) and F_DealBy = '" + ua.F_UserCode + "' ";
1100 1101
                                 break;
@@ -1556,9 +1557,38 @@ namespace CallCenterApi.Interface.Controllers.weixin
1556 1557
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
1557 1558
                     sql += $" and F_WorkOrderCode like '%" + code.Trim() + "%'";
1558 1559
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
1559
-                    sql += $"  and ( F_QuestionType like '%" + keywords.Trim()
1560
-                         + "%' or F_ZX_Area like '%" + keywords.Trim() + "%' or F_ZX_Branch like '%" + keywords.Trim()
1561
-                         + "%' or F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%')  ";
1560
+                {
1561
+
1562
+                    var QuestionManage = quesBLL.GetModelList("F_QuestionName like '%" + keywords + "%' and F_IsDelete=0");
1563
+                    if (QuestionManage != null)
1564
+                    {
1565
+                        if (QuestionManage.FirstOrDefault().F_Type == EnumWOType.Complaint.ToString())
1566
+                        {
1567
+                            if (QuestionManage.FirstOrDefault().F_Label == "3")
1568
+                            {
1569
+                                string queststrs = string.Format("'{0}'", string.Join(",", QuestionManage.Select(T => T.F_Id)).Replace(",", "','"));
1570
+                                sql += $"  and T_Wo_WorkOrder.F_QuestionType  in (" + queststrs + ")";
1571
+                            }
1572
+                            else if (QuestionManage.FirstOrDefault().F_Label == "2")
1573
+                            {
1574
+
1575
+                                sql += $"  and T_Wo_WorkOrder.F_QuestionType in ('" + GetComplaint(keywords, 1) + "')"; ;
1576
+                            }
1577
+                            else
1578
+                            {
1579
+                                sql += $"  and T_Wo_WorkOrder.F_QuestionType in ('" + GetComplaint(keywords, 0) + "')"; ;
1580
+                            }
1581
+                        }
1582
+                        else
1583
+                        {
1584
+                            sql += $"  and (T_Wo_WorkOrder.F_QuestionType  in (" + string.Join(",", QuestionManage.Select(t => t.F_Id).ToArray()) + ") or T_Wo_WorkOrder.F_QuestionType like '%" + keywords + "%')"; 
1585
+                        }         
1586
+                    }
1587
+
1588
+                }
1589
+                //sql += $"  and ( F_QuestionType like '%" + keywords.Trim()
1590
+                //     + "%' or F_ZX_Area like '%" + keywords.Trim() + "%' or F_ZX_Branch like '%" + keywords.Trim()
1591
+                //     + "%' or F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%')  ";
1562 1592
                 if (!string.IsNullOrWhiteSpace(cusname))//客户姓名
1563 1593
                     sql += $" and F_CusName like '%" + cusname.Trim() + "%'";
1564 1594
                 if (!string.IsNullOrWhiteSpace(cusphone))//客户电话
@@ -1729,6 +1759,43 @@ namespace CallCenterApi.Interface.Controllers.weixin
1729 1759
                 return Error("无操作权限!");
1730 1760
             }
1731 1761
         }
1762
+
1763
+
1764
+        /// <summary>
1765
+        /// 获取问题类别
1766
+        /// </summary>
1767
+        /// <returns></returns>
1768
+        public string GetComplaint(string msg, int type = 0)
1769
+        {
1770
+            string str = "";
1771
+            string str1 = "";
1772
+            string str3 = "";
1773
+            if (type == 0)
1774
+            {
1775
+                str1 = " select F_Id from T_Wo_QuestionManage where F_QuestionName like '%"+ msg +"%'";
1776
+                str3 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str1 + ")";
1777
+            }
1778
+            else if (type == 1)
1779
+            {
1780
+                str3 = " select F_Id from T_Wo_QuestionManage where  F_QuestionName like '%" + msg + "%'";
1781
+            }
1782
+            var dept = quesBLL.GetModelList("F_ParentId in(" + str3 + ")");
1783
+            if (dept != null)
1784
+            {
1785
+                foreach (var it in dept)
1786
+                {
1787
+
1788
+                    if (str != "")
1789
+                        str += "','" + it.F_Id.ToString();
1790
+                    else
1791
+                        str += it.F_Id.ToString();
1792
+
1793
+                }
1794
+            }
1795
+            //  string str4 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str3 + ")";
1796
+            return str;
1797
+        }
1798
+
1732 1799
         /// <summary>
1733 1800
         /// 根据部门获取工单号
1734 1801
         /// </summary>
@@ -1813,6 +1880,23 @@ namespace CallCenterApi.Interface.Controllers.weixin
1813 1880
 
1814 1881
             return str;
1815 1882
         }
1883
+
1884
+
1885
+
1886
+        /// <summary>
1887
+        /// 获取完结审批的工单
1888
+        /// </summary>
1889
+        /// <param name="usercode"></param>
1890
+        /// <returns></returns>
1891
+        public string GetOverWo(string usercode)
1892
+        {
1893
+            string str = "";
1894
+            str = $"Select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType=" + (int)EnumItemType.deal + " and F_WoState in (" + (int)EnumWorkOrderState.audit + "," + (int)EnumWorkOrderState.finish + ") and F_OptType=" + (int)EnumItemOpt.end + " and F_CreateUser='" + usercode + "'";
1895
+            return str;
1896
+
1897
+        }
1898
+
1899
+
1816 1900
         /// <summary>
1817 1901
         /// 获取待完成的工单编号
1818 1902
         /// </summary>
@@ -1971,11 +2055,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
1971 2055
                         sql = "";
1972 2056
                         sql += $"  F_IsDelete=0";
1973 2057
                         //sql += " and (F_State in(10,11) or  F_State2 in(10,11))";
1974
-                        sql += " and ((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
1975
-                        if (GetDeptUserCode(ua.F_DeptId) != "")
1976
-                        {
1977
-                            sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
1978
-                        }
2058
+                        sql += " and (((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
2059
+                        sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
2060
+                        sql += " or T_Wo_WorkOrder.F_ID in (" + GetOverWo(ua.F_UserCode) + "))";
1979 2061
                         //   sql += " and F_State in(10,11) and F_DealBy = '" + ua.F_UserCode + "' ";
1980 2062
                         YCL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已完成的
1981 2063
 
@@ -2985,14 +3067,14 @@ namespace CallCenterApi.Interface.Controllers.weixin
2985 3067
                 var model = woBLL.GetModel(id);
2986 3068
                 if (model != null)
2987 3069
                 {
2988
-                    if (model.F_SC_PreliminaryOpinion == "退换货")
3070
+                    //if (model.F_SC_PreliminaryOpinion == "退换货")
3071
+                    //{
3072
+                    List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
3073
+                    if (materlist != null)
2989 3074
                     {
2990
-                        List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
2991
-                        if (materlist != null)
2992
-                        {
2993
-                            model.MaterialItems = materlist;
2994
-                        }
3075
+                        model.MaterialItems = materlist;
2995 3076
                     }
3077
+                    //}
2996 3078
                     list.Add(model);
2997 3079
                 }
2998 3080
                 var itemlasts = itembll.GetModelList("  F_WoID=" + id + " ");
@@ -3119,9 +3201,13 @@ namespace CallCenterApi.Interface.Controllers.weixin
3119 3201
                     //}
3120 3202
                     else if (itemlast.F_Flag == 9)
3121 3203
                     {
3122
-                        if (itemlast.F_IsUsed == 0)
3204
+                        var itemlest = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + "  and  F_WoID='" + fid + "' and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
3205
+                        if (itemlest.F_IsUsed == 0)
3123 3206
                         {
3124
-                            flag = 9;
3207
+                            if (itemlest.F_Flag == 9)
3208
+                                flag = 9;
3209
+                            else
3210
+                                flag = itemlest.F_Type;
3125 3211
                         }
3126 3212
                         else
3127 3213
                         {
@@ -3160,7 +3246,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3160 3246
                                 {
3161 3247
                                     foreach (var item in itemnext2)
3162 3248
                                     {
3163
-                                        if (item.F_WoState != 11)
3249
+                                        if (item.F_WoState != 11 && item.F_WoState != 10)
3164 3250
                                             flag = item.F_Type;
3165 3251
                                     }
3166 3252
                                 }
@@ -3735,17 +3821,14 @@ namespace CallCenterApi.Interface.Controllers.weixin
3735 3821
                     else
3736 3822
                         model.F_TS_Quantity = "";
3737 3823
                     model.F_TS_Level = model1[i].F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
3738
-                    if (model1[i].F_SC_PreliminaryOpinion == "退换货")
3824
+                                                           
3825
+                    List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
3826
+                    if (materlist != null)
3739 3827
                     {
3740
-                        List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
3741
-                        if (materlist != null)
3742
-                        {
3743
-                            model.MaterialItems = materlist;
3744
-                            model.F_ZL_Fquantity = materlist.Sum(x => x.F_ReturnQuantity).ToString();
3745
-                        }
3828
+                        model.MaterialItems = materlist;
3829
+                        model.F_ZL_Fquantity = materlist.Sum(x => x.F_ReturnQuantity).ToString();
3746 3830
                     }
3747
-                    else
3748
-                        model.MaterialItems = null;
3831
+
3749 3832
                     model.F_CarNumber = model1[i].F_CarNumber;
3750 3833
                     model.F_LoadingFee = model1[i].F_LoadingFee;
3751 3834
                     model.F_UnLoadingFee = model1[i].F_UnLoadingFee;
@@ -4959,10 +5042,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
4959 5042
                 if (model.F_Source == "3")
4960 5043
                 {
4961 5044
                     model.F_State = (int)EnumWorkOrderState.customers;
5045
+                    model.F_State2 = (int)EnumWorkOrderState.customers;
4962 5046
                 }
4963 5047
                 else
4964 5048
                 {
4965 5049
                     model.F_State = (int)EnumWorkOrderState.audit;
5050
+                    model.F_State2 = (int)EnumWorkOrderState.audit;
4966 5051
                 }
4967 5052
                 model.F_limit = overtime;
4968 5053
                
@@ -5257,7 +5342,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5257 5342
         /// <returns></returns>
5258 5343
         [WechatActionFilter]
5259 5344
         public ActionResult AssignWorkOrder(string OpenId, long orderid, string cont, WorkOrdeDeptment deptment, string F_Files, int isvisit = 1,
5260
-            int overtime = 0, int sms = -1, int clbm = 0, int clid = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, int clbm2 = 0, int clid2 = 0,string jsonstr="", int flag = 1,int inoutflag = 0, string Supercont = "")
5345
+            int overtime = 0, int sms = -1, int clbm = 0, int clid = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, int clbm2 = 0, int clid2 = 0,string jsonstr="", int flag = 1,int inoutflag = 0, string Supercont = "", int opttype = 1, string cont2 = "")
5261 5346
         {
5262 5347
 
5263 5348
             if (!string.IsNullOrEmpty(OpenId))
@@ -5320,10 +5405,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
5320 5405
                         }
5321 5406
 
5322 5407
                     }
5323
-                    if (hclid == 0 && hclbm == 0 && isApprovalp != 0)
5324
-                    {
5325
-                        return Error("请选择接收部门");
5326
-                    }
5408
+                    //if (hclid == 0 && hclbm == 0 && isApprovalp != 0)
5409
+                    //{
5410
+                    //    return Error("请选择接收部门");
5411
+                    //}
5327 5412
                     #region 五要素
5328 5413
                     input.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 责任单位
5329 5414
                     input.F_EventReason = deptment.EventReason;// 事件原因
@@ -5348,6 +5433,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5348 5433
                             }
5349 5434
                         }      
5350 5435
                         model.F_Flag = flag;
5436
+                        var modellast = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextUser like '%{ua.F_UserCode}%' and F_IsUsed=0 order by   F_ID desc ").FirstOrDefault();
5351 5437
                         if (flag == 3)
5352 5438
                         {
5353 5439
                             if ((clbm == 0 && clid == 0) || (clbm2 == 0 && clid2 == 0))
@@ -5364,9 +5450,26 @@ namespace CallCenterApi.Interface.Controllers.weixin
5364 5450
                             if (clbm2 == 0 && clid2 == 0)
5365 5451
                             {
5366 5452
                                 return Error("请选择接收部门");
5453
+                            }                          
5454
+                            if (opttype == 2) //填写处理结果
5455
+                            {
5456
+                                flag = 3;
5457
+                                DealWO(ua, model,"", input, cont2, 1, "", 1,"", flag,isApprovalp);
5458
+                            }
5459
+                            else if (opttype == 3) // 待处理状态
5460
+                            {
5461
+                                flag = 3;
5462
+                                modellast.F_Type = 1;
5463
+                                modellast.F_Flag = flag;
5464
+                                modellast.F_NextDept = 0;
5465
+                                itembll.Update(modellast);
5367 5466
                             }
5368
-                            var res1 = AssignWO(ua, model, input, cont, F_Files, clbm2, clid2, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 2, flag,Supercont);
5369
-                            Overorder(ua, model, 1);
5467
+                            else //完结工单
5468
+                            {
5469
+                                Overorder(ua, model, 1);
5470
+                            }
5471
+                            model.F_Flag = flag;
5472
+                            var res1 = AssignWO(ua, model, input, cont, F_Files, clbm2, clid2, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 2, flag,Supercont);                        
5370 5473
                         }
5371 5474
                         else
5372 5475
                         {
@@ -5374,8 +5477,26 @@ namespace CallCenterApi.Interface.Controllers.weixin
5374 5477
                             {
5375 5478
                                 return Error("请选择接收部门");
5376 5479
                             }
5480
+                            if (opttype == 2) //填写处理结果
5481
+                            {
5482
+                                flag = 3;
5483
+                                DealWO(ua, model,"", input, cont2, 1, "", 2,"", flag,isApprovalp);
5484
+                            }
5485
+                            else if (opttype == 3) // 待处理状态
5486
+                            {
5487
+                                flag = 3;
5488
+                                modellast.F_Type = 2;
5489
+                                modellast.F_Flag = flag;
5490
+                                modellast.F_NextDept = 0;
5491
+                                itembll.Update(modellast);
5492
+                            }
5493
+                            else //完结工单
5494
+                            {
5495
+                                Overorder(ua, model, 2);
5496
+                            }
5497
+                            model.F_Flag = flag;
5377 5498
                             var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 1, flag, Supercont);
5378
-                            Overorder(ua, model, 2);
5499
+                          
5379 5500
                         }
5380 5501
                         return Success("转派成功");
5381 5502
                     }
@@ -5453,13 +5574,13 @@ namespace CallCenterApi.Interface.Controllers.weixin
5453 5574
                                         //    }
5454 5575
 
5455 5576
                                         //}
5456
-                                        else if (deptmodel.F_DeptId == 248 && model.F_SC_PreliminaryOpinion == "退换货")
5577
+                                        else if (deptmodel.F_DeptId == 248)
5457 5578
                                         {
5458
-                                            input.F_CarNumber = deptment.CarNumber;//返厂车牌号
5459
-                                            input.F_LoadingFee = deptment.LoadingFee;//装车费
5579
+                                            input.F_CarNumber = deptment.CarNumber;
5460 5580
                                             input.F_UnLoadingFee = deptment.UnLoadingFee;//卸车费
5461 5581
                                             input.F_MaterialFee = deptment.MaterialFee;//返料费
5462
-                                            input.F_DrivePhone = deptment.DrivePhone;//电话号码
5582
+                                            input.F_DrivePhone = deptment.DrivePhone;//电话号码nt.CarNumber;//返厂车牌号
5583
+                                            input.F_LoadingFee = deptment.LoadingFee;//装车费
5463 5584
                                             if (!string.IsNullOrEmpty(jsonstr))
5464 5585
                                             {
5465 5586
                                                 JavaScriptSerializer Serializer = new JavaScriptSerializer();   //实例化⼀个能够序列化数据的类
@@ -5545,7 +5666,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5545 5666
                         }
5546 5667
                         if (zflag != 3)
5547 5668
                         {
5548
-                            var modeldpts = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextDept={clbm} and F_Type not in({zflag},3) and F_Flag=3 order by   F_ID desc ").FirstOrDefault();
5669
+                            var modeldpts = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextDept={clbm} and F_Type not in({zflag},3) and F_Flag=3 and F_OptType not in(15,4,5) order by   F_ID desc ").FirstOrDefault();
5549 5670
                             if (modeldpts != null)
5550 5671
                                 return Error("不允许同一个部门出现在两条线内,请重新指派!");
5551 5672
                         }
@@ -5712,39 +5833,39 @@ namespace CallCenterApi.Interface.Controllers.weixin
5712 5833
                 touser = users;
5713 5834
             }
5714 5835
             string htouser = "", htousername = "";
5715
-            if (isApprovalp != 0 && nowUser.F_DeptId == 37)
5716
-            {
5717
-                if (hclid != 0)
5718
-                {
5719
-                    Model.T_Sys_UserAccount clus = userAccountBLL.GetModel(hclid);
5720
-                    if (clus != null)
5721
-                    {
5722
-                        if (string.IsNullOrEmpty(htouser))
5723
-                        {
5724
-                            htouser = clus.F_UserCode;
5725
-                            htousername = clus.F_UserName + "(" + clus.F_WorkNumber + ")";
5726
-                        }
5727
-                    }
5728
-                }
5729
-                else
5730
-                {
5731
-                    var list = userAccountBLL.GetModelList(" F_DeptId='" + hclbm + "'");
5732
-                    foreach (var l in list)
5733
-                    {
5734
-                        if (string.IsNullOrEmpty(htouser))
5735
-                        {
5736
-                            htouser = l.F_UserCode;
5737
-                            htousername = l.F_UserName + "(" + l.F_UserCode + ")";
5738
-                        }
5739
-                        else
5740
-                        {
5741
-                            htouser = htouser + "," + l.F_UserCode;
5742
-                            htousername = htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
5743
-                        }
5744
-                    }
5745
-                }
5746
-                AddLog(model.F_ID, (int)EnumWorkOrderState.assign, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat, 2);
5747
-            }
5836
+            //if (isApprovalp != 0 && nowUser.F_DeptId == 37)
5837
+            //{
5838
+            //    if (hclid != 0)
5839
+            //    {
5840
+            //        Model.T_Sys_UserAccount clus = userAccountBLL.GetModel(hclid);
5841
+            //        if (clus != null)
5842
+            //        {
5843
+            //            if (string.IsNullOrEmpty(htouser))
5844
+            //            {
5845
+            //                htouser = clus.F_UserCode;
5846
+            //                htousername = clus.F_UserName + "(" + clus.F_WorkNumber + ")";
5847
+            //            }
5848
+            //        }
5849
+            //    }
5850
+            //    else
5851
+            //    {
5852
+            //        var list = userAccountBLL.GetModelList(" F_DeptId='" + hclbm + "'");
5853
+            //        foreach (var l in list)
5854
+            //        {
5855
+            //            if (string.IsNullOrEmpty(htouser))
5856
+            //            {
5857
+            //                htouser = l.F_UserCode;
5858
+            //                htousername = l.F_UserName + "(" + l.F_UserCode + ")";
5859
+            //            }
5860
+            //            else
5861
+            //            {
5862
+            //                htouser = htouser + "," + l.F_UserCode;
5863
+            //                htousername = htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
5864
+            //            }
5865
+            //        }
5866
+            //    }
5867
+            //    AddLog(model.F_ID, (int)EnumWorkOrderState.assign, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat, 2);
5868
+            //}
5748 5869
 
5749 5870
             #region 财务审核后,填单人员可以收到到账提醒(短信到账提醒)20220217
5750 5871
             if (nowUser.F_DeptId == 260)
@@ -6178,13 +6299,13 @@ namespace CallCenterApi.Interface.Controllers.weixin
6178 6299
                         //    strsql = " and F_Type in(2,3)";
6179 6300
                         //}
6180 6301
 
6181
-                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList("F_WoID=" + model.F_ID + " and F_WoState=1 and F_IsUsed=0 and F_NextUser like '%" + ua.F_UserCode + "%' order by  F_ID desc ").FirstOrDefault();
6302
+                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList("F_WoID=" + model.F_ID + " and F_WoState in(1,4) and F_IsUsed=0 and F_NextUser like '%" + ua.F_UserCode + "%' order by  F_ID desc ").FirstOrDefault();
6182 6303
                         if (modellist == null)
6183 6304
                         {
6184 6305
                             return Error("非接单人不可操作工单");
6185 6306
 
6186 6307
                         }
6187
-                        var modellast = new BLL.T_Wo_WorkOrderItem_New().GetModelList("F_WoID=" + model.F_ID + " and F_WoState=1 and F_NextUser like '%" + ua.F_UserCode + "%'  order by  F_ID desc ");
6308
+                        var modellast = new BLL.T_Wo_WorkOrderItem_New().GetModelList("F_WoID=" + model.F_ID + " and F_WoState in(1,4) and F_NextUser like '%" + ua.F_UserCode + "%'  order by  F_ID desc ");
6188 6309
                         if (modellast.Count > 0)
6189 6310
                         {
6190 6311
                             int isused = modellast.Select(p => p.F_IsUsed == 0).Count();
@@ -6604,36 +6725,34 @@ namespace CallCenterApi.Interface.Controllers.weixin
6604 6725
                     if (model != null)
6605 6726
                     {
6606 6727
                         int flag = 0;
6607
-                        //string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6608
-                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_IsUsed=0 and  F_NextUser like '%{ua.F_UserCode}%'  order by   F_ID desc ").FirstOrDefault();
6609
-
6610
-
6611
-                        if (modellist == null)
6728
+                        string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6729
+                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_IsUsed=0 and  F_NextUser like '%{ua.F_UserCode}%'  order by   F_ID desc ");
6730
+                        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoState =1 and  F_WoID='" + model.F_ID + "'and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
6731
+                        if (modellist.Count <= 0)
6612 6732
                         {
6613 6733
                             return Error("非接单人不可操作工单");
6614 6734
                         }
6615
-
6616
-                        //if (!string.IsNullOrEmpty(modellist.F_CreateUser))
6617
-                        //{
6618
-                        //    var deptid = userAccountBLL.GetModel(modellist.F_CreateUser.ToString())?.F_DeptId;
6619
-                        //    if (markdepts.Contains(deptid.ToString()))
6620
-                        //    {
6621
-                        //        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoState =1 and  F_WoID='" + model.F_ID + "'and F_NextUser like '%" + modellist.F_CreateUser + "%' order by F_ID desc").FirstOrDefault();
6622
-                        //        if (itemnext.F_Flag == 9)
6623
-                        //        {
6624
-                        //            model.F_Flag = 9;
6625
-                        //        }
6626
-
6627
-                        //    }
6628
-                        //}
6629
-                        if (inoutflag != 0)
6735
+                        if (markdepts.Contains(ua.F_DeptId.ToString()) && itemnext.F_Flag == 9)
6630 6736
                         {
6631
-                            flag = inoutflag;
6737
+                            if (modellist.Count >= 2)
6738
+                            {
6739
+                                flag = 3;
6740
+                            }
6741
+                            else
6742
+                                return Error("异常退回工单失败!");
6632 6743
                         }
6633 6744
                         else
6634 6745
                         {
6635
-                            flag = Convert.ToInt32(modellist.F_Type);
6746
+                            if (inoutflag != 0)
6747
+                            {
6748
+                                flag = inoutflag;
6749
+                            }
6750
+                            else
6751
+                            {
6752
+                                flag = Convert.ToInt32(modellist.FirstOrDefault().F_Type);
6753
+                            }
6636 6754
                         }
6755
+
6637 6756
                         var res = BackWO(ua, model, cont, type, flag);
6638 6757
                         if (res)
6639 6758
                             return Success("退回成功");
@@ -6674,22 +6793,20 @@ namespace CallCenterApi.Interface.Controllers.weixin
6674 6793
 
6675 6794
                         if (modelnext != null)
6676 6795
                         {
6677
-                            foreach (var item in modelnext)
6678
-                            {
6679
-                                if (item.F_IsUsed == 1)
6680
-                                    return Error("撤回失败,无法撤回!");
6681
-                            }
6682 6796
                             if (inoutflag != 0)
6683 6797
                             {
6684 6798
                                 flag = inoutflag;
6685 6799
                             }
6686 6800
                             else
6687 6801
                             {
6688
-                                var modellist = itembll.GetModelList($"F_WoID={model.F_ID} and F_OptType=1 and F_IsUsed=0 and F_CreateUser={ua.F_UserCode} order by   F_ID desc ");
6689
-                                if (modellist == null)
6690
-                                { return Error("无操作权限"); }
6802
+                                var modellist = itembll.GetModelList($"F_WoID={model.F_ID}  and F_IsUsed=0 and F_CreateUser={ua.F_UserCode} order by   F_ID desc ");
6803
+
6804
+                                if (modellist.Count <= 0)
6805
+                                    return Error("撤回失败,无法撤回!");
6691 6806
                                 if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
6692 6807
                                 {
6808
+                                    if (modellist != null && modellist.Count < 2)
6809
+                                        return Error("撤回失败,无法撤回!");
6693 6810
                                     flag = 3;
6694 6811
                                 }
6695 6812
                                 else if (modellist != null && modellist.Count > 0)
@@ -6702,8 +6819,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
6702 6819
                                             flag = 3;
6703 6820
                                             model.F_Flag = 9;
6704 6821
                                         }
6705
-                                        else if (itemnext.F_Flag == 9)
6822
+                                        else if (itemnext != null && itemnext.F_Flag == 9)
6706 6823
                                         {
6824
+                                            if (modellist != null && modellist.Count < 2)
6825
+                                                return Error("撤回失败,无法撤回!");
6707 6826
                                             flag = 3;
6708 6827
                                             model.F_Flag = 9;
6709 6828
                                         }
@@ -6930,6 +7049,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6930 7049
                     }
6931 7050
                     else
6932 7051
                     {
7052
+                        model.F_Flag = 9;
6933 7053
                         model.F_State = wostate;
6934 7054
                         model.F_State2 = wostate;
6935 7055
                     }

+ 211 - 173
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -279,8 +279,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
279 279
                             //    sql += " and F_State2 in(10,11)";
280 280
                             //}
281 281
                             //sql += " and (F_State in(10,11) or  F_State2 in(10,11))";
282
-                            sql += " and ((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
282
+                            sql += " and (((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
283 283
                             sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
284
+                            sql += " or T_Wo_WorkOrder.F_ID in (" + GetOverWo(ua.F_UserCode) + "))";
284 285
                         }
285 286
 
286 287
                         break;
@@ -645,6 +646,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
645 646
             }
646 647
 
647 648
         }
649
+
650
+        /// <summary>
651
+        /// 获取完结审批的工单
652
+        /// </summary>
653
+        /// <param name="usercode"></param>
654
+        /// <returns></returns>
655
+        public string GetOverWo(string usercode)
656
+        {
657
+            string str = "";
658
+            str = $"Select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType="+(int)EnumItemType.deal+" and F_WoState in (" +(int)EnumWorkOrderState.audit+","+(int)EnumWorkOrderState.finish + ") and F_OptType=" + (int)EnumItemOpt.end + " and F_CreateUser='"+ usercode + "'";
659
+            return str;
660
+
661
+        }
648 662
         /// <summary>
649 663
         /// 获取工单数量
650 664
         /// </summary>
@@ -821,11 +835,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
821 835
                             //{
822 836
                             //    sql += " and F_State2 in(10,11)";
823 837
                             //}
824
-                            sql += " and ((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
825
-                            if (GetDeptUserCode(ua.F_DeptId) != "")
826
-                            {
827
-                                sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
828
-                            }
838
+                            sql += " and (((F_State in(10,11) and isnull(F_Flag,0)=0 ) or (F_Flag=2 and F_State2 in(10,11)) or  (F_Flag=1 and F_State in(10,11)) or (F_Flag=3 and(F_State in(10,11) or F_State2 in(10,11))))";
839
+                            sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
840
+                            sql += " or T_Wo_WorkOrder.F_ID in (" + GetOverWo(ua.F_UserCode) + "))";
829 841
                             //   sql += " and F_State in(10,11) and F_DealBy = '" + ua.F_UserCode + "' ";
830 842
                             YCL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已完成的
831 843
 
@@ -2515,14 +2527,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
2515 2527
                 var model = workOrder.GetModel(id);
2516 2528
                 if (model != null)
2517 2529
                 {
2518
-                    if (model.F_SC_PreliminaryOpinion == "退换货")
2530
+                    //if (model.F_SC_PreliminaryOpinion == "退换货")
2531
+                    //{
2532
+                    List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
2533
+                    if (materlist != null)
2519 2534
                     {
2520
-                        List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
2521
-                        if (materlist != null)
2522
-                        {
2523
-                            model.MaterialItems = materlist;
2524
-                        }
2535
+                        model.MaterialItems = materlist;
2525 2536
                     }
2537
+                    //}
2526 2538
                     list.Add(model);
2527 2539
                 }
2528 2540
                 var itemlasts = itembll.GetModelList("  F_WoID=" + id + " ");
@@ -2642,9 +2654,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
2642 2654
                     //}
2643 2655
                     else if (itemlast.F_Flag == 9)
2644 2656
                     {
2645
-                        if (itemlast.F_IsUsed == 0)
2657
+                        var itemlest = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + "  and  F_WoID='" + fid + "' and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
2658
+                        if (itemlest.F_IsUsed == 0)
2646 2659
                         {
2647
-                            flag = 9;
2660
+                            if (itemlest.F_Flag == 9)
2661
+                                flag = 9;
2662
+                            else
2663
+                                flag = itemlest.F_Type;
2648 2664
                         }
2649 2665
                         else
2650 2666
                         {
@@ -2679,14 +2695,26 @@ namespace CallCenterApi.Interface.Controllers.workorder
2679 2695
                             else
2680 2696
                             {
2681 2697
                                 var itemnext2 = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + "  and F_IsUsed=0 and  F_WoID='" + fid + "' and F_CreateUser='" + ua.F_UserCode + "' order by F_ID desc");
2682
-                                if (itemnext2.Count > 0)
2698
+                                if (itemnext2.Count > 0 && itemnext2.Count == 2)
2683 2699
                                 {
2684
-                                    foreach (var item in itemnext2)
2685
-                                    {
2686
-                                        if (item.F_WoState != 11)
2687
-                                            flag = item.F_Type;
2688
-                                    }
2700
+                                    flag = 3;
2701
+                                }
2702
+                                else if (itemnext2.Count > 0)
2703
+                                {
2704
+                                    flag = itemnext2.FirstOrDefault().F_Type;
2689 2705
                                 }
2706
+                                else
2707
+                                {
2708
+                                    flag = itemlast.F_Type;
2709
+                                }
2710
+                                //if (itemnext2.Count > 0)
2711
+                                //{
2712
+                                //    foreach (var item in itemnext2)
2713
+                                //    {
2714
+                                //        if (item.F_WoState != 11)
2715
+                                //            flag = item.F_Type;
2716
+                                //    }
2717
+                                //}
2690 2718
                             }
2691 2719
                         }
2692 2720
                     }
@@ -2713,20 +2741,20 @@ namespace CallCenterApi.Interface.Controllers.workorder
2713 2741
             if (userId != 0)
2714 2742
             {
2715 2743
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2716
-                var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_IsUsed=0 and F_OptType =1 and  F_WoID='" + fid + "'and (F_CreateUser='" + ua.F_UserCode + "' or     F_NextUser like '%" + ua.F_UserCode + "%') order by F_ID desc");
2744
+                var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_IsUsed=0  and  F_WoID='" + fid + "'and F_CreateUser='" + ua.F_UserCode + "' order by F_ID desc");
2717 2745
                 if (itemlast != null && itemlast.Count > 0)
2718 2746
                 {
2719 2747
                     if (markdepts.Contains(ua.F_DeptId.ToString()))
2720 2748
                     {
2721
-                        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_OptType =1 and  F_WoID='" + fid + "'and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
2749
+                        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + fid + "'and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
2722 2750
                         if (itemlast.Count == 2)
2723 2751
                         {
2724 2752
                             woflag = 9;
2725 2753
                         }
2726
-                        else if (itemnext != null && itemnext.F_Flag == 9)
2727
-                        {
2728
-                            woflag = 9;
2729
-                        }
2754
+                        //else if (itemnext != null && itemnext.F_Flag == 9)
2755
+                        //{
2756
+                        //    woflag = 9;
2757
+                        //}
2730 2758
                     }
2731 2759
                 }
2732 2760
             }
@@ -6688,6 +6716,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
6688 6716
                                 model.F_QuestionType = manage.F_QuestionName;//问题类别3
6689 6717
                                 model.F_QuestionTypeid = manage.F_Id;
6690 6718
                                 #region 20220215修改 肥效类增加作物字段
6719
+                                var cropid = 0;
6691 6720
                                 if (manage.F_Label == "3")
6692 6721
                                 {
6693 6722
                                     Model.T_Wo_QuestionManage Manage1 = quesBLL.GetModel(int.Parse(manage.F_ParentId.ToString()));//获取问题类别2
@@ -6695,13 +6724,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
6695 6724
                                     model.F_QuestionTypeone = Manage2.F_QuestionName;//问题类别1
6696 6725
                                     model.F_QuestionTypeoneid = Manage2.F_Id;//问题类别1
6697 6726
                                     model.F_QuestionTypetwo = Manage1.F_QuestionName;//问题类别2
6698
-                                    model.F_QuestionTypetwoid = Manage1.F_Id;//问题类别2
6699
-                                    var cropid = 0;
6700
-                                    if (int.TryParse(model1[i].F_Crops.Trim(), out cropid))
6701
-                                    {
6702
-                                        model.F_QuestionTypefour = new BLL.T_Sys_DictionaryValue().GetModel(cropid)?.F_Name ?? "";//问题类别4
6703
-                                        model.F_QuestionTypefourid = cropid;//问题类别4
6704
-                                    }
6727
+                                    model.F_QuestionTypetwoid = Manage1.F_Id;//问题类别2                             
6728
+                                }
6729
+                                if (int.TryParse(model1[i].F_Crops.Trim(), out cropid))
6730
+                                {
6731
+                                    model.F_QuestionTypefour = new BLL.T_Sys_DictionaryValue().GetModel(cropid)?.F_Name ?? "";//作物名称
6732
+                                    model.F_QuestionTypefourid = cropid;//作物
6705 6733
                                 }
6706 6734
                                 #endregion
6707 6735
                                 #region 修改前
@@ -6736,23 +6764,23 @@ namespace CallCenterApi.Interface.Controllers.workorder
6736 6764
                         model.F_TS_Quantity = "";
6737 6765
                     model.F_TS_Level = model1[i].F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
6738 6766
 
6739
-                    if (model1[i].F_SC_PreliminaryOpinion == "退换货")
6767
+                    //if (model1[i].F_SC_PreliminaryOpinion == "退换货")
6768
+                    //{
6769
+                    List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
6770
+                    if (materlist != null)
6740 6771
                     {
6741
-                        List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
6742
-                        if (materlist != null)
6743
-                        {
6744
-                            model.MaterialItems = materlist;
6745
-                            model.F_ZL_Fquantity = materlist.Sum(x => x.F_ReturnQuantity).ToString();
6746
-                        }
6772
+                        model.MaterialItems = materlist;
6773
+                        model.F_ZL_Fquantity = materlist.Sum(x => x.F_ReturnQuantity).ToString();
6747 6774
                     }
6748
-                    else
6749
-                     model.MaterialItems = null;
6750
-                    model.F_CarNumber= model1[i].F_CarNumber;
6775
+                    //}
6776
+                    //else
6777
+                    // model.MaterialItems = null;
6778
+                    model.F_CarNumber = model1[i].F_CarNumber;
6751 6779
                     model.F_DrivePhone = model1[i].F_DrivePhone;
6752 6780
                     model.F_LoadingFee = model1[i].F_LoadingFee;
6753 6781
                     model.F_UnLoadingFee = model1[i].F_UnLoadingFee;
6754 6782
                     model.F_MaterialFee = model1[i].F_MaterialFee;
6755
-                    model.F_EventReason= model1[i].F_EventReason;  //事件原因-内线
6783
+                    model.F_EventReason = model1[i].F_EventReason;  //事件原因-内线
6756 6784
                     model.F_EventReason2 = model1[i].F_EventReason2;  //事件原因-内线
6757 6785
                     #endregion
6758 6786
                     #region 咨询类
@@ -7930,7 +7958,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
7930 7958
                                     inputs.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
7931 7959
 
7932 7960
                                 }
7933
-                                else if (deptmodel.F_DeptName == "成品库" && model.F_SC_PreliminaryOpinion == "退换货") //退换货成品库录入物料信息
7961
+                                else if (deptmodel.F_DeptName == "成品库") //退换货成品库录入物料信息
7934 7962
                                 {
7935 7963
                                     if (string.IsNullOrEmpty(jsonstr))
7936 7964
                                     {
@@ -7966,7 +7994,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
7966 7994
                                     }
7967 7995
 
7968 7996
                                 }
7969
-                                else if (deptmodel.F_DeptId == 248 && model.F_SC_PreliminaryOpinion == "退换货")
7997
+                                else if (deptmodel.F_DeptId == 248)
7970 7998
                                 {
7971 7999
                                     inputs.F_CarNumber = deptment.CarNumber;//返厂车牌号
7972 8000
                                     inputs.F_LoadingFee = deptment.LoadingFee;//装车费
@@ -8160,7 +8188,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8160 8188
                     //验证信息 
8161 8189
                     if (model != null)
8162 8190
                     {
8163
-                        if (model.F_State != 11 && model.F_State != 10)
8191
+                        if ((model.F_State != 11 && model.F_State != 10)&&(model.F_State2 != 11 && model.F_State2 != 10))
8164 8192
                             return Error("无操作权限!");
8165 8193
                         if (model.F_State == 11 && model.F_VisitResult != "不满意")
8166 8194
                             return Error("非不满意工单不可退回");
@@ -8192,24 +8220,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
8192 8220
             //{
8193 8221
             //    strsql = $" and F_Type in(2,3)";
8194 8222
             //}
8195
-            var itemlasts = itembll.GetModelList($"F_ItemType={(int)EnumItemType.deal} and  F_WoID={model.F_ID} and  F_WoState={(int)EnumWorkOrderState.finish}");
8223
+            var itemlasts1 = itembll.GetModelList($"F_ItemType={(int)EnumItemType.deal} and  F_WoID={model.F_ID} and  F_WoState in ({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) and F_OptType={(int)EnumItemOpt.end} and F_Type in(1,3) order by  F_CreateTime desc").FirstOrDefault();
8224
+            var itemlasts2 = itembll.GetModelList($"F_ItemType={(int)EnumItemType.deal} and  F_WoID={model.F_ID} and  F_WoState in ({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) and F_OptType={(int)EnumItemOpt.end} and F_Type=2 order by  F_CreateTime desc").FirstOrDefault();
8196 8225
             string creatuser1 = "";
8197 8226
             string creatuser2 = "";
8198
-            if (itemlasts.Count > 0)
8227
+            if (itemlasts1 != null)
8199 8228
             {
8200
-                foreach (var it in itemlasts)
8201
-                {
8202
-                    if (it.F_WoState == 10 && (it.F_Type == 1 || it.F_Type == 3))
8203
-                    {
8204
-                        creatuser1 = it.F_CreateUser;
8205
-                        woflag = Convert.ToInt32(it.F_Type);
8206
-                    }
8207
-                    if (it.F_WoState == 10 && it.F_Type==2 )
8208
-                    {
8209
-                        creatuser2 = it.F_CreateUser;
8210
-                    }
8211
-                }
8229
+                creatuser1 = itemlasts1.F_CreateUser;
8230
+                woflag = Convert.ToInt32(itemlasts1.F_Type);
8231
+
8232
+            }
8233
+            if (itemlasts2 != null)
8234
+            {
8235
+                woflag = Convert.ToInt32(itemlasts2.F_Type);
8236
+                creatuser2 = itemlasts2.F_CreateUser;
8212 8237
             }
8238
+
8213 8239
             var opt = "退回";
8214 8240
             #region 读取当前登录人部门
8215 8241
             string deptname = "";
@@ -8467,7 +8493,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8467 8493
         /// <returns></returns>
8468 8494
         [Authority]
8469 8495
         public ActionResult AssignWorkOrder(long orderid, string cont, WorkOrdeDeptment deptment, string F_Files,
8470
-            int overtime = 0, int sms = 0, int clbm = 0, int clid = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, int clbm2 = 0, int clid2 = 0,string jsonstr="",int flag=1,int inoutflag = 0,string Supercont="")
8496
+            int overtime = 0, int sms = 0, int clbm = 0, int clid = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, int clbm2 = 0, int clid2 = 0,string jsonstr="",int flag=1,int inoutflag = 0,string Supercont="",int opttype=1, string cont2="")
8471 8497
         {
8472 8498
             int userId = CurrentUser.UserData.F_UserId;
8473 8499
             string usercode = CurrentUser.UserData.F_UserCode;
@@ -8547,10 +8573,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
8547 8573
                     }
8548 8574
                 }
8549 8575
 
8550
-                if (hclid == 0 && hclbm == 0 && isApprovalp != 0)
8551
-                {
8552
-                    return Error("请选择接收部门");
8553
-                }
8576
+                //if (hclid == 0 && hclbm == 0 && isApprovalp != 0)
8577
+                //{
8578
+                //    return Error("请选择接收部门");
8579
+                //}
8554 8580
                 #region 五要素
8555 8581
                 input.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 责任单位
8556 8582
                 input.F_EventReason = deptment.EventReason;// 事件原因
@@ -8574,6 +8600,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8574 8600
                             input.F_SC_CJ_ReturnAccount = deptment.ReturnAccount;//市场管理科-抽检-确认返账金额
8575 8601
                         }
8576 8602
                     }
8603
+                    var modellast = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextUser like '%{ua.F_UserCode}%' and F_IsUsed=0 order by   F_ID desc ").FirstOrDefault();
8577 8604
                     model.F_Flag = flag;
8578 8605
                     if (flag == 3)
8579 8606
                     {
@@ -8592,8 +8619,25 @@ namespace CallCenterApi.Interface.Controllers.workorder
8592 8619
                         {
8593 8620
                             return Error("请选择接收部门");
8594 8621
                         }
8595
-                        var res1 = AssignWO(ua, model, input, cont, F_Files, clbm2, clid2, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 2,flag,Supercont);
8596
-                        Overorder(ua, model,2,1);
8622
+                        if (opttype == 2) //填写处理结果
8623
+                        {
8624
+                            flag = 3;
8625
+                            DealWO(ua, model, input, cont2, "", 1, "", 1, flag,isApprovalp);
8626
+                        }
8627
+                        else if (opttype == 3) // 待处理状态
8628
+                        {
8629
+                            flag = 3;
8630
+                            modellast.F_Type = 1;
8631
+                            modellast.F_Flag = flag;
8632
+                            modellast.F_NextDept = 0;
8633
+                            itembll.Update(modellast);
8634
+                        }
8635
+                        else //完结工单
8636
+                        {
8637
+                           Overorder(ua, model, 2, 1);
8638
+                        }
8639
+                        model.F_Flag = flag;
8640
+                        var res1 = AssignWO(ua, model, input, cont, F_Files, clbm2, clid2, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 2, flag, Supercont);
8597 8641
                         //DealWO(ua, model, input, "", "", 1, "", 1, "",flag);
8598 8642
                     }
8599 8643
                     else
@@ -8602,9 +8646,25 @@ namespace CallCenterApi.Interface.Controllers.workorder
8602 8646
                         {
8603 8647
                             return Error("请选择接收部门");
8604 8648
                         }
8605
-                        var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid,"",0,1,flag,Supercont);
8606
-                        Overorder(ua, model,2,2);
8607
-                        //DealWO(ua, model, input, "", "", 1, "", 2, "",flag);
8649
+                        if (opttype == 2) //填写处理结果
8650
+                        {
8651
+                            flag = 3;
8652
+                            DealWO(ua, model, input, cont2, "", 1, "", 2, flag, isApprovalp);
8653
+                        }
8654
+                        else if (opttype == 3) // 待处理状态
8655
+                        {
8656
+                            flag = 3;                         
8657
+                            modellast.F_Type = 2;
8658
+                            modellast.F_Flag = flag;
8659
+                            modellast.F_NextDept = 0;
8660
+                            itembll.Update(modellast);
8661
+                        }
8662
+                        else //完结工单
8663
+                        {
8664
+                            Overorder(ua, model, 2, 2);
8665
+                        }
8666
+                        model.F_Flag = flag;
8667
+                        var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid,"",0,1,flag,Supercont);                               
8608 8668
                     }
8609 8669
                     return Success("转派成功");
8610 8670
                 }
@@ -8687,7 +8747,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8687 8747
                                     //    }
8688 8748
 
8689 8749
                                     //}
8690
-                                    else if (deptmodel.F_DeptId == 248 && model.F_SC_PreliminaryOpinion == "退换货")
8750
+                                    else if (deptmodel.F_DeptId == 248)
8691 8751
                                     {
8692 8752
                                         input.F_CarNumber = deptment.CarNumber;//返厂车牌号
8693 8753
                                         input.F_LoadingFee = deptment.LoadingFee;//装车费
@@ -8790,7 +8850,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
8790 8850
                     }
8791 8851
                     if (zflag != 3)
8792 8852
                     {
8793
-                        var modeldpts = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextDept={clbm} and F_Type not in({zflag},3) and F_Flag=3 order by   F_ID desc ").FirstOrDefault();
8853
+                        var modeldpts = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and  F_NextDept={clbm} and F_Type not in({zflag},3) and F_Flag=3 and F_OptType not in(15,4,5) order by   F_ID desc ").FirstOrDefault();
8794 8854
                         if (modeldpts != null)
8795 8855
                             return Error("不允许同一个部门出现在两条线内,请重新指派!");
8796 8856
                     }
@@ -9216,36 +9276,34 @@ namespace CallCenterApi.Interface.Controllers.workorder
9216 9276
                     if (model != null)
9217 9277
                     {
9218 9278
                         int flag = 0;
9219
-                        //string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
9220
-                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_IsUsed=0 and  F_NextUser like '%{ua.F_UserCode}%'  order by   F_ID desc ").FirstOrDefault();
9221
-
9222
-                        if (modellist == null)
9279
+                        string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
9280
+                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_IsUsed=0 and  F_NextUser like '%{ua.F_UserCode}%'  order by   F_ID desc ");
9281
+                        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoState =1 and  F_WoID='" + model.F_ID + "'and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc").FirstOrDefault();
9282
+                        if (modellist.Count <= 0)
9223 9283
                         {
9224 9284
                             return Error("非接单人不可操作工单");
9225 9285
                         }
9226
-
9227
-                        //if (!string.IsNullOrEmpty(modellist.F_CreateUser))
9228
-                        //{
9229
-                        //    var deptid = sysUserAccountBll.GetModel(modellist.F_CreateUser.ToString())?.F_DeptId;
9230
-                        //    if (markdepts.Contains(deptid.ToString()))
9231
-                        //    {
9232
-                        //        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and F_WoState =1 and  F_WoID='" + model.F_ID + "'and F_NextUser like '%" + modellist.F_CreateUser + "%' order by F_ID desc").FirstOrDefault();
9233
-                        //        if (itemnext!=null && itemnext.F_Flag == 9)
9234
-                        //        {
9235
-                        //            model.F_Flag = 9;
9236
-                        //        }
9237
-                               
9238
-                        //    }
9239
-                        //}
9240
-                        if (inoutflag != 0)
9286
+                        if (markdepts.Contains(ua.F_DeptId.ToString()) && itemnext.F_Flag == 9)
9241 9287
                         {
9242
-                            flag = inoutflag;
9288
+                            if (modellist.Count >= 2)
9289
+                            {
9290
+                                flag = 3;
9291
+                            }
9292
+                            else
9293
+                                return Error("异常退回工单失败!");
9243 9294
                         }
9244 9295
                         else
9245 9296
                         {
9246
-                            flag = Convert.ToInt32(modellist.F_Type);
9297
+                            if (inoutflag != 0)
9298
+                            {
9299
+                                flag = inoutflag;
9300
+                            }
9301
+                            else
9302
+                            {
9303
+                                flag = Convert.ToInt32(modellist.FirstOrDefault().F_Type);
9304
+                            }
9247 9305
                         }
9248
-                       
9306
+
9249 9307
                         var res = BackWO(ua, model, cont, type, flag);
9250 9308
                         if (res)
9251 9309
                             return Success("退回成功");
@@ -9291,19 +9349,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
9291 9349
                             }                                                  
9292 9350
                             else
9293 9351
                             {
9294
-                                var modellist = itembll.GetModelList($"F_WoID={model.F_ID} and F_OptType=1 and F_IsUsed=0 and F_CreateUser={ua.F_UserCode} order by   F_ID desc ");
9295
-                                //foreach (var item in modellist)
9296
-                                //{
9297
-                                //    if (item.F_IsUsed==1 )
9298
-                                //        return Error("撤回失败,无法撤回!");
9299
-                                //}
9352
+                                var modellist = itembll.GetModelList($"F_WoID={model.F_ID}  and F_IsUsed=0 and F_CreateUser={ua.F_UserCode} order by   F_ID desc ");
9353
+                                
9300 9354
                                 if(modellist.Count<=0)
9301 9355
                                     return Error("撤回失败,无法撤回!");                                               
9302 9356
                                 if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
9303
-                                {
9304
-                                    if (model.F_Flag == 3 && modellist != null && modellist.Count < 2)
9305
-                                        return Error("撤回失败,无法撤回!");
9306
-                                    else if ((model.F_Flag == 1 || model.F_Flag == 2) && modellist != null && modellist.Count < 1)
9357
+                                {                                  
9358
+                                    if (modellist != null && modellist.Count < 2)
9307 9359
                                         return Error("撤回失败,无法撤回!");
9308 9360
                                     flag = 3;
9309 9361
                                 }
@@ -9319,10 +9371,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
9319 9371
                                         }
9320 9372
                                         else if (itemnext!=null && itemnext.F_Flag == 9)
9321 9373
                                         {
9322
-                                            if (model.F_Flag == 3 && modellist != null && modellist.Count < 2)
9323
-                                                return Error("撤回失败,无法撤回!");
9324
-                                            else if ((model.F_Flag == 1 || model.F_Flag == 2) && modellist != null && modellist.Count < 1)
9325
-                                                return Error("撤回失败,无法撤回!");
9374
+                                            if(modellist != null && modellist.Count < 2)
9375
+                                                return Error("撤回失败,无法撤回!");                                          
9326 9376
                                             flag = 3;
9327 9377
                                             model.F_Flag = 9;
9328 9378
                                         }
@@ -9357,7 +9407,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9357 9407
         /// <param name="input"></param>
9358 9408
         /// <returns></returns>
9359 9409
         [Authority]
9360
-        public ActionResult ReturnvisitOrder(long orderid, string reason, string call, string F_VisitRemarks, int isOver = 0, int sms = 0,int resultscore=0,int effectscore=0,int servicescore=0,int qualityscore=0,int npscore=0)
9410
+        public ActionResult ReturnvisitOrder(long orderid, string reason, string call, string F_VisitRemarks, int isOver = 0, int sms = 0,int resultscore=-1,int effectscore=-1,int servicescore=-1,int qualityscore=-1,int npscore=-1)
9361 9411
         {
9362 9412
             int userId = CurrentUser.UserData.F_UserId;
9363 9413
             string cont = "";
@@ -9376,7 +9426,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9376 9426
                         //}
9377 9427
                         decimal evaluationscore = 0;
9378 9428
                         evaluationscore =Convert.ToDecimal(Math.Round((double)(resultscore + effectscore + servicescore + qualityscore)/4,1));//9-10非常满意,7-8满意,5-6一般,5分一下不满意
9379
-                        if (evaluationscore < 5)
9429
+                        if (evaluationscore < 5 && evaluationscore!=-1)
9380 9430
                             cont = "不满意";
9381 9431
                         else if (evaluationscore == 5 || evaluationscore == 6)
9382 9432
                             cont = "一般";
@@ -9384,6 +9434,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
9384 9434
                             cont = "一般";
9385 9435
                         else if (evaluationscore == 9 || evaluationscore == 10)
9386 9436
                             cont = "非常满意";
9437
+                        else if (evaluationscore==-1)
9438
+                            cont = "未评价";
9387 9439
                         model.F_VisitResultScore = resultscore;
9388 9440
                         model.F_EffectiveScore = effectscore;
9389 9441
                         model.F_ServiceAttitude = servicescore;
@@ -9420,7 +9472,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9420 9472
                     if (model != null)
9421 9473
                     {
9422 9474
                         int flag = 0;
9423
-                        var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_WoID='{model.F_ID }'and F_IsUsed=0 and F_WoState={(int)EnumWorkOrderState.finish} order by F_ID desc").FirstOrDefault();
9475
+                        var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_OptType={(int)EnumItemOpt.end} and F_WoID='{model.F_ID }' and F_WoState in({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) order by F_CreateTime desc").FirstOrDefault();                    
9424 9476
                         if (isover == 1)
9425 9477
                         {
9426 9478
                             if (inoutflag > 0)
@@ -9501,9 +9553,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9501 9553
         /// </summary>
9502 9554
         public bool RemindWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string cont)
9503 9555
         {
9504
-
9505
-            string strsql = " and F_Type in(1,2)";
9506
-            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "'"+ strsql + " and F_IsUsed=0 order by F_ID desc");
9556
+            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "' and F_IsUsed=0 order by F_ID desc");
9507 9557
             #region 接收人
9508 9558
             int todept = 0; string touser = ""; int flag = 3;
9509 9559
             if (itemlast != null && itemlast.Count > 0)
@@ -9513,10 +9563,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
9513 9563
                     touser = item.F_NextUser;
9514 9564
                     todept = item.F_NextDept.Value;
9515 9565
                     if (string.IsNullOrWhiteSpace(touser))
9516
-                        touser = item.F_CreateUser;
9517
-                    var usermodel= sysUserAccountBll.GetModel(touser);
9518
-                    if (usermodel != null)
9519
-                        flag = usermodel.F_Flag;
9566
+                        touser = item.F_CreateUser;               
9567
+                     flag = Convert.ToInt32(item.F_Type);
9520 9568
                     #region 读取被催办人部门
9521 9569
                     if (todept == 0 && !string.IsNullOrWhiteSpace(touser))
9522 9570
                     {
@@ -9534,7 +9582,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9534 9582
                     }
9535 9583
                     #endregion
9536 9584
                     var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ")催办工单,催办说明:" + cont;
9537
-                    long itemid = AddLog(model.F_ID, model.F_State.Value, content, (int)EnumItemType.urge, (int)EnumItemOpt.urge, touser, todept, nowUser, model.F_limit, int.Parse(item.F_IsSMS.ToString()),"",0, flag);
9585
+                    long itemid = AddLog(model.F_ID, model.F_State.Value, content, (int)EnumItemType.urge, (int)EnumItemOpt.urge, touser, todept, nowUser, model.F_limit, int.Parse(item.F_IsSMS.ToString()),"",0,flag);
9538 9586
                     if (itemid > 0)
9539 9587
                     {
9540 9588
                         if (!string.IsNullOrWhiteSpace(touser))
@@ -9727,6 +9775,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
9727 9775
                     }
9728 9776
                     else
9729 9777
                     {
9778
+                        model.F_Flag = 9;
9730 9779
                         model.F_State = wostate;
9731 9780
                         model.F_State2 = wostate;
9732 9781
                     }
@@ -9941,28 +9990,18 @@ namespace CallCenterApi.Interface.Controllers.workorder
9941 9990
             var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_ID desc").FirstOrDefault();
9942 9991
             if (itemlast != null)
9943 9992
                 touser = itemlast.F_CreateUser;
9944
-            var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_WoID='{model.F_ID }' and F_WoState={(int)EnumWorkOrderState.finish}");
9993
+            var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_OptType={(int)EnumItemOpt.end} and F_WoID='{model.F_ID }' and F_WoState in({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) order by F_CreateTime desc").FirstOrDefault();
9945 9994
             long nn = 0;
9946
-            if (itemlist.Count > 0)
9995
+            if (itemlist!=null)
9947 9996
             {
9948
-                foreach (var item in itemlist)
9949
-                {
9950
-                    if (item.F_Type == 1 || item.F_Type == 3)
9951
-                    {
9952
-                        model.F_State = wostate;
9953
-                    }
9954
-                    else if (item.F_Type == 2)
9955
-                    {
9956
-                        model.F_State2 = wostate;
9957
-                    }
9958
-                }
9959
-                nn = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.evaluate, optbut, touser, 0, nowUser, model.F_limit, sms);
9997
+                model.F_State = wostate;
9998
+                nn = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.evaluate, optbut, touser, 0, nowUser, model.F_limit, sms,"",0,1);
9960 9999
             }
9961 10000
             else
9962 10001
             {
9963 10002
                 model.F_State = wostate;
9964 10003
                 model.F_State2 = wostate;
9965
-                nn = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.evaluate, optbut, touser, 0, nowUser, model.F_limit, sms);
10004
+                nn = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.evaluate, optbut, touser, 0, nowUser, model.F_limit, sms, "", 0, 1);
9966 10005
             }
9967 10006
             //var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.evaluate, optbut, touser, 0, nowUser, model.F_limit, sms);
9968 10007
             if (nn > 0)
@@ -10042,8 +10081,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
10042 10081
            
10043 10082
             var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_ID desc").FirstOrDefault();
10044 10083
             if (itemlast != null)
10045
-                touser = itemlast.F_CreateUser;         
10046
-            var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_WoID='{model.F_ID }' and F_WoState={(int)EnumWorkOrderState.finish}").FirstOrDefault();
10084
+                touser = itemlast.F_CreateUser;
10085
+            //var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_OptType={(int)EnumItemOpt.end} and F_WoID='{model.F_ID }' and F_WoState in({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) order by F_CreateTime desc").FirstOrDefault();
10047 10086
             if (flag == 1)
10048 10087
             {
10049 10088
                 model.F_State = wostate;//外线关闭
@@ -10140,7 +10179,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
10140 10179
             {
10141 10180
                 model.F_DealResult = "已处理";//处理结果
10142 10181
                 opt = "处理完结";
10143
-                optbut = (int)EnumItemOpt.deal;
10182
+                optbut = (int)EnumItemOpt.end;
10144 10183
                 wostate = (int)EnumWorkOrderState.finish;
10145 10184
                 model.F_DealBy = nowUser.F_UserCode;
10146 10185
                 model.F_DealTime = DateTime.Now;
@@ -10630,40 +10669,39 @@ namespace CallCenterApi.Interface.Controllers.workorder
10630 10669
                 touser = users;
10631 10670
             }
10632 10671
             string htouser = "", htousername = "";
10633
-            if (isApprovalp != 0 && nowUser.F_DeptId == 37)
10634
-            {
10635
-                if (hclid != 0)
10636
-                {
10637
-                    Model.T_Sys_UserAccount clus = sysUserAccountBll.GetModel(hclid);
10638
-                    if (clus != null)
10639
-                    {
10640
-                        if (string.IsNullOrEmpty(htouser))
10641
-                        {
10642
-                            htouser = clus.F_UserCode;
10643
-                            htousername = clus.F_UserName + "(" + clus.F_WorkNumber + ")";
10644
-                        }
10645
-                    }
10646
-                }
10647
-                else
10648
-                {
10649
-                    var list = sysUserAccountBll.GetModelList(" F_DeptId='" + hclbm + "'");
10650
-                    foreach (var l in list)
10651
-                    {
10652
-                        if (string.IsNullOrEmpty(htouser))
10653
-                        {
10654
-                            htouser = l.F_UserCode;
10655
-                            htousername = l.F_UserName + "(" + l.F_WorkNumber + ")";
10656
-                        }
10657
-                        else
10658
-                        {
10659
-                            htouser = htouser + "," + l.F_UserCode;
10660
-                            htousername = htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
10661
-                        }
10662
-                    }
10663
-                }
10664
-              AddLog(model.F_ID, (int)EnumWorkOrderState.assign, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat, 2);
10665
-            }
10666
-
10672
+            //if (isApprovalp != 0 && nowUser.F_DeptId == 37)
10673
+            //{
10674
+            //    if (hclid != 0)
10675
+            //    {
10676
+            //        Model.T_Sys_UserAccount clus = sysUserAccountBll.GetModel(hclid);
10677
+            //        if (clus != null)
10678
+            //        {
10679
+            //            if (string.IsNullOrEmpty(htouser))
10680
+            //            {
10681
+            //                htouser = clus.F_UserCode;
10682
+            //                htousername = clus.F_UserName + "(" + clus.F_WorkNumber + ")";
10683
+            //            }
10684
+            //        }
10685
+            //    }
10686
+            //    else
10687
+            //    {
10688
+            //        var list = sysUserAccountBll.GetModelList(" F_DeptId='" + hclbm + "'");
10689
+            //        foreach (var l in list)
10690
+            //        {
10691
+            //            if (string.IsNullOrEmpty(htouser))
10692
+            //            {
10693
+            //                htouser = l.F_UserCode;
10694
+            //                htousername = l.F_UserName + "(" + l.F_WorkNumber + ")";
10695
+            //            }
10696
+            //            else
10697
+            //            {
10698
+            //                htouser = htouser + "," + l.F_UserCode;
10699
+            //                htousername = htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
10700
+            //            }
10701
+            //        }
10702
+            //    }
10703
+            //    AddLog(model.F_ID, (int)EnumWorkOrderState.assign, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, overtime, sms, creat, 2);
10704
+            //}
10667 10705
             #region 财务审核后,填单人员可以收到到账提醒(短信到账提醒)20220217
10668 10706
             if (nowUser.F_DeptId == 260)
10669 10707
             {
@@ -10679,7 +10717,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
10679 10717
             #region 工单处理
10680 10718
             var opt = "指派";
10681 10719
             int optbut = (int)EnumItemOpt.assign;
10682
-            int wostate = (int)EnumWorkOrderState.assign;//已指派待接单
10720
+            int wostate = (int)EnumWorkOrderState.assign;//已指派待接单         
10683 10721
             #region 读取当前登录人部门
10684 10722
             string deptname = "";
10685 10723
             var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);