duhongyu 6 lat temu
rodzic
commit
e0732d5201

+ 4 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

@@ -57,7 +57,7 @@ namespace CallCenterApi.Interface.Controllers
57 57
             }
58 58
 
59 59
         }
60
-        public ActionResult GetSmSList(string starttime, string endtime, int pageindex = 1, int pagesize = 10)
60
+        public ActionResult GetSmSList(string starttime, string endtime,string phone, int pageindex = 1, int pagesize = 10)
61 61
         {
62 62
             int userId = CurrentUser.UserData.F_UserId;
63 63
             if (userId > 0)
@@ -68,7 +68,9 @@ namespace CallCenterApi.Interface.Controllers
68 68
                     sql += " and datediff(day,RecvTime,'" + starttime + "')<=0 ";
69 69
                 if (!string.IsNullOrEmpty(endtime))
70 70
                     sql += " and datediff(day,RecvTime,'" + endtime + "')>=0   ";
71
-
71
+                if (!string.IsNullOrEmpty(phone))
72
+                    sql += " and CallerNum= "+ phone;
73
+                
72 74
                 int recordCount = 0;
73 75
                 dt = BLL.PagerBLL.GetListPager(
74 76
                         "T_SMS_RecvSMS",

+ 421 - 150
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -2100,13 +2100,34 @@ question, int page = 1, int limit = 10)
2100 2100
             public string name;
2101 2101
             public int  typeid;
2102 2102
             public int number;//数量
2103
-            public string ongesttime="0h";//用时最长
2104
-            public string minimumtime = "0h";//用时最短
2105
-            public string averageTime = "0h";//平均用时
2106
-            public string median = "0h";//中位数
2107
-            public string Overdue="0";//超期数量
2108
-            public string EndOverdue = "0";//超期数量
2109
-            public string efficiency = "0%";//效率提升率
2103
+            /// <summary>
2104
+            /// 用时最长
2105
+            /// </summary>
2106
+            public string ongesttime="0h";//
2107
+            /// <summary>
2108
+            /// 用时最短
2109
+            /// </summary>
2110
+            public string minimumtime = "0h";//
2111
+            /// <summary>
2112
+            /// 平均用时
2113
+            /// </summary>
2114
+            public string averageTime = "0h";//
2115
+            /// <summary>
2116
+            /// 中位数
2117
+            /// </summary>
2118
+            public string median = "0h";//
2119
+            /// <summary>
2120
+            /// 超期数量
2121
+            /// </summary>
2122
+            public string Overdue="0";//
2123
+            /// <summary>
2124
+            /// 超期数量
2125
+            /// </summary>
2126
+            public string EndOverdue = "0";//
2127
+            /// <summary>
2128
+            /// 效率提升率
2129
+            /// </summary>
2130
+            public string efficiency = "0%";//
2110 2131
             public List<worker> worker;
2111 2132
         }
2112 2133
        
@@ -2932,8 +2953,9 @@ question, int page = 1, int limit = 10)
2932 2953
          else if (isEnd == 2)
2933 2954
                 sql += $" and F_State =11 ";
2934 2955
             string Queststr = "";
2935
-            if (questionName!="")
2956
+            if (questionName!=""&& questionName!="0")
2936 2957
             {
2958
+               
2937 2959
                 try
2938 2960
                 {
2939 2961
                     Queststr = " select * from T_Wo_QuestionManage where F_IsDelete=0 and F_Label in(3) and F_Id='" + questionName + "'";
@@ -2998,190 +3020,199 @@ question, int page = 1, int limit = 10)
2998 3020
             DataTable QuestionManage = DbHelperSQL.Query(Queststr).Tables[0];
2999 3021
             List<Model.T_Wo_QuestionManage> categorylist = quesBLL.DataTableToList(QuestionManage);
3000 3022
             List<Complainthandling> modeNamelList = new List<Complainthandling>(categorylist.Count);
3001
-      //var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.deal+ "order by F_ID desc ");
3002
-            if (modellist !=null )
3023
+            string category = "";
3024
+            foreach (var it  in categorylist)
3003 3025
             {
3004
-                for (int i=0;i < categorylist.Count; i++)
3005
-              {
3026
+                if (category != "")
3027
+                    category += ",'" + it.F_Id+"'";
3028
+                else
3029
+                    category+= "'"+it.F_Id+"'";
3030
+            }
3031
+            var categorymodellist = workOrder.GetModelList(sql+ "and F_QuestionType in ("+ category+")");
3032
+            #region 
3033
+            if (questionName == "" || questionName == "0")
3034
+            {
3035
+                if (categorymodellist != null)
3036
+                {
3006 3037
                     List<float> timehource = new List<float>();
3007 3038
                     Complainthandling model = new Complainthandling();
3008
-                    model.name = categorylist[i].F_QuestionName;
3009
-                    model .typeid= categorylist[i].F_Id ;
3010
-                    model.number = 0;
3039
+                    model.name = "合计";
3040
+                    model.number = categorymodellist.Count;
3011 3041
                     int Overdue = 0;
3012 3042
                     int EndOverdue = 0;
3013 3043
                     int efficiency = 0;
3014 3044
                     model.worker = new List<worker>();
3015 3045
                     int lastnumber = 0;
3016
-                    foreach (var it in modellist)
3046
+                    foreach (var it in categorymodellist)
3017 3047
                     {
3018 3048
                         try
3019 3049
                         {
3020
-                            if (int .Parse (it.F_QuestionType) == categorylist[i].F_Id )
3050
+                            if (it.F_State == 10 || it.F_State == 11)
3021 3051
                             {
3022
-                                model.number ++;
3023
-                                if (it .F_State ==10|| it.F_State == 11)
3052
+                                efficiency++;
3053
+                              //  System.TimeSpan id = DateTime.Parse(it.F_DealTime.ToString()) - DateTime.Parse//(it.F_CreateOn.ToString());
3054
+                            //    double t = id.TotalHours;
3055
+                               
3056
+                            }
3057
+                            if (it.F_IsOver == 1)
3058
+                            {
3059
+                                worker worker = new worker();
3060
+                                worker.F_WorkOrderCode = it.F_WorkOrderCode;
3061
+                                if (it.F_State == 1)
3062
+                                    worker.F_State = "待接单";
3063
+                                else if (it.F_State == 2)
3064
+                                    worker.F_State = "待处理";
3065
+                                else if (it.F_State == 3)
3066
+                                    worker.F_State = "已退回";
3067
+                                else if (it.F_State == 4)
3068
+                                    worker.F_State = "异常退回";
3069
+                                else if (it.F_State == 4)
3070
+                                    worker.F_State = "异常退回";
3071
+                                else if (it.F_State == 11)
3072
+                                    worker.F_State = "已回访";
3073
+                                else
3074
+                                    worker.F_State = "已处理";
3075
+                                if (it.F_Type == "1")
3024 3076
                                 {
3025
-                                    efficiency++;
3026
-                                    System.TimeSpan id = DateTime.Parse(it.F_DealTime.ToString()) - DateTime.Parse(it.F_CreateOn.ToString());
3027
-                                    double t = id.TotalHours;
3028
-                                    timehource.Add((float)t);
3077
+                                    worker.F_Type = "咨询";
3029 3078
                                 }
3030
-                                if (it .F_IsOver ==1)
3079
+                                else if (it.F_Type == "2")
3031 3080
                                 {
3032
-                                    worker worker = new worker();
3033
-                                    worker.F_WorkOrderCode = it.F_WorkOrderCode;
3034
-                                    if (it.F_State == 1)
3035
-                                        worker.F_State = "待接单";
3036
-                                    else if (it.F_State == 2)
3037
-                                        worker.F_State = "待处理";
3038
-                                    else if (it.F_State == 3)
3039
-                                        worker.F_State = "已退回";
3040
-                                    else if (it.F_State == 4)
3041
-                                        worker.F_State = "异常退回";
3042
-                                    else if (it.F_State == 4)
3043
-                                        worker.F_State = "异常退回";
3044
-                                    else if (it.F_State == 11)
3045
-                                        worker.F_State = "已回访";
3046
-                                    else 
3047
-                                        worker.F_State = "已处理";
3048
-                                    if (it .F_Type == "1")
3049
-                                    {
3050
-                                        worker.F_Type = "咨询";
3051
-                                    }
3052
-                                    else if (it.F_Type == "2")
3053
-                                    {
3054
-                                        worker.F_Type = "投诉";
3055
-                                    }
3056
-                                    else if (it.F_Type == "3")
3057
-                                    {
3058
-                                        worker.F_Type = "抽检";
3059
-                                    }
3060
-                                    else
3081
+                                    worker.F_Type = "投诉";
3082
+                                }
3083
+                                else if (it.F_Type == "3")
3084
+                                {
3085
+                                    worker.F_Type = "抽检";
3086
+                                }
3087
+                                else
3088
+                                {
3089
+                                    worker.F_Type = "建议及其他";
3090
+                                }
3091
+                                worker.F_SalesBase = it.F_SalesBase;
3092
+                                worker.F_Description = it.F_Description;
3093
+                                string timeover = "", timeover2 = ""; int x = 0, y = 0;
3094
+                                var itemList = itembll.GetModelList("  F_WoID=" + it.F_ID  + " order by F_ID desc");
3095
+                                if (itemList[0].F_NextDept > 0)
3096
+                                {
3097
+                                    var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
3098
+                                    if (deptmodel != null)
3061 3099
                                     {
3062
-                                        worker.F_Type = "建议及其他";
3100
+                                        worker.F_Responsibility = deptmodel.F_DeptName;
3063 3101
                                     }
3064
-                                    worker.F_SalesBase = it.F_SalesBase;
3065
-                                    worker.F_Description = it.F_Description;
3066
-                                    string timeover = "", timeover2 = ""; int x = 0, y = 0;
3067
-                                    var itemList = itembll.GetModelList("  F_WoID=" + it.F_ID + "and F_WoState=1" + " order by F_ID desc");
3068
-                             
3069
-                                   
3070
-                                    if (itemList[0].F_NextDept > 0)
3102
+                                }
3103
+                                int limit = it.F_limit ;
3104
+                                    if (itemList != null)
3105
+                                  {
3106
+                                    for (int z = 0; z < itemList.Count; z++)
3071 3107
                                     {
3072
-                                        var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
3073
-                                        if (deptmodel != null)
3108
+                                        if (itemList[z].F_WoState >= 1)
3074 3109
                                         {
3075
-                                            worker.F_Responsibility = deptmodel.F_DeptName;
3110
+                                            if (itemList[z].F_WoState == 1)
3111
+                                            {
3112
+                                                x = z;
3113
+                                                timeover = itemList[z ].F_CreateTime.ToString();
3114
+                                             //   limit = int.Parse(itemList[z].F_LimitTime);
3115
+                                                continue;
3116
+                                            }
3076 3117
                                         }
3077 3118
                                     }
3078
-                                    int limit =0;
3079
-                                    if (itemList != null )
3119
+                                  for (int z = 0; z < itemList.Count; z++)
3080 3120
                                     {
3081
-                                       for (int z = 0; z < itemList.Count; z++)
3121
+                                        if (itemList[z].F_WoState >= 1)
3082 3122
                                         {
3083
-                                                if (itemList[z].F_WoState >= 1)
3123
+                                            if (itemList[z].F_WoState == 10)
3124
+                                            {
3125
+                                                y = z;
3126
+                                                timeover2 = itemList[z].F_CreateTime.ToString();
3127
+                                          //      limit = int.Parse(itemList[z].F_LimitTime);
3128
+                                            }
3129
+                                        }
3130
+                                        if (timeover2 != "")
3131
+                                        {
3132
+                                            if (timeover != "")
3133
+                                            {
3134
+                                                if (x > y)
3084 3135
                                                 {
3085
-                                                    if (itemList[z].F_WoState == 1)
3136
+                                                    System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3137
+                                                    double a = id.TotalHours;
3138
+                                                    worker.time = a - limit;
3139
+                                                    timehource.Add((float)worker.time);
3140
+                                                    if (worker.time > 24)
3086 3141
                                                     {
3087
-                                                        x = z;
3088
-                                                        timeover = itemList[z].F_CreateTime.ToString();
3089
-                                                        limit =int .Parse (itemList[z].F_LimitTime);
3142
+                                                        double t = worker.time / 24;
3143
+                                                        double v = worker.time % 24;
3144
+                                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3145
+                                                       
3090 3146
                                                     }
3091
-                                                    if (itemList[z].F_WoState == 10)
3147
+                                                    else
3092 3148
                                                     {
3093
-                                                        y = z;
3094
-                                                        timeover2 = itemList[z].F_CreateTime.ToString();
3095
-                                                        limit = int.Parse(itemList[z].F_LimitTime);
3149
+                                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3096 3150
                                                     }
3097 3151
                                                 }
3098
-                                                if (timeover2 != "")
3152
+                                                else
3099 3153
                                                 {
3100
-                                                    if (timeover != "")
3154
+                                                    System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3155
+                                                    double a = id.TotalHours;
3156
+
3157
+                                                    worker.time = a - limit;
3158
+                                                    timehource.Add((float)worker.time);
3159
+                                                    if (worker.time > 24)
3101 3160
                                                     {
3102
-                                                        if (x > y)
3103
-                                                        {
3104
-                                                            System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3105
-                                                            double a = id.TotalHours;
3106
-                     
3107
-                                                        
3108
-                                                            worker.time = a - limit;
3109
-                                                        if (worker.time>24)
3110
-                                                        {
3111
-                                                            double  t = worker.time / 24;
3112
-                                                            double v = worker.time % 24;
3113
-                                                            worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3114
-                                                        }
3115
-                                                        else
3116
-                                                        {
3117
-                                                            worker.overtime = string.Format("{0:f2}h", a - limit);
3118
-                                                        }
3119
-                                                    }
3120
-                                                        else
3121
-                                                        {
3122
-                                                            System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3123
-                                                            double a = id.TotalHours;
3124
-                           
3125
-                                                            worker.time = a - limit;
3126
-                                                        if (worker.time > 24)
3127
-                                                        {
3128
-                                                            double t = worker.time / 24;
3129
-                                                            double v = worker.time % 24;
3130
-                                                            worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3131
-                                                        }
3132
-                                                        else
3133
-                                                        {
3134
-                                                            worker.overtime = string.Format("{0:f2}h", a - limit);
3135
-                                                        }
3161
+                                                        double t = worker.time / 24;
3162
+                                                        double v = worker.time % 24;
3163
+                                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3136 3164
                                                     }
3165
+                                                    else
3166
+                                                    {
3167
+                                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3137 3168
                                                     }
3138 3169
 
3139 3170
                                                 }
3140
-                                                else if (time1 != "")
3141
-                                                {
3142
-                                                    System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3143
-                                                    double a = id.TotalHours;
3144
-                        
3145
-                                                    worker.time = a - limit;
3146
-                                                if (worker.time > 24)
3147
-                                                {
3148
-                                                    double t = worker.time / 24;
3149
-                                                    double v = worker.time % 24;
3150
-                                                    worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3151
-                                                }
3152
-                                                else
3153
-                                                {
3154
-                                                    worker.overtime = string.Format("{0:f2}h", a - limit);
3155
-                                                }
3156 3171
                                             }
3172
+
3157 3173
                                         }
3158
-                                        }
3159
-                                    if (it.F_State != 11)
3160
-                                        Overdue++;
3161
-                                    else
3162
-                                        EndOverdue++;
3163
-                                    model.worker.Add(worker);
3164
-                                }
3165
-                                model.Overdue = Overdue + "";
3166
-                                model.EndOverdue = EndOverdue + "";
3167
-                                if (lastmodellist != null)
3168
-                                {
3169
-                                    foreach (var iv in lastmodellist)
3170
-                                    {
3171
-                                        if (int.Parse(iv.F_QuestionType )== categorylist[i].F_Id)
3174
+                                        else if (timeover != "")
3172 3175
                                         {
3173
-                                            if (iv.F_State == 10 || iv.F_State == 11)
3174
-                                                lastnumber++;
3176
+                                            System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3177
+                                            double a = id.TotalHours;
3178
+
3179
+                                            worker.time = a - limit;
3180
+                                            timehource.Add((float)worker.time);
3181
+                                            if (worker.time > 24)
3182
+                                            {
3183
+                                                double t = worker.time / 24;
3184
+                                                double v = worker.time % 24;
3185
+                                                worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3186
+                                            }
3187
+                                            else
3188
+                                            {
3189
+                                                worker.overtime = string.Format("{0:f2}h", a - limit);
3190
+                                            }
3175 3191
                                         }
3176 3192
                                     }
3177 3193
                                 }
3194
+                                if (it.F_State != 11)
3195
+                                    Overdue++;
3196
+                                else
3197
+                                    EndOverdue++;
3198
+                                model.worker.Add(worker);
3199
+                            }
3200
+                            model.Overdue = Overdue + "";
3201
+                            model.EndOverdue = EndOverdue + "";
3202
+                            if (lastmodellist != null)
3203
+                            {
3204
+                                foreach (var iv in lastmodellist)
3205
+                                {
3206
+                                    if (iv.F_State == 10 || iv.F_State == 11)
3207
+                                        lastnumber++;
3208
+                                }
3178 3209
                             }
3179 3210
                         }
3180 3211
                         catch
3181 3212
                         {
3182
-                           
3213
+
3183 3214
                         }
3184
-                      
3215
+
3185 3216
                     }
3186 3217
                     if (lastnumber == 0)
3187 3218
                     {
@@ -3195,7 +3226,7 @@ question, int page = 1, int limit = 10)
3195 3226
                     if (timehource.Count > 0)
3196 3227
                     {
3197 3228
                         timehource.Sort((a, b) => b.CompareTo(a));
3198
-                       
3229
+
3199 3230
                         model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3200 3231
                         model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3201 3232
                         int n = timehource.Count / 2;
@@ -3215,17 +3246,257 @@ question, int page = 1, int limit = 10)
3215 3246
                         model.averageTime = "0h";
3216 3247
                     }
3217 3248
 
3218
-                    model.worker .Sort((a, b) => b.time  .CompareTo(a.time));
3249
+                    model.worker.Sort((a, b) => b.time.CompareTo(a.time));
3219 3250
                     if (questionName != "")
3220 3251
                         modeNamelList.Add(model);
3221 3252
                     else if (model.number > 0)
3222 3253
                     {
3223
-                        
3224 3254
                         modeNamelList.Add(model);
3225 3255
                     }
3226 3256
                 }
3227
-                       
3228 3257
             }
3258
+            
3259
+            #endregion
3260
+            //var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.deal+ "order by F_ID desc ");
3261
+            if (questionName!="0")
3262
+            {
3263
+                if (modellist != null)
3264
+                {
3265
+                    for (int i = 0; i < categorylist.Count; i++)
3266
+                    {
3267
+                        List<float> timehource = new List<float>();
3268
+                        Complainthandling model = new Complainthandling();
3269
+                        model.name = categorylist[i].F_QuestionName;
3270
+                        model.typeid = categorylist[i].F_Id;
3271
+                        model.number = 0;
3272
+                        int Overdue = 0;
3273
+                        int EndOverdue = 0;
3274
+                        int efficiency = 0;
3275
+                        model.worker = new List<worker>();
3276
+                        int lastnumber = 0;
3277
+                        foreach (var it in modellist)
3278
+                        {
3279
+                            try
3280
+                            {
3281
+                                if (int.Parse(it.F_QuestionType) == categorylist[i].F_Id)
3282
+                                {
3283
+                                    model.number++;
3284
+                                    if (it.F_State == 10 || it.F_State == 11)
3285
+                                    {
3286
+                                        efficiency++;
3287
+                                        System.TimeSpan id = DateTime.Parse(it.F_DealTime.ToString()) - DateTime.Parse(it.F_CreateOn.ToString());
3288
+                                        double t = id.TotalHours;
3289
+                                        timehource.Add((float)t);
3290
+                                    }
3291
+                                    if (it.F_IsOver == 1)
3292
+                                    {
3293
+                                        worker worker = new worker();
3294
+                                        worker.F_WorkOrderCode = it.F_WorkOrderCode;
3295
+                                        if (it.F_State == 1)
3296
+                                            worker.F_State = "待接单";
3297
+                                        else if (it.F_State == 2)
3298
+                                            worker.F_State = "待处理";
3299
+                                        else if (it.F_State == 3)
3300
+                                            worker.F_State = "已退回";
3301
+                                        else if (it.F_State == 4)
3302
+                                            worker.F_State = "异常退回";
3303
+                                        else if (it.F_State == 4)
3304
+                                            worker.F_State = "异常退回";
3305
+                                        else if (it.F_State == 11)
3306
+                                            worker.F_State = "已回访";
3307
+                                        else
3308
+                                            worker.F_State = "已处理";
3309
+                                        if (it.F_Type == "1")
3310
+                                        {
3311
+                                            worker.F_Type = "咨询";
3312
+                                        }
3313
+                                        else if (it.F_Type == "2")
3314
+                                        {
3315
+                                            worker.F_Type = "投诉";
3316
+                                        }
3317
+                                        else if (it.F_Type == "3")
3318
+                                        {
3319
+                                            worker.F_Type = "抽检";
3320
+                                        }
3321
+                                        else
3322
+                                        {
3323
+                                            worker.F_Type = "建议及其他";
3324
+                                        }
3325
+                                        worker.F_SalesBase = it.F_SalesBase;
3326
+                                        worker.F_Description = it.F_Description;
3327
+                                        string timeover = "", timeover2 = ""; int x = 0, y = 0;
3328
+                                        var itemList = itembll.GetModelList("  F_WoID=" + it.F_ID + " order by F_ID desc");
3329
+                                        if (itemList[0].F_NextDept > 0)
3330
+                                        {
3331
+                                            var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
3332
+                                            if (deptmodel != null)
3333
+                                            {
3334
+                                                worker.F_Responsibility = deptmodel.F_DeptName;
3335
+                                            }
3336
+                                        }
3337
+                                        int limit = it.F_limit;
3338
+                                        if (itemList != null)
3339
+                                        {
3340
+                                            for (int z = 0; z < itemList.Count; z++)
3341
+                                            {
3342
+                                                if (itemList[z].F_WoState >= 1)
3343
+                                                {
3344
+                                                    if (itemList[z].F_WoState == 1)
3345
+                                                    {
3346
+                                                        x = z;
3347
+                                                        timeover = itemList[z].F_CreateTime.ToString();
3348
+                                                        //   limit = int.Parse(itemList[z].F_LimitTime);
3349
+                                                        continue;
3350
+                                                    }
3351
+                                                }
3352
+                                            }
3353
+                                            for (int z = 0; z < itemList.Count; z++)
3354
+                                            {
3355
+                                                if (itemList[z].F_WoState >= 1)
3356
+                                                {
3357
+                                                    if (itemList[z].F_WoState == 10)
3358
+                                                    {
3359
+                                                        y = z;
3360
+                                                        timeover2 = itemList[z].F_CreateTime.ToString();
3361
+                                                        //      limit = int.Parse(itemList[z].F_LimitTime);
3362
+                                                    }
3363
+                                                }
3364
+                                                if (timeover2 != "")
3365
+                                                {
3366
+                                                    if (timeover != "")
3367
+                                                    {
3368
+                                                        if (x > y)
3369
+                                                        {
3370
+                                                            System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3371
+                                                            double a = id.TotalHours;
3372
+                                                            worker.time = a - limit;
3373
+                                                            timehource.Add((float)worker.time);
3374
+                                                            if (worker.time > 24)
3375
+                                                            {
3376
+                                                                double t = worker.time / 24;
3377
+                                                                double v = worker.time % 24;
3378
+                                                                worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3379
+
3380
+                                                            }
3381
+                                                            else
3382
+                                                            {
3383
+                                                                worker.overtime = string.Format("{0:f2}h", a - limit);
3384
+                                                            }
3385
+                                                        }
3386
+                                                        else
3387
+                                                        {
3388
+                                                            System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3389
+                                                            double a = id.TotalHours;
3390
+
3391
+                                                            worker.time = a - limit;
3392
+                                                            timehource.Add((float)worker.time);
3393
+                                                            if (worker.time > 24)
3394
+                                                            {
3395
+                                                                double t = worker.time / 24;
3396
+                                                                double v = worker.time % 24;
3397
+                                                                worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3398
+                                                            }
3399
+                                                            else
3400
+                                                            {
3401
+                                                                worker.overtime = string.Format("{0:f2}h", a - limit);
3402
+                                                            }
3403
+
3404
+                                                        }
3405
+                                                    }
3406
+
3407
+                                                }
3408
+                                                else if (timeover != "")
3409
+                                                {
3410
+                                                    System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3411
+                                                    double a = id.TotalHours;
3412
+
3413
+                                                    worker.time = a - limit;
3414
+                                                    timehource.Add((float)worker.time);
3415
+                                                    if (worker.time > 24)
3416
+                                                    {
3417
+                                                        double t = worker.time / 24;
3418
+                                                        double v = worker.time % 24;
3419
+                                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3420
+                                                    }
3421
+                                                    else
3422
+                                                    {
3423
+                                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3424
+                                                    }
3425
+                                                }
3426
+                                            }
3427
+                                        }
3428
+                                        if (it.F_State != 11)
3429
+                                            Overdue++;
3430
+                                        else
3431
+                                            EndOverdue++;
3432
+                                        model.worker.Add(worker);
3433
+                                    }
3434
+                                    model.Overdue = Overdue + "";
3435
+                                    model.EndOverdue = EndOverdue + "";
3436
+                                    if (lastmodellist != null)
3437
+                                    {
3438
+                                        foreach (var iv in lastmodellist)
3439
+                                        {
3440
+                                            if (int.Parse(iv.F_QuestionType) == categorylist[i].F_Id)
3441
+                                            {
3442
+                                                if (iv.F_State == 10 || iv.F_State == 11)
3443
+                                                    lastnumber++;
3444
+                                            }
3445
+                                        }
3446
+                                    }
3447
+                                }
3448
+                            }
3449
+                            catch
3450
+                            {
3451
+
3452
+                            }
3453
+
3454
+                        }
3455
+                        if (lastnumber == 0)
3456
+                        {
3457
+                            model.efficiency = string.Format("{0:f2}% ", efficiency / 1 * 100);
3458
+                        }
3459
+                        else
3460
+                        {
3461
+                            int v = efficiency - lastnumber;
3462
+                            model.efficiency = string.Format("{0:f2}% ", v / lastnumber * 100);
3463
+                        }
3464
+                        if (timehource.Count > 0)
3465
+                        {
3466
+                            timehource.Sort((a, b) => b.CompareTo(a));
3467
+
3468
+                            model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3469
+                            model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3470
+                            int n = timehource.Count / 2;
3471
+                            model.median = string.Format("{0:f2}h", timehource[n]);
3472
+                            float y = 0;
3473
+                            foreach (var iu in timehource)
3474
+                            {
3475
+                                y += iu;
3476
+                            }
3477
+                            model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3478
+                        }
3479
+                        else
3480
+                        {
3481
+                            model.ongesttime = "0h";
3482
+                            model.minimumtime = "0h";
3483
+                            model.median = "0h";
3484
+                            model.averageTime = "0h";
3485
+                        }
3486
+
3487
+                        model.worker.Sort((a, b) => b.time.CompareTo(a.time));
3488
+                        if (questionName != "")
3489
+                            modeNamelList.Add(model);
3490
+                        else if (model.number > 0)
3491
+                        {
3492
+
3493
+                            modeNamelList.Add(model);
3494
+                        }
3495
+                    }
3496
+
3497
+                }
3498
+            }
3499
+            
3229 3500
             modeNamelList.Sort((a, b) => b .number .CompareTo(a .number ));
3230 3501
             var obj = new
3231 3502
             {