zhupei 3 vuotta sitten
vanhempi
commit
108c773e1c

+ 9 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Wo_TempStorage.cs

@@ -55,6 +55,15 @@ namespace CallCenterApi.BLL
55 55
         {
56 56
             return dal.DeleteList(F_Idlist);
57 57
         }
58
+        /// <summary>
59
+        /// 条件删除
60
+        /// </summary>
61
+        /// <param name="where"></param>
62
+        /// <returns></returns>
63
+        public bool DelteByWhere(string where)
64
+        {
65
+            return dal.DelteByWhere(where);
66
+        }
58 67
 
59 68
         /// <summary>
60 69
         /// 得到一个对象实体

+ 23 - 1
codegit/CallCenterApi/CallCenterApi.DAL/T_Wo_TempStorage.cs

@@ -152,7 +152,29 @@ namespace CallCenterApi.DAL
152 152
                 return false;
153 153
             }
154 154
         }
155
-
155
+        /// <summary>
156
+        /// 添加删除
157
+        /// </summary>
158
+        /// <param name="where"></param>
159
+        /// <returns></returns>
160
+        public bool DelteByWhere(string where)
161
+        {
162
+            StringBuilder strSql = new StringBuilder();
163
+            strSql.Append("delete from T_Wo_TempStorage ");
164
+            if (where.Trim() != "")
165
+            {
166
+                strSql.Append(" where " + where);
167
+            }
168
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
169
+            if (rows > 0)
170
+            {
171
+                return true;
172
+            }
173
+            else
174
+            {
175
+                return false;
176
+            }
177
+        }
156 178
 
157 179
         /// <summary>
158 180
         /// 得到一个对象实体

+ 16 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/HomeController.cs

@@ -1,6 +1,7 @@
1 1
 
2 2
 using CallCenter.Utility;
3 3
 using CallCenterApi.Interface.Controllers.Base;
4
+using CallCenterApi.Model;
4 5
 using CallCenterAPI.WechatSDK;
5 6
 using Newtonsoft.Json;
6 7
 using System;
@@ -324,6 +325,21 @@ namespace CallCenterApi.Interface.Controllers
324 325
 
325 326
         }
326 327
 
328
+        public ActionResult mytest(string question2)
329
+        {
330
+            string sql = "";
331
+            string squsdf = string.Format("'{0}'", question2.Replace(",", "','"));
332
+            var QuestionManage = new BLL.T_Wo_QuestionManage().GetModelList("F_QuestionName in (" + squsdf + ")");
333
+            if (QuestionManage != null)
334
+            {
335
+                if (QuestionManage.FirstOrDefault().F_Type == EnumWOType.Complaint.ToString())
336
+                {
337
+                    sql += $"  and T_Wo_WorkOrder.F_QuestionType  in (" + string.Join(",", QuestionManage.Select(T => T.F_Id)) + ")"; ;
338
+                }
339
+            }
340
+            return Success(sql);
341
+        }
342
+
327 343
 
328 344
     }
329 345
 }

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

@@ -52,7 +52,7 @@ namespace CallCenterApi.Interface.Controllers
52 52
                 "F_RoleId",
53 53
                 "*",
54 54
                 sql,
55
-                "",
55
+                "ORDER BY F_RoleId desc",
56 56
                 pageSize,
57 57
                 pageIndex,
58 58
                 true,

+ 5 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -380,8 +380,12 @@ namespace CallCenterApi.Interface.Controllers.customer
380 380
                 var model = new object();
381 381
                 var sql = $" and  F_LegalPhone  = '" + tel.Trim() + "'";
382 382
                 var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
383
-                if (tel.Trim().Length == 11 && tel.Substring(0, 1) != "0")
383
+                if (tel.Trim().Length == 11 || tel.Trim().Length == 12 )
384 384
                 {
385
+                    if (tel.Substring(0, 1) == "0")
386
+                    {
387
+                        tel=tel.Substring(1, tel.Length-1);
388
+                    }
385 389
                     BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
386 390
                     Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList(" F_MobileNum='" + tel.Substring(0, 7) + "' ").FirstOrDefault();
387 391
 

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeController.cs

@@ -854,7 +854,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
854 854
                         model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
855 855
                         model_T_Sys_Accessories.F_FileName = filePathName;//附件名称
856 856
                         model_T_Sys_Accessories.F_FileType = type;//附件类型
857
-                        model_T_Sys_Accessories.F_FileUrl = (path+filePathName).Replace('\\', '/');//附件地址
857
+                        model_T_Sys_Accessories.F_FileUrl = filePathName.Replace('\\', '/');//附件地址
858 858
                         model_T_Sys_Accessories.F_Size = size;
859 859
                         //     model_T_Sys_Accessories.F_UserCode = userCode;//上传人  
860 860
                         model_T_Sys_Accessories.F_OriName = oriname;

+ 369 - 184
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -1092,7 +1092,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1092 1092
                                 if (GetDeptUserCode(ua.F_DeptId) != "")
1093 1093
                                 {
1094 1094
                                     //sql += " and (F_State in(10,11) or  F_State2 in(10,11))";
1095
-                                    sql += " and ((F_State in(10,11) and F_Flag = null ) 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))))";
1095
+                                    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 1096
                                     sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
1097 1097
                                 }
1098 1098
                                 //  sql += " and F_State in(10,11) and F_DealBy = '" + ua.F_UserCode + "' ";
@@ -1309,7 +1309,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1309 1309
                 List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
1310 1310
                 if (modlelist.Count > 0)
1311 1311
                 {
1312
-                    List<WorkOrderNewInput> Input = modeltooip(modlelist, ua);
1312
+                    List<WorkOrderNewInput> Input = modeltooip(modlelist, ua,state);
1313 1313
                     var obj = new
1314 1314
                     {
1315 1315
                         state = "success",
@@ -1542,7 +1542,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1542 1542
                     }
1543 1543
                     else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "BLRY" || ro.F_RoleCode == "ZG" || ro.F_RoleCode == "GC")
1544 1544
                     {
1545
-                        string markdepts = "37,57,74,88,268,295,339,422,213,427";
1545
+                        string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
1546 1546
                         string qualdepts = "12,36,295,245";
1547 1547
                         string detpid = "" + ua.F_DeptId;
1548 1548
                         var deparmentlist = new List<Model.T_Sys_Department>();
@@ -1922,7 +1922,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1922 1922
                         sql = "";
1923 1923
                         sql += $"  F_IsDelete=0";
1924 1924
                         //sql += " and (F_State in(10,11) or  F_State2 in(10,11))";
1925
-                        sql += " and ((F_State in(10,11) and F_Flag = null ) 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))))";
1925
+                        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))))";
1926 1926
                         if (GetDeptUserCode(ua.F_DeptId) != "")
1927 1927
                         {
1928 1928
                             sql += "  and F_DealBy in(" + GetDeptUserCode(ua.F_DeptId) + ") ";
@@ -2091,7 +2091,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2091 2091
                         else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "BLRY" || ro.F_RoleCode == "ZG" || ro.F_RoleCode == "GC")
2092 2092
                         {
2093 2093
 
2094
-                            string markdepts = "37,57,74,88,268,295,339,422,213,427";
2094
+                            string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
2095 2095
                             string qualdepts = "12,36,295,245";
2096 2096
                             string detpid = "" + ua.F_DeptId;
2097 2097
                             var deparmentlist = new List<Model.T_Sys_Department>();
@@ -2223,31 +2223,18 @@ namespace CallCenterApi.Interface.Controllers.weixin
2223 2223
                     if (model != null)
2224 2224
                     {
2225 2225
                         #region 添加注解表
2226
-                        Model.T_Wo_AnnotationTab annotab = new T_Wo_AnnotationTab();
2227
-                        annotab.F_Contents = cont;
2228
-                        annotab.F_AnnotationPerson = ua.F_UserCode;
2229
-                        annotab.F_CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
2230
-                        annotab.F_Wocode = model.F_ID;
2231
-                        new BLL.T_Wo_AnnotationTab().Add(annotab);
2226
+                        //Model.T_Wo_AnnotationTab annotab = new T_Wo_AnnotationTab();
2227
+                        //annotab.F_Contents = cont;
2228
+                        //annotab.F_AnnotationPerson = ua.F_UserCode;
2229
+                        //annotab.F_CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
2230
+                        //annotab.F_Wocode = model.F_ID;
2231
+                        //new BLL.T_Wo_AnnotationTab().Add(annotab);
2232 2232
                         #endregion
2233
-                        Annotationstr = cont + "-" + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
2233
+                        //Annotationstr = cont + "-" + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
2234
+                        Annotationstr = ua.F_UserName + "(" + ua.F_WorkNumber + ")" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "  " + cont + ";";
2234 2235
                         if (flag == 1)
2235 2236
                         {
2236
-                            if (ro.F_RoleCode == "XTGLY")
2237
-                            {
2238
-                                model.F_Annotation = Annotationstr;
2239
-                            }
2240
-                            else
2241
-                            {
2242
-                                if (string.IsNullOrEmpty(model.F_Annotation))
2243
-                                {
2244
-                                    model.F_Annotation = Annotationstr;
2245
-                                }
2246
-                                else
2247
-                                {
2248
-                                    model.F_Annotation = model.F_Annotation + "\n" + Annotationstr;
2249
-                                }
2250
-                            }
2237
+                            model.F_Annotation = Annotationstr;
2251 2238
 
2252 2239
 
2253 2240
                         }
@@ -2269,7 +2256,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2269 2256
                             string touser = "";
2270 2257
                             string strwhere = "";
2271 2258
                             string contens = "";
2272
-                            strwhere = $" F_DeptId in (select top 1 F_NextDept  from T_Wo_WorkOrderItem_New where F_WoID={model.F_ID} and F_NextDept in(37,57,74,88,268,295,339,422,213,427) order by F_CreateTime desc)";
2259
+                            strwhere = $" F_DeptId in (select top 1 F_NextDept  from T_Wo_WorkOrderItem_New where F_WoID={model.F_ID} and F_NextDept in(37,57,74,88,268,295,339,422,213,427,433) order by F_CreateTime desc)";
2273 2260
                             var deptmodel = departmentBLL.GetModelList(strwhere).FirstOrDefault();
2274 2261
                             if (deptmodel != null)
2275 2262
                             {
@@ -2750,8 +2737,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
2750 2737
             }
2751 2738
             else if (CirculMarket(ua.F_DeptId, 20))
2752 2739
             {
2753
-                nextda = 295;
2754
-                opt = "流转新乡黑科质检";
2740
+                nextda = 422;
2741
+                opt = "流转营销中心市场科";
2742
+                //nextda = 295;
2743
+                //opt = "流转新乡黑科质检";
2755 2744
             }
2756 2745
             else if (CirculMarket(ua.F_DeptId, 332))
2757 2746
             {
@@ -2840,7 +2829,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2840 2829
             if (!string.IsNullOrEmpty(OpenId))
2841 2830
             {
2842 2831
                 int woflag = 0;
2843
-                string markdepts = "37,57,74,88,268,295,339,213,427";
2832
+                string markdepts = "37,57,74,88,268,295,339,213,427,433";
2844 2833
                 string sqlstr = "";
2845 2834
                 if (id <= 0)
2846 2835
                 {
@@ -2906,7 +2895,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2906 2895
         /// 查询工单详情
2907 2896
         /// </summary>
2908 2897
         [WechatActionFilter]
2909
-        public ActionResult GetDetails(string OpenId, int id,int flag=1)
2898
+        public ActionResult GetDetails(string OpenId, int id,int flag=1,int state=0)
2910 2899
         {
2911 2900
             if (!string.IsNullOrEmpty(OpenId))
2912 2901
             {
@@ -2950,7 +2939,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2950 2939
                 }
2951 2940
                 if (list.Count > 0)
2952 2941
                 {
2953
-                    List<WorkOrderNewInput> Input = modeltooip(list, ua);
2942
+                    List<WorkOrderNewInput> Input = modeltooip(list, ua,state);
2954 2943
                     if (Input != null)
2955 2944
                     {
2956 2945
                         var obj = new
@@ -2983,22 +2972,72 @@ namespace CallCenterApi.Interface.Controllers.weixin
2983 2972
         /// </summary>
2984 2973
         /// <param name="fid"></param>
2985 2974
         /// <returns></returns>
2986
-        public int? GetNodeState(int fid, string usercode)
2975
+        public int? GetNodeState(int fid, string usercode, int state = 0)
2987 2976
         {
2988 2977
             int? flag = 0;
2989 2978
 
2990
-            string markdepts = "37,57,74,88,268,295,339,213,427";
2979
+            string markdepts = "37,57,74,88,268,295,339,213,427,433";
2991 2980
             if (!string.IsNullOrEmpty(usercode))
2992 2981
             {
2993 2982
                 Model.T_Sys_UserAccount ua = userAccountBLL.GetModel(usercode);
2994 2983
                 var itemlast = 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").FirstOrDefault();
2995 2984
                 if (itemlast != null)
2996 2985
                 {
2986
+                    int? wostate1 = 0, wostate2 = 0; int i = 0;
2997 2987
                     //if (!markdepts.Contains(ua.F_DeptId.ToString()))
2998 2988
                     //{
2989
+                    if (state == 2)
2990
+                        state = 1;
2991
+                    else if (state == 4)
2992
+                        state = 2;
2993
+                    else
2994
+                        state = 0;
2999 2995
                     if (itemlast.F_Flag != 9)
3000 2996
                     {
3001
-                        flag = itemlast.F_Type;
2997
+                        var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_IsUsed=0 and  F_WoID='" + fid + "' and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc");
2998
+                        if (itemnext.Count > 0 && itemnext.Count == 2)
2999
+                        {
3000
+                            foreach (var item in itemnext)
3001
+                            {
3002
+                                if (i == 0)
3003
+                                {
3004
+                                    wostate1 = item.F_WoState;
3005
+                                }
3006
+                                else
3007
+                                {
3008
+                                    wostate2 = item.F_WoState;
3009
+                                }
3010
+                                i++;
3011
+                            }
3012
+                            if (wostate1 == wostate2 || (wostate2 == 2 && wostate1 == 17) || (wostate1 == 2 && wostate2 == 17))
3013
+                            {
3014
+                                flag = 3;//需要判断处理内线还是外线
3015
+                            }
3016
+                            else if (state > 0)
3017
+                            {
3018
+                                flag = itemnext.Where(t => t.F_WoState == state || t.F_WoState == 17 || t.F_WoState == 4 || t.F_WoState == 3).FirstOrDefault().F_Type;
3019
+                            }
3020
+                        }
3021
+                        else if (itemnext.Count > 0)
3022
+                        {
3023
+                            flag = itemnext.FirstOrDefault().F_Type;
3024
+                        }
3025
+                        else
3026
+                        {
3027
+                            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");
3028
+                            if (itemnext2.Count > 0 && itemnext2.Count == 2)
3029
+                            {
3030
+                                flag = 3;
3031
+                            }
3032
+                            else if (itemnext2.Count > 0)
3033
+                            {
3034
+                                flag = itemnext2.FirstOrDefault().F_Type;
3035
+                            }
3036
+                            else
3037
+                            {
3038
+                                flag = itemlast.F_Type;
3039
+                            }
3040
+                        }
3002 3041
                     }
3003 3042
                     //}
3004 3043
                     else if (itemlast.F_Flag == 9)
@@ -3009,18 +3048,45 @@ namespace CallCenterApi.Interface.Controllers.weixin
3009 3048
                         }
3010 3049
                         else
3011 3050
                         {
3012
-                            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();
3013
-                            if (itemnext != null)
3014
-                                flag = itemnext.F_Type;
3015
-                            if (flag != 1 || flag != 2)
3051
+                            var itemnext = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_IsUsed=0 and  F_WoID='" + fid + "' and F_NextUser like '%" + ua.F_UserCode + "%' order by F_ID desc");
3052
+                            if (itemnext.Count > 0 && itemnext.Count == 2)
3053
+                            {
3054
+                                foreach (var item in itemnext)
3055
+                                {
3056
+                                    if (i == 0)
3057
+                                    {
3058
+                                        wostate1 = item.F_WoState;
3059
+                                    }
3060
+                                    else
3061
+                                    {
3062
+                                        wostate2 = item.F_WoState;
3063
+                                    }
3064
+                                    i++;
3065
+                                }
3066
+                                if (wostate1 == wostate2 || (wostate2 == 2 && wostate1 == 17) || (wostate1 == 2 && wostate2 == 17))
3067
+                                {
3068
+                                    flag = 3;//需要判断处理内线还是外线
3069
+                                }
3070
+                                else if (state > 0)
3071
+                                {
3072
+                                    flag = itemnext.Where(t => t.F_WoState == state || t.F_WoState == 17 || t.F_WoState == 4 || t.F_WoState == 3).FirstOrDefault().F_Type;
3073
+                                }
3074
+                            }
3075
+                            else if(itemnext.Count > 0)
3076
+                            {
3077
+                                flag = itemnext.FirstOrDefault().F_Type;
3078
+                            }
3079
+                            else
3016 3080
                             {
3017 3081
                                 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");
3018
-                                if (itemnext2 != null)
3082
+                                if (itemnext2.Count > 0)
3083
+                                {
3019 3084
                                     foreach (var item in itemnext2)
3020 3085
                                     {
3021
-                                        if(item.F_WoState!=10)
3022
-                                        flag = item.F_Type;
3086
+                                        if (item.F_WoState != 10)
3087
+                                            flag = item.F_Type;
3023 3088
                                     }
3089
+                                }
3024 3090
                             }
3025 3091
                         }
3026 3092
                     }
@@ -3252,7 +3318,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3252 3318
         /// <summary>
3253 3319
         /// 根据model返回CustomerBaseNewInput对象
3254 3320
         /// </summary>
3255
-        private List<WorkOrderNewInput> modeltooip(List<Model.T_Wo_WorkOrder> model1, Model.T_Sys_UserAccount ua)
3321
+        private List<WorkOrderNewInput> modeltooip(List<Model.T_Wo_WorkOrder> model1, Model.T_Sys_UserAccount ua,int state=0)
3256 3322
         {
3257 3323
             if (model1 != null && model1.Count > 0)
3258 3324
             {
@@ -3592,9 +3658,14 @@ namespace CallCenterApi.Interface.Controllers.weixin
3592 3658
                     else
3593 3659
                         model.F_TS_Quantity = "";
3594 3660
                     model.F_TS_Level = model1[i].F_TS_Level;//投诉-重要级别:轻微、一般、较大、重大
3595
-                    if (model1[i].MaterialItems != null)
3661
+                    if (model1[i].F_SC_PreliminaryOpinion == "退换货")
3596 3662
                     {
3597
-                        model.MaterialItems = model1[i].MaterialItems;  //退换货多物料信息
3663
+                        List<T_Wo_MaterialItems> materlist = new BLL.T_Wo_MaterialItems().GetModelList($" F_WoID={model.F_ID}");
3664
+                        if (materlist != null)
3665
+                        {
3666
+                            model.MaterialItems = materlist;
3667
+                            model.F_ZL_Fquantity = materlist.Sum(x => x.F_ReturnQuantity).ToString();
3668
+                        }
3598 3669
                     }
3599 3670
                     else
3600 3671
                         model.MaterialItems = null;
@@ -3642,7 +3713,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3642 3713
                     model.F_ZL_CompensationMethod = model1[i].F_ZL_CompensationMethod;//质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
3643 3714
                     model.F_ZL_CompensationMoney = model1[i].F_ZL_CompensationMoney;// 质量管理科-补偿钱款
3644 3715
                     model.F_ZL_CResponsibleUnits = model1[i].F_ZL_CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
3645
-                    model.F_ZL_Fquantity = model1[i].F_ZL_Fquantity;// 质量管理科-确认实收数量(吨)
3716
+                    //model.F_ZL_Fquantity = model1[i].F_ZL_Fquantity;// 质量管理科-确认实收数量(吨)
3646 3717
                     model.F_ZL_ImprovementRequirements = model1[i].F_ZL_ImprovementRequirements;//质量管理科-改进要求
3647 3718
                     model.F_ZL_CApprovalNo = model1[i].F_ZL_CApprovalNo;//质量管理科-对应审批工作流单号
3648 3719
                     model.F_ZL_CJ_IsRecord = model1[i].F_ZL_CJ_IsRecord;//质量管理科-抽检-未备案、已备案
@@ -3814,7 +3885,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3814 3885
                     model.F_Manufacturers = model1[i].F_Manufacturers;//质量管理科-原料及厂家
3815 3886
                     model.F_ProductionNum = model1[i].F_ProductionNum;//质量管理科-该批次生产数量
3816 3887
                     model.F_Flag = model1[i].F_Flag;//1单线外 2单线内 3双线 9市场科可以双线指派工单 0 未指派工单
3817
-                    model.inout = GetNodeState(model1[i].F_ID,ua.F_UserCode);
3888
+                    model.inout = GetNodeState(model1[i].F_ID,ua.F_UserCode,state);
3818 3889
                     if (ua != null)
3819 3890
                     {
3820 3891
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
@@ -4800,7 +4871,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
4800 4871
                 {
4801 4872
                     var tempmodel = new BLL.T_Wo_TempStorage().GetModel(tempid);
4802 4873
                     if (tempmodel != null)
4803
-                        new BLL.T_Wo_TempStorage().Delete(tempid);
4874
+                        new BLL.T_Wo_TempStorage().DelteByWhere($"F_CreateBy={ua.F_UserCode}");
4804 4875
                 }
4805 4876
                 #endregion
4806 4877
 
@@ -4894,8 +4965,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
4894 4965
 
4895 4966
                                 else if (CirculMarket(ua.F_DeptId, 20))
4896 4967
                                 {
4897
-                                    nextda = 295;
4898
-                                    opt = "流转新乡黑科质检";
4968
+                                    nextda = 422;
4969
+                                    opt = "流转营销中心市场科";
4970
+                                    //nextda = 295;
4971
+                                    //opt = "流转新乡黑科质检";
4899 4972
                                 }
4900 4973
                                 else if (CirculMarket(ua.F_DeptId, 332))
4901 4974
                                 {
@@ -5101,7 +5174,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5101 5174
         /// <returns></returns>
5102 5175
         [WechatActionFilter]
5103 5176
         public ActionResult AssignWorkOrder(string OpenId, long orderid, string cont, WorkOrdeDeptment deptment, string F_Files, int isvisit = 1,
5104
-            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)
5177
+            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)
5105 5178
         {
5106 5179
 
5107 5180
             if (!string.IsNullOrEmpty(OpenId))
@@ -5140,7 +5213,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5140 5213
                      sms = (int)itemlast.F_IsSMS;
5141 5214
                 }
5142 5215
                 WorkOrderNewInput input = new WorkOrderNewInput();
5143
-                string markdepts = "37,57,74,88,268,295,339,422,213,427";
5216
+                string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
5144 5217
                 string qualdepts = "12,36,295,245";
5145 5218
                 if (ua != null)
5146 5219
                 {
@@ -5204,7 +5277,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5204 5277
                                 return Error("请选择接收部门");
5205 5278
                             }
5206 5279
                             var res1 = AssignWO(ua, model, input, cont, F_Files, clbm2, clid2, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 2, flag);
5207
-                            DealWO(ua, model,"", input, "", 1, "", 1,"", flag);
5280
+                            Overorder(ua, model, 1);
5208 5281
                         }
5209 5282
                         else
5210 5283
                         {
@@ -5213,7 +5286,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5213 5286
                                 return Error("请选择接收部门");
5214 5287
                             }
5215 5288
                             var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid, "", 0, 1, flag);
5216
-                            DealWO(ua, model, "", input, "", 1, "", 2, "", flag);
5289
+                            Overorder(ua, model, 2);
5217 5290
                         }
5218 5291
                         return Success("转派成功");
5219 5292
                     }
@@ -5264,33 +5337,33 @@ namespace CallCenterApi.Interface.Controllers.weixin
5264 5337
                                             input.F_ZL_ResponsibleUnit = deptment.ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
5265 5338
 
5266 5339
                                         }
5267
-                                        else if (deptmodel.F_DeptName == "成品库" && model.F_SC_PreliminaryOpinion == "退换货" ) //退换货成品库录入物料信息
5268
-                                        {
5269
-                                            if (!string.IsNullOrEmpty(jsonstr))
5270
-                                            {
5271
-                                                JavaScriptSerializer Serializer = new JavaScriptSerializer();   //实例化⼀个能够序列化数据的类
5272
-                                                List<Material> list = Serializer.Deserialize<List<Material>>(jsonstr);
5273
-                                                List<T_Wo_MaterialItems> itemlist = new List<T_Wo_MaterialItems>();
5274
-
5275
-                                                if (list != null && list.Count > 0)
5276
-                                                {
5277
-                                                    foreach (var item in list)
5278
-                                                    {
5279
-                                                        T_Wo_MaterialItems itemodel = new T_Wo_MaterialItems();
5280
-                                                        itemodel.F_MaterialCode = item.materialcode;
5281
-                                                        itemodel.F_MaterialName = item.materialname;
5282
-                                                        itemodel.F_Formula = item.formula;
5283
-                                                        itemodel.F_ReturnQuantity = item.returnum??0;
5284
-                                                        itemodel.F_WoID = model.F_ID;//工单id
5285
-                                                        itemodel.F_CreateOn = DateTime.Now;
5286
-                                                        itemodel.F_Remark = item.specs;//规格
5287
-                                                        itemlist.Add(itemodel);
5288
-                                                    }
5289
-                                                    model.MaterialItems = itemlist;
5290
-                                                }
5291
-                                            }
5340
+                                        //else if (deptmodel.F_DeptName == "成品库" && model.F_SC_PreliminaryOpinion == "退换货" ) //退换货成品库录入物料信息
5341
+                                        //{
5342
+                                        //    if (!string.IsNullOrEmpty(jsonstr))
5343
+                                        //    {
5344
+                                        //        JavaScriptSerializer Serializer = new JavaScriptSerializer();   //实例化⼀个能够序列化数据的类
5345
+                                        //        List<Material> list = Serializer.Deserialize<List<Material>>(jsonstr);
5346
+                                        //        List<T_Wo_MaterialItems> itemlist = new List<T_Wo_MaterialItems>();
5347
+
5348
+                                        //        if (list != null && list.Count > 0)
5349
+                                        //        {
5350
+                                        //            foreach (var item in list)
5351
+                                        //            {
5352
+                                        //                T_Wo_MaterialItems itemodel = new T_Wo_MaterialItems();
5353
+                                        //                itemodel.F_MaterialCode = item.materialcode;
5354
+                                        //                itemodel.F_MaterialName = item.materialname;
5355
+                                        //                itemodel.F_Formula = item.formula;
5356
+                                        //                itemodel.F_ReturnQuantity = item.returnum??0;
5357
+                                        //                itemodel.F_WoID = model.F_ID;//工单id
5358
+                                        //                itemodel.F_CreateOn = DateTime.Now;
5359
+                                        //                itemodel.F_Remark = item.specs;//规格
5360
+                                        //                itemlist.Add(itemodel);
5361
+                                        //            }
5362
+                                        //            model.MaterialItems = itemlist;
5363
+                                        //        }
5364
+                                        //    }
5292 5365
 
5293
-                                        }
5366
+                                        //}
5294 5367
                                         else if (deptmodel.F_DeptId == 248 && model.F_SC_PreliminaryOpinion == "退换货")
5295 5368
                                         {
5296 5369
                                             input.F_CarNumber = deptment.CarNumber;//返厂车牌号
@@ -5371,8 +5444,23 @@ namespace CallCenterApi.Interface.Controllers.weixin
5371 5444
                                 return Error("请选择接收部门");
5372 5445
                             }
5373 5446
                         }
5374
-                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and (F_CreateUser={ua.F_UserCode} or F_NextUser like '%{ua.F_UserCode}%') and F_IsUsed=0 order by   F_ID desc ").FirstOrDefault();
5375
-                        var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid, "", 0, Convert.ToInt32(modellist.F_Type));
5447
+                        var modellist = 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 ");
5448
+                        int? zflag = 0;
5449
+                        if (inoutflag != 0)
5450
+                        {
5451
+                            zflag = inoutflag;
5452
+                        }
5453
+                        else if (modellist.Count > 0)
5454
+                        {
5455
+                            zflag = modellist.FirstOrDefault().F_Type;
5456
+                        }
5457
+                        if (zflag != 3)
5458
+                        {
5459
+                            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();
5460
+                            if (modeldpts != null)
5461
+                                return Error("不允许同一个部门出现在两条线内,请重新指派!");
5462
+                        }
5463
+                        var res = AssignWO(ua, model, input, cont, F_Files, clbm, clid, overtime, sms, isApprovalp, hclbm, hclid, "", 0, Convert.ToInt32(zflag));
5376 5464
                         if (res)
5377 5465
                         {
5378 5466
                             return Success("转派成功");
@@ -5386,6 +5474,66 @@ namespace CallCenterApi.Interface.Controllers.weixin
5386 5474
             return Error("无操作权限!");
5387 5475
         }
5388 5476
         /// <summary>
5477
+        /// 完结工单
5478
+        /// </summary>
5479
+        /// <param name="nowUser"></param>
5480
+        /// <param name="model"></param>
5481
+        /// <param name="isOver"></param>
5482
+        /// <param name="flag"></param>
5483
+        /// <returns></returns>
5484
+        public bool Overorder(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, int isOver = 0)
5485
+        {
5486
+            #region 工单处理
5487
+            int sms = 0;
5488
+            var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.visit + " and  F_WoID=" + model.F_ID + " ");
5489
+            if (itemlasts.Count > 0)
5490
+            {
5491
+                foreach (var it in itemlasts)
5492
+                {
5493
+                    if (it.F_WoState == 1)
5494
+                    {
5495
+                        sms = int.Parse(it.F_IsSMS.ToString());
5496
+                    }
5497
+                }
5498
+            }
5499
+            int optbut = (int)EnumItemOpt.end;
5500
+            int wostate = (int)EnumWorkOrderState.evaluate;
5501
+
5502
+            #region 读取当前登录人部门
5503
+            string deptname = "";
5504
+            var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
5505
+            if (deptmodel != null)
5506
+            {
5507
+                deptname = deptmodel.F_DeptName + "-";
5508
+            }
5509
+            #endregion
5510
+            var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") 完结工单";
5511
+
5512
+            //var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, touser, 0, nowUser, model.F_limit, sms);
5513
+            if (isOver >= 1)
5514
+            {
5515
+                #region 处理工单
5516
+                model.F_VisitOn = DateTime.Now;
5517
+                if (isOver == 1)
5518
+                {
5519
+                    AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, "", 0, nowUser, model.F_limit, sms, "", 0, 1);
5520
+                    model.F_State = wostate;  //外线关闭
5521
+                }
5522
+                else if (isOver == 2)
5523
+                {
5524
+                    AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, "", 0, nowUser, model.F_limit, sms, "", 0, 2);
5525
+                    model.F_State2 = wostate; //内线关闭
5526
+                }
5527
+                
5528
+                woBLL.Update(model);
5529
+                #endregion
5530
+                return true;
5531
+            }
5532
+            else
5533
+                return false;
5534
+            #endregion
5535
+        }
5536
+        /// <summary>
5389 5537
         /// 转派工单
5390 5538
         /// </summary>
5391 5539
         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, int flag = 1, int flagstate = 0)
@@ -5544,7 +5692,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5544 5692
                 #region 处理工单
5545 5693
                 //工单完结要更新工单的状态
5546 5694
                 //   model.F_DealBy = touser;
5547
-                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && model.F_State2 == 10 && flag == 3))
5695
+                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && flag == 3))
5548 5696
                 {
5549 5697
                     model.F_State = wostate;
5550 5698
                 }
@@ -5900,7 +6048,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5900 6048
         /// <returns></returns>
5901 6049
 
5902 6050
         [WechatActionFilter]
5903
-        public ActionResult SureWorkOrder(long orderid, string OpenId)
6051
+        public ActionResult SureWorkOrder(long orderid, string OpenId,int inoutflag=0)
5904 6052
         {
5905 6053
             if (!string.IsNullOrEmpty(OpenId))
5906 6054
             {
@@ -5911,6 +6059,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
5911 6059
                     Model.T_Wo_WorkOrder model = woBLL.GetModel(orderid);
5912 6060
                     if (model != null)
5913 6061
                     {
6062
+                        int? zflag = 0;
5914 6063
                         //string strsql = "";
5915 6064
                         //if (ua.F_Flag == 1)
5916 6065
                         //{
@@ -5934,7 +6083,14 @@ namespace CallCenterApi.Interface.Controllers.weixin
5934 6083
                             if (isused <= 0)
5935 6084
                                 return Error("工单已接单无需重新接单");
5936 6085
                         }
5937
-                        int? zflag = modellist.F_Type;
6086
+                        if (inoutflag != 0)
6087
+                        {
6088
+                            zflag = inoutflag;
6089
+                        }
6090
+                        else
6091
+                        {
6092
+                            zflag = modellist.F_Type;
6093
+                        }
5938 6094
                         var res = SureWO(ua, model, Convert.ToInt32(zflag));
5939 6095
                         if (res)
5940 6096
                             return Success("接单成功");
@@ -6036,7 +6192,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6036 6192
             if (itemid > 0)
6037 6193
             {
6038 6194
                 #region 处理工单
6039
-                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && model.F_State2 == 10 && flag == 3))
6195
+                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0)  && flag == 3))
6040 6196
                 {
6041 6197
                     model.F_State = wostate;//已接单待处理
6042 6198
                 }
@@ -6049,7 +6205,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6049 6205
                     model.F_State = wostate;//已接单待处理
6050 6206
                     model.F_State2 = wostate;//已接单待处理
6051 6207
                 }
6052
-                model.F_DealBy = nowUser.F_UserCode;//已接单待处理
6208
+                //model.F_DealBy = nowUser.F_UserCode;//已接单待处理
6053 6209
                 woBLL.Update(model);
6054 6210
                 #endregion
6055 6211
                 #region 推送消息
@@ -6088,9 +6244,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
6088 6244
         [WechatActionFilter]
6089 6245
         public ActionResult DealWorkOrder(string OpenId, long orderid, string F_Files, string cont, WorkOrdeDeptment deptment,
6090 6246
          string uncont = "",
6091
-        int isvisit = 1, int isover = 0)
6247
+        int isvisit = 1, int isover = 0, int inoutflag = 0)
6092 6248
         {
6093
-            string markdepts = "37,57,74,88,268,295,339,422,213,427";
6249
+            string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6094 6250
             string qualdepts = "12,36,295,245";
6095 6251
             if (!string.IsNullOrEmpty(OpenId))
6096 6252
             {
@@ -6120,6 +6276,17 @@ namespace CallCenterApi.Interface.Controllers.weixin
6120 6276
                             //    strsql = " and F_Type in(2,3)";
6121 6277
                             //}
6122 6278
                             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();
6279
+
6280
+                            int? zflag = 0;
6281
+                            if (inoutflag != 0)
6282
+                            {
6283
+                                zflag = inoutflag;
6284
+                            }
6285
+                            else
6286
+                            {
6287
+                                zflag = modellist.F_Type;
6288
+                            }
6289
+
6123 6290
                             if (modellist == null)
6124 6291
                             {
6125 6292
                                 //if (modellist.F_NextUser != ua.F_UserCode)
@@ -6147,7 +6314,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6147 6314
                                 return Error("工单已处理请勿重复操作!");
6148 6315
                             else
6149 6316
                             {
6150
-                                var res = DealWO(ua, model, F_Files, input, cont, isover, uncont, Convert.ToInt32(modellist.F_Type));
6317
+                                var res = DealWO(ua, model, F_Files, input, cont, isover, uncont, Convert.ToInt32(zflag));
6151 6318
                                 if (res)
6152 6319
                                     return Success("处理成功");
6153 6320
                                 else
@@ -6260,7 +6427,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6260 6427
         /// <returns></returns>
6261 6428
 
6262 6429
         [WechatActionFilter]
6263
-        public ActionResult BackWorkOrder(string OpenId, long orderid, string cont, int type = 0)
6430
+        public ActionResult BackWorkOrder(string OpenId, long orderid, string cont, int type = 0, int inoutflag = 0)
6264 6431
         {//办理人员和监管可以退回工单
6265 6432
             if (!string.IsNullOrEmpty(OpenId))
6266 6433
             {
@@ -6274,28 +6441,36 @@ namespace CallCenterApi.Interface.Controllers.weixin
6274 6441
                     if (model != null)
6275 6442
                     {
6276 6443
                         int flag = 0;
6277
-                        string markdepts = "37,57,74,88,268,295,339,422,213,427";
6278
-                        var modellist = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_IsUsed=0 and (F_CreateUser={ua.F_UserCode} or F_NextUser like '%{ua.F_UserCode}%')  order by   F_ID desc ").FirstOrDefault();
6444
+                        //string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6445
+                        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();
6446
+
6279 6447
 
6280 6448
                         if (modellist == null)
6281 6449
                         {
6282 6450
                             return Error("非接单人不可操作工单");
6283 6451
                         }
6284 6452
 
6285
-                        if (!string.IsNullOrEmpty(modellist.F_CreateUser))
6453
+                        //if (!string.IsNullOrEmpty(modellist.F_CreateUser))
6454
+                        //{
6455
+                        //    var deptid = userAccountBLL.GetModel(modellist.F_CreateUser.ToString())?.F_DeptId;
6456
+                        //    if (markdepts.Contains(deptid.ToString()))
6457
+                        //    {
6458
+                        //        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();
6459
+                        //        if (itemnext.F_Flag == 9)
6460
+                        //        {
6461
+                        //            model.F_Flag = 9;
6462
+                        //        }
6463
+
6464
+                        //    }
6465
+                        //}
6466
+                        if (inoutflag != 0)
6286 6467
                         {
6287
-                            var deptid = userAccountBLL.GetModel(modellist.F_CreateUser.ToString())?.F_DeptId;
6288
-                            if (markdepts.Contains(deptid.ToString()))
6289
-                            {
6290
-                                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();
6291
-                                if (itemnext.F_Flag == 9)
6292
-                                {
6293
-                                    model.F_Flag = 9;
6294
-                                }
6295
-
6296
-                            }
6468
+                            flag = inoutflag;
6469
+                        }
6470
+                        else
6471
+                        {
6472
+                            flag = Convert.ToInt32(modellist.F_Type);
6297 6473
                         }
6298
-                        flag = Convert.ToInt32(Convert.ToInt32(modellist.F_Type));
6299 6474
                         var res = BackWO(ua, model, cont, type, flag);
6300 6475
                         if (res)
6301 6476
                             return Success("退回成功");
@@ -6316,7 +6491,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6316 6491
         /// <param name="cont"></param>
6317 6492
         /// <returns></returns>
6318 6493
         [WechatActionFilter]
6319
-        public ActionResult RevokeWo(string OpenId, long orderid, string cont)
6494
+        public ActionResult RevokeWo(string OpenId, long orderid, string cont, int inoutflag = 0)
6320 6495
         {
6321 6496
 
6322 6497
             if (!string.IsNullOrEmpty(OpenId))
@@ -6330,7 +6505,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6330 6505
                     if (model != null)
6331 6506
                     {
6332 6507
                         int flag = 0;
6333
-                        string markdepts = "37,57,74,88,268,295,339,422,213,427";
6508
+                        string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6334 6509
                         Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
6335 6510
                         var modelnext = new BLL.T_Wo_WorkOrderItem_New().GetModelList($"F_WoID={model.F_ID} and F_OptType=1  and F_CreateUser={ua.F_UserCode} order by   F_ID desc ");
6336 6511
 
@@ -6341,38 +6516,45 @@ namespace CallCenterApi.Interface.Controllers.weixin
6341 6516
                                 if (item.F_IsUsed == 1)
6342 6517
                                     return Error("撤回失败,无法撤回!");
6343 6518
                             }
6344
-                            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 ");
6345
-                            if (modellist == null)
6346
-                            { return Error("无操作权限"); }
6347
-                            if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
6519
+                            if (inoutflag != 0)
6348 6520
                             {
6349
-                                flag = 3;
6521
+                                flag = inoutflag;
6350 6522
                             }
6351
-                            else if (modellist != null && modellist.Count > 0)
6523
+                            else
6352 6524
                             {
6353
-                                if (markdepts.Contains(ua.F_DeptId.ToString()))
6525
+                                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 ");
6526
+                                if (modellist == null)
6527
+                                { return Error("无操作权限"); }
6528
+                                if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
6529
+                                {
6530
+                                    flag = 3;
6531
+                                }
6532
+                                else if (modellist != null && modellist.Count > 0)
6354 6533
                                 {
6355
-                                    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();
6356
-                                    if (modellist.Count == 2)
6534
+                                    if (markdepts.Contains(ua.F_DeptId.ToString()))
6357 6535
                                     {
6358
-                                        flag = 3;
6359
-                                        model.F_Flag = 9;
6536
+                                        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();
6537
+                                        if (modellist.Count == 2)
6538
+                                        {
6539
+                                            flag = 3;
6540
+                                            model.F_Flag = 9;
6541
+                                        }
6542
+                                        else if (itemnext.F_Flag == 9)
6543
+                                        {
6544
+                                            flag = 3;
6545
+                                            model.F_Flag = 9;
6546
+                                        }
6360 6547
                                     }
6361
-                                    else if (itemnext.F_Flag == 9)
6548
+                                    if (flag == 0)
6362 6549
                                     {
6363
-                                        flag = 3;
6364
-                                        model.F_Flag = 9;
6550
+                                        flag = Convert.ToInt32(modellist.FirstOrDefault().F_Type);
6365 6551
                                     }
6366 6552
                                 }
6367
-                                if (flag == 0)
6553
+                                else
6368 6554
                                 {
6369
-                                    flag = Convert.ToInt32(modellist.FirstOrDefault().F_Type);
6555
+                                    return Error("无操作权限");
6370 6556
                                 }
6371 6557
                             }
6372
-                            else
6373
-                            {
6374
-                                return Error("无操作权限");
6375
-                            }
6376 6558
                             var res = RevWO(ua, model, cont, flag);
6377 6559
                             if (res)
6378 6560
                                 return Success("撤回成功");
@@ -6559,7 +6741,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6559 6741
                 #region 处理工单
6560 6742
                 if (deptid == 2)
6561 6743
                 {
6562
-                    if (flag == 1 || (model.F_Flag == null && flag == 3))
6744
+                    if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && flag == 3))
6563 6745
                     {
6564 6746
                         model.F_State = (int)EnumWorkOrderState.reassign;
6565 6747
                     }
@@ -6570,7 +6752,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6570 6752
                 }
6571 6753
                 else
6572 6754
                 {
6573
-                    if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && model.F_State2 == 10 && flag == 3))
6755
+                    if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && flag == 3))
6574 6756
                     {
6575 6757
                         model.F_State = wostate;
6576 6758
                     }
@@ -6607,7 +6789,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6607 6789
         {
6608 6790
             #region 工单处理
6609 6791
             int sms = 0;
6610
-            string markdepts = "37,57,74,88,268,295,339,422,213,427";
6792
+            string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6611 6793
             var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID=" + model.F_ID + " ");
6612 6794
             if (itemlasts.Count > 0)
6613 6795
             {
@@ -6709,7 +6891,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6709 6891
                 //}
6710 6892
                 #endregion
6711 6893
                 #region 处理工单
6712
-                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && model.F_State2 == 10 && flag == 3))
6894
+                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0)  && flag == 3))
6713 6895
                 {
6714 6896
                     model.F_State = wostate;
6715 6897
                 }
@@ -6797,7 +6979,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6797 6979
             if (itemid > 0)
6798 6980
             {
6799 6981
                 #region 处理工单
6800
-                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && model.F_State2 == 10 && flag == 3))
6982
+                if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0)  && flag == 3))
6801 6983
                 {
6802 6984
                     model.F_State = wostate;
6803 6985
                 }
@@ -6838,7 +7020,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
6838 7020
                             model.F_DealContent += cont + ";";
6839 7021
                         }
6840 7022
                     }
6841
-                    if (flag == 1 || (model.F_Flag == null && flag == 3))
7023
+                    if (flag == 1 || ((model.F_Flag == null || model.F_Flag == 0) && flag == 3))
6842 7024
                     {
6843 7025
                         model.F_SuperiorOpinion = cont;
6844 7026
                     }
@@ -7104,58 +7286,60 @@ namespace CallCenterApi.Interface.Controllers.weixin
7104 7286
                         var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
7105 7287
                         if (deptmodel1 != null)
7106 7288
                         {
7107
-                            deptname1 = deptmodel1.F_DeptName ;
7289
+                            deptname1 = deptmodel1.F_DeptName;
7108 7290
                             dapt = deptmodel1.F_ParentId;
7109 7291
                         }
7110 7292
                         //if (dapt != 0)
7111 7293
                         //{
7112
-                            if (CirculMarket(ua.F_DeptId, 11))
7113
-                            {
7114
-                                nextda = 427;
7115
-                                opt = "流转运营中心";
7116
-                            }
7117
-                            else if (CirculMarket(ua.F_DeptId, 14))
7118
-                            {
7119
-                                nextda = 57;
7120
-                                opt = "流转营销管理处";
7121
-                            }
7122
-                            else if (CirculMarket(ua.F_DeptId, 15))
7123
-                            {
7124
-                                nextda = 74;
7125
-                                opt = "流转策划推广";
7126
-                            }
7127
-                            else if (CirculMarket(ua.F_DeptId, 16))
7128
-                            {
7129
-                                nextda = 88;
7130
-                                opt = "流转销售部";
7131
-                            }
7132
-                            else if (CirculMarket(ua.F_DeptId, 18))
7133
-                            {
7134
-                                nextda = 268;
7135
-                                opt = "流转车用尿素";
7294
+                        if (CirculMarket(ua.F_DeptId, 11))
7295
+                        {
7296
+                            nextda = 427;
7297
+                            opt = "流转运营中心";
7298
+                        }
7299
+                        else if (CirculMarket(ua.F_DeptId, 14))
7300
+                        {
7301
+                            nextda = 57;
7302
+                            opt = "流转营销管理处";
7303
+                        }
7304
+                        else if (CirculMarket(ua.F_DeptId, 15))
7305
+                        {
7306
+                            nextda = 74;
7307
+                            opt = "流转策划推广";
7308
+                        }
7309
+                        else if (CirculMarket(ua.F_DeptId, 16))
7310
+                        {
7311
+                            nextda = 88;
7312
+                            opt = "流转销售部";
7313
+                        }
7314
+                        else if (CirculMarket(ua.F_DeptId, 18))
7315
+                        {
7316
+                            nextda = 268;
7317
+                            opt = "流转车用尿素";
7136 7318
 
7137
-                            }
7319
+                        }
7138 7320
 
7139
-                            else if (CirculMarket(ua.F_DeptId, 20))
7140
-                            {
7141
-                                nextda = 295;
7142
-                                opt = "流转新乡黑科质检";
7143
-                            }
7144
-                            else if (CirculMarket(ua.F_DeptId, 332))
7145
-                            {
7146
-                                nextda = 339;
7147
-                                opt = "流转营销管理处";
7321
+                        else if (CirculMarket(ua.F_DeptId, 20))
7322
+                        {
7323
+                            nextda = 422;
7324
+                            opt = "流转营销中心市场科";
7325
+                            //nextda = 295;
7326
+                            //opt = "流转新乡黑科质检";
7327
+                        }
7328
+                        else if (CirculMarket(ua.F_DeptId, 332))
7329
+                        {
7330
+                            nextda = 339;
7331
+                            opt = "流转营销管理处";
7148 7332
 
7149
-                            }
7150
-                            else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
7151
-                            {
7152
-                                nextda = ua.F_DeptId;
7153
-                                opt = "流转" + deptname1;
7154
-                            }
7333
+                        }
7334
+                        else if (ua.F_DeptId == 17 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
7335
+                        {
7336
+                            nextda = ua.F_DeptId;
7337
+                            opt = "流转" + deptname1;
7338
+                        }
7155 7339
                         //}
7156 7340
                         if (nextda != 0)
7157 7341
                         {
7158
-                            var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms,0,0,0,"",1 );
7342
+                            var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms, 0, 0, 0, "", 1);
7159 7343
                             if (res)
7160 7344
                                 return Success("保存成功");
7161 7345
                             else
@@ -7205,14 +7389,15 @@ namespace CallCenterApi.Interface.Controllers.weixin
7205 7389
                 if (flag != 3)
7206 7390
                     flagstr = $" and F_Type in({ flag},3)";
7207 7391
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(nowUser.F_RoleId);
7208
-                if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY" && flag != 3)
7209
-                {
7210
-                    strsql = $" F_OptType !=1 and isnull(F_IsUsed,'0')='0' and F_ItemType={itemtype} and  F_WoID={woid} and  F_CreateUser={nowUser.F_UserCode}{flagstr}";
7211
-                }
7212
-                else
7213
-                {
7214
-                    strsql = $" isnull(F_IsUsed,'0')='0' and F_ItemType={itemtype} and  F_WoID={woid} and  (F_CreateUser={nowUser.F_UserCode} or F_NextUser like '%{nowUser.F_UserCode}%'){flagstr}";
7215
-                }
7392
+                strsql = $" isnull(F_IsUsed,'0')='0' and F_ItemType={itemtype} and  F_WoID={woid} and  (F_CreateUser={nowUser.F_UserCode} or F_NextUser like '%{nowUser.F_UserCode}%'){flagstr}";
7393
+                //if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
7394
+                //{
7395
+                //    strsql = $" F_OptType !=1 and isnull(F_IsUsed,'0')='0' and F_ItemType={itemtype} and  F_WoID={woid} and  F_CreateUser={nowUser.F_UserCode}{flagstr}";
7396
+                //}
7397
+                //else
7398
+                //{
7399
+                //    strsql = $" isnull(F_IsUsed,'0')='0' and F_ItemType={itemtype} and  F_WoID={woid} and  (F_CreateUser={nowUser.F_UserCode} or F_NextUser like '%{nowUser.F_UserCode}%'){flagstr}";
7400
+                //}
7216 7401
             }
7217 7402
             else
7218 7403
             {

File diff suppressed because it is too large
+ 526 - 321
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs


+ 2 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Web.config

@@ -17,8 +17,8 @@
17 17
     <add key="smssign" value=""/>
18 18
   </appSettings>
19 19
   <connectionStrings>
20
-    <!--<add name="ConnectionString" connectionString="Data Source=192.168.8.3;User ID=sa;pwd=800100;Initial Catalog=xinlianxin;"/>-->
21
-  <add name="ConnectionString" connectionString="Data Source=.;User ID=sa;pwd=sa123456;Initial Catalog=CallCenter_XinXiangXLX0629;" />
20
+    <add name="ConnectionString" connectionString="Data Source=192.168.8.3;User ID=sa;pwd=800100;Initial Catalog=xinlianxin;"/>
21
+  <!--<add name="ConnectionString" connectionString="Data Source=.;User ID=sa;pwd=sa123456;Initial Catalog=CallCenter_XinXiangXLX0712;" />-->
22 22
   </connectionStrings>
23 23
   <system.web>
24 24
     <compilation debug="true" targetFramework="4.5"/>