Browse Source

投诉日期分布表,工单表,工单修改

duhongyu 6 years ago
parent
commit
b806090804

+ 74 - 36
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/BusinessController.cs

@@ -132,22 +132,43 @@ namespace CallCenterApi.Interface.Controllers.report
132 132
 
133 133
            
134 134
         }
135
-        private Date  RetuDate(string name,DateTime time ,List <Model .T_Bus_WorkOrder> modelList)
135
+
136
+        private class Timeslot
137
+        {
138
+            public int onetime { get; set; }
139
+            public int twotime { get; set; }
140
+            public int threetime { get; set; }
141
+            public int stime { get; set; }
142
+            public int etime { get; set; }
143
+        }
144
+        private Timeslot GetTimeslot (int mouth)
145
+        {
146
+            Timeslot timeslot = new Timeslot();
147
+            DateTime date = DateTime.Parse(DateTime.Now.ToString("yyyy") + "-" + mouth + "-01");
148
+            timeslot.onetime = date.AddMonths (-2).Month ;
149
+            timeslot.twotime = date.AddMonths(-1).Month;
150
+            timeslot.threetime = date.Month;
151
+            timeslot.stime = date.AddMonths(-11).Month;
152
+            timeslot.etime = date.AddMonths(-3).Month;
153
+            return timeslot;
154
+        }
155
+
156
+        private Date  RetuDate(string name, Timeslot timeslot, List <Model .T_Bus_WorkOrder> modelList)
136 157
         {
137 158
             Date date = new Date() ;
138
-            date.name = name;
159
+            date.name = DateTime .Parse (name).ToString ("MM月dd日")  ;
139 160
             date.total = 0;
140 161
             date.MonthCount1 = 0;
141
-            date.MonthCount1name = time.AddMonths(-11).Month + "-" + time.AddMonths(-4).Month + "月份日期";
162
+            date.MonthCount1name = timeslot.stime  + "-" + timeslot.etime  + "月份日期";
142 163
             date.MonthCountmix1 = "0.00%";
143 164
             date.MonthCount2 = 0;
144
-            date.MonthCount2name = time.AddMonths(-3).Month + "月份日期";
165
+            date.MonthCount2name = timeslot.onetime  + "月份日期";
145 166
             date.MonthCountmix2 = "0.00%";
146 167
             date.MonthCount3 = 0;
147
-            date.MonthCount3name = time.AddMonths(-2).Month + "月份日期";
168
+            date.MonthCount3name = timeslot.twotime  + "月份日期";
148 169
             date.MonthCountmix3 = "0.00%";
149 170
             date.MonthCount4 = 0;
150
-            date.MonthCount4name = time.AddMonths(-1).Month + "月份日期";
171
+            date.MonthCount4name = timeslot.threetime  + "月份日期";
151 172
             date.MonthCountmix4 = "0.00%";
152 173
             date.MonthCount5 = 0;
153 174
             date.MonthCount5name = "不清楚日期";
@@ -155,20 +176,31 @@ namespace CallCenterApi.Interface.Controllers.report
155 176
             for (int j = 0; j < modelList.Count; j++)
156 177
             {
157 178
                 string datetime = DateTime.Parse(modelList[j].F_CreateTime.ToString()).ToString("yyyy-MM-dd");
158
-                if (datetime == date.name)
179
+                if (datetime == name)
159 180
                 {
160 181
                     date.total++;
161 182
                     if (!string.IsNullOrEmpty(modelList[j].F_ProductDate))
162 183
                     {
163
-                        var pronos = DateTime.ParseExact(modelList[j].F_ProductDate, "yyyyMMdd", null).ToString("yyyy-MM-dd");
164
-                        var protime = Convert.ToDateTime(pronos);
165
-                        if (protime > time.AddMonths(-11) && protime < time.AddMonths(-3))
166
-                            date.MonthCount1++;
167
-                        if (protime > time.AddMonths(-3) && protime < time.AddMonths(-2))
184
+                        var pronos = DateTime.ParseExact(modelList[j].F_ProductDate, "yyyyMMdd", null).Month;
185
+                        if (timeslot.stime > timeslot.etime)
186
+                        {
187
+                            int t = 12 - timeslot.stime;
188
+                            if (pronos >= timeslot.stime && pronos <= 12)
189
+                                date.MonthCount1++;
190
+                            else if (pronos >= timeslot.etime)
191
+                                date.MonthCount1++;
192
+
193
+                        }
194
+                        else
195
+                        {
196
+                            if (pronos >= timeslot.stime && pronos <= timeslot.etime)
197
+                                date.MonthCount1++;
198
+                        }
199
+                        if (pronos == timeslot.onetime)
168 200
                             date.MonthCount2++;
169
-                        if (protime > time.AddMonths(-2) && protime < time.AddMonths(-1))
201
+                        if (pronos == timeslot.twotime)
170 202
                             date.MonthCount3++;
171
-                        if (protime > time.AddMonths(-1))
203
+                        if (pronos == timeslot.threetime)
172 204
                             date.MonthCount4++;
173 205
                     }
174 206
                     else
@@ -188,18 +220,6 @@ namespace CallCenterApi.Interface.Controllers.report
188 220
             }
189 221
             return date;
190 222
         }
191
-        public ActionResult DistributionToExcel()
192
-        {
193
-            NPOIHelper npoi = new NPOIHelper();
194
-            if (npoi.DistributionToExcel(DateTime .Now  , null) == "")
195
-            {
196
-                return Success("导出成功");
197
-            }
198
-            else
199
-            {
200
-                return Error("导出失败");
201
-            }
202
-        }
203 223
         /// <summary>
204 224
         /// 产品日期分布情况表
205 225
         /// </summary>
@@ -213,11 +233,13 @@ namespace CallCenterApi.Interface.Controllers.report
213 233
          //   Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
214 234
             string sql = $"  F_IsDelete=0";
215 235
             DateTime time=DateTime .Now ;
236
+           
216 237
             DataTable dt = new DataTable();
217 238
             if (datetime != null )
218 239
             {
219 240
                 time =DateTime .Parse ( datetime.ToString ());
220 241
             }
242
+            Timeslot timeslot = GetTimeslot(time.Month );
221 243
             int days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(time.Year, time.Month-1);//获取天数
222 244
             DateTime lastmonth= time.AddMonths(-1);
223 245
             sql += " and F_CreateTime>='" + lastmonth.ToString ("yyyy-MM") +"-28" + " 00:00:00' ";
@@ -229,8 +251,8 @@ namespace CallCenterApi.Interface.Controllers.report
229 251
             #region 上月28号至最后一天
230 252
             for (int i=0;i< lastday;i ++)
231 253
             {
232
-               string  name = string.Format("{0}-{1}", lastmonth.ToString("yyyy-MM"), 27 + i) ;
233
-                product.dates.Add(RetuDate(name, time, modelList));
254
+               string  name = string.Format("{0}-{1}", lastmonth.ToString("yyyy-MM"), 28 + i) ;
255
+                product.dates.Add(RetuDate(name, timeslot, modelList));
234 256
             }
235 257
             #endregion
236 258
             #region 本月一号至27号
@@ -245,7 +267,7 @@ namespace CallCenterApi.Interface.Controllers.report
245 267
                 {
246 268
                    name = string.Format("{0}-{1}", time.ToString("yyyy-MM"), 1 + i);
247 269
                 }
248
-                product.dates.Add(RetuDate(name, time, modelList));
270
+                product.dates.Add(RetuDate(name, timeslot, modelList));
249 271
             }
250 272
             Date date = new Date();
251 273
             date.total = modelList.Count;
@@ -254,15 +276,26 @@ namespace CallCenterApi.Interface.Controllers.report
254 276
             {
255 277
                 if (!string.IsNullOrEmpty(modelList[j].F_ProductDate))
256 278
                 {
257
-                    var pronos = DateTime.ParseExact(modelList[j].F_ProductDate, "yyyyMMdd", null).ToString("yyyy-MM-dd");
258
-                    var protime = Convert.ToDateTime(pronos);
259
-                    if (protime > time.AddMonths(-11) && protime < time.AddMonths(-3))
260
-                        date.MonthCount1++;
261
-                    if (protime > time.AddMonths(-3) && protime < time.AddMonths(-2))
279
+                    var pronos = DateTime.ParseExact(modelList[j].F_ProductDate, "yyyyMMdd", null).Month ;
280
+                    if (timeslot.stime > timeslot.etime)
281
+                    {
282
+                        int t = 12 - timeslot.stime;
283
+                        if (pronos >= timeslot.stime && pronos <= 12)
284
+                            date.MonthCount1++;
285
+                        else if (pronos >= timeslot.etime)
286
+                            date.MonthCount1++;
287
+
288
+                    }
289
+                    else
290
+                    {
291
+                        if (pronos >= timeslot.stime  && pronos <= timeslot.etime)
292
+                            date.MonthCount1++;
293
+                    }
294
+                    if (pronos == timeslot.onetime )
262 295
                         date.MonthCount2++;
263
-                    if (protime > time.AddMonths(-2) && protime < time.AddMonths(-1))
296
+                    if (pronos == timeslot.twotime )
264 297
                         date.MonthCount3++;
265
-                    if (protime > time.AddMonths(-1))
298
+                    if (pronos == timeslot.threetime )
266 299
                         date.MonthCount4++;
267 300
                 }
268 301
                 else
@@ -314,6 +347,7 @@ namespace CallCenterApi.Interface.Controllers.report
314 347
                     factory.proportion = string.Format("{0:f2}%", (float)factory.number / modelList.Count*100);
315 348
                     product.factory.Add(factory);
316 349
                 }
350
+                product.factory.Sort((a, b) => b.number.CompareTo(a.number));
317 351
                 Factory factor = new Factory();
318 352
                 factor.name = "合计";
319 353
                 factor.number = total;
@@ -343,6 +377,7 @@ namespace CallCenterApi.Interface.Controllers.report
343 377
                     factory.proportion = string.Format("{0:f2}%", (float)factory.number / modelList.Count * 100);
344 378
                     product.problem.Add(factory);
345 379
                 }
380
+                product.problem.Sort((a, b) => b.number.CompareTo(a.number));
346 381
                 Factory factor = new Factory();
347 382
                 factor.name = "合计";
348 383
                 factor.number = total;
@@ -350,6 +385,7 @@ namespace CallCenterApi.Interface.Controllers.report
350 385
                 factor.proportion = string.Format("{0:f2}%", (float)total / modelList.Count * 100);
351 386
                 product.problem.Add(factor);
352 387
             }
388
+           
353 389
             var productcode = new BLL.T_Sys_DictionaryValue().GetModelList("F_DictionaryFlag='CPDM'");
354 390
             product.product = new List<Factory>();
355 391
             if (productcode != null && modelList.Count > 0)
@@ -372,6 +408,7 @@ namespace CallCenterApi.Interface.Controllers.report
372 408
                     factory.proportion = string.Format("{0:f2}%", (float)factory.number / modelList.Count * 100);
373 409
                     product.product.Add(factory);
374 410
                 }
411
+                product.product.Sort((a, b) => b.number.CompareTo(a.number));
375 412
                 Factory factor = new Factory();
376 413
                 factor.name = "合计";
377 414
                 factor.number = total;
@@ -379,6 +416,7 @@ namespace CallCenterApi.Interface.Controllers.report
379 416
                 factor.proportion = string.Format("{0:f2}%", (float)total / modelList.Count * 100);
380 417
                 product.product.Add(factor);
381 418
             }
419
+           
382 420
             if (isdc > 0)
383 421
             {
384 422
                 NPOIHelper npoi = new NPOIHelper();

+ 105 - 26
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -78,12 +78,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
78 78
         /// 获取工单列表
79 79
         /// </summary>
80 80
         /// <returns></returns>
81
-        public ActionResult GetList(string code, string starttime, string endtime,string productType,string productDate, string batchNumber,string manufacturer,string problemCode,string notifications,string keywords, string dealTimely,int area = 0,int office=0,int duplicate=-1, int see = 0, int source = 0, int type = 0, int state = -1, int pageindex = 1, int pagesize = 10)
81
+        public ActionResult GetList(string code, string starttime, string endtime,string productType,string productDate, string batchNumber,string manufacturer,string problemCode,string notifications,string keywords, string dealTimely,int area = 0,int office=0,int duplicate=-1, int see = 0, int source = 0, int type = 0, int state = -1, int pageindex = 1, int pagesize = 10,int isdc=0,int istime=0 )
82 82
         {
83 83
             int userId = CurrentUser.UserData.F_UserId;
84 84
             if (userId != 0)
85 85
             {
86
-                string sql = $" and F_IsDelete=0";
86
+                string sql = $"  F_IsDelete=0";
87 87
                 DataTable dt = new DataTable();
88 88
                 #region 筛选条件
89 89
                 if (type > 0 && type < 5)//工单类型
@@ -192,40 +192,117 @@ namespace CallCenterApi.Interface.Controllers.workorder
192 192
                     }
193 193
                 }
194 194
                 #endregion
195
-                int recordCount = 0;
196
-                if (!string.IsNullOrWhiteSpace(sql))
195
+                string str = "";
196
+                if (!string.IsNullOrEmpty(starttime))
197 197
                 {
198
-
199
-                    dt = BLL.PagerBLL.GetListPager(
200
-                        "T_Bus_WorkOrder",
201
-                        "F_Id",
202
-                        "*",
203
-                        sql,
204
-                        "ORDER BY T_Bus_WorkOrder.F_Id desc",
205
-                        pagesize,
206
-                        pageindex,
207
-                        true,
208
-                        out recordCount);
198
+                    str = DateTime.Parse(starttime).ToString("yyyy年MM月dd日") + "至" +
199
+                        DateTime.Parse(endtime).ToString("yyyy年MM月dd日") + "消费者重复投诉表";
200
+                }
201
+                else if (istime == 0&&isdc >0)
202
+                {
203
+                    sql +=  " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM-dd") + "')<=0 ";
204
+                    sql += " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM-dd") + "')>=0   ";
205
+                    str = DateTime.Now.ToString("yyyy年MM月dd日") + "消费者重复投诉表";
209 206
                 }
210
-                List<Model.T_Bus_WorkOrder> modlelist = new BLL.T_Bus_WorkOrder().DataTableToList(dt);
211
-                if (modlelist.Count > 0)
207
+                else if (istime> 0 && isdc > 0)
212 208
                 {
213
-                    List<WorkOrderInput> Input = modeltooip(modlelist);
214
-                    var obj = new
209
+                    sql +=  " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM")
210
+                      +  "-01"+ "')<=0 ";
211
+                    sql += " and datediff(day,F_CreateTime,'" + DateTime.Now.ToString("yyyy-MM-dd") + "')>=0   ";
212
+                    str = DateTime.Now.ToString("yyyy年MM月") + "消费者重复投诉表";
213
+                }
214
+                if (isdc > 0)
215
+                {
216
+                    var depts = new BLL.T_Bus_WorkOrder().GetModelList(sql);
217
+                    #region 
218
+                    dt.Columns.Add("序号");
219
+                    dt.Columns.Add("姓名");
220
+                    dt.Columns.Add("地址");
221
+                    dt.Columns.Add("产品代码");
222
+                    dt.Columns.Add("产品名称");
223
+                    dt.Columns.Add("规格");
224
+                    dt.Columns.Add("生产日期");
225
+                    dt.Columns.Add("产品编码");
226
+                    dt.Columns.Add("生产厂家");
227
+                    dt.Columns.Add("问题代码");
228
+                    dt.Columns.Add("质量问题");
229
+                    dt.Columns.Add("通知人");
230
+                    dt.Columns.Add("接听人");
231
+                    dt.Columns.Add("落实情况");
232
+                    dt.Columns.Add("重复投诉日期");
233
+                    #endregion
234
+                    foreach (var it in depts)
235
+                    {
236
+                        DataRow drNew = dt.NewRow();
237
+                        #region 基本字段
238
+                        drNew["序号"] = it.F_SerialNumber;//序号
239
+                        drNew["姓名"] = it.F_CusName;//姓名
240
+                        drNew["地址"] = it.F_AddRess;//地址
241
+                        drNew["产品代码"] = it.F_ProductType;
242
+                        drNew["产品名称"] = it.F_ProductName;
243
+                        drNew["规格"] = it.F_Specifications;
244
+                        drNew["生产日期"] = it.F_ProductDate;
245
+                        drNew["产品编码"] = it.F_BatchNumber;
246
+                        drNew["生产厂家"] = it.F_Manufacturer;
247
+                        drNew["问题代码"] = it.F_ProblemCode;
248
+                        drNew["质量问题"] = it.F_QualityProblem;
249
+                        drNew["通知人"] = it.F_Notifications;
250
+                        drNew["接听人"] = it.F_ReceivingPerson;
251
+                        drNew["落实情况"] = it.F_ImplementationSituation;
252
+                        drNew["重复投诉日期"] = it.F_CreateTime;
253
+                        dt.Rows.Add(drNew);
254
+                        #endregion
255
+                    }
256
+                    NPOIHelper npoi = new NPOIHelper();
257
+                    if (npoi.ExportToExcel(str, dt) == "")
258
+                    {
259
+                        return Success("导出成功");
260
+                    }
261
+                    else
215 262
                     {
216
-                        state = "success",
217
-                        message = "成功",
218
-                        rows = Input,
219
-                        total = recordCount
220
-                    };
263
+                        return Error("导出失败");
221 264
 
222
-                    return Content(obj.ToJson()); ;
265
+                    }
223 266
                 }
224 267
                 else
225 268
                 {
269
+                    sql = "and" + sql;
270
+                    int recordCount = 0;
271
+                    if (!string.IsNullOrWhiteSpace(sql))
272
+                    {
273
+
274
+                        dt = BLL.PagerBLL.GetListPager(
275
+                            "T_Bus_WorkOrder",
276
+                            "F_Id",
277
+                            "*",
278
+                            sql,
279
+                            "ORDER BY T_Bus_WorkOrder.F_Id desc",
280
+                            pagesize,
281
+                            pageindex,
282
+                            true,
283
+                            out recordCount);
284
+                    }
285
+                    List<Model.T_Bus_WorkOrder> modlelist = new BLL.T_Bus_WorkOrder().DataTableToList(dt);
286
+                    if (modlelist.Count > 0)
287
+                    {
288
+                        List<WorkOrderInput> Input = modeltooip(modlelist);
289
+                        var obj = new
290
+                        {
291
+                            state = "success",
292
+                            message = "成功",
293
+                            rows = Input,
294
+                            total = recordCount
295
+                        };
226 296
 
227
-                    return Success("暂无工单"); ;
297
+                        return Content(obj.ToJson()); ;
298
+                    }
299
+                    else
300
+                    {
301
+
302
+                        return Success("暂无工单"); ;
303
+                    }
228 304
                 }
305
+               
229 306
             }
230 307
             else
231 308
             {
@@ -1090,6 +1167,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
1090 1167
                 model.F_Notifications = touser;//通知人
1091 1168
                 model.F_Largeareaid = F_Largeareaid;//转派大区id
1092 1169
                 model.F_Officeid = F_Officeid;//转派办事处id
1170
+                model.F_Area = F_Largeareaid.ToString ();//转派大区id
1171
+                model.F_Office = F_Officeid.ToString();//转派办事处id
1093 1172
                 model.F_Distribution = F_Distribution; //转派分销组id
1094 1173
                 model.F_DealUser = touser;//已接单待处理;//已接单待处理
1095 1174
                 workorderBLL.Update(model);

+ 13 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkorderAppController.cs

@@ -119,7 +119,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
119 119
         /// 获取工单列表
120 120
         /// </summary>
121 121
         /// <returns></returns>
122
-        public ActionResult GetList( string keywords, string dealTimely, int see=0, int state = -1, int pageindex = 1, int pagesize = 10)
122
+        public ActionResult GetList( string keywords, string dealTimely, int see=0, int state = -1, int pageindex = 1, int pagesize = 10,int Processing=0)
123 123
         {
124 124
             int userId = CurrentUser.UserData.F_UserId;
125 125
             if (userId != 0)
@@ -127,6 +127,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
127 127
                 string sql = $" and F_IsDelete=0";
128 128
                 DataTable dt = new DataTable();
129 129
                 #region 筛选条件
130
+               
131
+                    if (Processing==1)
132
+                        sql += "AND F_State in(0,1,2,3,4,5,6)";
133
+                else if (Processing == 2)
134
+                    sql += "AND F_State in(10)";
135
+
136
+
137
+
130 138
                 if (!string.IsNullOrWhiteSpace(dealTimely))//重要级别
131 139
                     sql += $" and F_DealTimely = '" + dealTimely.Trim() + "'";
132 140
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
@@ -1106,8 +1114,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1106 1114
             string touser = ""; string tousername = "";
1107 1115
             int deptid = 0;
1108 1116
             #region 获取接收人
1109
-            if (clid != 0)
1110
-            {
1117
+          
1111 1118
                 Model.T_Sys_UserAccount clus = userBLL.GetModel(clid);
1112 1119
                 deptid = clus.F_DeptId;
1113 1120
                 if (clus != null)
@@ -1115,8 +1122,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
1115 1122
                     touser = clus.F_UserCode;
1116 1123
                     tousername = clus.F_UserName + "(" + clus.F_UserCode  + ")";
1117 1124
                 }
1118
-            }
1119
-
1120 1125
             #endregion
1121 1126
             #region 工单处理
1122 1127
             string opt = "";
@@ -1127,7 +1132,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1127 1132
             int optbut = wostate ;
1128 1133
             #region 读取当前登录人部门
1129 1134
             string deptname = "";
1130
-            var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
1135
+            var deptmodel = departmentBLL.GetModel(clus.F_DeptId);
1131 1136
             int F_Largeareaid = 0, F_Officeid = 0,F_Distribution=0;
1132 1137
             if (deptmodel != null)
1133 1138
             {
@@ -1161,6 +1166,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
1161 1166
                 #region 处理工单
1162 1167
                 model.F_State = wostate;
1163 1168
                 model.F_Notifications = touser;//通知人
1169
+                model.F_Area = F_Largeareaid.ToString();//转派大区id
1170
+                model.F_Office = F_Officeid.ToString();//转派办事处id
1164 1171
                 model.F_Largeareaid  = F_Largeareaid;//转派大区id
1165 1172
                 model.F_DealUser = touser;//已接单待处理;
1166 1173
                 model.F_Officeid = F_Officeid;//转派办事处id

+ 170 - 143
codegit/CallCenterCommon/CallCenter.Utility/NPOI/NPOIHelper.cs

@@ -569,13 +569,13 @@ namespace CallCenter.Utility
569 569
                             {
570 570
                                 ICell cell101 = irow3list[td].CreateCell(3 * dt  - 3);
571 571
                                 cell101.SetCellValue(it.name );
572
-                                cell101.CellStyle = cellStyle;
572
+                                cell101.CellStyle = cellStylebt;
573 573
                                 ICell cell102 = irow3list[td].CreateCell(3 * dt  - 2);
574 574
                                 cell102.SetCellValue(it .number );
575
-                                cell102.CellStyle = cellStyle;
575
+                                cell102.CellStyle = cellStylebt;
576 576
                                ICell cell103= irow3list[td].CreateCell(3 * dt-1 );
577 577
                                cell103.SetCellValue(it.Proportion );
578
-                               cell103.CellStyle = cellStyle;
578
+                               cell103.CellStyle = cellStylebt;
579 579
                         }
580 580
                             else
581 581
                             {
@@ -583,13 +583,13 @@ namespace CallCenter.Utility
583 583
                                 td++;
584 584
                                 ICell cell101 = irow3list[td].CreateCell(3 * dt - 3);
585 585
                                 cell101.SetCellValue(it.name);
586
-                                cell101.CellStyle = cellStyle;
586
+                                cell101.CellStyle = cellStylebt;
587 587
                                 ICell cell102 = irow3list[td].CreateCell(3 * dt - 2);
588 588
                                 cell102.SetCellValue(it.number);
589
-                                cell102.CellStyle = cellStyle;
589
+                                cell102.CellStyle = cellStylebt;
590 590
                                ICell cell103 = irow3list[td].CreateCell(3 * dt-1);
591 591
                                 cell103.SetCellValue(it.Proportion);
592
-                                cell103.CellStyle = cellStyle;
592
+                                cell103.CellStyle = cellStylebt;
593 593
                         }
594 594
                         }
595 595
                    
@@ -611,13 +611,13 @@ namespace CallCenter.Utility
611 611
                     IRow irow5 = sheet.CreateRow(dtrow);
612 612
                     ICell cell51 = irow5.CreateCell(0);
613 613
                     cell51.SetCellValue(dt2.name);
614
-                    cell51.CellStyle = cellStyle;
614
+                    cell51.CellStyle = cellStylebt;
615 615
                     ICell cell52 = irow5.CreateCell(1);
616 616
                     cell52.SetCellValue(dt2.number);
617
-                    cell52.CellStyle = cellStyle;
617
+                    cell52.CellStyle = cellStylebt;
618 618
                     ICell cell53 = irow5.CreateCell(2);
619 619
                     cell53.SetCellValue(dt2.Proportion);
620
-                    cell53.CellStyle = cellStyle;
620
+                    cell53.CellStyle = cellStylebt;
621 621
                 }
622 622
                
623 623
                 #endregion
@@ -635,13 +635,13 @@ namespace CallCenter.Utility
635 635
                     IRow irow10 = sheet.CreateRow(dtrow);
636 636
                     ICell cell53 = irow10.CreateCell(0);
637 637
                     cell53.SetCellValue(dt3.name);
638
-                    cell53.CellStyle = cellStyle;
638
+                    cell53.CellStyle = cellStylebt;
639 639
                     ICell cell54 = irow10.CreateCell(1);
640 640
                     cell54.SetCellValue(dt3.number);
641
-                    cell54.CellStyle = cellStyle;
641
+                    cell54.CellStyle = cellStylebt;
642 642
                     ICell cell55 = irow10.CreateCell(2);
643 643
                     cell55.SetCellValue(dt3.Proportion);
644
-                    cell55.CellStyle = cellStyle;
644
+                    cell55.CellStyle = cellStylebt;
645 645
                 }
646 646
                
647 647
                 #endregion
@@ -660,13 +660,13 @@ namespace CallCenter.Utility
660 660
                     IRow irow12 = sheet.CreateRow(dtrow);
661 661
                     ICell cell55 = irow12.CreateCell(0);
662 662
                     cell55.SetCellValue(dt4.name);
663
-                    cell55.CellStyle = cellStyle;
663
+                    cell55.CellStyle = cellStylebt;
664 664
                     ICell cell56 = irow12.CreateCell(1);
665 665
                     cell56.SetCellValue(dt4.number);
666
-                    cell56.CellStyle = cellStyle;
666
+                    cell56.CellStyle = cellStylebt;
667 667
                     ICell cell57 = irow12.CreateCell(2);
668 668
                     cell57.SetCellValue(dt4.Proportion);
669
-                    cell57.CellStyle = cellStyle;
669
+                    cell57.CellStyle = cellStylebt;
670 670
                 }
671 671
              
672 672
 
@@ -686,20 +686,21 @@ namespace CallCenter.Utility
686 686
                     IRow irow15 = sheet.CreateRow(dtrow);
687 687
                     ICell cell57 = irow15.CreateCell(0);
688 688
                     cell57.SetCellValue(dt4.name);
689
-                    cell57.CellStyle = cellStyle;
689
+                    cell57.CellStyle = cellStylebt;
690 690
                     ICell cell58 = irow15.CreateCell(1);
691 691
                     cell58.SetCellValue(dt4.number);
692
-                    cell58.CellStyle = cellStyle;
692
+                    cell58.CellStyle = cellStylebt;
693 693
                     ICell cell59 = irow15.CreateCell(2);
694 694
                     cell59.SetCellValue(dt5.Proportion);
695
-                    cell59.CellStyle = cellStyle;
695
+                    cell59.CellStyle = cellStylebt;
696 696
                 }
697 697
                
698 698
                 #endregion
699 699
                 //自适应列宽度
700 700
                 for (int i = 0; i < 8; i++)
701 701
                 {
702
-                    sheet.AutoSizeColumn(i);
702
+                    // sheet.AutoSizeColumn(i);
703
+                    sheet.SetColumnWidth(i, 12 * 256);
703 704
                 }
704 705
 
705 706
                 using (MemoryStream ms = new MemoryStream())
@@ -749,6 +750,32 @@ namespace CallCenter.Utility
749 750
                 }
750 751
             }
751 752
         }
753
+        private string ReturnMsg(int j, int i, List<Factory> Factory1)
754
+        {
755
+            string msg = "";
756
+            switch (j)
757
+            {
758
+                case 0:
759
+                    msg = Factory1[i * 2].name;
760
+                    break;
761
+                case 1:
762
+                    msg = Factory1[i * 2].number.ToString();
763
+                    break;
764
+                case 2:
765
+                    msg = Factory1[i * 2].proportion;
766
+                    break;
767
+                case 3:
768
+                    msg = Factory1[i * 2 + 1].name;
769
+                    break;
770
+                case 4:
771
+                    msg = Factory1[i * 2 + 1].number.ToString();
772
+                    break;
773
+                case 5:
774
+                    msg = Factory1[i * 2 + 1].proportion;
775
+                    break;
776
+            }
777
+            return msg;
778
+        }
752 779
         /// <summary>
753 780
         /// 投诉产品日期分布表
754 781
         /// </summary>
@@ -761,10 +788,15 @@ namespace CallCenter.Utility
761 788
                 HSSFWorkbook workbook = new HSSFWorkbook();
762 789
                 ISheet sheet = workbook.CreateSheet("Sheet1");
763 790
                 ICellStyle cellStyle = workbook.CreateCellStyle();
791
+              
764 792
                 NPOI.SS.UserModel.IFont cellfont = workbook.CreateFont();
765 793
                 cellfont.Boldweight = (short)FontBoldWeight.Normal;
766 794
                 cellStyle.SetFont(cellfont);
767 795
                 ICellStyle cellStylebt = workbook.CreateCellStyle();
796
+                cellStylebt.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
797
+                cellStylebt.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
798
+                cellStylebt.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
799
+                cellStylebt.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
768 800
                 NPOI.SS.UserModel.IFont cellfontbt = workbook.CreateFont();
769 801
                 cellfontbt.Boldweight = (short)FontBoldWeight.Bold;
770 802
                
@@ -781,14 +813,20 @@ namespace CallCenter.Utility
781 813
                 IRow irow2 = sheet.CreateRow(1);
782 814
                 ICell cell2 = irow2.CreateCell(0);
783 815
                 ICellStyle style13 = workbook.CreateCellStyle();
816
+                style13.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
817
+                style13.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
818
+                style13.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
819
+                style13.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
784 820
                 style13.BorderDiagonalLineStyle = BorderStyle.Thin;
785 821
                 style13.BorderDiagonal = BorderDiagonal.Backward;
786 822
                 style13.BorderDiagonalColor = IndexedColors.Black .Index;
787
-                StringBuilder sb = new StringBuilder();
788
-                sb.AppendLine("数量".PadLeft(15));//该行不足长度10在左侧填空格
789
-                sb.AppendLine("日期".PadRight(15));//该行不足长度10在右侧填空格
790
-                cell2.SetCellValue(sb.ToString ());
823
+                string sb = "                  数量\n日期";
824
+              //  StringBuilder sb = new StringBuilder();
825
+              //  sb.AppendLine("数量".PadLeft(15));//该行不足长度10在左侧填空格
826
+              //  sb.AppendLine("日期".PadRight(15));//该行不足长度10在右侧填空格
827
+                cell2.SetCellValue(sb);
791 828
                 cell2.CellStyle = cellStylebt;
829
+                style13.WrapText = true;
792 830
                 irow2.GetCell(0).CellStyle = style13;
793 831
                 sheet.AddMergedRegion(new CellRangeAddress(1, 2, 0,0 ));
794 832
                 ICell cell6 = irow2.CreateCell(1);
@@ -801,16 +839,16 @@ namespace CallCenter.Utility
801 839
                     switch (i)
802 840
                     {
803 841
                         case 0:
804
-                            msg = datetime.AddMonths(-11).Month + "-" + datetime.AddMonths(-4).Month + "月份日期";
842
+                            msg = datetime.AddMonths(-11).Month + "-" + datetime.AddMonths(-3).Month + "月份日期";
805 843
                             break;
806 844
                         case 1:
807
-                            msg = datetime.AddMonths(-3).Month + "月份日期";
845
+                            msg = datetime.AddMonths(-2).Month + "月份日期";
808 846
                             break;
809 847
                         case 2:
810
-                            msg = datetime.AddMonths(-2).Month + "月份日期";
848
+                            msg = datetime.AddMonths(-1).Month + "月份日期";
811 849
                             break;
812 850
                         case 3:
813
-                            msg = datetime.AddMonths(-1).Month + "月份日期";
851
+                            msg = datetime.Month + "月份日期";
814 852
                             break;
815 853
                         case 4:
816 854
                             msg = "不清楚日期";
@@ -819,6 +857,8 @@ namespace CallCenter.Utility
819 857
                     ICell cell3 = irow2.CreateCell(i *2+ 2 );
820 858
                     cell3.SetCellValue(msg);
821 859
                     cell3.CellStyle = cellStylebt;
860
+                    ICell cell4 = irow2.CreateCell(i * 2 + 3);
861
+                    cell4.CellStyle = cellStylebt;
822 862
                     sheet.AddMergedRegion(new CellRangeAddress(1, 1, i * 2 + 2, i * 2 + 3));
823 863
                 }
824 864
                  IRow irow3 = sheet.CreateRow(2);
@@ -901,7 +941,7 @@ namespace CallCenter.Utility
901 941
                         }
902 942
                     }
903 943
                 }
904
-                int t = dt1.Count + 3;int count = 0;
944
+                int t = dt1.Count + 2;int count = 0;
905 945
                 List<Factory> Factory1 = product.factory;
906 946
                 List<Factory> Factory2 = product.problem;
907 947
                 List<Factory> Factory3 = product.product;
@@ -923,77 +963,57 @@ namespace CallCenter.Utility
923 963
                     istrue = false;
924 964
                     count = total;
925 965
                 }
926
-                   
927
-                IRow irow5 = sheet.CreateRow(t);
966
+                IRow irow5 = sheet.CreateRow(t+1);
928 967
                 ICell cell7 = irow5.CreateCell(0);
929 968
                 cell7.SetCellValue("工\n厂\n投\n诉\n占\n比\n");
969
+        
930 970
                 cell7.CellStyle = cellStylebt;
931
-                sheet.AddMergedRegion(new CellRangeAddress(t, t+ count, 0, 0));
971
+                cell7.CellStyle.WrapText=true ;
972
+                sheet.AddMergedRegion(new CellRangeAddress(t+1, t+ count, 0, 0));
932 973
                 ICell cell10 = irow5.CreateCell(7);
933 974
                 cell10.SetCellValue("各\n质\n量\n问\n题\n占\n比\n");
934 975
                 cell10.CellStyle = cellStylebt;
935
-                int structure = 0;
976
+                cell10.CellStyle.WrapText = true;
977
+                int structure = t + problem;
936 978
                 if (istrue)
937 979
                 {
938 980
                   if (a >1)
939 981
                     {
940 982
                         structure = t + problem + a / 2;
941
-                        sheet.AddMergedRegion(new CellRangeAddress(t, t + problem + a / 2, 7, 7));
983
+                        sheet.AddMergedRegion(new CellRangeAddress(t+1, t + problem + a / 2, 7, 7));
942 984
                     }
943 985
                        
944 986
                   else
945 987
                     {
946 988
                         structure = t + problem;
947
-                        sheet.AddMergedRegion(new CellRangeAddress(t, t + problem + 1, 7, 7));
989
+                        sheet.AddMergedRegion(new CellRangeAddress(t+1, t + problem, 7, 7));
948 990
                     }
949 991
                 }
950 992
                     else 
951
-                sheet.AddMergedRegion(new CellRangeAddress(t, t + problem, 7, 7));
952
-                IRow irow7 = sheet.CreateRow(structure);
993
+                sheet.AddMergedRegion(new CellRangeAddress(t+1, t + problem, 7, 7));
994
+                IRow irow7 = sheet.CreateRow(structure+1);
953 995
                 ICell cell11 = irow7.CreateCell(7);
954 996
                 cell11.SetCellValue("结\n构\n占\n比\n");
955 997
                 cell11.CellStyle = cellStylebt;
998
+                cell11.CellStyle.WrapText = true;
956 999
                 if (istrue)
957 1000
                 {
958 1001
                     if (a > 1)
959
-                        sheet.AddMergedRegion(new CellRangeAddress(t + problem + a / 2+1, t + total + 1 +a/2, 7, 7));
1002
+                        sheet.AddMergedRegion(new CellRangeAddress(structure + 1, structure+ productcode+a/2, 7, 7));
960 1003
                     else
961
-                        sheet.AddMergedRegion(new CellRangeAddress(t + problem + 2, t + total + 2, 7, 7));
1004
+                        sheet.AddMergedRegion(new CellRangeAddress(structure + 1, structure + productcode+a, 7, 7));
962 1005
                 }
963 1006
                     else
964
-                    sheet.AddMergedRegion(new CellRangeAddress(t + problem+1, t +  1 + total, 7, 7));
1007
+                    sheet.AddMergedRegion(new CellRangeAddress(structure + 1, structure + productcode, 7, 7));
965 1008
                 if (Factory1 != null)
966 1009
                 {
967 1010
                     for (int i = 0; i < count; i++)
968 1011
                     {
969 1012
                         if (i ==0 || t + i== structure)
970 1013
                         {
971
-                            if (i < Factory1.Count )
972
-                            {
973 1014
                                 for (int j = 0; j < 6; j++)
974 1015
                                 {
975
-                                    string msg = "";
976
-                                    switch (j)
977
-                                    {
978
-                                        case 0:
979
-                                            msg = Factory1[i * 2].name;
980
-                                            break;
981
-                                        case 1:
982
-                                            msg = Factory1[i * 2].number.ToString();
983
-                                            break;
984
-                                        case 2:
985
-                                            msg = Factory1[i * 2].proportion;
986
-                                            break;
987
-                                        case 3:
988
-                                            msg = Factory1[i * 2 + 1].name;
989
-                                            break;
990
-                                        case 4:
991
-                                            msg = Factory1[i * 2 + 1].number.ToString();
992
-                                            break;
993
-                                        case 5:
994
-                                            msg = Factory1[i * 2 + 1].proportion;
995
-                                            break;
996
-                                    }
1016
+                                    string msg = ReturnMsg(j ,i ,Factory1 );
997 1017
                                     if (i == 0)
998 1018
                                     {
999 1019
                                         ICell cell8 = irow5.CreateCell(j + 1);
@@ -1002,64 +1022,64 @@ namespace CallCenter.Utility
1002 1022
                                     }
1003 1023
                                     else
1004 1024
                                     {
1005
-                                        ICell cell8 = irow7.CreateCell(j + 1);
1006
-                                        cell8.SetCellValue(msg);
1007
-                                        cell8.CellStyle = cellStylebt;
1025
+                                        ICell cell9 = irow7.CreateCell(j + 1);
1026
+                                        cell9.SetCellValue(msg);
1027
+                                        cell9.CellStyle = cellStylebt;
1008 1028
                                     }
1009
-
1010 1029
                                 }
1011
-                            }
1012 1030
                             if (i ==0)
1013 1031
                             {
1014 1032
                                 for (int z = 0; z < 3; z++)
1015 1033
                                 {
1016
-                                    string msg = "";
1017 1034
                                     switch (z)
1018 1035
                                     {
1019 1036
                                         case 0:
1020
-                                            ICell cell8 = irow5.CreateCell(8);
1021
-                                            cell8.SetCellValue(Factory2[0].name );
1022
-                                            cell8.CellStyle = cellStylebt;
1023
-                                            sheet.AddMergedRegion(new CellRangeAddress(t, t , 8, 9));
1037
+                                            ICell cell12 = irow5.CreateCell(8);
1038
+                                            cell12.SetCellValue(Factory2[0].name );
1039
+                                            cell12.CellStyle = cellStylebt;
1040
+                                            sheet.AddMergedRegion(new CellRangeAddress(t+1, t+1 , 8, 9));
1041
+                                            ICell cell22 = irow5.CreateCell(9);
1042
+                                            cell22.CellStyle = cellStylebt;
1024 1043
                                             break;
1025 1044
                                         case 1:
1026
-                                            ICell cell9 = irow5.CreateCell(10);
1027
-                                            cell9.SetCellValue(Factory2[0].number .ToString ());
1028
-                                            cell9.CellStyle = cellStylebt;
1045
+                                            ICell cell13 = irow5.CreateCell(10);
1046
+                                            cell13.SetCellValue(Factory2[0].number .ToString ());
1047
+                                            cell13.CellStyle = cellStylebt;
1029 1048
                                            
1030 1049
                                             break;
1031 1050
                                         case 2:
1032
-                                            ICell cell12 = irow5.CreateCell(11);
1033
-                                            cell12.SetCellValue(Factory2[0].proportion);
1034
-                                            cell12.CellStyle = cellStylebt;
1051
+                                            ICell cell14 = irow5.CreateCell(11);
1052
+                                            cell14.SetCellValue(Factory2[0].proportion);
1053
+                                            cell14.CellStyle = cellStylebt;
1035 1054
                                             break;
1036 1055
                                     }
1037 1056
                                     
1038 1057
                                 }
1039 1058
                             }
1040
-                            else if (t + i  == structure)
1059
+                            else 
1041 1060
                             {
1042 1061
                                 for (int z = 0; z < 3; z++)
1043 1062
                                 {
1044
-                                    string msg = "";
1045 1063
                                     switch (z)
1046 1064
                                     {
1047 1065
                                         case 0:
1048
-                                            ICell cell8 = irow7.CreateCell(8);
1049
-                                            cell8.SetCellValue(Factory3[1].name);
1050
-                                            cell8.CellStyle = cellStylebt;
1051
-                                            sheet.AddMergedRegion(new CellRangeAddress(structure, structure, 8, 9));
1066
+                                            ICell cell15 = irow7.CreateCell(8);
1067
+                                            cell15.SetCellValue(Factory3[0].name);
1068
+                                            cell15.CellStyle = cellStylebt;
1069
+                                            sheet.AddMergedRegion(new CellRangeAddress(structure+1, structure+1, 8, 9));
1070
+                                            ICell cell31 = irow7.CreateCell(9);
1071
+                                            cell15.CellStyle = cellStylebt;
1052 1072
                                             break;
1053 1073
                                         case 1:
1054
-                                            ICell cell9 = irow7.CreateCell(10);
1055
-                                            cell9.SetCellValue(Factory3[1].number.ToString());
1056
-                                            cell9.CellStyle = cellStylebt;
1074
+                                            ICell cell16 = irow7.CreateCell(10);
1075
+                                            cell16.SetCellValue(Factory3[0].number.ToString());
1076
+                                            cell16.CellStyle = cellStylebt;
1057 1077
 
1058 1078
                                             break;
1059 1079
                                         case 2:
1060
-                                            ICell cell12 = irow7.CreateCell(11);
1061
-                                            cell12.SetCellValue(Factory3[1].proportion);
1062
-                                            cell12.CellStyle = cellStylebt;
1080
+                                            ICell cell17= irow7.CreateCell(11);
1081
+                                            cell17.SetCellValue(Factory3[0].proportion);
1082
+                                            cell17.CellStyle = cellStylebt;
1063 1083
                                             break;
1064 1084
                                     }
1065 1085
 
@@ -1070,41 +1090,19 @@ namespace CallCenter.Utility
1070 1090
                         else
1071 1091
                         {
1072 1092
                             
1073
-                            IRow irow6 = sheet.CreateRow(t + i);
1074
-                            if (i < Factory1.Count)
1093
+                            IRow irow6 = sheet.CreateRow(t+1 + i);
1094
+
1095
+                            if (i*2 < Factory1.Count)
1075 1096
                             {
1076 1097
                                 for (int j = 0; j < 6; j++)
1077 1098
                                 {
1078
-                                    string msg = "";
1079
-                                    switch (j)
1080
-                                    {
1081
-                                        case 0:
1082
-                                            msg = Factory1[i * 2].name;
1083
-                                            break;
1084
-                                        case 1:
1085
-                                            msg = Factory1[i * 2].number.ToString();
1086
-                                            break;
1087
-                                        case 2:
1088
-                                            msg = Factory1[i * 2].proportion;
1089
-                                            break;
1090
-                                        case 3:
1091
-                                            msg = Factory1[i * 2 + 1].name;
1092
-                                            break;
1093
-                                        case 4:
1094
-                                            msg = Factory1[i * 2 + 1].number.ToString();
1095
-                                            break;
1096
-                                        case 5:
1097
-                                            msg = Factory1[i * 2 + 1].proportion;
1098
-                                            break;
1099
-                                    }
1100
-                                    ICell cell9 = irow6.CreateCell(j + 1);
1101
-                                    cell9.SetCellValue(msg);
1102
-                                    cell9.CellStyle = cellStylebt;
1099
+                                    string msg = ReturnMsg(j, i, Factory1);
1100
+                                    ICell cell18 = irow6.CreateCell(j + 1);
1101
+                                    cell18.SetCellValue(msg);
1102
+                                    cell18.CellStyle = cellStylebt;
1103 1103
                                 }
1104 1104
                             }
1105
-                            if (istrue)
1106
-                            {
1107
-                                int b = 1;
1105
+                                int b = 0;
1108 1106
                                 if (a >1)
1109 1107
                                 {
1110 1108
                                     b= (a / 2) + (0 == a % 2 ? 0 : 1);
@@ -1113,14 +1111,15 @@ namespace CallCenter.Utility
1113 1111
                                 {
1114 1112
                                     for (int z = 0; z < 3; z++)
1115 1113
                                     {
1116
-                                        string msg = "";
1117 1114
                                         switch (z)
1118 1115
                                         {
1119 1116
                                             case 0:
1120 1117
                                                 ICell cell8 = irow6.CreateCell(8);
1121 1118
                                                 cell8.SetCellValue(Factory2[i].name);
1122 1119
                                                 cell8.CellStyle = cellStylebt;
1123
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i, 8, 9));
1120
+                                                sheet.AddMergedRegion(new CellRangeAddress(t+1 + i, t+1 + i, 8, 9));
1121
+                                                ICell cell22 = irow6.CreateCell(9);
1122
+                                                cell22.CellStyle = cellStylebt;
1124 1123
                                                 break;
1125 1124
                                             case 1:
1126 1125
                                                 ICell cell9 = irow6.CreateCell(10);
@@ -1136,7 +1135,7 @@ namespace CallCenter.Utility
1136 1135
                                         }
1137 1136
                                     }
1138 1137
                                 }
1139
-                               else  if (i < Factory2.Count )
1138
+                               else  if (i == Factory2.Count-1 )
1140 1139
                                 {
1141 1140
                                     for (int z = 0; z < 3; z++)
1142 1141
                                     {
@@ -1144,86 +1143,114 @@ namespace CallCenter.Utility
1144 1143
                                         switch (z)
1145 1144
                                         {
1146 1145
                                             case 0:
1147
-                                                ICell cell8 = irow7.CreateCell(8);
1146
+                                                ICell cell8 = irow6.CreateCell(8);
1148 1147
                                                 cell8.SetCellValue(Factory2[i].name);
1149 1148
                                                 cell8.CellStyle = cellStylebt;
1150
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i+b , 8, 9));
1149
+                                                sheet.AddMergedRegion(new CellRangeAddress(t +1+ i, t+1 + i+b , 8, 9));
1151 1150
                                                 break;
1152 1151
                                             case 1:
1153
-                                                ICell cell9 = irow7.CreateCell(10);
1152
+                                                ICell cell9 = irow6.CreateCell(10);
1154 1153
                                                 cell9.SetCellValue(Factory2[i].number.ToString());
1155 1154
                                                 cell9.CellStyle = cellStylebt;
1156
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i + b, 10, 10));
1155
+                                                sheet.AddMergedRegion(new CellRangeAddress(t+1 + i, t+1 + i + b, 10, 10));
1157 1156
 
1158 1157
                                                 break;
1159 1158
                                             case 2:
1160
-                                                ICell cell12 = irow7.CreateCell(11);
1159
+                                                ICell cell12 = irow6.CreateCell(11);
1161 1160
                                                 cell12.SetCellValue(Factory2[i].proportion);
1162 1161
                                                 cell12.CellStyle = cellStylebt;
1163
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i + b, 11, 11));
1162
+                                                sheet.AddMergedRegion(new CellRangeAddress(t+1 + i, t+1 + i + b, 11, 11));
1164 1163
                                                 break;
1165 1164
                                         }
1165
+                                    
1166 1166
                                     }
1167 1167
                                 }
1168 1168
                                 if (i <( Factory3.Count + Factory2.Count+b -1)&& i>= Factory2.Count + b)
1169 1169
                                 {
1170 1170
                                     for (int z = 0; z < 3; z++)
1171 1171
                                     {
1172
-                                        string msg = "";
1172
+                                       
1173 1173
                                         switch (z)
1174 1174
                                         {
1175 1175
                                             case 0:
1176 1176
                                                 ICell cell8 = irow6.CreateCell(8);
1177 1177
                                                 cell8.SetCellValue(Factory3[i- Factory2.Count -b ].name);
1178
+
1178 1179
                                                 cell8.CellStyle = cellStylebt;
1179
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i, 8, 9));
1180
+                                                sheet.AddMergedRegion(new CellRangeAddress(t +1+ i, t +1+ i, 8, 9));
1181
+                                                ICell cel27 = irow6.CreateCell(9);
1182
+                                                cel27.CellStyle = cellStylebt;
1180 1183
                                                 break;
1181 1184
                                             case 1:
1182 1185
                                                 ICell cell9 = irow6.CreateCell(10);
1183
-                                                cell9.SetCellValue(Factory3[i - Factory2.Count - b].number.ToString());
1186
+                                                cell9.SetCellValue(Factory3[i - Factory2.Count - b ].number.ToString());
1184 1187
                                                 cell9.CellStyle = cellStylebt;
1185 1188
 
1186 1189
                                                 break;
1187 1190
                                             case 2:
1188 1191
                                                 ICell cell12 = irow6.CreateCell(11);
1189
-                                                cell12.SetCellValue(Factory3[i - Factory2.Count - b].proportion);
1192
+                                                cell12.SetCellValue(Factory3[i - Factory2.Count - b ].proportion);
1190 1193
                                                 cell12.CellStyle = cellStylebt;
1191 1194
                                                 break;
1192 1195
                                         }
1193 1196
                                     }
1194 1197
                                 }
1195
-                                else  if ( i >= Factory2.Count + b&& i < Factory2.Count + b+ Factory3.Count )
1198
+                                else  if ( i== Factory2.Count + b+ Factory3.Count-1 )
1196 1199
                                 {
1197 1200
                                     for (int z = 0; z < 3; z++)
1198 1201
                                     {
1199
-                                        string msg = "";
1200 1202
                                         switch (z)
1201 1203
                                         {
1202 1204
                                             case 0:
1203
-                                                ICell cell8 = irow7.CreateCell(8);
1205
+                                                ICell cell8 = irow6.CreateCell(8);
1204 1206
                                                 cell8.SetCellValue(Factory3[i - Factory2.Count - b].name);
1205 1207
                                                 cell8.CellStyle = cellStylebt;
1206
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i + b, 8, 9));
1208
+                                                sheet.AddMergedRegion(new CellRangeAddress(t +1+ i, t+1 + i + b, 8, 9));
1207 1209
                                                 break;
1208 1210
                                             case 1:
1209
-                                                ICell cell9 = irow7.CreateCell(10);
1211
+                                                ICell cell9 = irow6.CreateCell(10);
1210 1212
                                                 cell9.SetCellValue(Factory3[i - Factory2.Count - b].number.ToString());
1211 1213
                                                 cell9.CellStyle = cellStylebt;
1212
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i + b, 10, 10));
1214
+                                                sheet.AddMergedRegion(new CellRangeAddress(t + 1 + i, t + 1 + i + b, 10, 10));
1213 1215
 
1214 1216
                                                 break;
1215 1217
                                             case 2:
1216
-                                                ICell cell12 = irow7.CreateCell(11);
1218
+                                                ICell cell12 = irow6.CreateCell(11);
1217 1219
                                                 cell12.SetCellValue(Factory3[i - Factory2.Count - b].proportion);
1218 1220
                                                 cell12.CellStyle = cellStylebt;
1219
-                                                sheet.AddMergedRegion(new CellRangeAddress(t + i, t + i + b, 11, 11));
1221
+                                                sheet.AddMergedRegion(new CellRangeAddress(t + 1 + i, t + 1 + i + b, 11, 11));
1220 1222
                                                 break;
1221 1223
                                         }
1222 1224
                                     }
1223 1225
                                 }
1224 1226
 
1227
+                            
1228
+                            if ( i == Factory2.Count)
1229
+                            {
1230
+                                ICell cell120 = irow6.CreateCell(7);
1231
+                                cell120.CellStyle = cellStylebt;
1232
+                                ICell cell124 = irow6.CreateCell(9);
1233
+                                cell124.CellStyle = cellStylebt;
1234
+                                ICell cell125 = irow6.CreateCell(10);
1235
+                                cell125.CellStyle = cellStylebt;
1236
+                                ICell cell126 = irow6.CreateCell(11);
1237
+                                cell126.CellStyle = cellStylebt;
1238
+                            }
1239
+                             if (i ==count -1)
1240
+                            {
1241
+                                ICell cell119 = irow6.CreateCell(0);
1242
+                                cell119.CellStyle = cellStylebt;
1243
+                                ICell cell121 = irow6.CreateCell(7);
1244
+                                cell121.CellStyle = cellStylebt;
1245
+                                ICell cell132 = irow6.CreateCell(8);
1246
+                                cell132.CellStyle = cellStylebt;
1247
+                                ICell cell128 = irow6.CreateCell(9);
1248
+                                cell128.CellStyle = cellStylebt;
1249
+                                ICell cell129 = irow6.CreateCell(10);
1250
+                                cell129.CellStyle = cellStylebt;
1251
+                                ICell cell130 = irow6.CreateCell(11);
1252
+                                cell130.CellStyle = cellStylebt;
1225 1253
                             }
1226
-                          
1227 1254
                         }
1228 1255
                     }
1229 1256
                 }