duhongyu 4 yıl önce
ebeveyn
işleme
f58a92b1b3

+ 294 - 258
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -143,6 +143,18 @@ namespace CallCenterApi.Interface.Controllers.workorder
143 143
                     sql += " and ((datediff(day,F_CreateTime,getdate() )>15 and F_WorkState = 9 and F_CloseTime is not null) or  F_WorkOrderId  in (select WorkOrderId   from PublicComment )) ";
144 144
                 }
145 145
             }
146
+            else
147
+            {
148
+                int jianhang = RequestString.GetInt("jianhang", 0);
149
+                if (jianhang > 0)
150
+                {
151
+                    sql += " and F_InfoSource != '1' ";
152
+                }
153
+                else
154
+                {
155
+                    sql += " and F_InfoSource = '1' ";
156
+                }
157
+            }
146 158
             string ComTitle = HttpUtility.UrlDecode(RequestString.GetQueryString("ComTitle"));
147 159
             string ComContent = HttpUtility.UrlDecode(RequestString.GetQueryString("ComContent"));
148 160
             string Result = HttpUtility.UrlDecode(RequestString.GetQueryString("Result"));
@@ -165,15 +177,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
165 177
                     " or F_Result like  '%" + strkey + "%' ) ";
166 178
                
167 179
             }
168
-            int jianhang = RequestString.GetInt("jianhang", 0);
169
-            if (jianhang>0)
170
-            {
171
-                sql += " and F_InfoSource != '1' ";
172
-            }
173
-            else
174
-            {
175
-                sql += " and F_InfoSource = '1' ";
176
-            }
180
+           
181
+          
177 182
           
178 183
             if (strusercode.Trim() != "" && strusercode != "undefined")
179 184
             {//坐席
@@ -552,6 +557,24 @@ namespace CallCenterApi.Interface.Controllers.workorder
552 557
                     buttons.Clear();
553 558
                     buttons.Add(ButtonGroup.query());
554 559
                 }
560
+                if (state == 9)
561
+                {
562
+                    if (userModel.F_RoleCode.ToUpper() == "ZJZY" || userModel.F_RoleCode.ToUpper() == "GLY" || userModel.F_RoleCode.ToUpper() == "DDZG" || userModel.F_RoleCode.ToUpper() == "ZXLD" || userModel.F_RoleCode.ToUpper() == "ZXHWY" || userModel.F_RoleCode.ToUpper() == "MTDD")
563
+                    {
564
+                        if (dr["F_CloseTime"] != null && dr["F_CloseTime"].ToString() != "")
565
+                        {
566
+                            var closedttime = DateTime.Parse(dr["F_CloseTime"].ToString());
567
+                            TimeSpan ts = DateTime.Now - closedttime;
568
+                            if (ts.TotalDays < 20)
569
+                            {
570
+                                buttons.Add(ButtonGroup.subreload());
571
+                            }
572
+                        }
573
+                        if (userModel.F_RoleCode.ToUpper() != "ZXHWY")
574
+                            buttons.Add(ButtonGroup.modify());
575
+
576
+                    }
577
+                }
555 578
                 dr["Buttons"] = buttons;
556 579
             }
557 580
             #endregion
@@ -2272,6 +2295,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
2272 2295
                 value = " INNER JOIN[GetValueId]('" + keyid + "') Value on wo.F_Key = Value.F_ValueId";
2273 2296
 
2274 2297
             }
2298
+            int jianhang = RequestString.GetInt("jianhang", 0);
2299
+            if (jianhang == 1)
2300
+            {
2301
+                sql += " and F_InfoSource = '1' ";
2302
+            }
2303
+            else if (jianhang == 2)
2304
+            {
2305
+                sql += " and F_InfoSource != '1' ";
2306
+            }
2275 2307
             if (type != 0)
2276 2308
             {
2277 2309
                 sql += " and F_InfoType = '" + type + "' ";
@@ -4685,7 +4717,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
4685 4717
                 //}
4686 4718
                 #endregion
4687 4719
             }
4688
-
4720
+            int jianhang = RequestString.GetInt("jianhang", 0);
4721
+            if (jianhang ==1)
4722
+            {
4723
+                sql += " and F_InfoSource = '1' ";
4724
+            }
4725
+            else if (jianhang ==2)
4726
+            {
4727
+                sql += " and F_InfoSource != '1' ";
4728
+            }
4689 4729
             string sqlwhere = "";string sqlwhere1 = "";
4690 4730
 
4691 4731
            
@@ -4792,6 +4832,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4792 4832
             {
4793 4833
                 sql += " and F_InfoSource = '" + source + "' ";
4794 4834
             }
4835
+
4795 4836
             string sqlwheres = ""; string value = "";
4796 4837
             if (keyid != 0)
4797 4838
             {
@@ -8346,7 +8387,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
8346 8387
                 if (modelT_Bus_WorkOrder != null && (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.neworder || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.audit || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.resubmit))
8347 8388
                 {
8348 8389
                     int source = RequestString.GetInt("source", 0);
8349
-
8350 8390
                     string cusname = RequestString.GetFormString("cusname");
8351 8391
                     string cussex = RequestString.GetFormString("cussex");
8352 8392
                     string cusphone = RequestString.GetFormString("cusphone");
@@ -8361,326 +8401,322 @@ namespace CallCenterApi.Interface.Controllers.workorder
8361 8401
                     string files = RequestString.GetFormString("files");
8362 8402
                     int sourcearea = RequestString.GetInt("sourcearea", 0);
8363 8403
                     string sourceaddress = RequestString.GetFormString("sourceaddress");
8364
-
8365 8404
                     int isresult = RequestString.GetInt("isresult", 0);
8366 8405
                     string result = RequestString.GetFormString("result");
8367
-
8368 8406
                     string keys = RequestString.GetFormString("keys");
8369 8407
                     string splituser = RequestString.GetFormString("splituser");
8370
-
8371 8408
                     int type = RequestString.GetInt("type", 0);
8372 8409
                     int bigtype = RequestString.GetInt("bigtype", 0);
8373 8410
                     int smalltype = RequestString.GetInt("smalltype", 0);
8374
-
8375 8411
                     int isprotect = RequestString.GetInt("isprotect", 0);
8376 8412
                     int level = RequestString.GetInt("level", 0);
8377 8413
                     int issubmit = RequestString.GetInt("issubmit", 0);
8378 8414
                     int isopen = RequestString.GetInt("isopen", 0);
8379 8415
                     int business = RequestString.GetInt("business", 0);
8380 8416
                     string workcontent = RequestString.GetFormString("workcontent");
8381
-                    using (TransactionScope trans = new TransactionScope())
8417
+                    lock (_MyLock)
8382 8418
                     {
8383
-                        #region 保存工单信息
8419
+                        using (TransactionScope trans = new TransactionScope())
8420
+                        {
8421
+                            #region 保存工单信息
8384 8422
 
8385
-                        modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
8423
+                            modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
8386 8424
 
8387
-                        modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
8388
-                        modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
8389
-                        modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
8390
-                        modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
8391
-                        modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
8425
+                            modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
8426
+                            modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
8427
+                            modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
8428
+                            modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
8429
+                            modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
8392 8430
 
8393
-                        modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
8394
-                        modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
8395
-                        modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
8396
-                        modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
8397
-                        modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
8398
-                        modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
8399
-                        modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
8400
-                        modelT_Bus_WorkOrder.F_Email = email;//E-mail
8431
+                            modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
8432
+                            modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
8433
+                            modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
8434
+                            modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
8435
+                            modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
8436
+                            modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
8437
+                            modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
8438
+                            modelT_Bus_WorkOrder.F_Email = email;//E-mail
8401 8439
 
8402
-                        modelT_Bus_WorkOrder.F_ComTitle = title;//标题
8403
-                        modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
8404
-                        modelT_Bus_WorkOrder.F_File = files;//附件
8405
-                        modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
8406
-                        modelT_Bus_WorkOrder.F_Content = workcontent;
8407
-                        modelT_Bus_WorkOrder.F_Key = keys;
8408
-                        modelT_Bus_WorkOrder.F_Level = level;
8409
-                        modelT_Bus_WorkOrder.F_ToBereply = 0;
8410
-                        //是否直办(即时答复)0:,否1: 是         
8411
-                        modelT_Bus_WorkOrder.F_IsResult = isresult;
8412
-                        modelT_Bus_WorkOrder.F_Result = result;//处理结果
8413
-                        if (isopen>0)
8414
-                        modelT_Bus_WorkOrder.F_IsOpen = isopen;
8415
-                        modelT_Bus_WorkOrder.F_Business = business;
8416
-                        //如果选择即刻答复:是,即为直办,工单结束
8417
-                        if (isresult == 1)
8418
-                        {
8419
-                            modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.finish;// 9;//已结案
8420
-                            modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
8421
-                            modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
8422
-                            modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
8423
-                            modelT_Bus_WorkOrder.F_IsClosed = 1;
8424
-                            modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
8425
-                            modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
8426
-                        }
8427
-                        else if (issubmit == 1)
8428
-                        {
8429
-                            modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
8430
-                            modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.submit;// 1;//提交领导
8431
-                        }
8432
-                        #region
8433
-                        //20190715 审核环节去掉 zhengbingbing
8434
-                        //else
8435
-                        //{
8436
-                        //    if(modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.neworder || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.audit)
8437
-                        //        modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.audit;
8438
-                        //}
8439
-                        //else if (issubmit == 1)
8440
-                        //{
8441
-                        //    modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
8442
-                        //    modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.submit;// 1;//提交领导
8443
-                        //}
8444
-                        #endregion
8445
-                        if (state >0)
8446
-                        {
8447
-                            if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY" || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "DDZG"|| userModel.F_RoleCode == "MTDD")
8440
+                            modelT_Bus_WorkOrder.F_ComTitle = title;//标题
8441
+                            modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
8442
+                            modelT_Bus_WorkOrder.F_File = files;//附件
8443
+                            modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
8444
+                            modelT_Bus_WorkOrder.F_Content = workcontent;
8445
+                            modelT_Bus_WorkOrder.F_Key = keys;
8446
+                            modelT_Bus_WorkOrder.F_Level = level;
8447
+                            modelT_Bus_WorkOrder.F_ToBereply = 0;
8448
+                            //是否直办(即时答复)0:,否1: 是         
8449
+                            modelT_Bus_WorkOrder.F_IsResult = isresult;
8450
+                            modelT_Bus_WorkOrder.F_Result = result;//处理结果
8451
+                            if (isopen > 0)
8452
+                                modelT_Bus_WorkOrder.F_IsOpen = isopen;
8453
+                            modelT_Bus_WorkOrder.F_Business = business;
8454
+                            //如果选择即刻答复:是,即为直办,工单结束
8455
+                            if (isresult == 1)
8448 8456
                             {
8449
-                             
8450
-                                int assignid = RequestString.GetInt("assignid", 0);
8451
-                                int maindeptid = RequestString.GetInt("maindeptid", 0);
8452
-                                //string maindeptid = RequestString.GetFormString("maindeptid");
8453
-                                string otherdeptids = RequestString.GetFormString("otherdeptids");
8454
-                                DateTime limittime = DateTime.Now;
8455
-                                try
8456
-                                {
8457
-                                    limittime = DateTime.Now.AddDays(int.Parse(RequestString.GetFormString("limittime")));
8458
-                                }
8459
-                                catch
8457
+                                modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.finish;// 9;//已结案
8458
+                                modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
8459
+                                modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
8460
+                                modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
8461
+                                modelT_Bus_WorkOrder.F_IsClosed = 1;
8462
+                                modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
8463
+                                modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
8464
+                            }
8465
+                            else if (issubmit == 1)
8466
+                            {
8467
+                                modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
8468
+                                modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.submit;// 1;//提交领导
8469
+                            }
8470
+                            #region
8471
+                            //20190715 审核环节去掉 zhengbingbing
8472
+                            //else
8473
+                            //{
8474
+                            //    if(modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.neworder || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.audit)
8475
+                            //        modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.audit;
8476
+                            //}
8477
+                            //else if (issubmit == 1)
8478
+                            //{
8479
+                            //    modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
8480
+                            //    modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.submit;// 1;//提交领导
8481
+                            //}
8482
+                            #endregion
8483
+                            if (state > 0)
8484
+                            {
8485
+                                if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY" || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "DDZG" || userModel.F_RoleCode == "MTDD")
8460 8486
                                 {
8461
-                                    limittime = DateTime.Parse(RequestString.GetFormString("limittime") + " 23:59:59");
8462
-                                }
8463
-                                
8464
-                                string assignedopinion = RequestString.GetFormString("assignedopinion");
8465 8487
 
8466
-                                var modelT_Bus_AssignedInfoLasts = assignBLL.GetList(0, $" F_WorkOrderId='{workorderid}' and F_IsDelete='0' and  F_State='1' ", " F_CreateTime desc").Tables[0];
8467
-                                //if (modelT_Bus_AssignedInfoLasts.Rows.Count > 0)
8468
-                                //{
8469
-                                //    if (modelT_Bus_AssignedInfoLasts.Rows[0]["F_CreateUser"].ToString() != userModel.F_UserCode)
8470
-                                //    {
8471
-                                //        return Error("操作失败");
8472
-                                //    }
8473
-                                //}
8474
-
8475
-                                if (!string.IsNullOrEmpty(otherdeptids))
8476
-                                {
8477
-                                    if (otherdeptids.Split(',').Contains(maindeptid.ToString()))
8488
+                                    int assignid = RequestString.GetInt("assignid", 0);
8489
+                                    int maindeptid = RequestString.GetInt("maindeptid", 0);
8490
+                                    //string maindeptid = RequestString.GetFormString("maindeptid");
8491
+                                    string otherdeptids = RequestString.GetFormString("otherdeptids");
8492
+                                    DateTime limittime = DateTime.Now;
8493
+                                    try
8478 8494
                                     {
8479
-                                        return Error("主办单位不能出现在协办单位");
8495
+                                        limittime = DateTime.Now.AddDays(int.Parse(RequestString.GetFormString("limittime")));
8480 8496
                                     }
8481
-                                }
8482
-                                if (limittime < DateTime.Now)
8483
-                                {
8484
-                                    return Error("办理时限不能小于当前时间");
8485
-                                }
8486
-                                
8487
-                                Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = new Model.T_Bus_AssignedInfo();
8488
-                                var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
8489
-                                if (modelT_Bus_WorkOrder != null && deptinfo != null)
8490
-                                {
8491
-                                    //if (modelT_Bus_WorkOrder.F_WorkState == 1)
8492
-                                    //if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)
8493
-                                    if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)
8497
+                                    catch
8498
+                                    {
8499
+                                        limittime = DateTime.Parse(RequestString.GetFormString("limittime") + " 23:59:59");
8500
+                                    }
8501
+
8502
+                                    string assignedopinion = RequestString.GetFormString("assignedopinion");
8503
+
8504
+                                    var modelT_Bus_AssignedInfoLasts = assignBLL.GetList(0, $" F_WorkOrderId='{workorderid}' and F_IsDelete='0' and  F_State='1' ", " F_CreateTime desc").Tables[0];
8505
+                                    //if (modelT_Bus_AssignedInfoLasts.Rows.Count > 0)
8506
+                                    //{
8507
+                                    //    if (modelT_Bus_AssignedInfoLasts.Rows[0]["F_CreateUser"].ToString() != userModel.F_UserCode)
8508
+                                    //    {
8509
+                                    //        return Error("操作失败");
8510
+                                    //    }
8511
+                                    //}
8512
+
8513
+                                    if (!string.IsNullOrEmpty(otherdeptids))
8494 8514
                                     {
8495
-                                        int aid = 0;
8496
-                                        using (TransactionScope tran = new TransactionScope())
8515
+                                        if (otherdeptids.Split(',').Contains(maindeptid.ToString()))
8497 8516
                                         {
8498
-                                            if (assignid == 0)
8499
-                                            {
8500
-                                                #region 插入交办记录
8501
-                                                modelT_Bus_AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8502
-                                                modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
8503
-                                                modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
8504
-                                                modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
8505
-                                                modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
8506
-
8507
-                                                modelT_Bus_AssignedInfo.F_State = state;//0草稿  1正式
8508
-                                                modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
8509
-                                                modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
8510
-                                                modelT_Bus_AssignedInfo.F_IsDelete = 0;
8511
-                                                modelT_Bus_AssignedInfo.F_IsOverdue = 0;
8512
-                                                modelT_Bus_AssignedInfo.F_IsSure = 0;
8513
-                                                modelT_Bus_AssignedInfo.F_IsReload = 0;
8514
-                                                modelT_Bus_AssignedInfo.F_IsNext = 0;
8515
-                                                modelT_Bus_AssignedInfo.F_TimeResp = assignBLL.GetRepTimly(DateTime.Now);//及时查收时间点
8516
-                                                aid = assignBLL.Add(modelT_Bus_AssignedInfo);
8517
+                                            return Error("主办单位不能出现在协办单位");
8518
+                                        }
8519
+                                    }
8520
+                                    if (limittime < DateTime.Now)
8521
+                                    {
8522
+                                        return Error("办理时限不能小于当前时间");
8523
+                                    }
8517 8524
 
8518
-                                                #endregion
8519
-                                            }
8520
-                                            else
8525
+                                    Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = new Model.T_Bus_AssignedInfo();
8526
+                                    var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
8527
+                                    if (modelT_Bus_WorkOrder != null && deptinfo != null)
8528
+                                    {
8529
+                                        //if (modelT_Bus_WorkOrder.F_WorkState == 1)
8530
+                                        //if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)
8531
+                                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)
8532
+                                        {
8533
+                                            int aid = 0;
8534
+                                            using (TransactionScope tran = new TransactionScope())
8521 8535
                                             {
8522
-                                                #region 修改交办记录
8523
-                                                modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
8524
-                                                if (modelT_Bus_AssignedInfo != null)
8536
+                                                if (assignid == 0)
8525 8537
                                                 {
8538
+                                                    #region 插入交办记录
8539
+                                                    modelT_Bus_AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8526 8540
                                                     modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
8527 8541
                                                     modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
8528 8542
                                                     modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
8529 8543
                                                     modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
8530
-                                                    modelT_Bus_AssignedInfo.F_TimeResp = assignBLL.GetRepTimly(DateTime.Now);//及时查收时间点
8544
+
8531 8545
                                                     modelT_Bus_AssignedInfo.F_State = state;//0草稿  1正式
8532 8546
                                                     modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
8533 8547
                                                     modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
8534
-                                                    assignBLL.Update(modelT_Bus_AssignedInfo);
8535
-                                                    aid = modelT_Bus_AssignedInfo.F_Id;
8548
+                                                    modelT_Bus_AssignedInfo.F_IsDelete = 0;
8549
+                                                    modelT_Bus_AssignedInfo.F_IsOverdue = 0;
8550
+                                                    modelT_Bus_AssignedInfo.F_IsSure = 0;
8551
+                                                    modelT_Bus_AssignedInfo.F_IsReload = 0;
8552
+                                                    modelT_Bus_AssignedInfo.F_IsNext = 0;
8553
+                                                    modelT_Bus_AssignedInfo.F_TimeResp = assignBLL.GetRepTimly(DateTime.Now);//及时查收时间点
8554
+                                                    aid = assignBLL.Add(modelT_Bus_AssignedInfo);
8555
+
8556
+                                                    #endregion
8536 8557
                                                 }
8558
+                                                else
8559
+                                                {
8560
+                                                    #region 修改交办记录
8561
+                                                    modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
8562
+                                                    if (modelT_Bus_AssignedInfo != null)
8563
+                                                    {
8564
+                                                        modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
8565
+                                                        modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
8566
+                                                        modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
8567
+                                                        modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
8568
+                                                        modelT_Bus_AssignedInfo.F_TimeResp = assignBLL.GetRepTimly(DateTime.Now);//及时查收时间点
8569
+                                                        modelT_Bus_AssignedInfo.F_State = state;//0草稿  1正式
8570
+                                                        modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
8571
+                                                        modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
8572
+                                                        assignBLL.Update(modelT_Bus_AssignedInfo);
8573
+                                                        aid = modelT_Bus_AssignedInfo.F_Id;
8574
+                                                    }
8537 8575
 
8538
-                                                #endregion
8539
-                                            }
8576
+                                                    #endregion
8577
+                                                }
8540 8578
 
8541
-                                            if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_State == 1)
8542
-                                            {
8543
-                                                #region 保存工单信息
8544
-                                                //modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
8545
-                                                modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.receive;//待查收
8546
-                                                modelT_Bus_WorkOrder.F_LimitTime = limittime;
8547
-                                                modelT_Bus_WorkOrder.F_MainDeptId = maindeptid;
8548
-                                                modelT_Bus_WorkOrder.F_OtherDeptIds = otherdeptids;
8549
-                                                modelT_Bus_WorkOrder.F_AssignUser = userModel.F_UserCode;
8550
-                                                modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
8551
-                                                workorderBLL.Update(modelT_Bus_WorkOrder);
8552
-                                                #endregion
8579
+                                                if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_State == 1)
8580
+                                                {
8581
+                                                    #region 保存工单信息
8582
+                                                    //modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
8583
+                                                    modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.receive;//待查收
8584
+                                                    modelT_Bus_WorkOrder.F_LimitTime = limittime;
8585
+                                                    modelT_Bus_WorkOrder.F_MainDeptId = maindeptid;
8586
+                                                    modelT_Bus_WorkOrder.F_OtherDeptIds = otherdeptids;
8587
+                                                    modelT_Bus_WorkOrder.F_AssignUser = userModel.F_UserCode;
8588
+                                                    modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
8589
+                                                    workorderBLL.Update(modelT_Bus_WorkOrder);
8590
+                                                    #endregion
8553 8591
 
8554
-                                                #region 删除草稿信息
8555
-                                                var cglist = assignBLL.GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
8592
+                                                    #region 删除草稿信息
8593
+                                                    var cglist = assignBLL.GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
8556 8594
 
8557
-                                                foreach (var cg in cglist)
8558
-                                                {
8559
-                                                    cg.F_IsDelete = 1;
8560
-                                                    cg.F_DeleteUser = userModel.F_UserCode;
8561
-                                                    cg.F_DeleteTime = DateTime.Now;
8595
+                                                    foreach (var cg in cglist)
8596
+                                                    {
8597
+                                                        cg.F_IsDelete = 1;
8598
+                                                        cg.F_DeleteUser = userModel.F_UserCode;
8599
+                                                        cg.F_DeleteTime = DateTime.Now;
8562 8600
 
8563
-                                                    assignBLL.Update(cg);
8564
-                                                }
8565
-                                                #endregion
8601
+                                                        assignBLL.Update(cg);
8602
+                                                    }
8603
+                                                    #endregion
8566 8604
 
8567
-                                                #region 插入操作记录
8568
-                                                Model.T_Bus_Operation opers = new Model.T_Bus_Operation();
8569
-                                                opers.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8570
-                                                opers.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
8571
-                                                opers.F_State = modelT_Bus_WorkOrder.F_WorkState;
8605
+                                                    #region 插入操作记录
8606
+                                                    Model.T_Bus_Operation opers = new Model.T_Bus_Operation();
8607
+                                                    opers.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8608
+                                                    opers.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
8609
+                                                    opers.F_State = modelT_Bus_WorkOrder.F_WorkState;
8572 8610
 
8573
-                                                string userinfos = userModel.depname  + "(" + userModel.F_UserCode + ")";
8611
+                                                    string userinfos = userModel.depname + "(" + userModel.F_UserCode + ")";
8574 8612
 
8575
-                                                opers.F_Message = userinfos + " 交办了工单,主办单位:" + deptinfo.F_DeptName;
8576
-                                                if (!string.IsNullOrEmpty(otherdeptids))
8577
-                                                {
8578
-                                                    string sql = "select dbo.GetDeptNames('" + otherdeptids + "')";
8579
-                                                    opers.F_Message += ",协办单位:" + DbHelperSQL.GetSingle(sql);
8580
-                                                }
8581
-                                                opers.F_CreateUser = userModel.F_UserCode;
8582
-                                                opers.F_CreateTime = DateTime.Now;
8583
-                                                opers.F_IsDelete = 0;
8613
+                                                    opers.F_Message = userinfos + " 交办了工单,主办单位:" + deptinfo.F_DeptName;
8614
+                                                    if (!string.IsNullOrEmpty(otherdeptids))
8615
+                                                    {
8616
+                                                        string sql = "select dbo.GetDeptNames('" + otherdeptids + "')";
8617
+                                                        opers.F_Message += ",协办单位:" + DbHelperSQL.GetSingle(sql);
8618
+                                                    }
8619
+                                                    opers.F_CreateUser = userModel.F_UserCode;
8620
+                                                    opers.F_CreateTime = DateTime.Now;
8621
+                                                    opers.F_IsDelete = 0;
8584 8622
 
8585
-                                                operBLL.Add(opers);
8623
+                                                    operBLL.Add(opers);
8586 8624
 
8587
-                                                //推送消息表
8588
-                                                var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
8625
+                                                    //推送消息表
8626
+                                                    var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
8589 8627
 
8590
-                                                foreach (var u in users)
8591
-                                                {
8592
-                                                    msg.AddInternalMessagesInfo("工单消息", opers.F_Message + ",工单编号:" + opers.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode, (int)EnumSmsType.workorder);
8628
+                                                    foreach (var u in users)
8629
+                                                    {
8630
+                                                        msg.AddInternalMessagesInfo("工单消息", opers.F_Message + ",工单编号:" + opers.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode, (int)EnumSmsType.workorder);
8631
+                                                    }
8632
+                                                    #endregion
8593 8633
                                                 }
8594
-                                                #endregion
8595
-                                            }
8596 8634
 
8597
-                                            tran.Complete();
8635
+                                                tran.Complete();
8636
+                                            }
8637
+                                            return Success("操作成功", modelT_Bus_AssignedInfo.F_Id);
8638
+                                        }
8639
+                                        else
8640
+                                        {
8641
+                                            return Error("已经交办过了");
8598 8642
                                         }
8599
-                                        return Success("操作成功", modelT_Bus_AssignedInfo.F_Id);
8600 8643
                                     }
8601 8644
                                     else
8602 8645
                                     {
8603
-                                        return Error("已经交办过了");
8646
+                                        return Error("操作失败");
8604 8647
                                     }
8648
+
8605 8649
                                 }
8606 8650
                                 else
8607 8651
                                 {
8608
-                                    return Error("操作失败");
8652
+                                    return Error("权限不足");
8609 8653
                                 }
8654
+                            }
8655
+                            workorderBLL.Update(modelT_Bus_WorkOrder);
8610 8656
 
8657
+                            #endregion
8658
+                            #region 插入操作记录
8659
+                            Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
8660
+                            oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8661
+                            oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
8662
+                            oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
8663
+                            oper.F_File = modelT_Bus_WorkOrder.F_File;
8664
+
8665
+                            string userinfo = userModel.depname + "(" + userModel.F_UserCode + ")";
8666
+                            if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.neworder || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.audit)//0)
8667
+                            {
8668
+                                oper.F_Message = userinfo + " 修改了工单";
8611 8669
                             }
8612
-                            else
8670
+                            if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)//1)
8613 8671
                             {
8614
-                                return Error("权限不足");
8672
+                                oper.F_Message = userinfo + " 修改并提交了工单";
8673
+                            }
8674
+                            if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.resubmit)//1)
8675
+                            {
8676
+                                oper.F_Message = userinfo + " 修改了重办工单";
8677
+                            }
8678
+                            if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.finish)//9)
8679
+                            {
8680
+                                oper.F_Message = userinfo + " 修改并结案了工单";
8615 8681
                             }
8616
-                        }
8617
-                        workorderBLL.Update(modelT_Bus_WorkOrder);
8618
-
8619
-                        #endregion
8620
-
8621
-                        #region 插入操作记录
8622
-                        Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
8623
-                        oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
8624
-                        oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
8625
-                        oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
8626
-                        oper.F_File = modelT_Bus_WorkOrder.F_File;
8627 8682
 
8628
-                        string userinfo = userModel.depname + "(" + userModel.F_UserCode + ")";
8629
-                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.neworder || modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.audit)//0)
8630
-                        {
8631
-                            oper.F_Message = userinfo + " 修改了工单";
8632
-                        }
8633
-                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)//1)
8634
-                        {
8635
-                            oper.F_Message = userinfo + " 修改并提交了工单";
8636
-                        }
8637
-                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.resubmit)//1)
8638
-                        {
8639
-                            oper.F_Message = userinfo + " 修改了重办工单";
8640
-                        }
8641
-                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.finish)//9)
8642
-                        {
8643
-                            oper.F_Message = userinfo + " 修改并结案了工单";
8644
-                        }
8683
+                            oper.F_CreateUser = userModel.F_UserCode;
8684
+                            oper.F_CreateTime = DateTime.Now;
8685
+                            oper.F_IsDelete = 0;
8645 8686
 
8646
-                        oper.F_CreateUser = userModel.F_UserCode;
8647
-                        oper.F_CreateTime = DateTime.Now;
8648
-                        oper.F_IsDelete = 0;
8687
+                            operBLL.Add(oper);
8649 8688
 
8650
-                        operBLL.Add(oper);
8689
+                            //推送消息表
8690
+                            if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)//1)
8691
+                            {
8651 8692
 
8652
-                        //推送消息表
8653
-                        if (modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.submit)//1)
8654
-                        {
8655
-                          
8656
-                            var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLYGLY'or F_RoleCode='MTDD')  ").Select(p => p.F_RoleId);
8657
-                            var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ")  ");
8693
+                                var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLYGLY'or F_RoleCode='MTDD')  ").Select(p => p.F_RoleId);
8694
+                                var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ")  ");
8658 8695
 
8659
-                            foreach (var u in users)
8660
-                            {
8661
-                                msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode, (int)EnumSmsType.workorder);
8662
-                            }
8663
-                        }
8664
-                        //调用科大讯飞
8665
-                        if (modelT_Bus_WorkOrder.F_InfoSource == 7 && modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.finish)//9)
8666
-                        {
8667
-                            ShangQiuWorkOrderController sqwo = new ShangQiuWorkOrderController();
8668
-                            bool bl = sqwo.SaveReplyInfo(oper.F_WorkOrderId, userModel.F_UserCode, userModel.depname, modelT_Bus_WorkOrder.F_Result, "3", modelT_Bus_WorkOrder.F_InfoType.Value.ToString());
8669
-                            if (bl)
8670
-                            {
8671
-                                Success("调用成功,工单号:" + oper.F_WorkOrderId);
8696
+                                foreach (var u in users)
8697
+                                {
8698
+                                    msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode, (int)EnumSmsType.workorder);
8699
+                                }
8672 8700
                             }
8673
-                            else
8701
+                            //调用科大讯飞
8702
+                            if (modelT_Bus_WorkOrder.F_InfoSource == 7 && modelT_Bus_WorkOrder.F_WorkState == (int)EnumWorkState.finish)//9)
8674 8703
                             {
8675
-                                Error("调用失败,工单号:" + oper.F_WorkOrderId);
8704
+                                ShangQiuWorkOrderController sqwo = new ShangQiuWorkOrderController();
8705
+                                bool bl = sqwo.SaveReplyInfo(oper.F_WorkOrderId, userModel.F_UserCode, userModel.depname, modelT_Bus_WorkOrder.F_Result, "3", modelT_Bus_WorkOrder.F_InfoType.Value.ToString());
8706
+                                if (bl)
8707
+                                {
8708
+                                    Success("调用成功,工单号:" + oper.F_WorkOrderId);
8709
+                                }
8710
+                                else
8711
+                                {
8712
+                                    Error("调用失败,工单号:" + oper.F_WorkOrderId);
8713
+                                }
8676 8714
                             }
8715
+                            #endregion
8716
+                            trans.Complete();
8677 8717
                         }
8678
-                        #endregion
8679
-
8680
-                        trans.Complete();
8681 8718
                     }
8682 8719
                     return Success("操作成功");
8683
-
8684 8720
                 }
8685 8721
                 else
8686 8722
                 {

+ 2 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Common/ButtonGroup.cs

@@ -462,7 +462,8 @@ namespace CallCenterApi.Interface.Models.Common
462 462
                     //调度专员 中心领导管理员 管理员
463 463
                     if ((code == "ZXLD" || code == "ZXLDGLYGLY" || code == "GLY" || code == "DDZG"|| code == "MTDD"|| code == "ZXHWY") && iszb == "1")
464 464
                     {
465
-                        buttons.Add(back());
465
+
466
+                       // buttons.Add(back());
466 467
                     }
467 468
                     if (code == "ZXLD" || code == "ZXLDGLYGLY" || code == "GLY" || code == "DDZG" || code == "MTDD" || code == "ZXHWY")
468 469
                     {

+ 267 - 0
CallCenterCommon/CallCenter.Utility/NPOI/NPOIHelper.cs

@@ -515,7 +515,274 @@ namespace CallCenter.Utility
515 515
 
516 516
             return dt;
517 517
         }
518
+        private string GetCellValue(DataRow dr,int index,int i   )
519
+        {
520
+            string str = "";
521
+            switch (i)
522
+            {
523
+                case 0:
524
+                    str = index.ToString();
525
+                    break;
526
+                case 1:
527
+                    str = dr["deptname"].ToString();
528
+                    break;
529
+                case 2:
530
+                    str = dr["Undertakers"].ToString();
531
+                    break;
532
+                case 3:
533
+                    str = dr["Undertakersrate"].ToString();
534
+                    break;
535
+                case 4:
536
+                    str = dr["Undertakersscore"].ToString();
537
+                    break;
538
+                case 5:
539
+                    str = dr["overdue"].ToString();
540
+                    break;
541
+                case 6:
542
+                    str = dr["overduerate"].ToString();
543
+                    break;
544
+                case 7:
545
+                    str = dr["overduescore"].ToString();
546
+                    break;
547
+                case 8:
548
+                    str = dr["unsuccessful"].ToString();
549
+                    break;
550
+                case 9:
551
+                    str = dr["unsuccessfulrate"].ToString();
552
+                    break;
553
+                case 10:
554
+                    str = dr["unsuccessfulscore"].ToString();
555
+                    break;
556
+                case 11:
557
+                    str = dr["Chargeback"].ToString();
558
+                    break;
559
+                case 12:
560
+                    str = dr["Chargebackrate"].ToString();
561
+                    break;
562
+                case 13:
563
+                    str = dr["Chargebackscore"].ToString();
564
+                    break;
565
+                case 14:
566
+                    str = dr["Comment"].ToString();
567
+                    break;
568
+                case 15:
569
+                    str = dr["dissatisfied"].ToString();
570
+                    break;
571
+                case 16:
572
+                    str = dr["satisfiedrate"].ToString();
573
+                    break;
574
+                case 17:
575
+                    str = dr["satisfiedscore"].ToString();
576
+                    break;
577
+                case 18:
578
+                    str = dr["total"].ToString();
579
+                    break;
580
+                case 19:
581
+                    str = index.ToString();
582
+                    break;
583
+
584
+            }
585
+            return str;
586
+        }
587
+        /// <summary>
588
+        /// 督办数据报表导出
589
+        /// </summary>
590
+        /// <param name="ds"></param>
591
+        /// <returns></returns>
592
+        public string DBExportToExcel(DataTable dt,string Name,string month,string starttime ,string endtime )
593
+        {
594
+            try
595
+            {
596
+                HSSFWorkbook workbook = new HSSFWorkbook();
597
+                ISheet sheet = workbook.CreateSheet(Name);
598
+                ICellStyle cellStyle = workbook.CreateCellStyle();
599
+                NPOI.SS.UserModel.IFont cellfont = workbook.CreateFont();
600
+                cellfont.Boldweight = (short)FontBoldWeight.Normal;
601
+                cellStyle.SetFont(cellfont);
602
+                ICellStyle cellStylebt = workbook.CreateCellStyle();
603
+                NPOI.SS.UserModel.IFont cellfontbt = workbook.CreateFont();
604
+                cellfontbt.Boldweight = (short)FontBoldWeight.Bold;
605
+                cellStylebt.SetFont(cellfontbt);
606
+                cellStylebt.VerticalAlignment = VerticalAlignment.Center;
607
+                cellStylebt.Alignment = HorizontalAlignment.Center;
608
+                IRow irow1 = sheet.CreateRow(0);
609
+                ICell cell1 = irow1.CreateCell(0);
610
+                cell1.SetCellValue("12345联动服务工作"+ month + "月份办理情况通报表");
611
+                cell1.CellStyle = cellStylebt;
612
+                sheet.AddMergedRegion(new CellRangeAddress(0, 1, 0, 19));
613
+                IRow irow2 = sheet.CreateRow(2);
614
+                ICell cell2 = irow2.CreateCell(0);
615
+                cell2.SetCellValue("统计周期:"+ starttime+"至"+ endtime+"                统计时间:"+DateTime .Now.ToString ("yyyy年MM月dd日"));
616
+                cell2.CellStyle = cellStylebt;
617
+                sheet.AddMergedRegion(new CellRangeAddress(2, 2, 0, 19));
618
+                IRow irow3 = sheet.CreateRow(3);
619
+                ICell cell3 = irow3.CreateCell(0);
620
+                cell3.SetCellValue("一、县(市、区)联动单位");
621
+                cell3.CellStyle = cellStylebt;
622
+                sheet.AddMergedRegion(new CellRangeAddress(3, 3, 0, 19));
623
+                string[] cols = {"序号","联动单位","承办件",
624
+                "承办率","得分(5分)","超期件","按时反馈率","得分(20分)",
625
+                "未果件","办结率","得分(10分)","退单件","有效回复率",
626
+                "得分(15分)","群众评议总数","不满意件","满意率","得分(50分)","总分","排名"};
627
+                IRow irow4 = sheet.CreateRow(4);
628
+                int icolIndex = 0;
629
+                foreach (string dc in cols)
630
+                {
631
+                    ICell cell = irow4.CreateCell(icolIndex);
632
+                    cell.SetCellValue(dc);
633
+                    cell.CellStyle = cellStylebt;
634
+                    icolIndex++;
635
+                }
636
+                int iRowIndex = 5;
637
+                DataRow[] rows = dt.Select("category=1");
638
+                int index = 0;
639
+                foreach (DataRow dr in rows)
640
+                {
641
+                    index++;
642
+                    int iCellIndex = 0;
643
+                    IRow irow = sheet.CreateRow(iRowIndex );
644
+                    for (int i = 0; i < 20; i++)
645
+                    {
646
+                        ICell cell = irow.CreateCell(iCellIndex);
647
+                        cell.SetCellValue(GetCellValue(dr, index,i ));
648
+                        cell.CellStyle = cellStyle;
649
+                        iCellIndex++;
650
+                    }
651
+                    iRowIndex++;
652
+                }
653
+               
654
+                IRow irow5 = sheet.CreateRow(iRowIndex);
655
+                ICell cell5 = irow5.CreateCell(0);
656
+                cell5.SetCellValue("二、市直机关联动单位一组");
657
+                cell5.CellStyle = cellStylebt;
658
+                sheet.AddMergedRegion(new CellRangeAddress(iRowIndex, iRowIndex, 0, 19));
659
+                iRowIndex++;
660
+                IRow irow6 = sheet.CreateRow(iRowIndex);
661
+                 icolIndex = 0;
662
+                foreach (string dc in cols)
663
+                {
664
+                    ICell cell = irow6.CreateCell(icolIndex);
665
+                    cell.SetCellValue(dc);
666
+                    cell.CellStyle = cellStylebt;
667
+                    icolIndex++;
668
+                }
669
+                 iRowIndex++;
670
+                 rows = dt.Select("category=2");
671
+                 index = 0;
672
+                foreach (DataRow dr in rows)
673
+                {
674
+                    index++;
675
+                    int iCellIndex = 0;
676
+                    IRow irow = sheet.CreateRow(iRowIndex);
677
+                    for (int i = 0; i < 20; i++)
678
+                    {
679
+                        ICell cell = irow.CreateCell(iCellIndex);
680
+                        cell.SetCellValue(GetCellValue(dr, index,i ));
681
+                        cell.CellStyle = cellStyle;
682
+                        iCellIndex++;
683
+                    }
684
+                    iRowIndex++;
685
+                }
686
+                IRow irow7 = sheet.CreateRow(iRowIndex);
687
+                ICell cell7 = irow7.CreateCell(0);
688
+                cell7.SetCellValue("三、市直机关联动单位二组");
689
+                cell7.CellStyle = cellStylebt;
690
+                sheet.AddMergedRegion(new CellRangeAddress(iRowIndex, iRowIndex, 0, 19));
691
+                iRowIndex++;
692
+                IRow irow8 = sheet.CreateRow(iRowIndex);
693
+                icolIndex = 0;
694
+                foreach (string dc in cols)
695
+                {
696
+                    ICell cell = irow8.CreateCell(icolIndex);
697
+                    cell.SetCellValue(dc);
698
+                    cell.CellStyle = cellStylebt;
699
+                    icolIndex++;
700
+                }
701
+                iRowIndex++;
702
+                rows = dt.Select("category=3");
703
+                index = 0;
704
+                foreach (DataRow dr in rows)
705
+                {
706
+                    index++;
707
+                    int iCellIndex = 0;
708
+                    IRow irow = sheet.CreateRow(iRowIndex);
709
+                    for (int i = 0; i < 20; i++)
710
+                    {
711
+                        ICell cell = irow.CreateCell(iCellIndex);
712
+                        cell.SetCellValue(GetCellValue(dr, index,i ));
713
+                        cell.CellStyle = cellStyle;
714
+                        iCellIndex++;
715
+                    }
716
+                    iRowIndex++;
717
+                }
718
+                IRow irow9 = sheet.CreateRow(iRowIndex);
719
+                ICell cell9 = irow9.CreateCell(0);
720
+                cell9.SetCellValue("四、公益型企业联动单位");
721
+                cell9.CellStyle = cellStylebt;
722
+                sheet.AddMergedRegion(new CellRangeAddress(iRowIndex, iRowIndex, 0, 19));
723
+                iRowIndex++;
724
+                IRow irow10 = sheet.CreateRow(iRowIndex);
725
+                icolIndex = 0;
726
+                foreach (string dc in cols)
727
+                {
728
+                    ICell cell = irow10.CreateCell(icolIndex);
729
+                    cell.SetCellValue(dc);
730
+                    cell.CellStyle = cellStylebt;
731
+                    icolIndex++;
732
+                }
733
+                iRowIndex++;
734
+                rows = dt.Select("category=4");
735
+                index = 0;
736
+                foreach (DataRow dr in rows)
737
+                {
738
+                    index++;
739
+                    int iCellIndex = 0;
740
+                    IRow irow = sheet.CreateRow(iRowIndex);
741
+                    for (int i = 0; i < 20; i++)
742
+                    {
743
+                        ICell cell = irow.CreateCell(iCellIndex);
744
+                        cell.SetCellValue(GetCellValue(dr, index,i ));
745
+                        cell.CellStyle = cellStyle;
746
+                        iCellIndex++;
747
+                    }
748
+                    iRowIndex++;
749
+                }
750
+                //自适应列宽度
751
+                for (int i = 0; i < 20; i++)
752
+                {
753
+                     sheet.AutoSizeColumn(i);
754
+                   // sheet.SetColumnWidth(i, 20 * 256);
755
+                }
756
+
757
+                using (MemoryStream ms = new MemoryStream())
758
+                {
759
+                    workbook.Write(ms);
760
+
761
+                    HttpContext curContext = HttpContext.Current;
762
+
763
+
764
+                    // 设置编码和附件格式
765
+                    curContext.Response.ContentType = "application/vnd.ms-excel";
766
+                    curContext.Response.ContentEncoding = Encoding.UTF8;
767
+                    curContext.Response.Charset = "";
768
+                    curContext.Response.AppendHeader("Content-Disposition",
769
+                        "attachment;filename=" + HttpUtility.UrlEncode(Name + ".xls", Encoding.UTF8));
518 770
 
771
+                    curContext.Response.BinaryWrite(ms.GetBuffer());
772
+
773
+                    workbook = null;
774
+                    ms.Close();
775
+                    ms.Dispose();
776
+
777
+                    curContext.Response.End();
778
+                }
779
+                return "";
780
+            }
781
+            catch
782
+            {
783
+                return "导出失败!";
784
+            }
785
+        }
519 786
         /// <summary>
520 787
         /// 弹出下载框导出excel
521 788
         /// </summary>