|
|
@@ -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()); ;
|