|
|
@@ -22,6 +22,14 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
22
|
22
|
BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
|
|
23
|
23
|
private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
|
|
24
|
24
|
BLL.T_Wo_WorkOrder workOrder = new BLL.T_Wo_WorkOrder();
|
|
|
25
|
+ public ActionResult GetDicValueListByFlag(string flag)
|
|
|
26
|
+ {
|
|
|
27
|
+ DataTable dt = new DataTable();
|
|
|
28
|
+
|
|
|
29
|
+ dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='" + flag + "' and F_State=1 ").Tables[0];
|
|
|
30
|
+
|
|
|
31
|
+ return Success("列表加载成功", dt);
|
|
|
32
|
+ }
|
|
25
|
33
|
public ActionResult GetDataList(string stime, string endtime, int deptid = 0)
|
|
26
|
34
|
{
|
|
27
|
35
|
DataTable dtNew = new DataTable();//getData(stime, endtime, deptid);
|
|
|
@@ -947,14 +955,13 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
947
|
955
|
{
|
|
948
|
956
|
public string name;//名称
|
|
949
|
957
|
public int number;// 数量
|
|
950
|
|
- public Contrast contrast;//同比
|
|
951
|
|
-
|
|
952
|
|
- }
|
|
953
|
|
- public class Contrast
|
|
954
|
|
- {
|
|
|
958
|
+ public int Lastyearnumber;//去年同比
|
|
|
959
|
+ public int Lastmonthnumber;//上月同比
|
|
955
|
960
|
public int Lastyear;//去年同比
|
|
956
|
961
|
public int Lastmonth;//上月同比
|
|
|
962
|
+
|
|
957
|
963
|
}
|
|
|
964
|
+
|
|
958
|
965
|
public string GetCustomerCode(int area=0,int branch=0,string channel="")
|
|
959
|
966
|
{
|
|
960
|
967
|
string str = "";
|
|
|
@@ -971,17 +978,43 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
971
|
978
|
{
|
|
972
|
979
|
sql += " and F_Channel= '" + channel + "'";
|
|
973
|
980
|
}
|
|
974
|
|
- str = "select F_CustomerCode from T_Cus_CustomerBaseNew where F_IsDelete=0" + sql;
|
|
|
981
|
+ if (sql != "")
|
|
|
982
|
+ {
|
|
|
983
|
+ str = "select F_CustomerCode from T_Cus_CustomerBaseNew where F_IsDelete=0" + sql;
|
|
|
984
|
+ }
|
|
|
985
|
+ return str;
|
|
|
986
|
+ }
|
|
|
987
|
+ public string GetCustomerrel(int area = 0, int branch = 0, string channel = "")
|
|
|
988
|
+ {
|
|
|
989
|
+ string str = "";
|
|
|
990
|
+ string sql = "";
|
|
|
991
|
+ if (area > 0)
|
|
|
992
|
+ {
|
|
|
993
|
+ sql += " and F_AreaID =" + area;
|
|
|
994
|
+ }
|
|
|
995
|
+ if (branch > 0)
|
|
|
996
|
+ {
|
|
|
997
|
+ sql += " and F_BranchID =" + branch;
|
|
|
998
|
+ }
|
|
|
999
|
+ if (channel != "")
|
|
|
1000
|
+ {
|
|
|
1001
|
+ sql += " and F_Channel= '" + channel + "'";
|
|
|
1002
|
+ }
|
|
|
1003
|
+ str = "select F_LegalPhone from T_Cus_CustomerBaseNew where F_IsDelete=0" +sql;
|
|
975
|
1004
|
return str;
|
|
976
|
1005
|
}
|
|
977
|
1006
|
/// <summary>
|
|
978
|
1007
|
/// 大数据一览表
|
|
979
|
1008
|
/// </summary>
|
|
980
|
1009
|
/// <returns></returns>
|
|
981
|
|
- public ActionResult GetFeedbacklList(string stime, string endtime,string salesBase ,string product,string channel, int area=0,int branch=0, int type = 0)
|
|
|
1010
|
+ public ActionResult GetBigdataList(string stime, string endtime,string salesBase ,string product,string channel, int area=0,int branch=0, int type = 0)
|
|
982
|
1011
|
{
|
|
983
|
1012
|
#region
|
|
984
|
|
- string sql = $" and F_IsDelete=0";
|
|
|
1013
|
+ if (!Refresh())
|
|
|
1014
|
+ {
|
|
|
1015
|
+ return Error("查询失败");
|
|
|
1016
|
+ }
|
|
|
1017
|
+ string sql = $" F_IsDelete=0";
|
|
985
|
1018
|
DataTable dt = new DataTable();
|
|
986
|
1019
|
#region 筛选条件
|
|
987
|
1020
|
if (string.IsNullOrEmpty(stime))
|
|
|
@@ -992,38 +1025,57 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
992
|
1025
|
{
|
|
993
|
1026
|
endtime = DateTime.Now.Date.ToString("yyyy-MM-dd");
|
|
994
|
1027
|
}
|
|
995
|
|
-
|
|
996
|
|
- if (!string .IsNullOrEmpty (salesBase.Trim() ))
|
|
|
1028
|
+ int Months = 1;
|
|
|
1029
|
+ if (!string.IsNullOrEmpty(stime)&& !string.IsNullOrEmpty(endtime))
|
|
|
1030
|
+ {
|
|
|
1031
|
+ Months = DateTime.Parse(endtime).Month - DateTime.Parse(stime).Month;
|
|
|
1032
|
+ if (DateTime.Parse(endtime).Day > DateTime.Parse(stime).Day )
|
|
|
1033
|
+ {
|
|
|
1034
|
+ Months = Months + 1;
|
|
|
1035
|
+ }
|
|
|
1036
|
+ }
|
|
|
1037
|
+ if (!string .IsNullOrEmpty (salesBase ))
|
|
997
|
1038
|
{
|
|
998
|
1039
|
sql += $" and F_SalesBase='"+ salesBase.Trim()+"'";
|
|
999
|
1040
|
}
|
|
1000
|
1041
|
|
|
1001
|
|
- string smouth= Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).AddMonths(-1).ToLongDateString()).ToString("yyyy-MM-dd");
|
|
1002
|
|
- string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddDays(-1).ToLongDateString()).ToString("yyyy-MM-dd");
|
|
|
1042
|
+ string smouth= Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).AddMonths(-Months).ToLongDateString()).ToString("yyyy-MM-dd");
|
|
|
1043
|
+ string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddMonths(-Months).ToLongDateString()).ToString("yyyy-MM-dd");
|
|
1003
|
1044
|
string syear = Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).Date.AddYears (-1).ToLongDateString()).ToString("yyyy-MM-dd");
|
|
1004
|
1045
|
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");
|
|
1005
|
|
- string msg = "";
|
|
|
1046
|
+
|
|
1006
|
1047
|
|
|
1007
|
1048
|
#endregion
|
|
1008
|
|
- string time = sql += $" and datediff(day,F_CreateOn,'{stime}')<=0 and datediff(day,F_CreateOn,'{endtime}')>=0 ";
|
|
1009
|
|
- string lastmouth = sql += $" and datediff(day,F_CreateOn,'{smouth}')<=0 and datediff(day,F_CreateOn,'{endmouth}')>=0 ";
|
|
1010
|
|
- string lastyear = sql += $" and datediff(day,F_CreateOn,'{syear}')<=0 and datediff(day,F_CreateOn,'{endyear}')>=0 ";
|
|
|
1049
|
+ string time = $" and datediff(day,F_CreateOn,'{stime}')<=0 and datediff(day,F_CreateOn,'{endtime}')>=0 ";
|
|
|
1050
|
+ string lastmouth = $" and datediff(day,F_CreateOn,'{smouth}')<=0 and datediff(day,F_CreateOn,'{endmouth}')>=0 ";
|
|
|
1051
|
+ string lastyear= $" and datediff(day,F_CreateOn,'{syear}')<=0 and datediff(day,F_CreateOn,'{endyear}')>=0 ";
|
|
1011
|
1052
|
BigDate model = new BigDate();
|
|
1012
|
1053
|
model.type = new List<Template>();
|
|
|
1054
|
+ string strType = "";
|
|
|
1055
|
+ if (type > 0)
|
|
|
1056
|
+ {
|
|
|
1057
|
+ strType = $"and F_Type = " + type;
|
|
|
1058
|
+ }
|
|
|
1059
|
+ string strChannel = "";
|
|
|
1060
|
+ if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel))
|
|
|
1061
|
+ {
|
|
|
1062
|
+ strChannel= " and T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, channel) + ") ";
|
|
|
1063
|
+ }
|
|
|
1064
|
+ string strCategory = "";
|
|
|
1065
|
+ if (!string.IsNullOrEmpty(product))
|
|
|
1066
|
+ {
|
|
|
1067
|
+ strCategory = $" and F_TS_Category='" + product.Trim() + "'";
|
|
|
1068
|
+ }
|
|
1013
|
1069
|
#region 反馈类型
|
|
1014
|
|
- for (int i=0;i <=5;i++)
|
|
|
1070
|
+ for (int i=0;i <5;i++)
|
|
1015
|
1071
|
{
|
|
1016
|
|
- if (area >0|| branch>0||!string .IsNullOrEmpty (channel.Trim ()))
|
|
1017
|
|
- {
|
|
1018
|
|
- sql += $" and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
|
|
1019
|
|
- }
|
|
1020
|
|
- if (!string.IsNullOrEmpty(product.Trim()))
|
|
1021
|
|
- {
|
|
1022
|
|
- sql += $" and F_TS_Category='" + product.Trim() + "'";
|
|
1023
|
|
- }
|
|
|
1072
|
+ string sqltype = "";
|
|
1024
|
1073
|
Template template = new Template() ;
|
|
1025
|
1074
|
switch (i)
|
|
1026
|
1075
|
{
|
|
|
1076
|
+ case 0:
|
|
|
1077
|
+ template.name = "合计";
|
|
|
1078
|
+ break;
|
|
1027
|
1079
|
case 1:
|
|
1028
|
1080
|
template.name = "咨询";
|
|
1029
|
1081
|
break;
|
|
|
@@ -1036,15 +1088,13 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
1036
|
1088
|
case 4:
|
|
1037
|
1089
|
template.name = "建议";
|
|
1038
|
1090
|
break;
|
|
1039
|
|
- case 5:
|
|
1040
|
|
- template.name = "合计";
|
|
1041
|
|
- break;
|
|
|
1091
|
+
|
|
1042
|
1092
|
}
|
|
1043
|
|
- if (i<5 )
|
|
|
1093
|
+ if (i>0 )
|
|
1044
|
1094
|
{
|
|
1045
|
|
- sql += $"and F_Type = " + i;
|
|
|
1095
|
+ sqltype = $"and F_Type = " + i;
|
|
1046
|
1096
|
}
|
|
1047
|
|
- model.type.Add(ReturenTemplate(sql,time , lastmouth, lastyear));
|
|
|
1097
|
+ model.type.Add(ReturenTemplate(template,sql + sqltype+ strChannel+ strCategory, time , lastmouth, lastyear));
|
|
1048
|
1098
|
}
|
|
1049
|
1099
|
#endregion
|
|
1050
|
1100
|
#region 产品
|
|
|
@@ -1055,21 +1105,18 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
1055
|
1105
|
{
|
|
1056
|
1106
|
dicval = dicvalueBll.DataTableToList(dicv);
|
|
1057
|
1107
|
}
|
|
1058
|
|
- if (dicval != null && dicval.Count > 0)
|
|
|
1108
|
+ if (dicval != null && dicval.Count > 0)
|
|
1059
|
1109
|
{
|
|
1060
|
|
- if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
|
|
1061
|
|
- {
|
|
1062
|
|
- sql += $" and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
|
|
1063
|
|
- }
|
|
1064
|
|
- if (type > 0)
|
|
1065
|
|
- {
|
|
1066
|
|
- sql += $"and F_Type = " + type;
|
|
1067
|
|
- }
|
|
1068
|
1110
|
Template template = new Template();
|
|
|
1111
|
+ template.name = "合计";
|
|
|
1112
|
+ model.product.Add(ReturenTemplate(template, sql + strChannel + strType, time, lastmouth, lastyear));
|
|
1069
|
1113
|
foreach (var it in dicval)
|
|
1070
|
1114
|
{
|
|
1071
|
|
- sql += $"and F_TS_Category = '" + it.F_Name+"'";
|
|
1072
|
|
- model.product.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
|
|
|
1115
|
+ Template templates = new Template();
|
|
|
1116
|
+ string mag = "";
|
|
|
1117
|
+ mag = $"and F_TS_Category = '" + it.F_Name+"'";
|
|
|
1118
|
+ templates.name = it.F_Name;
|
|
|
1119
|
+ model.product.Add(ReturenTemplate(templates, sql + strChannel + strType + mag, time, lastmouth, lastyear));
|
|
1073
|
1120
|
}
|
|
1074
|
1121
|
}
|
|
1075
|
1122
|
#endregion
|
|
|
@@ -1083,107 +1130,212 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
1083
|
1130
|
}
|
|
1084
|
1131
|
if (QDLXl != null && QDLXl.Count > 0)
|
|
1085
|
1132
|
{
|
|
1086
|
|
- if (!string.IsNullOrEmpty(product.Trim()))
|
|
1087
|
|
- {
|
|
1088
|
|
- sql += $" and F_TS_Category='" + product.Trim() + "'";
|
|
1089
|
|
- }
|
|
1090
|
|
- if (type > 0)
|
|
1091
|
|
- {
|
|
1092
|
|
- sql += $"and F_Type = " + type;
|
|
1093
|
|
- }
|
|
1094
|
|
- Template template = new Template();
|
|
|
1133
|
+ Template templates = new Template();
|
|
|
1134
|
+ templates.name = "合计";
|
|
|
1135
|
+ model.channel.Add(ReturenTemplate(templates, sql + strCategory + strType , time, lastmouth, lastyear));
|
|
1095
|
1136
|
foreach (var it in QDLXl)
|
|
1096
|
1137
|
{
|
|
1097
|
|
- if (area > 0 || branch > 0 )
|
|
1098
|
|
- {
|
|
1099
|
|
- sql += $" and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, it.F_Name) + ") "; ;
|
|
1100
|
|
- }
|
|
1101
|
|
- model.channel.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
|
|
|
1138
|
+ Template template = new Template();
|
|
|
1139
|
+ string str = "";
|
|
|
1140
|
+ str = " and T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, it.F_Name) + ") ";
|
|
|
1141
|
+ template.name = it.F_Name;
|
|
|
1142
|
+ model.channel.Add(ReturenTemplate(template,sql+strCategory + strType + str, time, lastmouth, lastyear));
|
|
1102
|
1143
|
}
|
|
1103
|
1144
|
}
|
|
1104
|
1145
|
#endregion
|
|
1105
|
1146
|
#region 工单类型
|
|
|
1147
|
+ model.state = new List<Template>();
|
|
1106
|
1148
|
for (int i = 0; i < 5; i++)
|
|
1107
|
1149
|
{
|
|
1108
|
|
- if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
|
|
1109
|
|
- {
|
|
1110
|
|
- sql += $" and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
|
|
1111
|
|
- }
|
|
1112
|
|
- if (!string.IsNullOrEmpty(product.Trim()))
|
|
1113
|
|
- {
|
|
1114
|
|
- sql += $" and F_TS_Category='" + product.Trim() + "'";
|
|
1115
|
|
- }
|
|
1116
|
|
- if (type > 0)
|
|
1117
|
|
- {
|
|
1118
|
|
- sql += $"and F_Type = " + type;
|
|
1119
|
|
- }
|
|
|
1150
|
+ string sqlchannel = "";
|
|
|
1151
|
+
|
|
1120
|
1152
|
Template template = new Template();
|
|
1121
|
1153
|
switch (i)
|
|
1122
|
1154
|
{
|
|
|
1155
|
+ case 0:
|
|
|
1156
|
+ template.name = "合计";
|
|
|
1157
|
+ break;
|
|
1123
|
1158
|
case 1:
|
|
1124
|
1159
|
template.name = "待处理";
|
|
1125
|
|
- sql += " and F_State in (0, 1, 2, 3, 4, 5, 6, 7, 12, 14, 16)";
|
|
|
1160
|
+ sqlchannel = " and F_State in (0, 1, 2, 3, 4, 5, 6, 7, 12, 14, 16)";
|
|
1126
|
1161
|
break;
|
|
1127
|
1162
|
case 2:
|
|
1128
|
1163
|
template.name = "已处理";
|
|
1129
|
|
- sql += " and F_State in (10,11)";
|
|
|
1164
|
+ sqlchannel = " and F_State in (10,11)";
|
|
1130
|
1165
|
break;
|
|
1131
|
1166
|
case 3:
|
|
1132
|
1167
|
template.name = "待回访";
|
|
1133
|
|
- sql += " and F_State in (10)";
|
|
|
1168
|
+ sqlchannel = " and F_State in (10)";
|
|
1134
|
1169
|
break;
|
|
1135
|
1170
|
case 4:
|
|
1136
|
1171
|
template.name = "已回访";
|
|
1137
|
|
- sql += " and F_State in (11)";
|
|
|
1172
|
+ sqlchannel = " and F_State in (11)";
|
|
1138
|
1173
|
break;
|
|
|
1174
|
+
|
|
1139
|
1175
|
}
|
|
1140
|
|
- model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
|
|
|
1176
|
+ model.state.Add(ReturenTemplate(template,sql + sqlchannel+strChannel + strCategory + strType, time, lastmouth, lastyear));
|
|
1141
|
1177
|
}
|
|
1142
|
1178
|
#endregion
|
|
1143
|
1179
|
#region 满意度
|
|
1144
|
|
- for (int i = 0; i < 5; i++)
|
|
|
1180
|
+ model.satisfaction = new List<Template>();
|
|
|
1181
|
+ for (int i = 0; i <5; i++)
|
|
1145
|
1182
|
{
|
|
1146
|
|
- sql += " and F_State in (11)";
|
|
1147
|
|
- if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
|
|
1148
|
|
- {
|
|
1149
|
|
- sql += $" and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
|
|
1150
|
|
- }
|
|
1151
|
|
- if (!string.IsNullOrEmpty(product.Trim()))
|
|
1152
|
|
- {
|
|
1153
|
|
- sql += $" and F_TS_Category='" + product.Trim() + "'";
|
|
1154
|
|
- }
|
|
1155
|
|
- if (type > 0)
|
|
1156
|
|
- {
|
|
1157
|
|
- sql += $"and F_Type = " + type;
|
|
1158
|
|
- }
|
|
|
1183
|
+ string sqlsatisfaction = "";
|
|
|
1184
|
+ sqlsatisfaction += " and F_State in (11)";
|
|
|
1185
|
+ sqlsatisfaction += " and F_IsVisit =1";
|
|
1159
|
1186
|
Template template = new Template();
|
|
1160
|
1187
|
switch (i)
|
|
1161
|
1188
|
{
|
|
|
1189
|
+ case 0:
|
|
|
1190
|
+ template.name += "合计";
|
|
|
1191
|
+ break;
|
|
1162
|
1192
|
case 1:
|
|
1163
|
1193
|
template.name = "非常满意";
|
|
1164
|
|
- sql += " and F_VisitResult ='非常满意'";
|
|
|
1194
|
+ sqlsatisfaction += " and F_VisitResult ='非常满意'";
|
|
1165
|
1195
|
break;
|
|
1166
|
1196
|
case 2:
|
|
1167
|
1197
|
template.name = "满意";
|
|
1168
|
|
- sql += " and F_VisitResult ='满意'";
|
|
|
1198
|
+ sqlsatisfaction += " and F_VisitResult ='满意'";
|
|
1169
|
1199
|
break;
|
|
1170
|
1200
|
case 3:
|
|
1171
|
1201
|
template.name = "一般";
|
|
1172
|
|
- sql += " and F_VisitResult ='一般'";
|
|
|
1202
|
+ sqlsatisfaction += " and F_VisitResult ='一般'";
|
|
1173
|
1203
|
break;
|
|
1174
|
1204
|
case 4:
|
|
1175
|
1205
|
template.name = "不满意";
|
|
1176
|
|
- sql += " and F_VisitResult ='不满意'";
|
|
1177
|
|
- break;
|
|
1178
|
|
- case 5:
|
|
1179
|
|
- template.name = "合计";
|
|
|
1206
|
+ sqlsatisfaction += " and F_VisitResult ='不满意'";
|
|
1180
|
1207
|
break;
|
|
|
1208
|
+
|
|
1181
|
1209
|
}
|
|
1182
|
|
- model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
|
|
|
1210
|
+ model.satisfaction .Add(ReturenTemplate(template,sql + sqlsatisfaction + strChannel + strCategory + strType, time, lastmouth, lastyear));
|
|
1183
|
1211
|
#endregion
|
|
|
1212
|
+
|
|
|
1213
|
+
|
|
1184
|
1214
|
}
|
|
1185
|
|
- #endregion
|
|
1186
|
|
- var obj = new
|
|
|
1215
|
+ #endregion
|
|
|
1216
|
+ #region 超期工单
|
|
|
1217
|
+ model.overdue = new List<Template>();
|
|
|
1218
|
+ string sqloverdue = "";
|
|
|
1219
|
+ sqloverdue += strChannel + strCategory + strType;
|
|
|
1220
|
+ var modlelist = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + time);
|
|
|
1221
|
+ Template templatee = new Template();
|
|
|
1222
|
+ templatee.name = "合计";
|
|
|
1223
|
+ templatee.number =0;
|
|
|
1224
|
+ model.overdue.Add(templatee);
|
|
|
1225
|
+ if (modlelist.Count > 0)
|
|
|
1226
|
+ {
|
|
|
1227
|
+ foreach (var it in modlelist)
|
|
|
1228
|
+ {
|
|
|
1229
|
+ var itemList = itembll.GetModelList(" F_WoID=" + it.F_ID + "and F_WoState=1" + " order by F_ID desc");
|
|
|
1230
|
+ if (itemList.Count > 0)
|
|
|
1231
|
+ {
|
|
|
1232
|
+ if (itemList[0].F_NextDept > 0)
|
|
|
1233
|
+ {
|
|
|
1234
|
+ var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
|
|
|
1235
|
+ if (model.overdue.Count > 0)
|
|
|
1236
|
+ {
|
|
|
1237
|
+
|
|
|
1238
|
+ int overdue = 0;
|
|
|
1239
|
+ foreach (var im in model.overdue)
|
|
|
1240
|
+ {
|
|
|
1241
|
+ if (im.name == deptmodel.F_DeptName)
|
|
|
1242
|
+ {
|
|
|
1243
|
+ im.number += 1;
|
|
|
1244
|
+ overdue = 1;
|
|
|
1245
|
+ }
|
|
|
1246
|
+ if (im .name =="合计")
|
|
|
1247
|
+ {
|
|
|
1248
|
+ im.number += 1;
|
|
|
1249
|
+ }
|
|
|
1250
|
+ }
|
|
|
1251
|
+ if (overdue == 0)
|
|
|
1252
|
+ {
|
|
|
1253
|
+ Template templates = new Template();
|
|
|
1254
|
+ templates.name = deptmodel.F_DeptName;
|
|
|
1255
|
+ templates.number = 1;
|
|
|
1256
|
+ model.overdue.Add(templates);
|
|
|
1257
|
+ }
|
|
|
1258
|
+ }
|
|
|
1259
|
+ else
|
|
|
1260
|
+ {
|
|
|
1261
|
+ Template templates = new Template();
|
|
|
1262
|
+ templates.name = deptmodel.F_DeptName;
|
|
|
1263
|
+ templates.number = 1;
|
|
|
1264
|
+ model.overdue.Add(templates);
|
|
|
1265
|
+ }
|
|
|
1266
|
+
|
|
|
1267
|
+
|
|
|
1268
|
+ }
|
|
|
1269
|
+ }
|
|
|
1270
|
+ }
|
|
|
1271
|
+ }
|
|
|
1272
|
+ if (model.overdue.Count > 0)
|
|
|
1273
|
+ {
|
|
|
1274
|
+ foreach (var it in model.overdue)
|
|
|
1275
|
+ {
|
|
|
1276
|
+ if (it .name =="合计")
|
|
|
1277
|
+ {
|
|
|
1278
|
+ var lastmouthmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastmouth).Count ;
|
|
|
1279
|
+ var lastyearmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastyear).Count ;
|
|
|
1280
|
+ it.Lastmonthnumber = lastmouthmodlel;
|
|
|
1281
|
+ it.Lastyearnumber = lastyearmodlel;
|
|
|
1282
|
+ it.Lastmonth = it.number - lastmouthmodlel;
|
|
|
1283
|
+ it.Lastyear = it.number - lastyearmodlel;
|
|
|
1284
|
+ }
|
|
|
1285
|
+ else
|
|
|
1286
|
+ {
|
|
|
1287
|
+ var deptmodel = departmentBLL.GetModel(it.name);
|
|
|
1288
|
+ var lastmouthmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastmouth);
|
|
|
1289
|
+ int lastmouthlist = 0;
|
|
|
1290
|
+ int lastyearlist = 0;
|
|
|
1291
|
+ if (lastmouthmodlel.Count > 0)
|
|
|
1292
|
+ {
|
|
|
1293
|
+ foreach (var im in lastmouthmodlel)
|
|
|
1294
|
+ {
|
|
|
1295
|
+ var itemList = itembll.GetModelList(" F_WoID=" + im.F_ID + "and F_WoState=1" + "and F_NextDept=" + deptmodel.F_DeptId + " order by F_ID desc");
|
|
|
1296
|
+ if (itemList.Count > 0)
|
|
|
1297
|
+ {
|
|
|
1298
|
+ lastmouthlist++;
|
|
|
1299
|
+ }
|
|
|
1300
|
+ }
|
|
|
1301
|
+ }
|
|
|
1302
|
+ var lastyearmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastyear);
|
|
|
1303
|
+ if (lastyearmodlel.Count > 0)
|
|
|
1304
|
+ {
|
|
|
1305
|
+ foreach (var im in lastyearmodlel)
|
|
|
1306
|
+ {
|
|
|
1307
|
+ var itemList = itembll.GetModelList(" F_WoID=" + im.F_ID + "and F_WoState=1" + "and F_NextDept=" + deptmodel.F_DeptId + " order by F_ID desc");
|
|
|
1308
|
+ if (itemList.Count > 0)
|
|
|
1309
|
+ {
|
|
|
1310
|
+ lastyearlist++;
|
|
|
1311
|
+ }
|
|
|
1312
|
+ }
|
|
|
1313
|
+ }
|
|
|
1314
|
+ it.Lastmonthnumber = lastmouthlist;
|
|
|
1315
|
+ it.Lastyearnumber = lastyearlist;
|
|
|
1316
|
+ it.Lastmonth = it.number - lastmouthlist;
|
|
|
1317
|
+ it.Lastyear = it.number - lastyearlist;
|
|
|
1318
|
+ }
|
|
|
1319
|
+ }
|
|
|
1320
|
+
|
|
|
1321
|
+ }
|
|
|
1322
|
+ if (model.overdue.Count > 0)
|
|
|
1323
|
+ {
|
|
|
1324
|
+ for (int j = 0; j < model.overdue.Count - 1; j++)
|
|
|
1325
|
+ {
|
|
|
1326
|
+ for (int z = 0; z < model.overdue.Count - 1 - j; z++)
|
|
|
1327
|
+ {
|
|
|
1328
|
+ if (model.overdue[z].number < model.overdue[z + 1].number)
|
|
|
1329
|
+ {
|
|
|
1330
|
+ var temp = model.overdue[z + 1];
|
|
|
1331
|
+ model.overdue[z + 1] = model.overdue[z];
|
|
|
1332
|
+ model.overdue[z] = temp;
|
|
|
1333
|
+ }
|
|
|
1334
|
+ }
|
|
|
1335
|
+ }
|
|
|
1336
|
+ }
|
|
|
1337
|
+ #endregion
|
|
|
1338
|
+ var obj = new
|
|
1187
|
1339
|
{
|
|
1188
|
1340
|
state = "success",
|
|
1189
|
1341
|
message = "成功",
|
|
|
@@ -1193,6 +1345,8 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
1193
|
1345
|
|
|
1194
|
1346
|
return Content(obj.ToJson()); ;
|
|
1195
|
1347
|
}
|
|
|
1348
|
+
|
|
|
1349
|
+
|
|
1196
|
1350
|
private bool Refresh()
|
|
1197
|
1351
|
{
|
|
1198
|
1352
|
int type = 0;
|
|
|
@@ -1299,15 +1453,16 @@ namespace CallCenterApi.Interface.Controllers.report
|
|
1299
|
1453
|
}
|
|
1300
|
1454
|
return true;
|
|
1301
|
1455
|
}
|
|
1302
|
|
- public Template ReturenTemplate(string sql,string time,string lastmouth,string lastyear )
|
|
|
1456
|
+ public Template ReturenTemplate(Template template,string sql,string time,string lastmouth,string lastyear )
|
|
1303
|
1457
|
{
|
|
1304
|
|
- Template template = new Template();
|
|
1305
|
1458
|
template.number = new BLL.T_Wo_WorkOrder().GetModelList(sql + time).Count;//
|
|
1306
|
1459
|
int mounthnumber = 0, yearnumber = 0;
|
|
1307
|
1460
|
mounthnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastmouth).Count;//
|
|
1308
|
1461
|
yearnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastyear).Count;//
|
|
1309
|
|
- template.contrast.Lastmonth = template.number - mounthnumber;
|
|
1310
|
|
- template.contrast.Lastyear = template.number - yearnumber;
|
|
|
1462
|
+ template.Lastmonthnumber = mounthnumber;
|
|
|
1463
|
+ template.Lastyearnumber = yearnumber;
|
|
|
1464
|
+ template.Lastmonth = template.number - mounthnumber;
|
|
|
1465
|
+ template.Lastyear = template.number - yearnumber;
|
|
1311
|
1466
|
return template;
|
|
1312
|
1467
|
}
|
|
1313
|
1468
|
|