Kaynağa Gözat

工单数量修改,列表修改。大屏修改

duhongyu 6 yıl önce
ebeveyn
işleme
da587928f0

+ 299 - 155
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -2093,13 +2093,15 @@ namespace CallCenterApi.Interface.Controllers.report
2093 2093
         {
2094 2094
             public string name;
2095 2095
             public int number;//数量
2096
-            public string ongesttime;//用时最长
2097
-            public string minimumtime;//用时最短
2098
-            public string averageTime;//平均用时
2099
-            public string median;//中位数
2100
-            public string Overdue;//超期数量
2101
-            public string efficiency;//效率提升率
2096
+            public string ongesttime="0h";//用时最长
2097
+            public string minimumtime = "0h";//用时最短
2098
+            public string averageTime = "0h";//平均用时
2099
+            public string median = "0h";//中位数
2100
+            public string Overdue="0";//超期数量
2101
+            public string efficiency = "0%";//效率提升率
2102
+            public List<worker> worker;
2102 2103
         }
2104
+       
2103 2105
         public class Channel
2104 2106
         {
2105 2107
             public string channel;//渠道
@@ -2131,8 +2133,8 @@ namespace CallCenterApi.Interface.Controllers.report
2131 2133
             public int number;// 数量
2132 2134
             public int Lastyearnumber;//去年同比
2133 2135
             public int Lastmonthnumber;//上月同比
2134
-            public int Lastyear;//去年同比
2135
-            public int Lastmonth;//上月同比
2136
+            public int   Lastyear;//去年同比
2137
+            public int   Lastmonth;//上月同比
2136 2138
 
2137 2139
         }
2138 2140
       
@@ -2208,38 +2210,33 @@ namespace CallCenterApi.Interface.Controllers.report
2208 2210
                     Months = Months + 1;
2209 2211
                 }
2210 2212
             }
2211
-            
2212
-        
2213 2213
             string smouth= Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).AddMonths(-Months).ToLongDateString()).ToString("yyyy-MM-dd");
2214
-            string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddMonths(-Months).ToLongDateString()).ToString("yyyy-MM-dd");
2214
+            string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddMonths(-Months).AddMonths(1).AddDays(-1).ToLongDateString()).ToString("yyyy-MM-dd");
2215 2215
             string syear = Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).Date.AddYears (-1).ToLongDateString()).ToString("yyyy-MM-dd");
2216 2216
             string endyear= Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).Date.AddMonths(1).AddSeconds(-1).AddYears(-1).ToLongDateString()).ToString("yyyy-MM-dd");
2217
-           
2218
-           
2219 2217
             #endregion
2220 2218
             string time = $" and datediff(day,F_CreateOn,'{stime}')<=0 and datediff(day,F_CreateOn,'{endtime}')>=0 ";
2221 2219
             string lastmouth = $" and datediff(day,F_CreateOn,'{smouth}')<=0 and datediff(day,F_CreateOn,'{endmouth}')>=0 ";
2222 2220
             string lastyear= $" and datediff(day,F_CreateOn,'{syear}')<=0 and datediff(day,F_CreateOn,'{endyear}')>=0 ";
2223 2221
             BigDate model = new BigDate();
2224 2222
             model.salesBase  = new List<Template>();
2225
-            string strType = "";
2226 2223
             if (type >0)
2227 2224
             {
2228 2225
                 sql += $"and F_Type = " + type;
2229 2226
             }
2230 2227
             if (!string.IsNullOrEmpty(salesBase))
2231 2228
             {
2232
-                strType = $" and F_SalesBase='" + salesBase.Trim() + "'";
2229
+                sql += $" and F_SalesBase='" + salesBase.Trim() + "'";
2233 2230
             }
2234
-            string strChannel = "";
2231
+          
2235 2232
             if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel))
2236 2233
             {
2237
-                strChannel= " and  T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, channel) + ") ";
2234
+                sql += " and  T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, channel) + ") ";
2238 2235
             }
2239
-            string strCategory = "";
2236
+          
2240 2237
             if (!string.IsNullOrEmpty(product))
2241 2238
             {
2242
-                strCategory = $" and F_TS_Category='" + product.Trim() + "'";
2239
+                sql += $" and F_TS_Category='" + product.Trim() + "'";
2243 2240
             }
2244 2241
             #region 反馈类型
2245 2242
             for (int i=0;i <5;i++)
@@ -2273,7 +2270,15 @@ namespace CallCenterApi.Interface.Controllers.report
2273 2270
                 {
2274 2271
                     sqltype = $"and F_SalesBase in ('新乡','新疆','九江','东北')";
2275 2272
                 }
2276
-                model.salesBase .Add(ReturenTemplate(template,sql + sqltype+ strChannel+ strCategory, time , lastmouth, lastyear));
2273
+                if (!string.IsNullOrEmpty(salesBase))
2274
+                {
2275
+                    model.salesBase.Add(ReturenTemplate(template, sql, time, lastmouth, lastyear));
2276
+                }
2277
+                else
2278
+                {
2279
+                    model.salesBase.Add(ReturenTemplate(template, sql + sqltype, time, lastmouth, lastyear));
2280
+                }
2281
+              
2277 2282
             }
2278 2283
             #endregion
2279 2284
             #region 产品
@@ -2296,14 +2301,14 @@ namespace CallCenterApi.Interface.Controllers.report
2296 2301
                 }
2297 2302
                 Template template = new Template();
2298 2303
                 template.name = "合计";
2299
-                model.product.Add(ReturenTemplate(template, sql + strChannel + $"and F_TS_Category in (" + msf + ")" + strType, time, lastmouth, lastyear));
2304
+                model.product.Add(ReturenTemplate(template, sql  + $"and F_TS_Category in (" + msf + ")" , time, lastmouth, lastyear));
2300 2305
                 foreach (var it in dicval)
2301 2306
                 {
2302 2307
                     Template templates = new Template();
2303 2308
                     string mag = "";
2304 2309
                     mag = $"and F_TS_Category = '" + it.F_Name+"'";
2305 2310
                     templates.name = it.F_Name;
2306
-                    model.product.Add(ReturenTemplate(templates, sql + strChannel + strType + mag, time, lastmouth, lastyear));
2311
+                    model.product.Add(ReturenTemplate(templates, sql   + mag, time, lastmouth, lastyear));
2307 2312
                 }
2308 2313
             }
2309 2314
             #endregion
@@ -2319,14 +2324,14 @@ namespace CallCenterApi.Interface.Controllers.report
2319 2324
             {
2320 2325
                 Template templates = new Template();
2321 2326
                 templates.name = "合计";
2322
-                model.channel.Add(ReturenTemplate(templates, sql + strCategory + strType , time, lastmouth, lastyear));
2327
+                model.channel.Add(ReturenTemplate(templates, sql , time, lastmouth, lastyear));
2323 2328
                 foreach (var it in QDLXl)
2324 2329
                 {
2325 2330
                     Template template = new Template();
2326 2331
                     string str = "";
2327 2332
                     str = " and  T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, it.F_Name) + ") ";
2328 2333
                     template.name = it.F_Name;
2329
-                    model.channel.Add(ReturenTemplate(template,sql+strCategory  + strType + str, time, lastmouth, lastyear));
2334
+                    model.channel.Add(ReturenTemplate(template,sql + str, time, lastmouth, lastyear));
2330 2335
                 }
2331 2336
             }
2332 2337
             #endregion
@@ -2360,7 +2365,7 @@ namespace CallCenterApi.Interface.Controllers.report
2360 2365
                         break;
2361 2366
                    
2362 2367
                 }
2363
-                model.state.Add(ReturenTemplate(template,sql  + sqlchannel+strChannel + strCategory + strType, time, lastmouth, lastyear));
2368
+                model.state.Add(ReturenTemplate(template,sql  + sqlchannel, time, lastmouth, lastyear));
2364 2369
             }
2365 2370
             #endregion
2366 2371
             #region 满意度
@@ -2394,7 +2399,7 @@ namespace CallCenterApi.Interface.Controllers.report
2394 2399
                         break;
2395 2400
                   
2396 2401
                 }
2397
-                model.satisfaction .Add(ReturenTemplate(template,sql + sqlsatisfaction + strChannel + strCategory + strType, time, lastmouth, lastyear));
2402
+                model.satisfaction .Add(ReturenTemplate(template,sql + sqlsatisfaction, time, lastmouth, lastyear));
2398 2403
                 #endregion
2399 2404
               
2400 2405
                  
@@ -2403,7 +2408,7 @@ namespace CallCenterApi.Interface.Controllers.report
2403 2408
             #region 超期工单
2404 2409
             model.overdue = new List<Template>();
2405 2410
             string sqloverdue = "";
2406
-            sqloverdue += strChannel + strCategory + strType;
2411
+            sqloverdue += "";
2407 2412
             var modlelist = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + time);
2408 2413
             Template templatee = new Template();
2409 2414
             templatee.name = "合计";
@@ -2468,6 +2473,7 @@ namespace CallCenterApi.Interface.Controllers.report
2468 2473
                         it.Lastyearnumber = lastyearmodlel;
2469 2474
                         it.Lastmonth = it.number - lastmouthmodlel;
2470 2475
                         it.Lastyear = it.number - lastyearmodlel;
2476
+                       
2471 2477
                     }
2472 2478
                     else
2473 2479
                     {
@@ -2500,8 +2506,10 @@ namespace CallCenterApi.Interface.Controllers.report
2500 2506
                         }
2501 2507
                         it.Lastmonthnumber = lastmouthlist;
2502 2508
                         it.Lastyearnumber = lastyearlist;
2503
-                        it.Lastmonth = it.number - lastmouthlist;
2504
-                        it.Lastyear = it.number - lastyearlist;
2509
+                        it.Lastmonth= it.number - lastmouthlist;
2510
+                        it.Lastyear= it.number - lastyearlist;
2511
+                        
2512
+                       
2505 2513
                     }
2506 2514
                 }
2507 2515
                  
@@ -2648,8 +2656,9 @@ namespace CallCenterApi.Interface.Controllers.report
2648 2656
             yearnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastyear).Count;//
2649 2657
             template.Lastmonthnumber = mounthnumber;
2650 2658
             template.Lastyearnumber = yearnumber;
2651
-            template.Lastmonth = template.number - mounthnumber;
2652 2659
             template.Lastyear = template.number - yearnumber;
2660
+            template.Lastmonth = template.number - mounthnumber;
2661
+            
2653 2662
             return template;
2654 2663
         }
2655 2664
 
@@ -2658,15 +2667,31 @@ namespace CallCenterApi.Interface.Controllers.report
2658 2667
         /// 市场反馈一览表
2659 2668
         /// </summary>
2660 2669
         /// <returns></returns>
2661
-        public ActionResult GetFeedbacklList()
2670
+        public ActionResult GetFeedbacklList(string stime, string endtime)
2662 2671
         {
2663 2672
             string sql = $"  F_IsDelete=0";
2664 2673
             DataTable dt = new DataTable();
2665 2674
             #region 筛选条件
2666 2675
             List<Feedback> modelList = new List<Feedback>(5);
2667
-            string smonthtime = DateTime.Now.Date.ToString("yyyy-MM-01 00:00:00");
2676
+            string smonthtime = "";
2677
+            if (!string .IsNullOrEmpty (stime))
2678
+            {
2679
+                smonthtime = stime .Trim() + " 00:00:01 "; ;
2680
+            }
2681
+            else
2682
+            {
2683
+                smonthtime = DateTime.Now.Date.ToString("yyyy-MM-01 00:00:00");
2684
+            }
2685
+            if (string .IsNullOrEmpty (endtime))
2686
+            {
2687
+                 endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
2688
+            }
2689
+            else
2690
+            {
2691
+                endtime = endtime + " 23:59:59 "; ;
2692
+            }
2668 2693
             string sdaytime = DateTime.Now.Date.ToString("yyyy-MM-dd 00:00:00");
2669
-            string endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
2694
+            
2670 2695
             for (int i = 1; i <= 5; i++)
2671 2696
             {
2672 2697
                 Feedback model = new Feedback();
@@ -2868,17 +2893,26 @@ namespace CallCenterApi.Interface.Controllers.report
2868 2893
             public string F_QuestionType;
2869 2894
             public int number;
2870 2895
         }
2896
+        public class worker
2897
+        {
2898
+            public string F_WorkOrderCode;//工单编号
2899
+            public string F_State;//工单状态
2900
+            public string overtime;//超期时间
2901
+            public string F_Description;//问题描述
2902
+            public string F_Responsibility;//责任科室
2903
+            public string F_SalesBase;//销售基地
2904
+        }
2905
+       
2871 2906
         /// <summary>
2872 2907
         ///月份投诉处理周期表
2873 2908
         /// </summary>
2874 2909
         /// <returns></returns>
2875
-        public ActionResult GetComplainthandlList(string product,string salesBase,string stime ="", string endtime="", string questionName = "" )
2910
+        public ActionResult GetComplainthandlList(string salesBase,string stime ="", string endtime="", string questionName = "" )
2876 2911
         {
2877 2912
             string sql = $"  F_IsDelete=0";
2878 2913
             if (!string.IsNullOrWhiteSpace(salesBase))//销售基地
2879 2914
                 sql += $" and F_SalesBase like '%" + salesBase.Trim() + "%'";
2880
-            if (!string.IsNullOrWhiteSpace(product))//产品
2881
-                sql += $" and F_TS_Category='" + product.Trim() + "'";
2915
+         
2882 2916
             string Queststr = "";
2883 2917
             if (questionName!="")
2884 2918
             {
@@ -2886,147 +2920,257 @@ namespace CallCenterApi.Interface.Controllers.report
2886 2920
             }
2887 2921
             else
2888 2922
             {
2889
-
2890 2923
                 Queststr = " select * from T_Wo_QuestionManage where F_IsDelete=0 AND F_Label in(3)";
2891 2924
             }
2892
-            DataTable QuestionManage = DbHelperSQL.Query(Queststr).Tables[0];
2893
-            List<Model.T_Wo_QuestionManage> categorylist = quesBLL.DataTableToList(QuestionManage);
2894
-            List<Complainthandling> modeNamelList = new List<Complainthandling>(categorylist.Count);
2895
-            string time = "";
2896
-            if (stime == "")
2925
+            int year = DateTime.Now.Year;//当前年  
2926
+            int mouth = DateTime.Now.Month;//当前月  
2927
+            if (stime != "")
2928
+            {
2929
+                year = DateTime.Parse(stime).Year;
2930
+                mouth = DateTime.Parse(stime).Month;
2931
+            }
2932
+            int beforeYear = 0;
2933
+            int beforeMouth = 0;
2934
+            if (mouth <= 1)//如果当前月是一月,那么年份就要减1  
2935
+            {
2936
+                beforeYear = year - 1;
2937
+                beforeMouth = 12;//上个月  
2938
+            }
2939
+            else
2940
+            {
2941
+                beforeYear = year;
2942
+                beforeMouth = mouth - 1;//上个月  
2943
+            }
2944
+            string beforeMouthOneDay = beforeYear + "年" + beforeMouth + "月" + 1 + "日";//上个月第一天  
2945
+            string beforeMouthLastDay = beforeYear + "年" + beforeMouth + "月" + DateTime.DaysInMonth(year, beforeMouth) + "日";//上个月最后一天
2946
+            string time1 = DateTime.Parse(beforeMouthOneDay).ToString("yyyy-MM-dd");
2947
+            string time2 = DateTime.Parse(beforeMouthLastDay).ToString("yyyy-MM-dd");
2948
+            sql += "and F_Type=2";
2949
+            string where= " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + time1.Trim() + " 00:00:01', 120) ";
2950
+            where += " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + time2.Trim() + " 00:00:01', 120) ";
2951
+            var lastmodellist = workOrder.GetModelList(sql+ where);
2952
+            if (stime != null && stime.Trim() != "")
2953
+            {
2954
+                sql += " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
2955
+            }
2956
+            else
2897 2957
             {
2898 2958
                 stime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM-dd");
2959
+                sql += " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
2960
+            }
2961
+            if (endtime != null && endtime.Trim() != "")
2962
+            {
2963
+                sql += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + endtime.Trim() + " 23:59:59', 120) ";
2899 2964
             }
2900
-            if (endtime == "")
2965
+            else
2901 2966
             {
2902 2967
                 endtime = DateTime.Now.ToString("yyyy-MM-dd");
2968
+                sql += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + endtime.Trim() + " 23:59:59', 120) ";
2903 2969
             }
2904
-            List<Complainthandling> modelList = new List<Complainthandling>(categorylist.Count);
2905
-            for (int i = 0; i < categorylist.Count; i++)
2970
+          
2971
+            var modellist = workOrder.GetModelList(sql);
2972
+            DataTable QuestionManage = DbHelperSQL.Query(Queststr).Tables[0];
2973
+            List<Model.T_Wo_QuestionManage> categorylist = quesBLL.DataTableToList(QuestionManage);
2974
+            List<Complainthandling> modeNamelList = new List<Complainthandling>(categorylist.Count);
2975
+            var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.deal+ "order by F_ID desc ");
2976
+            if (modellist !=null )
2906 2977
             {
2907
-                Complainthandling model = new Complainthandling();
2908
-                model.name = categorylist[i].F_QuestionName;
2909
-                string strnumber = " select  F_QuestionType,count(F_QuestionType) number from T_Wo_WorkOrder where" + sql+"and F_QuestionType= '" + categorylist[i].F_Id  +"'" +
2910
-                    "group by F_QuestionType order by count(F_QuestionType) desc";
2911
-                DataTable QuestionType = DbHelperSQL.Query(strnumber).Tables[0];
2912
-                List<QuestionType> QuestionTypelists = DataTableToList(QuestionType);
2913
-                if (QuestionTypelists.Count >0)
2914
-                {
2915
-                    model.number = QuestionTypelists[0].number;
2916
-                }
2917
-                else
2918
-                {
2978
+                for (int i=0;i < categorylist.Count; i++)
2979
+              {
2980
+                 Complainthandling model = new Complainthandling();
2981
+                    model.name = categorylist[i].F_QuestionName;
2919 2982
                     model.number = 0;
2920
-                }
2921
-                string msg = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + time + "and F_QuestionType  =" + "'" + categorylist[i].F_Id  + "'" + "ORDER BY number ";
2922
-                DataTable dtxy = DbHelperSQL.Query(msg).Tables[0];
2923
-                List<QuestionType> QuestionTypes = DataTableToList(dtxy);
2924
-                float average = 0;
2925
-                int med = QuestionTypes.Count / 2;
2926
-                if (QuestionTypes.Count>0)
2927
-                {
2928
-                    for (int j = 0; j < QuestionTypes.Count; j++)
2983
+                  int efficiency = 0;
2984
+                    model.worker = new List<worker>();
2985
+                    foreach (var it in modellist)
2929 2986
                     {
2930
-                        if(QuestionTypes.Count==1)
2931
-                        {
2932
-                            model.minimumtime = QuestionTypes[j].number.ToString();
2933
-                            model.ongesttime = QuestionTypes[j].number.ToString();
2934
-                            model.median = QuestionTypes[j].number.ToString();
2935
-                        }
2936
-                        else
2987
+                        try
2937 2988
                         {
2938
-                            if (j == 0)
2989
+                            if (int .Parse (it.F_QuestionType) == categorylist[i].F_Id )
2939 2990
                             {
2940
-                                model.minimumtime = QuestionTypes[j].number.ToString();
2941
-                            }
2942
-                            else if (j == QuestionTypes.Count - 1)
2943
-                            {
2944
-                                model.ongesttime = QuestionTypes[j].number.ToString();
2945
-                            }
2946
-                            else if (j == med)
2947
-                            {
2948
-                                model.median = QuestionTypes[j].number.ToString();
2991
+                                model.number ++;
2992
+                                if (it .F_State ==10|| it.F_State == 11)
2993
+                                {
2994
+                                    efficiency++;
2995
+                                    System.TimeSpan id = DateTime.Parse(it.F_DealTime.ToString()) - DateTime.Parse(it.F_CreateOn.ToString());
2996
+                                    double t = id.TotalHours;
2997
+                                    List<float> timehource = new List<float>();
2998
+                                    timehource.Add((float)t);
2999
+
3000
+                                    if (timehource.Count > 0)
3001
+                                    {
3002
+                                        timehource.Sort((a, b) => b.CompareTo(a));
3003
+                                        model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3004
+                                        model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3005
+                                        int n = timehource.Count / 2;
3006
+                                        model.median = string.Format("{0:f2}h", timehource[n]);
3007
+                                        float y = 0;
3008
+                                        foreach (var iu in timehource)
3009
+                                        {
3010
+                                            y += iu;
3011
+                                        }
3012
+                                        model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3013
+                                    }
3014
+                                    else
3015
+                                    {
3016
+                                        model.ongesttime = "0h";
3017
+                                        model.minimumtime = "0h";
3018
+                                        model.median = "0h";
3019
+                                        model.averageTime = "0h";
3020
+                                    }
3021
+                                }
3022
+                                else
3023
+                                {
3024
+                                    model.ongesttime = "0h";
3025
+                                    model.minimumtime = "0h";
3026
+                                    model.median = "0h";
3027
+                                    model.averageTime = "0h";
3028
+                                }
3029
+                                int Overdue = 0;
3030
+                              
3031
+                                if (it .F_IsOver ==1&& it.F_State !=11)
3032
+                                {
3033
+                                    worker worker = new worker();
3034
+                                    worker.F_WorkOrderCode = it.F_WorkOrderCode;
3035
+                                    if (it.F_State == 1)
3036
+                                        worker.F_State = "待接单";
3037
+                                    else if (it.F_State == 2)
3038
+                                        worker.F_State = "待处理";
3039
+                                    else if (it.F_State == 3)
3040
+                                        worker.F_State = "已退回";
3041
+                                    else if (it.F_State == 4)
3042
+                                        worker.F_State = "异常退回";
3043
+                                    else if (it.F_State == 4)
3044
+                                        worker.F_State = "异常退回";
3045
+                                   else 
3046
+                                        worker.F_State = "已处理";
3047
+                                    worker.F_SalesBase = it.F_SalesBase;
3048
+                                    worker.F_Description = it.F_Description;
3049
+                                    string timeover = "", timeover2 = ""; int x = 0, y = 0;
3050
+                                    int limit =0;
3051
+                                    if (itemlasts != null )
3052
+                                    {
3053
+                                     for (int z = 0; z < itemlasts.Count; z++)
3054
+                                      {
3055
+                                             if (it.F_ID == itemlasts[z].F_WoID)
3056
+                                              {
3057
+                                                if (itemlasts[z].F_WoState >= 1)
3058
+                                                {
3059
+                                                    if (itemlasts[z].F_WoState == 1)
3060
+                                                    {
3061
+                                                        x = z;
3062
+                                                        timeover = itemlasts[z].F_CreateTime.ToString();
3063
+                                                        limit =int .Parse ( itemlasts[z].F_LimitTime);
3064
+                                                    }
3065
+                                                    if (itemlasts[z].F_WoState == 10)
3066
+                                                    {
3067
+                                                        y = z;
3068
+                                                        timeover2 = itemlasts[z].F_CreateTime.ToString();
3069
+                                                        limit = int.Parse(itemlasts[z].F_LimitTime);
3070
+                                                    }
3071
+                                                }
3072
+                                                if (timeover2 != "")
3073
+                                                {
3074
+                                                    if (timeover != "")
3075
+                                                    {
3076
+                                                        if (x > y)
3077
+                                                        {
3078
+                                                            System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3079
+                                                            double a = id.TotalHours;
3080
+                                                            worker.overtime = string .Format ("{0:f2}h", a - limit);
3081
+                                                            if (itemlasts[x].F_NextDept > 0)
3082
+                                                            {
3083
+                                                                var deptment = departmentBLL.GetModel(int.Parse(itemlasts[x].F_NextDept.ToString()));
3084
+                                                                if (deptment != null)
3085
+                                                                {
3086
+                                                                    worker.F_Responsibility = deptment.F_DeptName;
3087
+                                                                }
3088
+                                                            }
3089
+
3090
+                                                        }
3091
+                                                        else
3092
+                                                        {
3093
+                                                            System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3094
+                                                            double a = id.TotalHours;
3095
+                                                            worker.overtime = string.Format("{0:f2}h", a - limit);
3096
+                                                            if (itemlasts[y].F_NextDept > 0)
3097
+                                                            {
3098
+                                                                var deptment = departmentBLL.GetModel(int.Parse(itemlasts[y].F_NextDept.ToString()));
3099
+                                                                if (deptment != null)
3100
+                                                                {
3101
+                                                                    worker.F_Responsibility = deptment.F_DeptName;
3102
+                                                                }
3103
+
3104
+                                                            }
3105
+
3106
+                                                        }
3107
+                                                    }
3108
+
3109
+                                                }
3110
+                                                else if (time1 != "")
3111
+                                                {
3112
+                                                    System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3113
+                                                    double a = id.TotalHours;
3114
+                                                    worker.overtime = string.Format("{0:f2}h", a - limit);
3115
+                                                    if (itemlasts[x].F_NextDept > 0)
3116
+                                                    {
3117
+                                                        var deptment = departmentBLL.GetModel(int.Parse(itemlasts[x].F_NextDept.ToString()));
3118
+                                                        if (deptment != null)
3119
+                                                        {
3120
+                                                            worker.F_Responsibility = deptment.F_DeptName;
3121
+                                                        }
3122
+                                                    }
3123
+                                                }
3124
+
3125
+
3126
+                                            }
3127
+                                        }
3128
+                                        }
3129
+                                    Overdue++;
3130
+                                    model.worker.Add(worker);
3131
+                                }
3132
+                                model.Overdue = Overdue + "";
3133
+                                int lastnumber = 0;
3134
+                                if (lastmodellist != null)
3135
+                                {
3136
+                                    foreach (var iv in lastmodellist)
3137
+                                    {
3138
+                                        if (iv .F_QuestionType== it.F_QuestionType)
3139
+                                        {
3140
+                                            if (iv.F_State ==10|| iv.F_State == 11)
3141
+                                            lastnumber++;
3142
+                                        }
3143
+                                    }
3144
+                                 }
3145
+                                if (lastnumber==0)
3146
+                                {
3147
+                                    model.efficiency = string.Format("{0:f2}% ", efficiency / 1*100);
3148
+                                }
3149
+                                else
3150
+                                {
3151
+                                    int v = efficiency - lastnumber;
3152
+                                    model.efficiency = string.Format("{0:f2}% ", v / lastnumber*100);
3153
+                                }
2949 3154
                             }
2950 3155
                         }
2951
-                        average += QuestionTypes[j].number;
3156
+                        catch
3157
+                        {
3158
+                           
3159
+                        }
2952 3160
                     }
3161
+                    if (questionName != "")
3162
+                        modeNamelList.Add(model);
3163
+                    else if (model.number > 0)
3164
+                        modeNamelList.Add(model);
2953 3165
                 }
2954
-                else
2955
-                {
2956
-                    model.minimumtime = "0";
2957
-                    model.ongesttime = "0";
2958
-                    model.median = "0";
2959
-                }
2960
-               
2961
-                float ave = average / QuestionTypes.Count;
2962
-                if (float.IsNaN(ave))
2963
-                {
2964
-                    ave = 0;
2965
-                }
2966
-                model.averageTime = string.Format("{0:f2}", ave);
2967
-                string Over = "select  F_QuestionType,count(F_IsOver) number from T_Wo_WorkOrder where  " + sql +
2968
-                    "and F_QuestionType  ='" + categorylist[i].F_Id  + "'" + time + "group by F_QuestionType order by count(F_IsOver) desc";
2969
-                DataTable Overdtxy = DbHelperSQL.Query(Over).Tables[0];
2970
-                List<QuestionType> Overdue = DataTableToList(Overdtxy);
2971
-                if (Overdue.Count >0)
2972
-                {
2973
-                    model.Overdue = Overdue[0].number.ToString();
2974
-                }
2975
-                else
2976
-                {
2977
-                    model.Overdue ="0";
2978
-                }
2979
-                int year = DateTime.Now.Year;//当前年  
2980
-                int mouth = DateTime.Now.Month;//当前月  
2981
-                if (stime != "")
2982
-                {
2983
-                    year = DateTime.Parse(stime).Year;
2984
-                    mouth = DateTime.Parse(stime).Month;
2985
-                }
2986
-                int beforeYear = 0;
2987
-                int beforeMouth = 0;
2988
-                if (mouth <= 1)//如果当前月是一月,那么年份就要减1  
2989
-                {
2990
-                    beforeYear = year - 1;
2991
-                    beforeMouth = 12;//上个月  
2992
-                }
2993
-                else
2994
-                {
2995
-                    beforeYear = year;
2996
-                    beforeMouth = mouth - 1;//上个月  
2997
-                }
2998
-                string beforeMouthOneDay = beforeYear + "年" + beforeMouth + "月" + 1 + "日";//上个月第一天  
2999
-                string beforeMouthLastDay = beforeYear + "年" + beforeMouth + "月" + DateTime.DaysInMonth(year, beforeMouth) + "日";//上个月最后一天
3000
-                string time1 = DateTime.Parse(beforeMouthOneDay).ToString("yyyy-MM-dd");
3001
-                string time2 = DateTime.Parse(beforeMouthLastDay).ToString("yyyy-MM-dd");
3002
-                string times = "";
3003
-                times += " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + time1.Trim() + " 00:00:01', 120) ";
3004
-                times += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + time2.Trim() + " 23:59:59', 120) ";
3005
-                string msgs = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + times + "and F_QuestionType  =" + "'" + categorylist[i].F_Id  + "'" + "ORDER BY number ";
3006
-                DataTable dtxys = DbHelperSQL.Query(msgs).Tables[0];
3007
-                List<QuestionType> Questionmonth = DataTableToList(dtxys);
3008
-                float efficien = 0;
3009
-                for (int j = 0; j < Questionmonth.Count; j++)
3010
-                {
3011
-                    efficien += Questionmonth[j].number;
3012
-                }
3013
-                float eff = efficien / Questionmonth.Count;
3014
-                float Percentile = (ave - eff) / eff * 100;
3015
-              
3016
-                if (float .IsNaN (Percentile) )
3017
-                {
3018
-                    Percentile = 0;
3019
-                }
3020
-                model.efficiency = string.Format("-{0:f2}% ", Percentile);
3021
-                modelList.Add(model);
3022 3166
             }
3023
-            modelList.Sort((a, b) => b .number .CompareTo(a .number ));
3167
+            modeNamelList.Sort((a, b) => b .number .CompareTo(a .number ));
3024 3168
             var obj = new
3025 3169
             {
3026 3170
                 state = "success",
3027 3171
                 message = "成功",
3028
-                rows = modelList,
3029
-                total = modelList.Count 
3172
+                rows = modeNamelList,
3173
+                total = modeNamelList.Count 
3030 3174
             };
3031 3175
 
3032 3176
             return Content(obj.ToJson()); ;

+ 25 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -202,6 +202,31 @@ namespace CallCenterApi.Interface.Controllers.workorder
202 202
             }
203 203
             return Error("加载失败");
204 204
         }
205
+        public ActionResult GetQuestionName()
206
+        {
207
+            DataTable dt = new DataTable();
208
+            var sql = "and F_IsDelete=0";
209
+            sql += "and  F_Label=3";
210
+            int recordCount = 0;
211
+            dt = BLL.PagerBLL.GetListPager(
212
+                       "T_Wo_QuestionManage",
213
+                       "F_ID",
214
+                       "*",
215
+                       sql,
216
+                       "ORDER BY T_Wo_QuestionManage.F_ID ",
217
+                       10000,
218
+                       1,
219
+                       true,
220
+                       out recordCount);
221
+
222
+            List<Model.T_Wo_QuestionManage> modelList = new BLL.T_Wo_QuestionManage().DataTableToList(dt);
223
+            if (modelList != null)
224
+            {
225
+                if (modelList.Count > 0)
226
+                    return Success("加载成功", modelList);
227
+            }
228
+            return Error("加载失败");
229
+        }
205 230
         public ActionResult GetQuestionType(int type = 0,int pid=0)
206 231
         {
207 232
             DataTable dt = new DataTable();

+ 339 - 83
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -231,6 +231,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
231 231
                         {
232 232
                             sql += " and (F_CreateBy= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.F_ID in ( " + GetCYWorkOrderID(ua.F_UserCode) + ") or F_State =13)";
233 233
                             sql += $" and F_State=" + (int)EnumWorkOrderState.evaluate; ;
234
+                            sql += $" and F_IsVisit=" +1; ;
234 235
                         }
235 236
                         else if (ro.F_RoleCode == "XTGLY")
236 237
                         {
@@ -419,6 +420,67 @@ namespace CallCenterApi.Interface.Controllers.workorder
419 420
                             return Success("暂无工单");
420 421
                         }
421 422
                         break;
423
+                    case 19://综合回访
424
+                        if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX")
425
+                        {
426
+                            sql += " and (F_CreateBy= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.F_ID in ( " + GetCYWorkOrderID(ua.F_UserCode) + ") or F_State =13)";
427
+                           
428
+                        }
429
+                        else if (ro.F_RoleCode == "XTGLY")
430
+                        {
431
+                            uwhere = ""; ;
432
+                        }
433
+                        else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "ZG")
434
+                        {
435
+                            string detpid = "";
436
+                            var deparmentlist = new List<Model.T_Sys_Department>();
437
+                            Model.T_Sys_Department dModel = departmentBLL.GetModel(ua.F_DeptId);
438
+                            if (dModel != null)
439
+                            {
440
+                                if (dModel.F_Layer == 1)
441
+                                {
442
+                                    deparmentlist = new BLL.T_Sys_Department().GetModelList(" F_State=1 and F_Layer=" + 2 + " and F_ParentId=" + dModel.F_DeptId);
443
+                                    if (deparmentlist.Count > 0)
444
+                                    {
445
+                                        foreach (var it in deparmentlist)
446
+                                        {
447
+                                            if (detpid != "")
448
+                                            {
449
+                                                detpid += "," + it.F_DeptId;
450
+                                            }
451
+                                            else
452
+                                            {
453
+                                                detpid = "" + it.F_DeptId; ;
454
+                                            }
455
+                                        }
456
+                                    }
457
+                                }
458
+                                else
459
+                                {
460
+                                    detpid = ua.F_DeptId.ToString();
461
+                                }
462
+                                if (GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.evaluate + "") != "")
463
+                                {
464
+                                    sql += $"  and T_Wo_WorkOrder.F_ID in ( " + GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.evaluate + "") + ") "; ;
465
+                                }
466
+                                else
467
+                                {
468
+
469
+                                    return Success("暂无工单"); ;
470
+                                }
471
+
472
+                            }
473
+                            else
474
+                            {
475
+                                return Error("加载失败");
476
+                            }
477
+                        }
478
+                        else
479
+                        {
480
+                            return Success("无操作权限"); ;
481
+                        }
482
+                        sql += $" and F_State in(10," + (int)EnumWorkOrderState.evaluate + ")"; ;
483
+                        break;
422 484
                 }
423 485
                 #endregion
424 486
                 int recordCount = 0;
@@ -481,9 +543,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
481 543
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
482 544
                 string uwhere = " ";
483 545
                 string sql = "";
484
-              int  Assign=0, Receipt = 0, Acceptedorders = 0, Ovar = 0, Allocated = 0, Tobevisited = 0, Returnvisit = 0, Tobefinished = 0, GCApproved = 0, CustomerWorkorder = 0, Delays =
485
-                    0, DeWorkOrder = 0, Approved = 0, WeChatWorkOrder = 0  , TobeApproved = 0, Createdbill = 0, Backid = 0;
486
-                for (int i=0;i<=18;i ++)
546
+                if (!Refresh())
547
+                {
548
+                    return Error("查询失败");
549
+                }
550
+                int DZP = 0, YCD = 0, DJD = 0, DCL = 0, YQGD = 0, YZP = 0, DSP = 0, YCL = 0, GCDBL = 0, YBL = 0, WSP =
551
+                    0, YGGD = 0, KHFK = 0, CQGD = 0  , CBGD = 0, TD = 0, ZHCX = 0, RV_awaitVist = 0, RV_haveVisit = 0, RV_resultVisit = 0, DWJ = 0,ZHHF=0; ; 
552
+                for (int i=0;i<=20;i ++)
487 553
                 {
488 554
                     switch (i )
489 555
                     {
@@ -498,7 +564,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
498 564
                             {
499 565
                                 uwhere = "";
500 566
                             }
501
-                           
502 567
                             #region 获取部门工单列表
503 568
                             else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "ZG")
504 569
                             {
@@ -535,16 +600,17 @@ namespace CallCenterApi.Interface.Controllers.workorder
535 600
                                     }
536 601
                                     else
537 602
                                     {
538
-                                        Assign = 0;
603
+                                        DZP = 0;
539 604
                                         break;
540 605
                                     }
541
-
606
+                                   
542 607
                                 }
543 608
                                 else
544 609
                                 {
545
-                                    Assign = 0;
610
+                                    DZP = 0;
546 611
                                     break;
547 612
                                 }
613
+                               
548 614
                             }
549 615
                             #endregion
550 616
                             else
@@ -552,7 +618,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
552 618
                                 sql += $" and F_CreateBy like '%" + ua.F_UserCode + "%'"; ;
553 619
                             }
554 620
                             sql += $" and F_State in(" + (int)EnumWorkOrderState.neworder + "," + (int)EnumWorkOrderState.reassign + ")" + " " + uwhere;
555
-                             Assign = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count ;//指派
621
+                            DZP = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count ;//指派
556 622
                             break;
557 623
                         case 1://待接单的
558 624
                             sql = "";
@@ -567,10 +633,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
567 633
                             else
568 634
                             {
569 635
 
570
-                                Receipt = 0;
636
+                                DJD = 0;
571 637
                                 break;
572 638
                             }
573
-                             Receipt = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//接单
639
+                            DJD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//接单
574 640
                             break;
575 641
                         case 2://待完成的(待处理)
576 642
                             sql = "";
@@ -581,17 +647,17 @@ namespace CallCenterApi.Interface.Controllers.workorder
581 647
                             }
582 648
                             else
583 649
                             {
584
-                                Acceptedorders = 0;
650
+                                DCL = 0;
585 651
                                 break;
586 652
                             }
587
-                             Acceptedorders = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已接单
653
+                            DCL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已接单
588 654
                         
589 655
                             break;
590 656
                         case 10://已完成的
591 657
                             sql = "";
592 658
                             sql += $"  F_IsDelete=0";
593 659
                             sql += " and F_State =" + (int)EnumWorkOrderState.finish + " and F_DealBy = '" + ua.F_UserCode + "' ";
594
-                             Ovar = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已完成的
660
+                            YCL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已完成的
595 661
                           
596 662
                             break;
597 663
                         case 3://客服已分配
@@ -602,10 +668,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
602 668
                                 if (GetParticipateID() != "")
603 669
                                 {
604 670
                                     sql += " and  T_Wo_WorkOrder.F_ID in ( " + GetParticipateID() + ") ";
671
+                                    sql += " and F_State =" + (int)EnumWorkOrderState.assign;
605 672
                                 }
606 673
                                 else
607 674
                                 {
608
-                                    Allocated = 0;
675
+                                    YZP = 0;
609 676
                                     break;
610 677
                                 }
611 678
                             }
@@ -617,12 +684,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
617 684
                                 }
618 685
                                 else
619 686
                                 {
620
-                                    Allocated = 0;
687
+                                    YZP = 0;
621 688
                                     break;
622 689
                                 }
623 690
                             }
624
-                            
625
-                             Allocated = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客服已分配
691
+
692
+                            YZP = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客服已分配
626 693
                        
627 694
                             break;
628 695
                         case 4://待回访
@@ -634,11 +701,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
634 701
                             }
635 702
                             else
636 703
                             {
637
-                                Tobevisited = 0;
704
+                                RV_awaitVist = 0;
638 705
                                 break;
639 706
                             }
640 707
                             sql += $" and F_State=" + (int)EnumWorkOrderState.finish + " and F_IsVisit = '" + "1" + "' " + uwhere; ;
641
-                             Tobevisited = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待回访
708
+                            RV_awaitVist = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待回访
642 709
                       
643 710
                             break;
644 711
                         case 6://已回访
@@ -648,6 +715,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
648 715
                             {
649 716
                                 sql += " and (F_CreateBy= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.F_ID in ( " + GetCYWorkOrderID(ua.F_UserCode) + ") or F_State =13)";
650 717
                                 sql += $" and F_State=" + (int)EnumWorkOrderState.evaluate; ;
718
+                              
651 719
                             }
652 720
                             else if (ro.F_RoleCode == "XTGLY")
653 721
                             {
@@ -689,25 +757,27 @@ namespace CallCenterApi.Interface.Controllers.workorder
689 757
                                     else
690 758
                                     {
691 759
 
692
-                                        Returnvisit = 0;
760
+                                        RV_haveVisit = 0;
693 761
                                         break;
694 762
                                     }
695 763
 
696 764
                                 }
697 765
                                 else
698 766
                                 {
699
-                                    Returnvisit = 0;
767
+                                    RV_haveVisit = 0;
700 768
                                     break;
701 769
                                 }
702 770
                             }
703 771
                             else
704 772
                             {
705
-                                Returnvisit = 0;
773
+                                RV_haveVisit = 0;
706 774
                                 break;
707 775
                             }
776
+                            string where=$" and F_State in(10," + (int)EnumWorkOrderState.evaluate + ")"; ;
777
+                            RV_resultVisit = new BLL.T_Wo_WorkOrder().GetModelList(sql+ where).Count;//
708 778
                             sql += $" and F_State=" + (int)EnumWorkOrderState.evaluate;
709
-                             Returnvisit= new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已回访
710
-                          
779
+                            sql += $" and F_IsVisit=" + 1; ;
780
+                            RV_haveVisit = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已回访
711 781
                             break;
712 782
                         case 7://待完结
713 783
                             sql = "";
@@ -718,11 +788,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
718 788
                             }
719 789
                             else
720 790
                             {
721
-                                Tobefinished = 0;
791
+                                DWJ = 0;
722 792
                                 break; ;
723 793
                             }
724 794
                             sql += $" and F_State=" + (int)EnumWorkOrderState.finish + " and F_IsVisit = '" + "0" + "' "; ;
725
-                             Tobefinished = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待完结
795
+                            DWJ = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待完结
726 796
                             break;
727 797
                         case 8://待审批
728 798
                             sql = "";
@@ -737,10 +807,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
737 807
                             else
738 808
                             {
739 809
 
740
-                                GCApproved = 0;
810
+                                GCDBL = 0;
741 811
                                 break; ;
742 812
                             }
743
-                             GCApproved = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//高层待审批
813
+                            GCDBL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//高层待审批
744 814
                             break;
745 815
                         case 9://客户工单
746 816
                             sql = "";
@@ -751,11 +821,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
751 821
                             }
752 822
                             else
753 823
                             {
754
-                                CustomerWorkorder = 0;
824
+                                KHFK = 0;
755 825
                                 break; ;
756 826
                             }
757 827
                             sql += $" and F_State=" + (int)EnumWorkOrderState.customers;
758
-                             CustomerWorkorder = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客户工单
828
+                            KHFK = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客户工单
759 829
 
760 830
                             break;
761 831
                         case 11://延期工单
@@ -767,10 +837,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
767 837
                             }
768 838
                             else
769 839
                             {
770
-                                Delays = 0;
840
+                                YQGD = 0;
771 841
                                 break; ;
772 842
                             }
773
-                             Delays = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客户工单
843
+                            YQGD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//客户工单
774 844
                           
775 845
                             break;
776 846
                         case 12://微信未通过工单
@@ -782,11 +852,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
782 852
                             }
783 853
                             else
784 854
                             {
785
-                                DeWorkOrder = 0;
855
+                                WSP = 0;
786 856
                                 break; ;
787 857
                             }
788 858
                             sql += $" and F_State=" + (int)EnumWorkOrderState.recustomers;
789
-                             DeWorkOrder = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//微信未通过工单
859
+                            WSP = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//微信未通过工单
790 860
                          
791 861
                             break;
792 862
                         case 13://已审批
@@ -800,16 +870,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
800 870
                                 }
801 871
                                 else
802 872
                                 {
803
-                                    Approved = 0;
873
+                                    YBL = 0;
804 874
                                     break; ;
805 875
                                 }
806 876
                             }
807 877
                             else
808 878
                             {
809
-                                Approved = 0;
879
+                                YBL = 0;
810 880
                                 break; ;
811 881
                             }
812
-                             Approved = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已审批
882
+                            YBL = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//已审批
813 883
                            
814 884
                             break;
815 885
                         case 14://业务员工单
@@ -821,10 +891,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
821 891
                             }
822 892
                             else
823 893
                             {
824
-                                WeChatWorkOrder = 0;
894
+                                YGGD = 0;
825 895
                                 break; ;
826 896
                             }
827
-                             WeChatWorkOrder = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//微信业务员工单
897
+                            YGGD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//微信业务员工单
828 898
                            
829 899
                             break;
830 900
                         case 15://待审批
@@ -838,29 +908,178 @@ namespace CallCenterApi.Interface.Controllers.workorder
838 908
                                 }
839 909
                                 else
840 910
                                 {
841
-                                    TobeApproved = 0;
911
+                                    DSP = 0;
842 912
                                     break; ;
843 913
                                 }
844 914
                             }
845 915
                             else
846 916
                             {
847
-                                TobeApproved = 0;
917
+                                DSP = 0;
848 918
                                 break; ;
849 919
                             }
850 920
 
851
-                             TobeApproved = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待审批
852
-
853
-                      
921
+                            DSP = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//待审批
854 922
                             break;
855
-                        case 16://已创单
923
+                        case 16:
856 924
                             sql = "";
857 925
                             sql += $"  F_IsDelete=0";
858 926
                             sql += $" and F_CreateBy  ='" + ua.F_UserCode + "'";
859
-                             Createdbill = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//业务员已创单
927
+                            YCD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//业务员已创单
928
+                            break;
929
+                     
930
+                        case 17://超期
931
+                            sql = "";
932
+                            sql += $"  F_IsDelete=0";
933
+                            sql += $" and F_IsOver=" + 1;
934
+                            if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "YWY" || ro.F_RoleCode == "BLRY")
935
+                            {
936
+                                sql += $" and F_DealBy like '%" + ua.F_UserCode.Trim() + "%'";
937
+                            }
938
+                            else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "ZG")
939
+                            {
940
+                                string detpid = "";
941
+                                var deparmentlist = new List<Model.T_Sys_Department>();
942
+                                Model.T_Sys_Department dModel = departmentBLL.GetModel(ua.F_DeptId);
943
+                                if (dModel != null)
944
+                                {
945
+                                    if (dModel.F_Layer == 1)
946
+                                    {
947
+                                        deparmentlist = new BLL.T_Sys_Department().GetModelList(" F_State=1 and F_Layer=" + 2 + " and F_ParentId=" + dModel.F_DeptId);
948
+                                        if (deparmentlist.Count > 0)
949
+                                        {
950
+                                            foreach (var it in deparmentlist)
951
+                                            {
952
+                                                if (detpid != "")
953
+                                                {
954
+                                                    detpid += "," + it.F_DeptId;
955
+                                                }
956
+                                                else
957
+                                                {
958
+                                                    detpid = "" + it.F_DeptId; ;
959
+                                                }
960
+                                            }
961
+                                        }
962
+                                    }
963
+                                    else
964
+                                    {
965
+                                        detpid = ua.F_DeptId.ToString();
966
+                                    }
967
+                                    if (GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.dealing + ", " + (int)EnumWorkOrderState.receive + "," +
968
+                            (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "") != "")
969
+                                    {
970
+                                        sql += $"  and T_Wo_WorkOrder.F_ID in ( " + GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
971
+                            (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "") + ") "; ;
972
+                                    }
973
+                                    else
974
+                                    {
860 975
 
861
-                           
976
+                                        CQGD = 0;
977
+                                        break; ;
978
+                                    }
979
+
980
+                                }
981
+                                else
982
+                                {
983
+                                    CQGD = 0;
984
+                                    break; ;
985
+                                }
986
+                            }
987
+                            else if (ro.F_RoleCode == "JDYBZZX")
988
+                            {
989
+                                sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
990
+                            }
991
+                            else if (ro.F_RoleCode == "QTJS")
992
+                            {
993
+                                CQGD = 0;
994
+                                break; ;
995
+                            }
996
+                            CQGD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//超期
997
+                            break;
998
+                        case 18://催办
999
+                            sql = "";
1000
+                            sql += $"  F_IsDelete=0";
1001
+                            var list = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.urge);
1002
+                            string str = "";
1003
+                           foreach (var it in list)
1004
+                            {
1005
+                                if (str !="")
1006
+                                    str += "," + it.F_WoID;
1007
+                                else
1008
+                                    str= ""+it.F_WoID;
1009
+                            }
1010
+                            if (str != "")
1011
+                            {
1012
+                                sql += $"  and T_Wo_WorkOrder.F_ID in(" + str + ")";
1013
+                            }
1014
+                            else
1015
+                            {
1016
+                                CBGD = 0;
1017
+                                break;
1018
+                            }
1019
+                            CBGD = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//催办
1020
+                            break;
1021
+                        case 19://综合查询
1022
+                            sql = "";
1023
+                            sql += $"  F_IsDelete=0";
1024
+                            if (ro.F_RoleCode == "QTJS" || ro.F_RoleCode == "YWY")
1025
+                                sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
1026
+                            else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "BLRY" || ro.F_RoleCode == "ZG")
1027
+                            {
1028
+                                string detpid = "";
1029
+                                var deparmentlist = new List<Model.T_Sys_Department>();
1030
+                                Model.T_Sys_Department dModel = departmentBLL.GetModel(ua.F_DeptId);
1031
+                                if (dModel != null)
1032
+                                {
1033
+                                    if (dModel.F_Layer == 1)
1034
+                                    {
1035
+                                        deparmentlist = new BLL.T_Sys_Department().GetModelList(" F_State=1 and F_Layer=" + 2 + " and F_ParentId=" + dModel.F_DeptId);
1036
+                                        if (deparmentlist.Count > 0)
1037
+                                        {
1038
+                                            foreach (var it in deparmentlist)
1039
+                                            {
1040
+                                                if (detpid != "")
1041
+                                                {
1042
+                                                    detpid += "," + it.F_DeptId;
1043
+                                                }
1044
+                                                else
1045
+                                                {
1046
+                                                    detpid = "" + it.F_DeptId;
1047
+                                                }
1048
+                                            }
1049
+                                        }
1050
+                                    }
1051
+                                    else
1052
+                                    {
1053
+                                        detpid = ua.F_DeptId.ToString();
1054
+                                    }
1055
+                               
1056
+                                        if (GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.neworder + ", " + (int)EnumWorkOrderState.assign + "," +
1057
+                            (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish
1058
+                            + "," + (int)EnumWorkOrderState.evaluate + "") != "")
1059
+                                        {
1060
+
1061
+                                            sql += $"  and T_Wo_WorkOrder.F_ID in ( " + GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.neworder + ", " + (int)EnumWorkOrderState.assign + "," +
1062
+                            (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish
1063
+                            + "," + (int)EnumWorkOrderState.evaluate + "") + ") ";
1064
+                                        }
1065
+                                        else
1066
+                                        {
1067
+
1068
+                                        ZHCX = 0;
1069
+                                        break;
1070
+                                    }
1071
+                                  
1072
+
1073
+                                }
1074
+                                else
1075
+                                {
1076
+                                    ZHCX = 0;
1077
+                                    break;
1078
+                                }
1079
+                            }
1080
+                            ZHCX = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//综合查询
862 1081
                             break;
863
-                        case 17://退单
1082
+                        case 20://退单
864 1083
                             sql = "";
865 1084
                             sql += $"  F_IsDelete=0";
866 1085
                             if (GetBackid(ua) != "")
@@ -869,37 +1088,43 @@ namespace CallCenterApi.Interface.Controllers.workorder
869 1088
                             }
870 1089
                             else
871 1090
                             {
872
-                                Backid = 0;
873
-                                break; ;
1091
+                                TD = 0;
1092
+                               break;
874 1093
                             }
875
-                             Backid = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//退单
1094
+                            TD  = new BLL.T_Wo_WorkOrder().GetModelList(sql).Count;//综合查询
876 1095
                             break;
1096
+
1097
+
877 1098
                     }
878 1099
                 }
879 1100
 
880 1101
                 #endregion
881
-              
1102
+
882 1103
                 var obj = new
883 1104
                 {
884 1105
                     state = "success",
885 1106
                     message = "成功",
886
-                    Assign = Assign,//指派
887
-                    Receipt = Receipt,//待接单
888
-                    Acceptedorders = Acceptedorders,//已接单(待处理)
889
-                    Ovar = Ovar,//已完成的
890
-                    Allocated = Allocated,//客服已分配
891
-                    Tobevisited = Tobevisited,//待回访
892
-                    Returnvisit = Returnvisit,//已回访
893
-                    Tobefinished = Tobefinished,//待完结
894
-                    GCApproved = GCApproved,//高层待审批
895
-                    CustomerWorkorder = CustomerWorkorder,//客户工单
896
-                    Delays = Delays,//延期工单
897
-                    DeWorkOrder = DeWorkOrder,//微信未通过工单
898
-                    Approved = Approved,//已审批
899
-                    WeChatWorkOrder = WeChatWorkOrder,//微信业务员工单
900
-                    TobeApproved = TobeApproved,//待审批
901
-                    Createdbill = Createdbill,//业务员已创单
902
-                    Backid = Backid,//待审批
1107
+                    DZP = DZP,//指派
1108
+                    DJD = DJD,//待接单
1109
+                    DCL = DCL,//已接单(待处理)
1110
+                    YCL = YCL,//已完成的
1111
+                    YZP = YZP,//客服已分配
1112
+                    RV_await = RV_awaitVist,//待回访
1113
+                    RV_have = RV_haveVisit,//已回访
1114
+                    RV_result = RV_resultVisit,//综合回访
1115
+                    DWJ = DWJ,//待完结
1116
+                    GCDBL = GCDBL,//高层待审批
1117
+                    KHFK = KHFK,//客户工单
1118
+                    YQGD = YQGD,//延期工单
1119
+                    WSP = WSP,//微信未通过工单
1120
+                    YBL = YBL,//已审批
1121
+                    YGGD = YGGD,//微信业务员工单
1122
+                    DSP = DSP,//待审批
1123
+                    YCD = YCD,//业务员已创单
1124
+                    TD = TD,//退单
1125
+                    CQGD = CQGD,//超期
1126
+                    CBGD = CBGD,//催办
1127
+                    ZHCX = ZHCX,//综合查询
903 1128
                 };
904 1129
                 return Content(obj.ToJson()); ;
905 1130
             }
@@ -2241,7 +2466,26 @@ namespace CallCenterApi.Interface.Controllers.workorder
2241 2466
                 if (type > 0 && type < 5)//工单类型
2242 2467
                     sql += $" and F_Type=" + type;
2243 2468
               if (state >= 0)//
2244
-                   sql += $" and F_State=" + state;
2469
+                {
2470
+                    if (state==5)
2471
+                    {
2472
+                        sql += $" and F_State in (2,3,4,5)";
2473
+                    }
2474
+                    else if (state == 6)
2475
+                    {
2476
+                        sql += $" and F_State in (11)";
2477
+                        sql += $" and F_IsVisit=" + 1; ;
2478
+                    }
2479
+                    else if (state == 10)
2480
+                    {
2481
+                        sql += $" and F_State in (10,11)";
2482
+                    }
2483
+                    else
2484
+                    {
2485
+                        sql += $" and F_State=" + state;
2486
+                    }
2487
+                }
2488
+                  
2245 2489
                 if (source > 0)//工单来源
2246 2490
                     sql += $" and F_Source=" + source;
2247 2491
 
@@ -2300,7 +2544,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2300 2544
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2301 2545
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2302 2546
                 if (ro.F_RoleCode == "QTJS" || ro.F_RoleCode == "YWY")
2303
-                sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
2547
+                    sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
2304 2548
                 else if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "BLRY" || ro.F_RoleCode == "ZG")
2305 2549
                 {
2306 2550
                     string detpid = "";
@@ -2321,7 +2565,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2321 2565
                                     }
2322 2566
                                     else
2323 2567
                                     {
2324
-                                        detpid="" + it.F_DeptId;
2568
+                                        detpid = "" + it.F_DeptId;
2325 2569
                                     }
2326 2570
                                 }
2327 2571
                             }
@@ -2330,9 +2574,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
2330 2574
                         {
2331 2575
                             detpid = ua.F_DeptId.ToString();
2332 2576
                         }
2333
-                        if (state>=0)
2577
+                        if (state >= 0)
2334 2578
                         {
2335
-                            if (GetDeptWorkOrderID(detpid,""+state+"" ) != "")
2579
+                            if (GetDeptWorkOrderID(detpid, "" + state + "") != "")
2336 2580
                             {
2337 2581
 
2338 2582
                                 sql += $"  and T_Wo_WorkOrder.F_ID in ( " + GetDeptWorkOrderID(detpid, "" + state + "") + ") ";
@@ -2346,8 +2590,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
2346 2590
                         else
2347 2591
                         {
2348 2592
                             if (GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.neworder + ", " + (int)EnumWorkOrderState.assign + "," +
2349
-                (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback+ "," + (int)EnumWorkOrderState.finish
2350
-                + "," + (int)EnumWorkOrderState.evaluate+"") != "")
2593
+                (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish
2594
+                + "," + (int)EnumWorkOrderState.evaluate + "") != "")
2351 2595
                             {
2352 2596
 
2353 2597
                                 sql += $"  and T_Wo_WorkOrder.F_ID in ( " + GetDeptWorkOrderID(detpid, "" + (int)EnumWorkOrderState.neworder + ", " + (int)EnumWorkOrderState.assign + "," +
@@ -2360,7 +2604,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2360 2604
                                 return Success("暂无工单"); ;
2361 2605
                             }
2362 2606
                         }
2363
-                      
2607
+
2364 2608
                     }
2365 2609
                     else
2366 2610
                     {
@@ -3115,6 +3359,24 @@ namespace CallCenterApi.Interface.Controllers.workorder
3115 3359
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
3116 3360
                 #endregion
3117 3361
                 int recordCount = 0;
3362
+                var list = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.urge);
3363
+                string str = "";
3364
+                foreach (var it in list)
3365
+                {
3366
+                    if (str != "")
3367
+                        str += "," + it.F_WoID;
3368
+                    else
3369
+                        str = "" + it.F_WoID;
3370
+                }
3371
+                if (str != "")
3372
+                {
3373
+                    sql += $"  and T_Wo_WorkOrder.F_ID in(" + str + ")";
3374
+                }
3375
+                else
3376
+                {
3377
+                    return Success("暂无工单");
3378
+                }
3379
+               
3118 3380
                 if (!string.IsNullOrWhiteSpace(sql))
3119 3381
                 {
3120 3382
 
@@ -3128,12 +3390,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
3128 3390
                         pageindex,
3129 3391
                         true,
3130 3392
                         out recordCount);
3131
-                    dt.Columns.Add("CBCount", typeof(int));
3132
-                    foreach (DataRow dr in dt.Rows)
3133
-                    {
3134
-                        var list = itembll.GetList(" F_WoID ='" + dr["ID"].ToString() + "' and F_ItemType=" + (int)EnumItemType.urge).Tables[0];
3135
-                        dr["CBCount"] = list.Rows.Count;
3136
-                    }
3137 3393
                     List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
3138 3394
                     List<WorkOrderNewInput> Input = modeltooip(modlelist);
3139 3395
                     if (Input != null )