using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http.Filters;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using ZXDT.CallCenter.Model;
using ZXDT.CallCenter.MVCWeb.Commons;
using ZXDT.CallCenter.MVCWeb.Models;
using ZXDT.Common;

namespace ZXDT.CallCenter.MVCWeb.Controllers
{
 
    public class ReportController : Controller
    {
        BLL.T_Call_CallRecords recordBLL = new BLL.T_Call_CallRecords();

        BLL.T_Wo_WorkOrderBase workorderBLL = new BLL.T_Wo_WorkOrderBase();
        int rxzhj = 0;
        int wxzhj = 0;
        int wbzhj = 0;
        //
        // GET: /Report/

        public ActionResult Index()
        {
            return View();
        }

        //
        // 主页面来电类型比例分析

        public ActionResult IndexCenterCallPre(string type, string strdate)
        {
            string res = "0^0";
            int c1 = 0;//自助服务
            int c2 = 0;//人工服务 
            int count = 0;//总数
            DataTable dt = new DataTable();
            Models.WorkOrderPieModel model = new Models.WorkOrderPieModel();
            model.PieTypeArrName = "[]";
            model.PieDataJson = "[]";
            string sql = "";
            try
            {
                //查询按钮
                if (!string.IsNullOrEmpty(strdate))
                {
                    string startdate = strdate.Split('~')[0].Trim();
                    string enddate = strdate.Split('~')[1].Trim();
                    sql += " and F_CREATEDATE>=  '" + startdate.Trim()+"'" ;
                    sql += " and F_CREATEDATE<= '" + enddate.Trim() + "'";
                }
                dt = new ZXDT.CallCenter.BLL.T_Wo_WorkOrderBase().GetList("1=1  " + sql + " order by F_WORKORDERTYPEID").Tables[0];
                if (dt != null)
                {
                    #region
                    count = dt.Rows.Count;
                    c1 = dt.Select("F_WORKORDERTYPEID=1 ").Length;
                    c2 = count - c1;
                 

                    model.PieTypeArrName = "['自助服务'";
                    model.PieDataJson = "[{ value:" + c1 + ",name: '自助服务'}";
                    model.PieTypeArrName += ",'人工服务']";
                    model.PieDataJson += ",{value:" + c2 + ",name: '人工服务'}]";
                    #endregion
                }
            }
            catch (Exception err)
            {
            }
            finally
            {
                dt.Clear();
                dt.Dispose();
                res = c1.ToString() + "^" + c2.ToString();
            }  
            return View(model);
        }

        //
        // 主页面工单类型比例分析

        public ActionResult IndexCenterWorkOrderPre(string type, string strdate)
        {
            Models.WorkOrderPieModel model = new Models.WorkOrderPieModel();
            model.PieTypeArrName = "[]";
            model.PieDataJson = "[]";
            DataTable dt = new DataTable();
            try
            {
                string startdate = strdate.Split('~')[0].Trim();
                string enddate = strdate.Split('~')[1].Trim();
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=1 ");
                if (namelist != null)
                {
                    dt = new BLL.T_Wo_WorkOrderBase().GetList(" F_CREATEDATE>='"+ startdate +"'"+ "and F_CREATEDATE <='"+ enddate+"'").Tables[0];
                    string arrname = "";
                    string arrjson = "";//{ value: 31, name: '咨询' },
                    int i = 0;
                    int count = 0;
                    foreach (Model.T_Wo_WorkOrderType m in namelist)
                    {
                        count = dt.Select("F_FILEFLAG=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                        if (i == 0)
                        {
                            arrname += "'" + m.F_Name.Trim() + "'";
                            arrjson += "{ value: " + count.ToString() + ", name: '" + m.F_Name.Trim() + "' }";
                        }
                        else
                        {
                            arrname += ",'" + m.F_Name.Trim() + "'";
                            arrjson += ",{ value: " + count.ToString() + ", name: '" + m.F_Name.Trim() + "' }";
                        }
                        i++;
                    }
                    model.PieTypeArrName = "[" + arrname + "]";
                    model.PieDataJson = "[" + arrjson + "]";
                }
            }
            catch
            { }
            finally
            {
                dt.Clear();
                dt.Dispose();
            }
            return View(model);
        }

        //
        // 主页面工单类型时间段比例分析

        public ActionResult IndexCenterWorkOrderTimeBar(string type, string strdate)
        {
            Models.WorkOrderPieModel model = new Models.WorkOrderPieModel();
            model.PieTypeArrName = "[]";
            model.PieDataJson = "[]";
            DataTable dt = new DataTable();
            try
            {
                string startdate = strdate.Split('~')[0].Trim();
                string enddate = strdate.Split('~')[1].Trim();
                DataTable datas = recordBLL.GetWorkOrderWeekData(startdate, enddate);
                if (datas != null)
                {
                    for (int i = 1; i < 8; i++)
                    {
                        DataRow[] rowsZX = datas.Select("Weeks=" + i + " and BusinessType=" + 6);
                        if (rowsZX != null && rowsZX.Length > 0)
                        {
                            model.Week1 += ",";
                            model.Week1 += rowsZX[0]["callInCount"];
                        }
                        else
                        {
                            model.Week1 += ",";
                            model.Week1 += 0;
                        }
                        DataRow[] rowsBY = datas.Select("Weeks=" + i + "  and BusinessType=" + 18);
                        if (rowsBY != null && rowsBY.Length > 0)
                        {
                            model.Week2 += ",";
                            model.Week2 += rowsBY[0]["callInCount"];
                        }
                        else
                        {
                            model.Week2 += ",";
                            model.Week2 += 0;
                        }


                        DataRow[] rowsGS = datas.Select("Weeks=" + i + "  and BusinessType=" + 19);
                        if (rowsGS != null && rowsGS.Length > 0)
                        {
                            model.Week3 += ",";
                            model.Week3 += rowsGS[0]["callInCount"];
                        }
                        else
                        {
                            model.Week3 += ",";
                            model.Week3 += 0;
                        }


                        DataRow[] rowsJY = datas.Select("Weeks=" + i + " and BusinessType=" + 14);
                        if (rowsJY != null && rowsJY.Length > 0)
                        {
                            model.Week4 += ",";
                            model.Week4 += rowsJY[0]["callInCount"];
                        }
                        else
                        {
                            model.Week4 += ",";
                            model.Week4 += 0;
                        }


                        DataRow[] rowsTS = datas.Select("Weeks=" + i + " and BusinessType=" + 3);
                        if (rowsTS != null && rowsTS.Length > 0)
                        {
                            model.Week5 += ",";
                            model.Week5 += rowsTS[0]["callInCount"];
                        }
                        else
                        {
                            model.Week5 += ",";
                            model.Week5 += 0;
                        }
                    }
                    model.Week1 = model.Week1.Trim(',');
                    model.Week2 = model.Week2.Trim(',');
                    model.Week3 = model.Week3.Trim(',');
                    model.Week4 = model.Week4.Trim(',');
                    model.Week5 = model.Week5.Trim(',');
                }

            }
            catch
            { }
            finally
            {
                dt.Clear();
                dt.Dispose();
            }
            return View(model);
        }




        #region 来电时间分布图

        public ActionResult CallInMatch()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }



        /// <summary>
        /// 获取曲线数据信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("GetdTypeData")]
        [HttpGet]
        public string GetdTypeData(DateTime? NowDateTime, int? busType, string dType, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {


                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }
                dataModel.code = 0;
                dataModel.data = recordBLL.GetdTypeData(dType, busType, startDate, endDate);
                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }


        }




        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("CallInMatchData")]
        [HttpGet]
        public string CallInMatchData(DateTime? NowDateTime, string dateParty)
        { //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            { 
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }
                dataModel.code = 0;
                dataModel.data = recordBLL.GetHourData(startDate, endDate);

                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }
        }
        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("CallInMatchDataList")]
        [HttpGet]
        public string CallInMatchDataList(DateTime? NowDateTime, int page, int limit, 
            string dateParty, string CallHour,string linkman,string calltype,string ywtype)
        { //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {
                string startDate = "";
                string endDate = "";
                string sql = " ";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12); 
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }
                if (startDate.Trim()== endDate.Trim()) {
                    sql += " and BeginTime>= '" + startDate + "  00:00:00'";
                    sql += " and BeginTime<= '" + endDate + " 23:59:59'";
                }
                else { 
                sql += " and BeginTime>= '" + startDate + "'";
                sql += " and BeginTime<= '" + endDate + "'";
                }
                if (!String.IsNullOrEmpty (CallHour))
                {
                    sql += "and CallType=0 and DATEPART(HH, BeginTime)=" + CallHour;
                }
                //坐席工号
                if (!String.IsNullOrEmpty(linkman))
                {
                    sql += "and UserCode=" + linkman;
                }
                //呼叫方向，1呼出0呼入calltype
                switch (calltype)
                {
                    case "0":sql = sql + "and CallType=0";break;
                    case "1": sql = sql + "and CallType=1"; break;
                    default:  break;
                }
                switch (Server.UrlDecode( ywtype))
                {
                    case "1": sql = sql + " and CallType=0 and BusinessType=1"; break;//咨询
                    case "2": sql = sql + " and CallType=0 and BusinessType=2"; break;//建议
                    case "3": sql = sql + " and CallType=0 and BusinessType=3"; break;//表扬
                    case "4": sql = sql + " and CallType=0 and BusinessType=4"; break;//挂失
                    case "9": sql = sql + " and CallType=0 and BusinessType=9"; break;//投诉
                    case "9999": sql = sql + " and CallType=0 and  CallId not  in ( select CallId from T_Call_CallRecords where BusinessType  in (1,2,3,4,9 ))"; break;//放弃排队
                    default: break;

                        //case "1": sql = sql + " and CallType=0 and F_ServiceType=1"; break;//咨询
                        //case "2": sql = sql + " and CallType=0 and F_ServiceType=2"; break;//投诉
                        //case "3": sql = sql + " and CallType=0 and F_ServiceType=3"; break;//建议
                        //case "4": sql = sql + " and CallType=0 and F_ServiceType=4"; break;//表扬
                        //case "5": sql = sql + " and CallType=0 and F_ServiceType=5"; break;//挂失
                        //case "9999": sql = sql + " and CallType=0 and  CallId not  in ( select CallId from T_Call_CallRecords where F_ServiceType  in (1,2,3,4,5 ))"; break;//放弃排队
                        //default: break;
                }
                DataTable dt = new DataTable(); 
                int recordCount = 0;
                Model.PageData<Model.T_Call_CallRecords> pageModel = new Model.PageData<Model.T_Call_CallRecords>();
                dt = BLL.PagerBLL.GetListPager(
                   "T_Call_CallRecords",
                     "CallId",
                     " *,CONVERT(varchar, BeginTime, 120 ) as BeginTimeNew,CONVERT(varchar, TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar, TalkEndTime, 120 ) as TalkEndTimeNew,CONVERT(varchar, TalkStartTime, 120 ) as TalkStartTimeNew,CONVERT(varchar, TalkEndTime, 120 ) as TalkEndTimeNew"+
                     @",(select top 1 F_ScaleResume from T_Cus_CustomerBase n where  CallNumber=n.F_Telephone) as F_ScaleResume 
                ,case 
 when  BusinessType=1 then '咨询'
 when  BusinessType=2 then '建议'
 when  BusinessType=3 then '表扬'
 when  BusinessType=4 then '挂失'
 when  BusinessType=9 then '投诉'

 when  F_ServiceType=1 then '咨询'
 when  F_ServiceType = 2 then '投诉'
 when  F_ServiceType = 3 then '建议'
 when  F_ServiceType = 4 then '表扬'
 when  F_ServiceType = 5 then '挂失'
 else '' end as
BType, case when (isnull(BusinessType,0)>0 or isnull(F_ServiceType,0)>0) then '人工服务' else '' end  as ywtype  ",
                     sql,
                     "ORDER BY  CallId desc", 
                    limit,
                    page,
                    true,
                    out recordCount);

                dataModel.code = 0;
                //dataModel.data = recordBLL.GetHourDataList(CallHour,startDate, endDate);
                dataModel.count = recordCount;
                dataModel.data = dt;
                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string CallInMatchChartData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }
            DataTable table = recordBLL.GetHourData(startDate, endDate);
            //拼接数据
            if (table != null && table.Rows.Count > 0)
            {
                int[] strArr = new int[24];
                int[] intArr = new int[24];
                for (int i = 0; i < 24; i++)
                {
                    strArr[i] = i;
                    DataRow[] row = table.Select("CallHour=" + i);
                    if (row != null && row.Length > 0)
                    {
                        intArr[i] = (int)row[0]["callInCount"];
                    }
                    else
                    {
                        intArr[i] = 0;
                    }
                }
                dataModel.bottom = JsonConvert.SerializeObject(strArr);
                dataModel.datas = JsonConvert.SerializeObject(intArr);

            }
            return JsonConvert.SerializeObject(dataModel);
        }




        #endregion
        #region 咨询业务类型分布图
        public ActionResult zxywtype()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);
        }

        // 咨询业务比例分析
        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("zxywtypeWorkOrderPreData")]
        [HttpGet]
        public string zxywtypeWorkOrderPreData(DateTime? NowDateTime, string dateParty)
        {

            
            //数据结果集
            ResponseData dataModel = new ResponseData();
            DataTable dt = new DataTable();
           int  counthj = 0;
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    //startDate = dateParty.Substring(0, 10);
                    //endDate = dateParty.Substring(12);
                    startDate = dateParty.Split('~')[0].Trim();
                    endDate = dateParty.Split('~')[1].Trim();
                }
                else
                {
                    startDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
                    endDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
                }  
                DataTable newTable = new DataTable();
                newTable.Columns.Add("TypeID");
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=6 ");
                 if (namelist != null)
                {
                    dt = new BLL.T_Wo_WorkOrderBase().GetList("F_CREATEDATE>='"+ startDate + "'and F_CREATEDATE<='"+ endDate+ "' and F_FILEFLAG=6").Tables[0];
                    int i = 0;
                    int count = 0;
                    DataRow dataRow;
                    foreach (Model.T_Wo_WorkOrderType m in namelist)
                    {  
                        count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                        dataRow = newTable.NewRow();
                        dataRow["TypeID"] = m.F_WorkOrderTypeId.ToString();
                        dataRow["业务类型"] = m.F_Name.Trim();
                        dataRow["工单数量"] = count.ToString();
                        newTable.Rows.Add(dataRow);
                        counthj = counthj + count;
                        i++;
                    }
                    dataRow = newTable.NewRow();
                    dataRow["TypeID"] = "";
                   dataRow["业务类型"] = "总合计";
                    dataRow["工单数量"] = counthj.ToString();
                    newTable.Rows.Add(dataRow);
                }
               
                dataModel.code = 0;
                dataModel.data = newTable;
                dataModel.count = counthj;

            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }
            finally
            {
                dt.Clear();
                dt.Dispose();
            } 
            return JsonConvert.SerializeObject(dataModel);
        }
        public string zxywtypeWorkOrderPre(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            DataTable dt = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(dateParty))
                {
                    //startDate = dateParty.Substring(0, 10);
                    //endDate = dateParty.Substring(12);
                    startDate = dateParty.Split('~')[0].Trim();
                    endDate = dateParty.Split('~')[1].Trim();
                }
                else
                {
                    startDate = DateTime.Now.ToString("yyyy-MM-dd")+" 00:00:00";
                    endDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
                }
                DataTable newTable = new DataTable();
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=6 ");

                if (namelist != null)
                {
                    dt = new BLL.T_Wo_WorkOrderBase().GetList("F_CREATEDATE>='" + startDate + "'and F_CREATEDATE<='" + endDate+ "' and F_FILEFLAG=6").Tables[0];

                    //dt = new BLL.T_Wo_WorkOrderBase().GetList(" DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
                    int i = 0;
                    int count = 0;
                    DataRow dataRow;
                    foreach (Model.T_Wo_WorkOrderType m in namelist)
                    {
                        count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = m.F_Name.Trim();
                        dataRow["工单数量"] = count.ToString();
                        newTable.Rows.Add(dataRow);
                        i++;
                    }
                }
                if (newTable != null && newTable.Rows.Count > 0)
                {
                    string[] strArr = new string[newTable.Rows.Count];
                    string contentArr = "";
                    for (int i = 0; i < newTable.Rows.Count; i++)
                    {
                        strArr[i] = newTable.Rows[i]["业务类型"].ToString();
                        if (i == 0)
                        {
                            contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";
                        }
                        else
                        {
                            contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";

                        }

                    }
                    dataModel.bottom = JsonConvert.SerializeObject(strArr);
                    dataModel.datas = "[" + contentArr + "]";

                }
            }
            catch (Exception ex) { LogHelper.Default.WriteError(ex.Message, ex); }
            finally { dt.Clear();dt.Dispose(); }
            return JsonConvert.SerializeObject(dataModel);
        }
        #endregion
        #region  业务类型分布图
        public ActionResult YwTypeReport()
        {
            CallScreenModel callScreenModel = new CallScreenModel();
            //业务类型字典表
            callScreenModel.WorkOrderTypeModelList = GetWorkTypeModelList(); 
            return View(callScreenModel);
        }
        // 业务比例分析
        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("ywtypeWorkOrderPreData")]
        [HttpGet]
        public string ywtypeWorkOrderPreData(DateTime? NowDateTime, string dateParty,string bussType,string bussDetail)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            DataTable dt = new DataTable();
            int counthj = 0;
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    //startDate = dateParty.Substring(0, 10);
                    //endDate = dateParty.Substring(12);
                    startDate = dateParty.Split('~')[0].Trim();
                    endDate = dateParty.Split('~')[1].Trim();
                }
                else
                {
                    startDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
                    endDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
                }
                DataTable newTable = new DataTable();
                newTable.Columns.Add("TypeID");
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=1 ");
                if (bussType == "" || bussType ==null)
                { 
                    if (namelist != null)
                    {
                       dt = new BLL.T_Wo_WorkOrderBase().GetList(" DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
               
                        int j = dt.Rows.Count;
                        int i = 0;
                       
                        DataRow dataRow;
                        foreach (Model.T_Wo_WorkOrderType m in namelist)
                        {
                            int count = 0;
                            count = dt.Select("F_FILEFLAG=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                            dataRow = newTable.NewRow(); 
                            dataRow["TypeID"] = m.F_WorkOrderTypeId.ToString();
                            dataRow["业务类型"] = m.F_Name.Trim();
                            dataRow["工单数量"] = count.ToString();
                            newTable.Rows.Add(dataRow);
                            counthj = counthj + count;
                            i++;
                        }

                        //热线业务工单数
                        dataRow = newTable.NewRow(); 
                        dataRow["TypeID"] = 0;
                        dataRow["业务类型"] = "热线系统工单数合计";
                        dataRow["工单数量"] = dt.Select("F_REPAIRMANID<=2  ").Count();// counthj.ToString();
                      int rxgd= dt.Select("F_REPAIRMANID<=2  ").Count();
                        newTable.Rows.Add(dataRow);
                        //微信业务工单数
                        string startDate1 = startDate.Substring(0, 10);
                        string endDate1 = endDate.Substring(0, 10);
                        dataRow = newTable.NewRow();
                        dataRow["TypeID"] = "0";
                        dataRow["业务类型"] = "微信系统工单数合计";
                        int wxCount = dt.Select("F_REPAIRMANID=3 ").Count();//WXWorkOrderCount(3, startDate1, endDate1);
                        dataRow["工单数量"] = wxCount;
                        newTable.Rows.Add(dataRow);
                        //微博业务工单数
                        dataRow = newTable.NewRow();
                        dataRow["TypeID"] = "0";
                        dataRow["业务类型"] = "微博系统工单数合计";
                        int wbCount = dt.Select("F_REPAIRMANID=4 AND F_FILEFLAG <>0").Count(); // WXWorkOrderCount(4, startDate1, endDate1);
                        dataRow["工单数量"] = wbCount;
                        //总合计
                        newTable.Rows.Add(dataRow);
                        dataRow = newTable.NewRow();
                        dataRow["TypeID"] = "0";
                        dataRow["业务类型"] = "总合计";
                        dataRow["工单数量"] = (rxgd + wxCount + wbCount).ToString();
                        newTable.Rows.Add(dataRow);
                    }
                }
                else {
                    if (bussType=="3")
                    {
                        namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId in (4,17) " );
                    }
                    else { 
                    namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId= "+ bussType);
                    }
                    if (namelist.Count==0)
                    {
                        namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_WorkOrderTypeId= " + bussType);
                    }
                    if (namelist != null)
                    {
                        dt = new BLL.T_Wo_WorkOrderBase().GetList("   DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
                        int j = dt.Rows.Count;
                        int i = 0;
                        int count = 0;
                        DataRow dataRow;
                        foreach (Model.T_Wo_WorkOrderType m in namelist)
                        {
                            count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + " and F_FILEFLAG=" + bussType).Length;
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = m.F_WorkOrderTypeId.ToString();
                            dataRow["业务类型"] = m.F_Name.Trim();
                            dataRow["工单数量"] = count.ToString();
                            newTable.Rows.Add(dataRow);
                            counthj = counthj + count;
                            i++;
                        } 
                        dataRow = newTable.NewRow();
                        dataRow["TypeID"] = "0";
                        dataRow["业务类型"] = "总合计";
                        dataRow["工单数量"] = counthj.ToString();
                        newTable.Rows.Add(dataRow);
                    }
                } 
                dataModel.code = 0;
                dataModel.data = newTable;
                dataModel.count = counthj;

            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }
            finally
            {
                dt.Clear();
                dt.Dispose();
            }
            return JsonConvert.SerializeObject(dataModel);
        }
        public string ywtypeWorkOrderPre(DateTime? NowDateTime, string dateParty, string bussType, string bussDetail)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            DataTable dt = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(dateParty))
                {
                    //startDate = dateParty.Substring(0, 10);
                    //endDate = dateParty.Substring(12);
                    startDate = dateParty.Split('~')[0].Trim();
                    endDate = dateParty.Split('~')[1].Trim();
                }
                else
                {
                    startDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
                    endDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
                }
                DataTable newTable = new DataTable();
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=1 ");

                if (bussType == "" || bussType == null)
                {
                    if (namelist != null)
                    {
                        dt = new BLL.T_Wo_WorkOrderBase().GetList(" DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
                        int j = dt.Rows.Count;
                        int i = 0;
                        int count = 0;
                        DataRow dataRow;
                        foreach (Model.T_Wo_WorkOrderType m in namelist)
                        {
                            count = dt.Select("F_FILEFLAG=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                            dataRow = newTable.NewRow();
                            dataRow["业务类型"] = m.F_Name.Trim();
                            dataRow["工单数量"] = count.ToString();
                            newTable.Rows.Add(dataRow);
                            i++;
                        } 
                    }
                }
                else
                {
                    if (bussType == "3")
                    {
                        namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId in (4,17) ");
                    }
                    else
                    {
                        namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId= " + bussType);
                    }
                    if (namelist.Count == 0)
                    {
                        namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_WorkOrderTypeId= " + bussType);
                    }
                    if (namelist != null)
                    {
                        dt = new BLL.T_Wo_WorkOrderBase().GetList("   DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
                        int i = 0;
                        int count = 0;
                        DataRow dataRow;
                        foreach (Model.T_Wo_WorkOrderType m in namelist)
                        {
                            count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + " and F_FILEFLAG=" + bussType).Length;
                            dataRow = newTable.NewRow();
                            dataRow["业务类型"] = m.F_Name.Trim();
                            dataRow["工单数量"] = count.ToString();
                            newTable.Rows.Add(dataRow); 
                            i++;
                        } 
                    }
                }
                if (newTable != null && newTable.Rows.Count > 0)
                {
                    string[] strArr = new string[newTable.Rows.Count];
                    string contentArr = "";
                    for (int i = 0; i < newTable.Rows.Count; i++)
                    {
                        strArr[i] = newTable.Rows[i]["业务类型"].ToString();
                        if (i == 0)
                        {
                            contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";
                        }
                        else
                        {
                            contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";

                        }

                    }
                    dataModel.bottom = JsonConvert.SerializeObject(strArr);
                    dataModel.datas = "[" + contentArr + "]";

                }
            }
            catch (Exception ex) { }
            finally { dt.Clear(); dt.Dispose(); }
            return JsonConvert.SerializeObject(dataModel);
        }

        /// 获取 微信/微博接口数量--放置咨询类
        /// </summary>
        /// <param name="StartDate">开始日期</param>
        /// <param name="EndDate">结束日期</param>
        /// <returns></returns>
        public int WXWorkOrderCount(int? busType, string startDate, string endDate)
        {
            int totalCount = 0;
            string wxAddUrl = "";
            try
            {
                StringBuilder returnStr = new StringBuilder();
                if (busType == 4)
                {
                    wxAddUrl = "http://rexian.zzmetro.com/api/external/wbcount";
                }
                else
                {
                    wxAddUrl = "http://rexian.zzmetro.com/api/external/wxcount";
                }
                string paramsStr = "begin=" + startDate + "&end=" + endDate;
                string addWxResult = HttpHelper.HttpGet(wxAddUrl, paramsStr);
                WXResponseResult ResultModel = JsonConvert.DeserializeObject<WXResponseResult>(addWxResult);

                if (ResultModel != null)
                {
                    //if (ResultModel.service > 0 && ResultModel.service > totalCount)
                    //{
                    //    totalCount = ResultModel.service - totalCount;
                    //}

                    if (ResultModel.customer > 0 && ResultModel.customer > totalCount)
                    {
                        totalCount = ResultModel.customer - totalCount;
                    }
                }
            }
            catch (Exception ex)
            {

            }

            return totalCount;
        }
        #endregion
        #region 来电类型分布图

        public ActionResult CallInTypeMath()
        {
            WorkOrderMyModel model = new WorkOrderMyModel(); 
            return View(model);


        }

        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("CallInTypeMatchData")]
        [HttpGet]
        public string CallInTypeMatchData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.GetBussTypeData(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("来电类型");
            newTable.Columns.Add("来电次数");

            if (datas != null && datas.Rows.Count > 0)
            {

                DataRow dataRow;
                int otherCount = 0;
                foreach (DataRow thisRow in datas.Rows)
                {

                    if (thisRow["BusinessType"].ToString() == "1")
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "咨询";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "2"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "建议";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "3"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "表扬";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else if ((thisRow["BusinessType"].ToString() == "4"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "挂失";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "9"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "投诉";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else
                    {

                        if (!string.IsNullOrEmpty(thisRow["callInCount"].ToString()))
                        {
                            otherCount += int.Parse(thisRow["callInCount"].ToString());
                        }

                    }
                }
                dataRow = newTable.NewRow();
                dataRow["来电类型"] = "放弃排队";
                dataRow["来电次数"] = otherCount;
                newTable.Rows.Add(dataRow);

            }
            dataModel.code = 0;
            dataModel.data = newTable;
            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string CallInTypeMatchChartData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }
            DataTable datas = recordBLL.GetBussTypeData(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("来电类型");
            newTable.Columns.Add("来电次数");

            if (datas != null && datas.Rows.Count > 0)
            {

                DataRow dataRow;
                int otherCount = 0;
                foreach (DataRow thisRow in datas.Rows)
                {

                    if (thisRow["BusinessType"].ToString() == "1")
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "咨询";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "2"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "建议";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "3"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "表扬";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else if ((thisRow["BusinessType"].ToString() == "4"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "挂失";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "9"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["来电类型"] = "投诉";
                        dataRow["来电次数"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else
                    {

                        if (!string.IsNullOrEmpty(thisRow["callInCount"].ToString()))
                        {
                            otherCount += int.Parse(thisRow["callInCount"].ToString());
                        }

                    }
                }
                dataRow = newTable.NewRow();
                dataRow["来电类型"] = "放弃排队";
                dataRow["来电次数"] = otherCount;
                newTable.Rows.Add(dataRow);

            }
            if (newTable != null && newTable.Rows.Count > 0)
            {
                string[] strArr = new string[newTable.Rows.Count];
                string contentArr = "";
                for (int i = 0; i < newTable.Rows.Count; i++)
                {
                    strArr[i] = newTable.Rows[i]["来电类型"].ToString();
                    if (i == 0)
                    {
                        contentArr += " { value: " + newTable.Rows[i]["来电次数"].ToString() + ", name: '" + newTable.Rows[i]["来电类型"].ToString() + "' }";
                    }
                    else
                    {
                        contentArr += " ,{ value: " + newTable.Rows[i]["来电次数"].ToString() + ", name: '" + newTable.Rows[i]["来电类型"].ToString() + "' }";

                    }

                }
                dataModel.bottom = JsonConvert.SerializeObject(strArr);
                dataModel.datas = "[" + contentArr + "]";

            }
            return JsonConvert.SerializeObject(dataModel);
        }




        #endregion

        #region 工单类型分布图 接口数据

        public ActionResult WorkOrderTypeMath()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }

        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeMathData")]
        [HttpGet]
        public string WorkOrderTypeMathData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();

            try
            {
                string startDate = "";
                string endDate = "";
                int zhjcount = 0;
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeData(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("TypeID");
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                DataRow dataRow;
                if (datas != null && datas.Rows.Count > 0)
                { 
                    foreach (DataRow thisRow in datas.Rows)
                    {

                        if (thisRow["BusinessType"].ToString() == "6")
                        {
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = "6";
                            dataRow["业务类型"] = "咨询";

                            int totalCount = 0;
                            string getCount = thisRow["callInCount"].ToString();
                            if (!string.IsNullOrEmpty(getCount))
                            {
                                totalCount = int.Parse(getCount);
                            } 
                            dataRow["工单数量"] = totalCount; 
                            newTable.Rows.Add(dataRow);
                            zhjcount = zhjcount + totalCount;
                        }
                        else if ((thisRow["BusinessType"].ToString() == "14"))
                        {
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = "14";
                            dataRow["业务类型"] = "建议";
                            dataRow["工单数量"] = thisRow["callInCount"];
                            zhjcount = zhjcount +Convert.ToInt32( thisRow["callInCount"].ToString());
                            newTable.Rows.Add(dataRow);
                        }
                        else if ((thisRow["BusinessType"].ToString() == "18"))
                        {
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = "18";
                            dataRow["业务类型"] = "表扬";
                            dataRow["工单数量"] = thisRow["callInCount"];
                            zhjcount = zhjcount + Convert.ToInt32(thisRow["callInCount"].ToString());
                            newTable.Rows.Add(dataRow);
                        }

                        else if ((thisRow["BusinessType"].ToString() == "19"))
                        {
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = "19";
                            dataRow["业务类型"] = "挂失";
                            dataRow["工单数量"] = thisRow["callInCount"];
                            zhjcount = zhjcount + Convert.ToInt32(thisRow["callInCount"].ToString());
                            newTable.Rows.Add(dataRow);
                        }
                        else if ((thisRow["BusinessType"].ToString() == "3"))
                        {
                            dataRow = newTable.NewRow();
                            dataRow["TypeID"] = "3";
                            dataRow["业务类型"] = "投诉";
                            dataRow["工单数量"] = thisRow["callInCount"];
                            zhjcount = zhjcount + Convert.ToInt32(thisRow["callInCount"].ToString());
                            newTable.Rows.Add(dataRow);
                        }

                    }
                    
                }
                #region 合计
                //热线系统 
                dataRow = newTable.NewRow();
                dataRow["TypeID"] = "0";
                dataRow["业务类型"] = "热线系统合计";
                dataRow["工单数量"] = zhjcount;
                newTable.Rows.Add(dataRow);
                //微信
                int wxCount = WXWorkOrderCount(3, startDate, endDate);
                dataRow = newTable.NewRow();
                dataRow["TypeID"] = "0";
                dataRow["业务类型"] = "微信业务数";
                dataRow["工单数量"] = wxCount;
                newTable.Rows.Add(dataRow);
                //微博
                int wbCount = WXWorkOrderCount(4, startDate, endDate);
                dataRow = newTable.NewRow();
                dataRow["TypeID"] = "0";
                dataRow["业务类型"] = "微博业务数";
                dataRow["工单数量"] = wbCount;
                newTable.Rows.Add(dataRow);

                //合计
                dataRow = newTable.NewRow();
                dataRow["TypeID"] = "0";
                dataRow["业务类型"] = "合计（不含未分类）";
                dataRow["工单数量"] = zhjcount + wxCount + wbCount;
                newTable.Rows.Add(dataRow);
                #endregion
                dataModel.code = 0;
                dataModel.data = newTable;

            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }


            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string WorkOrderTypeMathChartData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }
            DataTable datas = recordBLL.GetWorkOrderBussTypeData(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("业务类型");
            newTable.Columns.Add("工单数量");
            DataRow dataRow;
            int wxCount = WXWorkOrderCount(3, startDate, endDate);
            dataRow = newTable.NewRow();
            dataRow["业务类型"] = "微信";
            dataRow["工单数量"] = wxCount;
            newTable.Rows.Add(dataRow);
            int wbCount = WXWorkOrderCount(4, startDate, endDate);
            dataRow = newTable.NewRow();
            dataRow["业务类型"] = "微博";
            dataRow["工单数量"] = wbCount;
            newTable.Rows.Add(dataRow);

            if (datas != null && datas.Rows.Count > 0)
            { 
                foreach (DataRow thisRow in datas.Rows)
                {

                    if (thisRow["BusinessType"].ToString() == "6")
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "咨询";
                     
                        int totalCount=0;
                        string getCount=thisRow["callInCount"].ToString(); 
                        if(!string.IsNullOrEmpty(getCount))
                        {
                            totalCount=int.Parse(getCount);
                        } 
                        dataRow["工单数量"] = totalCount;


                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "14"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "建议";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "18"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "表扬";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else if ((thisRow["BusinessType"].ToString() == "19"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "挂失";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "3"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "投诉";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    
                }


            }
            if (newTable != null && newTable.Rows.Count > 0)
            {
                string[] strArr = new string[newTable.Rows.Count];
                string contentArr = "";
                for (int i = 0; i < newTable.Rows.Count; i++)
                {
                    strArr[i] = newTable.Rows[i]["业务类型"].ToString();
                    if (i == 0)
                    {
                        contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";
                    }
                    else
                    {
                        contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";

                    } 
                } 

                dataModel.bottom = JsonConvert.SerializeObject(strArr);
                dataModel.datas = "[" + contentArr + "]";

            }
            return JsonConvert.SerializeObject(dataModel);
        }
         
        #region 接口数据
        /// <summary>
        /// 接口数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeFromData")]
        [HttpGet]
        public string WorkOrderTypeFromData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();

            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeFromData(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("语音工单");
                newTable.Columns.Add("微信工单");
                newTable.Columns.Add("微博工单");

                if (datas != null && datas.Rows.Count > 0)
                {

                    DataRow dataRow;

                    if (datas != null && datas.Rows.Count > 0)
                    {

                        #region 咨询工单
                        int callInCount = 0;
                        int wxCount = 0;
                        int wbCount = 0;
                        //来电工单数量
                        DataRow[] CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wxCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wbCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "咨询";
                        dataRow["语音工单"] = callInCount;
                        dataRow["微信工单"] = wxCount;
                        dataRow["微博工单"] = wbCount;
                        newTable.Rows.Add(dataRow);

                        #endregion


                        #region 建议工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wxCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wbCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "建议";
                        dataRow["语音工单"] = callInCount;
                        dataRow["微信工单"] = wxCount;
                        dataRow["微博工单"] = wbCount;
                        newTable.Rows.Add(dataRow);

                        #endregion

                        #region 表扬工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wxCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wbCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "表扬";
                        dataRow["语音工单"] = callInCount;
                        dataRow["微信工单"] = wxCount;
                        dataRow["微博工单"] = wbCount;
                        newTable.Rows.Add(dataRow);

                        #endregion


                        #region 挂失工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wxCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wbCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "挂失";
                        dataRow["语音工单"] = callInCount;
                        dataRow["微信工单"] = wxCount;
                        dataRow["微博工单"] = wbCount;
                        newTable.Rows.Add(dataRow);

                        #endregion

                        #region 投诉工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                callInCount += int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wxCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            if (CallRows[0]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[0]["callInCount"].ToString()))
                            {
                                wbCount = int.Parse(CallRows[0]["callInCount"].ToString());
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "投诉";
                        dataRow["语音工单"] = callInCount;
                        dataRow["微信工单"] = wxCount;
                        dataRow["微博工单"] = wbCount;
                        newTable.Rows.Add(dataRow);

                        #endregion



                    }


                }
                dataModel.code = 0;
                dataModel.data = newTable;

            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }


            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 接口数据2
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeFromDataNewbak")]
        [HttpGet]
        public string WorkOrderTypeFromDataNewbak(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData(); 
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12); 
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeFromDataNew(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("BusinessType");
                newTable.Columns.Add("allcount");
                newTable.Columns.Add("callcount");
                newTable.Columns.Add("callCount_zb");
                newTable.Columns.Add("wxcount");
                newTable.Columns.Add("wbcount");
                newTable.Columns.Add("Returnvisitproblem"); //概要：F_RETURNVISITPROBLEM  
                newTable.Columns.Add("Returnvisitproblem_zb");
                if (datas != null && datas.Rows.Count > 0)
                { 
                    DataRow dataRow; 
                    if (datas != null && datas.Rows.Count > 0)
                    { 
                        #region 咨询工单
                        int callInCount = 0;
                        int wxCount = 0;
                        int wbCount = 0;
                         List<string> Returnvisitproblem_zx = new List<string>();
                        //string Returnvisitproblem_zx = "[";
                        //来电工单数量
                        DataRow[] CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        } 
                        //微信工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wxCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        } 
                        //微博工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wbCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        }
                        //Returnvisitproblem_zx = Returnvisitproblem_zx + "]";
                        //微博接口
                        int  wxxtCount = WXWorkOrderCount(3, startDate, endDate);
                        //微信接口
                        int wbxtCount = WXWorkOrderCount(4, startDate, endDate); 
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "咨询";
                        dataRow["allcount"] = callInCount+ wxCount + wxxtCount+ wbCount + wbxtCount;
                        dataRow["callCount_zb"] = 0;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = wxCount+ wxxtCount;
                        dataRow["wbcount"] = wbCount+ wbxtCount;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_zx);  
                        dataRow["Returnvisitproblem_zb"] = ""; 
                        newTable.Rows.Add(dataRow); 
                        #endregion 
                        #region 建议工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //string Returnvisitproblem_jy = "";
                        List<string> Returnvisitproblem_jy = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        } 
                        //微信工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wxCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wbCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        } 
                        dataRow = newTable.NewRow(); 
                        dataRow["BusinessType"] = "建议";
                        dataRow["allcount"] = callInCount + wxCount +wbCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["callCount_zb"] = 0; 
                        dataRow["wxcount"] = wxCount ;
                        dataRow["wbcount"] = wbCount ;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_jy) ;
                         dataRow["Returnvisitproblem_zb"] = "";
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 表扬工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //string Returnvisitproblem_by = "";
                        List<string> Returnvisitproblem_by = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        } 
                        //微信工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wxCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wbCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        dataRow = newTable.NewRow(); 
                        dataRow["BusinessType"] = "表扬";
                        dataRow["allcount"] = callInCount + wxCount + wbCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["callCount_zb"] = 0;
                        dataRow["wxcount"] = wxCount;
                        dataRow["wbcount"] = wbCount;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_by); 
                        dataRow["Returnvisitproblem_zb"] = "";
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 挂失工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        //string Returnvisitproblem_gs = "";
                        List<string> Returnvisitproblem_gs = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }


                        //微信工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wxCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wbCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow(); 
                        dataRow["BusinessType"] = "挂失";
                        dataRow["allcount"] = callInCount + wxCount + wbCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = wxCount;
                        dataRow["wbcount"] = wbCount;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_gs); 
                        dataRow["callCount_zb"] = 0;
                        dataRow["Returnvisitproblem_zb"] = "";
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 投诉工单
                        callInCount = 0;
                        wxCount = 0;
                        wbCount = 0;
                        int callInCount_zb = 0;
                       List<string> Returnvisitproblem_zb = new List<string>();
                        List<string> Returnvisitproblem_ts = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_ts.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        //留言工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_ts.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }  

                        //微信工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wxCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_ts.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        //微博工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID=4");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    wbCount = int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_ts.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //转办工单数量 
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_zb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                            dataRow = newTable.NewRow(); 
                        dataRow["BusinessType"] = "投诉";
                        dataRow["allcount"] = callInCount + wxCount + wbCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["callCount_zb"] = callInCount_zb;
                        dataRow["wxcount"] = wxCount;
                        dataRow["wbcount"] = wbCount;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_ts);  
                       dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_zb); ;
                        newTable.Rows.Add(dataRow);

                        #endregion 
                    } 
                }
                dataModel.code = 0;
                dataModel.data = newTable; 
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            } 
            return JsonConvert.SerializeObject(dataModel);
        }
        [ActionName("WorkOrderTypeFromDataNewBK1012")]
        [HttpGet]
        public string WorkOrderTypeFromDataNewBK1012(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeFromDataNew(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("BusinessType");
                newTable.Columns.Add("allcount");
                newTable.Columns.Add("callcount");
                //newTable.Columns.Add("callCount_zb");
                newTable.Columns.Add("wxcount");
                newTable.Columns.Add("wbcount");
                newTable.Columns.Add("Returnvisitproblem"); //概要：F_RETURNVISITPROBLEM  
                //newTable.Columns.Add("Returnvisitproblem_zb");
                if (datas != null && datas.Rows.Count > 0)
                {
                    DataRow dataRow;
                    if (datas != null && datas.Rows.Count > 0)
                    {
                        #region 咨询工单
                        int callInCount = 0;
                        List<string> Returnvisitproblem_zx = new List<string>();
                        //string Returnvisitproblem_zx = "[";
                        //来电工单数量
                        DataRow[] CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "咨询";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_zx);
                        newTable.Rows.Add(dataRow);
                        #endregion
                        #region 建议工单
                        callInCount = 0;
                        //string Returnvisitproblem_jy = "";
                        List<string> Returnvisitproblem_jy = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "建议";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_jy);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 表扬工单
                        callInCount = 0;
                        //string Returnvisitproblem_by = "";
                        List<string> Returnvisitproblem_by = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "表扬";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_by);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 挂失工单
                        callInCount = 0;
                        //string Returnvisitproblem_gs = "";
                        List<string> Returnvisitproblem_gs = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "挂失";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_gs);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 投诉工单
                        callInCount = 0;
                        int callInCount_zb = 0;
                        List<string> Returnvisitproblem_zb = new List<string>();
                        List<string> Returnvisitproblem_ts = new List<string>();
                        //转办工单数量 
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_zb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "投诉";
                        dataRow["allcount"] = callInCount_zb;
                        dataRow["callcount"] = callInCount_zb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_zb);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                    }
                }
                dataModel.code = 0;
                dataModel.data = newTable;
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }
            return JsonConvert.SerializeObject(dataModel);
        }
       
        /// <summary>
        /// 原接口数据：WorkOrderTypeFromDataNew
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeFromDataNew1104")]
        [HttpGet]
        public string WorkOrderTypeFromDataNew1104(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeFromDataNew(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("BusinessType");
                newTable.Columns.Add("allcount");
                newTable.Columns.Add("callcount");
                //newTable.Columns.Add("callCount_zb");
                newTable.Columns.Add("wxcount");
                newTable.Columns.Add("wbcount");
                newTable.Columns.Add("Returnvisitproblem"); //概要：F_RETURNVISITPROBLEM  
                //newTable.Columns.Add("Returnvisitproblem_zb");
                if (datas != null && datas.Rows.Count > 0)
                {
                    DataRow dataRow;
                    if (datas != null && datas.Rows.Count > 0)
                    {
                        #region 咨询工单
                        int callInCount = 0;
                        List<string> Returnvisitproblem_zx = new List<string>();
                        //string Returnvisitproblem_zx = "[";
                        //来电工单数量
                        DataRow[] CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            #region
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                            #endregion
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zx.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim());
                                }
                            }
                            #region
                            //for (int i = 0; i < CallRows.Length; i++)
                            //{
                            //    if (i == 0)
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + "\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //    else
                            //    {
                            //        Returnvisitproblem_zx = Returnvisitproblem_zx + ",\"" + CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() + "\"";
                            //    }
                            //}
                            #endregion
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "咨询";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_zx);
                        newTable.Rows.Add(dataRow);
                        #endregion
                        #region 建议工单
                        callInCount = 0;
                        int callInCount_jyzb = 0;
                        List<string> Returnvisitproblem_jyzb = new List<string>();
                        //string Returnvisitproblem_jy = "";
                        List<string> Returnvisitproblem_jy = new List<string>();
                        ////来电工单数量
                        //CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=1");
                        //if (CallRows != null && CallRows.Length > 0)
                        //{
                        //    for (int i = 0; i < CallRows.Length; i++)
                        //    {
                        //        if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                        //        {
                        //            callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                        //        }
                        //        if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                        //        {
                        //            Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                        //        }
                        //    }
                        //}
                        //转办工单数量 
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_jyzb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_jyzb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        ////留言工单数量
                        //CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID=2");
                        //if (CallRows != null && CallRows.Length > 0)
                        //{
                        //    for (int i = 0; i < CallRows.Length; i++)
                        //    {
                        //        if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                        //        {
                        //            callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                        //        }
                        //        if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                        //        {
                        //            Returnvisitproblem_jy.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                        //        }
                        //    }
                        //}
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "建议";
                        dataRow["allcount"] = callInCount_jyzb;
                        dataRow["callcount"] = callInCount_jyzb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_jyzb);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 表扬工单
                        callInCount = 0;
                        //string Returnvisitproblem_by = "";
                        List<string> Returnvisitproblem_by = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_by.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "表扬";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_by);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 挂失工单
                        callInCount = 0;
                        //string Returnvisitproblem_gs = "";
                        List<string> Returnvisitproblem_gs = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //留言工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID=2");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gs.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "挂失";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_gs);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 投诉工单
                        callInCount = 0;
                        int callInCount_zb = 0;
                        List<string> Returnvisitproblem_zb = new List<string>();
                        List<string> Returnvisitproblem_ts = new List<string>();
                        //转办工单数量 
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_zb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "投诉";
                        dataRow["allcount"] = callInCount_zb;
                        dataRow["callcount"] = callInCount_zb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_zb);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                    }
                }
                dataModel.code = 0;
                dataModel.data = newTable;
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }
            return JsonConvert.SerializeObject(dataModel);
        }
        /// <summary>
        /// 接口数据11.04:总数、转办数量、化解数量、转办工单列表、化解工单列表
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeFromDataNew")]
        public string WorkOrderTypeFromDataNew(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderBussTypeFromDataNew(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("BusinessType");
                newTable.Columns.Add("allcount");
                newTable.Columns.Add("callcount");
                newTable.Columns.Add("wxcount");
                newTable.Columns.Add("wbcount");
                //newTable.Columns.Add("callCount_zb");
                //newTable.Columns.Add("callCount_kfhj");
                newTable.Columns.Add("Returnvisitproblem"); //概要：F_RETURNVISITPROBLEM
                //newTable.Columns.Add("Returnvisitproblem_zb");
                //newTable.Columns.Add("Returnvisitproblem_kfhj");
                if (datas != null && datas.Rows.Count > 0)
                {
                    DataRow dataRow;
                    if (datas != null && datas.Rows.Count > 0)
                    {
                        #region 咨询工单
                        int callInCount = 0;
                        int callInCount_zxzb = 0;
                        int callInCount_zxkfhj = 0;
                        string Returnvisitproblem_count= "[]";
                        List<string> Returnvisitproblem_zxzb = new List<string>();
                        List<string> Returnvisitproblem_zxkfhj = new List<string>();
                        //来电工单\留言工单数量
                        DataRow[] CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID in (1,2)");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办 3客服处理
                        CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID in (1,2)");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_zxzb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_count ="[]";
                                   // Returnvisitproblem_zxzb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办 3客服处理
                        /*CallRows = datas.Select("BusinessType=6 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_zxkfhj += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_zxkfhj.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }*/
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "咨询";
                        dataRow["allcount"] = callInCount;
                        dataRow["callcount"] = callInCount;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = Returnvisitproblem_count;//JsonConvert.SerializeObject(Returnvisitproblem_zxzb);
                        //dataRow["callCount_zb"] = callInCount_zxzb;
                        //dataRow["callCount_kfhj"] = callInCount_zxkfhj;
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_zxzb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_zxkfhj);
                        newTable.Rows.Add(dataRow);
                        #endregion
                                                                                                                                                              #region 建议工单
                        callInCount = 0;
                        int callInCount_jyzb = 0;
                        int callInCount_jykfhj = 0;
                        List<string> Returnvisitproblem_jyzb = new List<string>();
                        List<string> Returnvisitproblem_jykfhj = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID in (1,2)");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办 3客服处理
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_jyzb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    
                                    Returnvisitproblem_jyzb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办 3客服处理
                        CallRows = datas.Select("BusinessType=14 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_jykfhj += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                   
                                    Returnvisitproblem_jykfhj.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "建议";
                        dataRow["allcount"] = callInCount_jyzb;
                        dataRow["callcount"] = callInCount_jyzb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_jyzb);
                        //dataRow["callCount_zb"] = callInCount_jyzb;
                        //dataRow["callCount_kfhj"] = callInCount_jykfhj;
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_jyzb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_jykfhj);
                        newTable.Rows.Add(dataRow);

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "建议(客服已解释)";
                        dataRow["allcount"] = callInCount_jykfhj;
                        dataRow["callcount"] = callInCount_jykfhj;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_jykfhj);
                        //dataRow["callCount_zb"] = callInCount_zxzb;
                        //dataRow["callCount_kfhj"] = callInCount_zxkfhj;
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_zxzb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_zxkfhj);
                        newTable.Rows.Add(dataRow);
                         
                        #endregion 
                        #region 表扬工单
                        callInCount = 0;
                        int callInCount_byzb = 0;
                        int callInCount_bykfhj = 0;
                        
                        List<string> Returnvisitproblem_byzb = new List<string>();
                        List<string> Returnvisitproblem_bykfhj = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID in (1,2)  ");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办
                        CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID in (1,2) ");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_byzb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    
                                    Returnvisitproblem_byzb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //转办工单数量 3客服处理
                        /*CallRows = datas.Select("BusinessType=18 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_bykfhj += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_bykfhj.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }*/
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "表扬";
                        dataRow["allcount"] = callInCount_byzb;
                        dataRow["callcount"] = callInCount_byzb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] =JsonConvert.SerializeObject(Returnvisitproblem_byzb);
                        //dataRow["callCount_zb"] = callInCount_byzb;
                        //dataRow["callCount_kfhj"] = callInCount_bykfhj;
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_byzb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_bykfhj);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 挂失工单
                        callInCount = 0;
                        int callInCount_gszb = 0;
                        int callInCount_gskfhj = 0;
                        
                        List<string> Returnvisitproblem_gszb = new List<string>();
                        List<string> Returnvisitproblem_gskfhj = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID in (1,2) ");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                            }
                        } 
                        //转办工单数量 1转办
                        CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID in (1,2) ");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_gszb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    
                                    Returnvisitproblem_gszb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        #region
                        //转办工单数量 3客服处理
                        /*CallRows = datas.Select("BusinessType=19 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_gskfhj += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    Returnvisitproblem_gskfhj.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }*/
                        #endregion
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "挂失";
                        dataRow["allcount"] = callInCount_gszb;
                        dataRow["callcount"] = callInCount_gszb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_gszb);

                        //dataRow["callCount_zb"] = callInCount_gszb;
                        //dataRow["callCount_kfhj"] = callInCount_gskfhj;
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_gszb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_gskfhj);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                        #region 投诉工单
                        callInCount = 0;
                        int callInCount_tszb = 0;
                        int callInCount_tskfhj = 0;
                        
                        List<string> Returnvisitproblem_tszb = new List<string>();
                        List<string> Returnvisitproblem_tskfhj = new List<string>();
                        //来电工单数量
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                            }
                        }
                        //转办工单数量 1转办
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=1");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_tszb += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                   
                                    Returnvisitproblem_tszb.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        //转办工单数量 3客服处理
                        CallRows = datas.Select("BusinessType=3 and F_REPAIRMANID in (1,2)   and F_WORKORDERTYPEID=3");
                        if (CallRows != null && CallRows.Length > 0)
                        {
                            for (int i = 0; i < CallRows.Length; i++)
                            {
                                if (CallRows[i]["callInCount"] != null && !string.IsNullOrEmpty(CallRows[i]["callInCount"].ToString()))
                                {
                                    callInCount_tskfhj += int.Parse(CallRows[i]["callInCount"].ToString());
                                }
                                if (CallRows[i]["F_RETURNVISITPROBLEM"].ToString().Trim() != "")
                                {
                                    
                                    Returnvisitproblem_tskfhj.Add(CallRows[i]["F_RETURNVISITPROBLEM"].ToString());
                                }
                            }
                        }
                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "投诉";
                        dataRow["allcount"] = callInCount_tszb;
                        dataRow["callcount"] = callInCount_tszb;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_tszb);
                        //dataRow["callCount_zb"] = callInCount_tszb;
                        //dataRow["callCount_kfhj"] = callInCount_tskfhj; 
                        //dataRow["Returnvisitproblem_zb"] = JsonConvert.SerializeObject(Returnvisitproblem_tszb);
                        //dataRow["Returnvisitproblem_kfhj"] = JsonConvert.SerializeObject(Returnvisitproblem_tskfhj);
                        newTable.Rows.Add(dataRow);

                        dataRow = newTable.NewRow();
                        dataRow["BusinessType"] = "投诉(客服已化解)";
                        dataRow["allcount"] = callInCount_tskfhj;
                        dataRow["callcount"] = callInCount_tskfhj;
                        dataRow["wxcount"] = 0;
                        dataRow["wbcount"] = 0;
                        dataRow["Returnvisitproblem"] = JsonConvert.SerializeObject(Returnvisitproblem_tskfhj);
                        newTable.Rows.Add(dataRow);

                        #endregion 
                    }
                }
                dataModel.code = 0;
                dataModel.data = newTable;
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
            }
            return JsonConvert.SerializeObject(dataModel);
        }
        #endregion
        #endregion

        #region  坐席业务量统计



        public ActionResult WorkOrderTypeUserMath()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }
        BLL.UserAccount userBLL = new BLL.UserAccount();
        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTypeUserMathData")]
        [HttpGet]
        public string WorkOrderTypeUserMathData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {



                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderUeserData(startDate, endDate);

                DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];



                DataTable newTable = new DataTable();
                newTable.Columns.Add("坐席工号");
                newTable.Columns.Add("坐席姓名");
                newTable.Columns.Add("业务数量");
                newTable.Columns.Add("语音业务数量");
                newTable.Columns.Add("在线业务数量");
                newTable.Columns.Add("微信业务数量");
                newTable.Columns.Add("微博业务数量");





                if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
                {

                    foreach (DataRow row in userTable.Rows)
                    {
                        DataRow newRow = newTable.NewRow();
                        newRow[0] = row["F_UserCode"];
                        newRow[1] = row["F_UserName"];

                        int totalCount2 = 0;
                        int totalCount3 = 0;
                        int totalCount4 = 0;
                        int totalCount5 = 0;
                        int totalCount6 = 0;
                        DataRow[] thisUserRows = datas.Select("坐席工号='" + row["F_UserCode"] + "'");
                        if (thisUserRows != null && thisUserRows.Length > 0)
                        {
                            foreach (DataRow collRow in thisUserRows)
                            {
                                if (!string.IsNullOrEmpty(collRow["业务量"].ToString()))
                                {
                                    int thisCount = int.Parse(collRow["业务量"].ToString());
                                    totalCount2 += thisCount;
                                    if (!string.IsNullOrEmpty(collRow["渠道"].ToString()))
                                    {
                                        int qudaoID = int.Parse(collRow["渠道"].ToString());
                                        if (qudaoID == 1)
                                        {
                                            totalCount3 += thisCount;
                                        }
                                        else if (qudaoID == 2)
                                        {
                                            totalCount3 += thisCount;
                                        }
                                        else if (qudaoID == 3)
                                        {
                                            totalCount4 += thisCount;
                                            totalCount5 += thisCount;
                                        }
                                        else if (qudaoID == 4)
                                        {
                                            totalCount4 += thisCount;
                                            totalCount6 += thisCount;
                                        }
                                    }
                                    else
                                    {
                                        totalCount3 += thisCount;
                                    }
                                }

                            }
                        }

                        newRow[2] = totalCount2;
                        newRow[3] = totalCount3;
                        newRow[4] = totalCount4;
                        newRow[5] = totalCount5;
                        newRow[6] = totalCount6;
                        newTable.Rows.Add(newRow);
                    }


                }
                dataModel.code = 0;
                dataModel.data = newTable;
                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string WorkOrderTypeUserMathChartData(DateTime? NowDateTime, string dateParty)
        {
            WorkOrderTypeUserMathModel resultModel = new WorkOrderTypeUserMathModel();
            resultModel.bottom = "";
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.GetWorkOrderUeserData(startDate, endDate);

            DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];



            DataTable newTable = new DataTable();
            newTable.Columns.Add("坐席工号");
            newTable.Columns.Add("坐席姓名");
            newTable.Columns.Add("业务数量");
            newTable.Columns.Add("语音业务数量");
            newTable.Columns.Add("在线业务数量");
            newTable.Columns.Add("微信业务数量");
            newTable.Columns.Add("微博业务数量");





            if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
            {

                foreach (DataRow row in userTable.Rows)
                {


                    resultModel.bottom += ",'" + row["F_UserName"].ToString() + "'";
                    int totalCount2 = 0;
                    int totalCount3 = 0;
                    int totalCount4 = 0;
                    int totalCount5 = 0;
                    int totalCount6 = 0;
                    DataRow[] thisUserRows = datas.Select("坐席工号='" + row["F_UserCode"] + "'");

                    if (thisUserRows != null && thisUserRows.Length > 0)
                    {
                        foreach (DataRow collRow in thisUserRows)
                        {


                            if (!string.IsNullOrEmpty(collRow["业务量"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["业务量"].ToString());
                                totalCount2 += thisCount;
                                if (!string.IsNullOrEmpty(collRow["渠道"].ToString()))
                                {
                                    int qudaoID = int.Parse(collRow["渠道"].ToString());
                                    if (qudaoID == 1)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 2)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 3)
                                    {
                                        totalCount4 += thisCount;
                                        totalCount5 += thisCount;
                                    }
                                    else if (qudaoID == 4)
                                    {
                                        totalCount4 += thisCount;
                                        totalCount6 += thisCount;
                                    }
                                }
                                else
                                {
                                    totalCount3 += thisCount;
                                }
                            }

                        }
                    }
                    resultModel.d1 += "," + totalCount2;
                    resultModel.d2 += "," + totalCount3;
                    resultModel.d3 += "," + totalCount4;
                    resultModel.d4 += "," + totalCount5;
                    resultModel.d5 += "," + totalCount6;


                }


            }
            if (!string.IsNullOrEmpty(resultModel.bottom))
            {
                resultModel.bottom = "[" + resultModel.bottom.Trim(',') + "]";
            }

            if (!string.IsNullOrEmpty(resultModel.d1))
            {
                         resultModel.d1 = "[" + resultModel.d1.Trim(',') + "]";
            }

            if (!string.IsNullOrEmpty(resultModel.d2))
            {
                resultModel.d2 = "[" + resultModel.d2.Trim(',') + "]";
            }

            if (!string.IsNullOrEmpty(resultModel.d3))
            {
                resultModel.d3 = "[" + resultModel.d3.Trim(',') + "]";
            }

            if (!string.IsNullOrEmpty(resultModel.d4))
            {
                resultModel.d4 = "[" + resultModel.d2.Trim(',') + "]";
            }
            if (!string.IsNullOrEmpty(resultModel.d5))
            {
                resultModel.d5 = "[" + resultModel.d5.Trim(',') + "]";
            }

            
            return JsonConvert.SerializeObject(resultModel);
        }





        #endregion


        #region 分渠道业务统计

        public ActionResult WorkOrderFrom()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }

        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderFromData")]
        [HttpGet]
        public string WorkOrderFromData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {
                string startDate = "";
                string endDate = "";
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12);

                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }

                DataTable datas = recordBLL.GetWorkOrderFrom(startDate, endDate);
                DataTable newTable = new DataTable();
                newTable.Columns.Add("渠道");
                newTable.Columns.Add("工单数量");

                //微信业务工单数 
                int wxxtCount = WXWorkOrderCount(3, startDate, endDate);
                //微博业务工单数 
                int wbxtCount = WXWorkOrderCount(4, startDate, endDate);
                //语音数量
                int callCount = 0;
                //微信数量
                int wxCount = 0;
                //微博数量
                int wbCount = 0;
                if (datas != null && datas.Rows.Count > 0)
                { 
                    foreach (DataRow thisRow in datas.Rows)
                    {
                        //工单数量
                        int thisRowCount = 0;
                        if (!string.IsNullOrEmpty(thisRow["callInCount"].ToString()))
                        {
                            thisRowCount = int.Parse(thisRow["callInCount"].ToString());
                        }
                        //业务渠道
                        string bussFrtom = thisRow["渠道"].ToString();

                        if (!string.IsNullOrEmpty(bussFrtom))
                        {
                            if (bussFrtom == "1" || bussFrtom == "2")
                            {
                                callCount += thisRowCount;
                            }
                            else if (bussFrtom == "3")
                            { 
                                wxCount += thisRowCount;
                            }
                            else if (bussFrtom == "4")
                            { 
                                wbCount += thisRowCount;
                            }
                        }
                        else
                        {
                            callCount += thisRowCount;
                        } 
                    }  
                } 
                wxCount = wxCount + wxxtCount;
                wbCount = wbCount + wbxtCount;
                DataRow dataRow = newTable.NewRow();
                dataRow["渠道"] = "语音业务数";
                dataRow["工单数量"] = callCount;
                newTable.Rows.Add(dataRow);
                DataRow dataRow1 = newTable.NewRow();
                dataRow1["渠道"] = "微信业务数";
                dataRow1["工单数量"] = wxCount;
                newTable.Rows.Add(dataRow1);
                DataRow dataRow2 = newTable.NewRow();
                dataRow2["渠道"] = "微博业务数";
                dataRow2["工单数量"] = wbCount;
                newTable.Rows.Add(dataRow2);
                DataRow dataRow3 = newTable.NewRow();
                dataRow3["渠道"] = "合计（不含未分类）";
                dataRow3["工单数量"] = callCount + wxCount + wbCount;
                newTable.Rows.Add(dataRow3);
                dataModel.code = 0;
                dataModel.data = newTable;
                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string WorkOrderFromChartData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();

            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.GetWorkOrderFrom(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("渠道");
            newTable.Columns.Add("工单数量");
            //微信业务工单数 
            int wxxtCount = WXWorkOrderCount(3, startDate, endDate);
            //微博业务工单数 
            int wbxtCount = WXWorkOrderCount(4, startDate, endDate); 
            if (datas != null && datas.Rows.Count > 0)
            {
                //语音数量
                int callCount = 0;
                //微信数量
                int wxCount = 0;
                //微博数量
                int wbCount = 0;


                foreach (DataRow thisRow in datas.Rows)
                {
                    //工单数量
                    int thisRowCount = 0;
                    if (!string.IsNullOrEmpty(thisRow["callInCount"].ToString()))
                    {
                        thisRowCount = int.Parse(thisRow["callInCount"].ToString());
                    }
                    //业务渠道
                    string bussFrtom = thisRow["渠道"].ToString();

                    if (!string.IsNullOrEmpty(bussFrtom))
                    {
                        if (bussFrtom == "1" || bussFrtom == "2")
                        {
                            callCount += thisRowCount;
                        }
                        else if (bussFrtom == "3")
                        {
                            wxCount += thisRowCount;
                        }
                        else if (bussFrtom == "4")
                        {
                            wbCount += thisRowCount;
                        }
                    }
                    else
                    {
                        callCount += thisRowCount;
                    }

                }

                DataRow dataRow = newTable.NewRow();
                dataRow["渠道"] = "语音";
                dataRow["工单数量"] = callCount;
                newTable.Rows.Add(dataRow);
                DataRow dataRow1 = newTable.NewRow();
                dataRow1["渠道"] = "微信";
                dataRow1["工单数量"] = wxCount+ wxxtCount;
                newTable.Rows.Add(dataRow1);
                DataRow dataRow2 = newTable.NewRow();
                dataRow2["渠道"] = "微博";
                dataRow2["工单数量"] = wbCount+ wbxtCount;
                newTable.Rows.Add(dataRow2);
            }
            if (newTable != null && newTable.Rows.Count > 0)
            {
                string[] strArr = new string[newTable.Rows.Count];
                string contentArr = "";
                for (int i = 0; i < newTable.Rows.Count; i++)
                {
                    strArr[i] = newTable.Rows[i]["渠道"].ToString();
                    if (i == 0)
                    {
                        contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["渠道"].ToString() + "' }";
                    }
                    else
                    {
                        contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["渠道"].ToString() + "' }";

                    }

                }
                dataModel.bottom = JsonConvert.SerializeObject(strArr);
                dataModel.datas = "[" + contentArr + "]";

            }
            return JsonConvert.SerializeObject(dataModel);
        }
        #endregion


        #region  坐席处理方式业务量统计



        public ActionResult WorkOrderTrainFunctionMath()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }

        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderTrainFunctionMathData")]
        [HttpGet]
        public string WorkOrderTrainFunctionMathData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.GetWorkOrderTrainFunction(startDate, endDate);

            DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];



            DataTable newTable = new DataTable();
            newTable.Columns.Add("坐席工号");
            newTable.Columns.Add("坐席姓名");
            newTable.Columns.Add("业务数量");
            newTable.Columns.Add("咨询");
            newTable.Columns.Add("建议");
            newTable.Columns.Add("表扬");
            newTable.Columns.Add("挂失");
            newTable.Columns.Add("投诉");
            newTable.Columns.Add("转办投诉");
            newTable.Columns.Add("现场处理投诉");
            newTable.Columns.Add("客服处理投诉");

            if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
            {

                foreach (DataRow row in userTable.Rows)
                {
                    DataRow newRow = newTable.NewRow();
                    newRow[0] = row["F_UserCode"];
                    newRow[1] = row["F_UserName"];

                    int totalCount2 = 0;
                    int totalCount3 = 0;
                    int totalCount4 = 0;
                    int totalCount5 = 0;
                    int totalCount6 = 0;
                    int totalCount7 = 0;
                    int totalCount8 = 0;
                    int totalCount9 = 0;
                    int totalCount10 = 0;
                    DataRow[] thisUserRows = datas.Select("坐席工号='" + row["F_UserCode"] + "'");
                    if (thisUserRows != null && thisUserRows.Length > 0)
                    {
                        foreach (DataRow collRow in thisUserRows)
                        {
                            if (!string.IsNullOrEmpty(collRow["业务类别"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["业务量"].ToString());
                                totalCount2 += thisCount;
                                if (!string.IsNullOrEmpty(collRow["业务类别"].ToString()))
                                {
                                    int qudaoID = int.Parse(collRow["业务类别"].ToString());

                                    int blFunction = int.Parse(collRow["处理方式"].ToString());

                                    if (qudaoID == 6)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 14)
                                    {
                                        totalCount4 += thisCount;
                                    }
                                    else if (qudaoID == 18)
                                    {

                                        totalCount5 += thisCount;
                                    }
                                    else if (qudaoID == 19)
                                    {

                                        totalCount6 += thisCount;
                                    }
                                    else if (qudaoID == 3)
                                    {

                                        totalCount7 += thisCount;
                                        if (blFunction == 1)
                                        {
                                            totalCount8 += thisCount;
                                        }
                                        else if (blFunction == 2)
                                        {
                                            totalCount9 += thisCount;
                                        }

                                        else if (blFunction == 3)
                                        {
                                            totalCount10 += thisCount;
                                        }
                                    }


                                }

                            }

                        }
                    }

                    newRow[2] = totalCount2;
                    newRow[3] = totalCount3;
                    newRow[4] = totalCount4;
                    newRow[5] = totalCount5;
                    newRow[6] = totalCount6;
                    newRow[7] = totalCount7;
                    newRow[8] = totalCount8;
                    newRow[9] = totalCount9;
                    newRow[10] = totalCount10;
                    newTable.Rows.Add(newRow);
                }


            }
            dataModel.code = 0;
            dataModel.data = newTable;
            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string WorkOrderTrainFunctionMathChartData(DateTime? NowDateTime, string dateParty)
        {
            WorkOrderTypeUserMathModel resultModel = new WorkOrderTypeUserMathModel();
            //数据结果集
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.GetWorkOrderTrainFunction(startDate, endDate);

            DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];





            if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
            {

                foreach (DataRow row in userTable.Rows)
                {


                    resultModel.bottom += ",'" + row["F_UserName"].ToString() + "'";
                    int totalCount2 = 0;
                    int totalCount3 = 0;
                    int totalCount4 = 0;
                    int totalCount5 = 0;
                    int totalCount6 = 0;
                    int totalCount7 = 0;
                    int totalCount8 = 0;
                    int totalCount9 = 0;
                    int totalCount10 = 0;
                    DataRow[] thisUserRows = datas.Select("坐席工号='" + row["F_UserCode"] + "'");

                    if (thisUserRows != null && thisUserRows.Length > 0)
                    {
                        foreach (DataRow collRow in thisUserRows)
                        {


                            if (!string.IsNullOrEmpty(collRow["业务类别"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["业务量"].ToString());
                                totalCount2 += thisCount;
                                if (!string.IsNullOrEmpty(collRow["业务类别"].ToString()))
                                {
                                    int qudaoID = int.Parse(collRow["业务类别"].ToString());

                                    int blFunction = int.Parse(collRow["处理方式"].ToString());

                                    if (qudaoID == 6)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 14)
                                    {
                                        totalCount4 += thisCount;
                                    }
                                    else if (qudaoID == 18)
                                    {

                                        totalCount5 += thisCount;
                                    }
                                    else if (qudaoID == 19)
                                    {

                                        totalCount6 += thisCount;
                                    }
                                    else if (qudaoID == 3)
                                    {

                                        totalCount7 += thisCount;
                                        if (blFunction == 1)
                                        {
                                            totalCount8 += thisCount;
                                        }
                                        else if (blFunction == 2)
                                        {
                                            totalCount9 += thisCount;
                                        }

                                        else if (blFunction == 3)
                                        {
                                            totalCount10 += thisCount;
                                        }
                                    }


                                }

                            }

                        }
                    }
                    resultModel.d1 += "," + totalCount2;
                    resultModel.d2 += "," + totalCount3;
                    resultModel.d3 += "," + totalCount4;
                    resultModel.d4 += "," + totalCount5;
                    resultModel.d5 += "," + totalCount6;
                    resultModel.d6 += "," + totalCount7;
                    resultModel.d7 += "," + totalCount8;
                    resultModel.d8 += "," + totalCount9;
                    resultModel.d9 += "," + totalCount10;


                }



                resultModel.bottom = "[" + resultModel.bottom.Trim(',') + "]";
                resultModel.d1 = "[" + resultModel.d1.Trim(',') + "]";
                resultModel.d2 = "[" + resultModel.d2.Trim(',') + "]";
                resultModel.d3 = "[" + resultModel.d3.Trim(',') + "]";
                resultModel.d4 = "[" + resultModel.d4.Trim(',') + "]";
                resultModel.d5 = "[" + resultModel.d5.Trim(',') + "]";
                resultModel.d6 = "[" + resultModel.d6.Trim(',') + "]";
                resultModel.d7 = "[" + resultModel.d7.Trim(',') + "]";
                resultModel.d8 = "[" + resultModel.d8.Trim(',') + "]";
                resultModel.d9 = "[" + resultModel.d9.Trim(',') + "]";
            }

            return JsonConvert.SerializeObject(resultModel);
        }





        #endregion


        #region  坐席话务量统计



        public ActionResult CallTimeMath()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }

        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("CallTimeMathData")]
        [HttpGet]
        public string CallTimeMathData(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.CallTimeMath(startDate, endDate);

            DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];



            DataTable newTable = new DataTable();
            newTable.Columns.Add("坐席工号");
            newTable.Columns.Add("坐席姓名");
            newTable.Columns.Add("总通话次数");
            newTable.Columns.Add("接听电话次数");
            newTable.Columns.Add("呼出电话次数");
            newTable.Columns.Add("通话总时长");
            newTable.Columns.Add("平均通话时长");
            newTable.Columns.Add("流失率");
            newTable.Columns.Add("接通率");
            if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
            {

                foreach (DataRow row in userTable.Rows)
                {
                    DataRow newRow = newTable.NewRow();
                    newRow[0] = row["F_UserCode"];
                    newRow[1] = row["F_UserName"];

                    int totalCount2 = 0;
                    int totalCount3 = 0;
                    int totalCount4 = 0;
                    int totalCount5 = 0;
                    int totalCount6 = 0;

                    DataRow[] thisUserRows = datas.Select("userId=" + row["F_UserId"]);
                    if (thisUserRows != null && thisUserRows.Length > 0)
                    {
                        foreach (DataRow collRow in thisUserRows)
                        {
                            if (!string.IsNullOrEmpty(collRow["呼叫次数"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["呼叫次数"].ToString());
                                totalCount2 += thisCount;
                                if (!string.IsNullOrEmpty(collRow["呼叫类型"].ToString()))
                                {
                                    int qudaoID = int.Parse(collRow["呼叫类型"].ToString());
                                    if (qudaoID == 0)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 1)
                                    {
                                        totalCount4 += thisCount;
                                    }

                                }

                            }
                            if (!string.IsNullOrEmpty(collRow["通话时长"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["通话时长"].ToString());
                                totalCount5 += thisCount;
                            }
                        }
                    }

                    if (totalCount2 > 0)
                    {
                        totalCount6 = (int)totalCount5 / totalCount2;
                    }
                    #region  计算流失率  通过率
                    //string startDatestr = "";
                    //string endDatestr = "";
                    //if (!string.IsNullOrEmpty(startDate))
                    //{
                    //    startDatestr=" and BeginTime>='" + startDate + "  00:00:00' ";
                    //}
                    //if (!string.IsNullOrEmpty(endDate))
                    //{
                    //    endDatestr=" and BeginTime<='" + endDate + " 23:59:59' ";
                    //}
                    //decimal ls= recordBLL.GetRecordCount(string.Format("Userid={0} and RingLongTime>3 and CallState=0 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    //decimal tg =recordBLL.GetRecordCount(string.Format("Userid={0} and CallState=1 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    //decimal zs = 1.00M*recordBLL.GetRecordCount(string.Format("Userid={0} {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    string lsl = "0%";//流失率
                    string jtl = "0%";//通过率
                    //if (zs!=0)
                    //{
                    //     lsl = (ls / zs).ToString("P");
                    //     jtl = (tg / zs).ToString("P");
                    //}                   
                    #endregion


                    newRow[2] = totalCount2;
                    newRow[3] = totalCount3;
                    newRow[4] = totalCount4;
                    newRow[5] = totalCount5;
                    newRow[6] = totalCount6;
                    newRow[7] = lsl;
                    newRow[8] = jtl;

                    newTable.Rows.Add(newRow);
                }


            }
            dataModel.code = 0;
            dataModel.data = newTable;
            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 图标数据
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>

        public string CallTimeMathChartData(DateTime? NowDateTime, string dateParty)
        {
            WorkOrderTypeUserMathModel resultModel = new WorkOrderTypeUserMathModel();
            //数据结果集
            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            DataTable datas = recordBLL.CallTimeMath(startDate, endDate);

            DataTable userTable = userBLL.GetList(" F_SeatFlag=1").Tables[0];





            if (datas != null && datas.Rows.Count > 0 && userTable != null && userTable.Rows.Count > 0)
            {

                foreach (DataRow row in userTable.Rows)
                {


                    resultModel.bottom += ",'" + row["F_UserName"].ToString() + "'";
                    int totalCount2 = 0;
                    int totalCount3 = 0;
                    int totalCount4 = 0;
                    int totalCount5 = 0;
                    int totalCount6 = 0;


                    DataRow[] thisUserRows = datas.Select("userId=" + row["F_UserId"]);
                    if (thisUserRows != null && thisUserRows.Length > 0)
                    {
                        foreach (DataRow collRow in thisUserRows)
                        {


                            if (!string.IsNullOrEmpty(collRow["呼叫次数"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["呼叫次数"].ToString());
                                totalCount2 += thisCount;
                                if (!string.IsNullOrEmpty(collRow["呼叫类型"].ToString()))
                                {
                                    int qudaoID = int.Parse(collRow["呼叫类型"].ToString());
                                    if (qudaoID == 0)
                                    {
                                        totalCount3 += thisCount;
                                    }
                                    else if (qudaoID == 1)
                                    {
                                        totalCount4 += thisCount;
                                    }

                                }

                            }
                            if (!string.IsNullOrEmpty(collRow["通话时长"].ToString()))
                            {
                                int thisCount = int.Parse(collRow["通话时长"].ToString());
                                totalCount5 += thisCount;
                            }
                        }
                    }

                    if (totalCount2 > 0)
                    {
                        totalCount6 = (int)totalCount5 / totalCount2;
                    }

                    #region  计算流失率  通过率
                    string startDatestr = "";
                    string endDatestr = "";
                    if (!string.IsNullOrEmpty(startDate))
                    {
                        startDatestr = " and BeginTime>='" + startDate + "  00:00:00' ";
                    }
                    if (!string.IsNullOrEmpty(endDate))
                    {
                        endDatestr = " and BeginTime<='" + endDate + " 23:59:59' ";
                    }
                    decimal ls = recordBLL.GetRecordCount(string.Format("Userid={0} and RingLongTime>3 and CallState=0 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    decimal tg = recordBLL.GetRecordCount(string.Format("Userid={0} and CallState=1 {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    decimal zs = 1.00M * recordBLL.GetRecordCount(string.Format("Userid={0} {1} {2}", row["F_UserId"], startDatestr, endDatestr));
                    string lsl = "0%";//流失率
                    string jtl = "0%";//通过率
                    if (zs != 0)
                    {
                        lsl = (ls / zs).ToString("P");
                        jtl = (tg / zs).ToString("P");
                    }
                    #endregion

                    resultModel.d1 += "," + totalCount2;
                    resultModel.d2 += "," + totalCount3;
                    resultModel.d3 += "," + totalCount4;
                    resultModel.d4 += "," + totalCount5;
                    resultModel.d5 += "," + totalCount6;
                    resultModel.d6 += "," + lsl;
                    resultModel.d7 += "," + jtl;



                }



                resultModel.bottom = "[" + resultModel.bottom.Trim(',') + "]";
                resultModel.d1 = "[" + resultModel.d1.Trim(',') + "]";
                resultModel.d2 = "[" + resultModel.d2.Trim(',') + "]";
                resultModel.d3 = "[" + resultModel.d3.Trim(',') + "]";
                resultModel.d4 = "[" + resultModel.d4.Trim(',') + "]";
                resultModel.d5 = "[" + resultModel.d5.Trim(',') + "]";
                resultModel.d6 = "[" + resultModel.d6.Trim(',') + "]";
                resultModel.d7 = "[" + resultModel.d7.Trim(',') + "]";
            }

            return JsonConvert.SerializeObject(resultModel);
        }





        #endregion

        #region 热线工作分析报告

        public ActionResult ReportWorkOrderInfo()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);
        }

        public ActionResult ReportWorkOrderInfoWord(string dateParty,string type)
        {
            string res = "";
            string name = "周";
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
            }
            try
            {
                switch (type)
                {
                    case "0":
                        name = "周";
                        res = ReportWorkOrderInfoOneWeek(dateParty);
                        res = res.Split('^')[0];
                        break;
                    case "1":
                        name = "两周";
                        res = ReportWorkOrderInfoTwoWeek(dateParty);
                        res = res.Split('^')[0];
                        break;
                    case "2":
                        name = "季度";
                        string data1 = ReportWorkOrderInfoQuarterNew(dateParty);
                        string[] arr = data1.Split('^');
                        string[] strcount = arr[0].Split(',');
                        #region 参数
                        DateTime now = Convert.ToDateTime(startDate);
                        int nowMonth = now.Month; //当前月 
                        int nowYear = now.Year; //当前年
                        int preYear = now.Year - 1;//前一年 
                        int preMonth = now.Month-1; //上月 
                        string nowQuarter = "";
                        if (nowMonth >= 1 && nowMonth <= 3)
                        {
                            nowQuarter = "一";
                        }
                        else if (nowMonth >= 4 && nowMonth <= 6)
                        {
                            nowQuarter = "二";
                        }
                        else if (nowMonth >= 7 && nowMonth <= 9)
                        {
                            nowQuarter = "三";
                        }
                        else { nowQuarter = "四"; }
                        string preQuarter = "";

                        if (preMonth >= 1 && preMonth <= 3)
                        {
                            preQuarter = "一";
                        }
                        else if (preMonth >= 4 && preMonth <= 6)
                        {
                            preQuarter = "二";
                        }
                        else if (preMonth >= 7 && preMonth <= 9)
                        {
                            preQuarter = "三";
                        }
                        else { preQuarter = "四"; }

                        string bgyear = nowYear + "年";
                        string preyear = preYear + "年";
                        string bgQuarter = "第" + nowQuarter + "季度";
                        string prebgQuarter = "第" + preQuarter + "季度";
                        string bgname = bgyear + bgQuarter;
                        string prename = "";
                        if (nowMonth <= 3)
                        {
                            prename = preyear + "第四季度";
                        }
                        else
                        {
                            prename = bgyear + prebgQuarter;
                        }

                        #endregion
                        #region 报告
                        string bgmc = bgname + "服务热线工作分析报告";
                        string bgmc1 = "一、" + bgname + "全媒体客服平台受理量统计及分析";
                        string bgmc1_nr1 = "   郑州地铁服务热线" + bgname + "全媒体客服平台共受理乘客事务" + strcount[0] + "件，其中热线电话" + strcount[1] + "通、微博互动 " + strcount[2] + "人次、微信互动" + strcount[3] + "人次。";
                        string bgmc1_nr2 = "   由上图所示，" + bgQuarter + "主要受理量比较平均。同比" + prename + "全媒体客服平台总受理量" + strcount[4] + "，其中热线电话受理量" + strcount[5] + "，微博互动量" + strcount[6] + "，微信互动量" + strcount[7] + "。（" + prebgQuarter + "全媒体客服平台共受理乘客事务" + strcount[8] + "件，其中热线电话" + strcount[9] + "通、微博互动" + strcount[10] + "人次、微信互动" + strcount[11] + "人次）。";
                        string bgmc1_tb1 = arr[1];
                        string bgmc2 = "二、" + bgname + "服务热线电话受理量统计及分析";
                        string bgmc2_nr1 = bgname + "热线电话共受理乘客事务" + strcount[1] + "通，占全媒体客服平台总受理量的" + strcount[12] + ",";

                        string data2 = ReportWorkOrderInfoQuarterNewTwo(dateParty);
                        arr = data2.Split('^');
                        strcount = arr[0].Split(',');

                        string bgmc2_nr2 = "日均受理乘客事务约" + strcount[1] + "通/天，人工接听" + strcount[2] + "通，接通率为" + strcount[3] + "。直接答复" + strcount[4] + "通，直接答复率" + strcount[5] + "。转办办理" + strcount[6] + "件，按期回复率" + strcount[7] + "。办理结果回访满意率___%。热线服务满意率___%,平均通话时长___分，来电高峰主要集中在___点至___点，热线客户评价总体满意率___%，乘客满意度较好。";
                        string bgmc2_tb1 = arr[1];
                        string bgmc2_part1 = "（一）乘客咨询部分";
                        string bgmc2_part1_nr1 = "共接听咨询来电" + arr[4] + "通，其中" + arr[5] + "(其他类咨询主要包含咨询地铁计次票售卖相关事宜及郑州地铁·商易行APP相关事宜等。)";
                        string bgmc2_part1_nr2 = "其中列车时刻类信息占比最高，占咨询总量的" + arr[6] + ",其次是在线购票类信息占咨询总量的" + arr[7] + "。除常规咨询类问题外，本季度较为突出的咨询问题集中在郑州地铁·商易行APP相关购票业务咨询及违禁品相关规定咨询内容。";

                        string data3 = ReportWorkOrderInfoQuarterNewTwoZXMX(dateParty);
                        arr = data3.Split('^');
                        strcount = arr[0].Split(',');
                        string bgmc2_tb2 = arr[1];
                        string bgmc2_part2 = "（二）乘客投诉部分";
                        string bgmc2_part2_nr1 = bgname + "热线电话共受理乘客来电投诉" + arr[4] + "件，其中转办相关责任部门" + arr[5] + "件，由服务热线化解的投诉" + arr[6] + "件，化解率达高达" + arr[7] + "。";
                        string bgmc2_part2_1 = "1、以受理方式为标准的分析情况";
                        string bgmc2_tb4= arr[8];
                        string bgmc2_part2_1_nr1 = "根据上表数据显示，热线电话受理的投诉量占总投诉量的" + arr[10] + "。";
                        string bgmc2_part2_2 = "2、以责任部门为标准的分析情况（转办）";
                        string bgmc2_tb5 = arr[9];
                        string bgmc2_part2_2_nr1 = "根据上表数据显示，客运服务类投诉占总投诉量的___%,安保类投诉占总投诉量___%。员工服务类投诉___件。客运类主要是员工服务态度不好造成的投诉居多，安保类投诉主要是安检处对喷雾、刀具等物品的检查标准不一致及员工服务态度欠佳等方面。";

                        string data4 = ReportWorkOrderInfoQuarterNewTwoQTMX(dateParty);
                        arr = data4.Split('^');
                        strcount = arr[0].Split(',');
                        string bgmc2_part3 = "（三）乘客建议部分";
                        string bgmc2_part3_nr1 = "确保地铁安全运营和倡导市民文明低碳出行服务热线也在第一时间将广大乘客反馈的合理化建议及意见反馈给公司。第一季度热线电话受理有效建议" + arr[4] + "件。";
                        string bgmc2_part4 = "（四）乘客表扬、挂失部分";
                        string bgmc2_part4_nr1 = bgname + "服务热线共帮助乘客找寻失物" + arr[5] + "件，受到乘客来电表扬" + arr[6] + "件。";

                        string data5 = ReportWorkOrderInfoQuarterNewTwoWBMX(dateParty);
                        arr = data5.Split('^');
                        strcount = arr[0].Split(',');
                        string bgmc3 = "三、" + bgname + "微博互动受理量统计及分析";
                        string bgmc3_nr1 = bgname + "微博互动受理乘客事务" + arr[4] + "件，其中私信___人次、评论___人次、 ___人次。";
                        string bgmc3_nr2 = "由上图所示，" + bgQuarter + "主要受理量在___月份，___月份受理量突增的原因是受12月20日列车信号故障及春运期间客流急剧增加的影响所致。其中所反映的问题较突出的有：延误证明开具时间及要求；咨询列车时刻信息；咨询列车时刻信息。";

                        string data6 = ReportWorkOrderInfoQuarterNewTwoWXMX(dateParty);
                        arr = data6.Split('^');
                        strcount = arr[0].Split(',');
                        string bgmc4 = "四、" + bgname + "微信互动受理量统计及分析";
                        string bgmc4_nr1 = bgname + "微信互动受理乘客事务" + arr[4] + "人次。";
                        string bgmc4_nr2 = "由上图所示，" + bgname + "微信主要受理量在___月份。其中___月份受理量突增的原因与微博突增的原因一致。其中所反映的问题较突出的有：列车时刻信息咨询。";

                        res += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">";
                        res += "<tr><td><h1 style=\"text-align:center;font-family:方正小标宋简体;\">";
                        res += "<label id=\"bgmc\">" + bgmc + "</label></h1></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc1\">" + bgmc1 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc1_nr1\">" + bgmc1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + bgmc1_tb1 + "</td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc1_nr2\">" + bgmc1_nr2 + "</label></h3></td></tr>";

                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc2\">" + bgmc2 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_nr1\">" + bgmc2_nr1 + "</label>";
                        res += "<label id=\"bgmc2_nr2\">" + bgmc2_nr2 + "</label></h3></td></tr>";
                        res += "<tr><td>" + bgmc2_tb1 + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part1\">" + bgmc2_part1 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part1_nr1\">" + bgmc2_part1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part1_nr2\">" + bgmc2_part1_nr2 + "</label></h3></td></tr>";
                        res += "<tr><td>" + bgmc2_tb2 + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2\">" + bgmc2_part2 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_nr1\">" + bgmc2_part2_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2_1\">" + bgmc2_part2_1 + "</label></b></h2></td></tr>";
                        res += "<tr><td>" + bgmc2_tb4 + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_1_nr1\">" + bgmc2_part2_1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2_2\">" + bgmc2_part2_2 + "</label></b></h2></td></tr>";
                        res += "<tr><td>" + bgmc2_tb5+ "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_2_nr1\">" + bgmc2_part2_2_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_2_nr2\">" + "" + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part3\">" + bgmc2_part3 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part3_nr1\">" + bgmc2_part3_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part4\">" + bgmc2_part4 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part4_nr1\">" + bgmc2_part4_nr1 + "</label></h3></td></tr>";

                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc3\">" + bgmc3 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc3_nr1\">" + bgmc3_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc3_nr2\">" + bgmc3_nr2 + "</label></h3></td></tr>";

                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc4\">" + bgmc4 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc4_nr1\">" + bgmc4_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc4_nr2\">" + bgmc4_nr2 + "</label></h3></td></tr></table>";
                        #endregion
                        break;
                    case "3":
                        name = "年度";
                        string ydata1 = ReportWorkOrderInfoQuarterNew(dateParty);
                        string[] yarr = ydata1.Split('^');
                        string[] ystrcount = yarr[0].Split(',');
                        #region 参数
                        DateTime ynow = Convert.ToDateTime(startDate);
                        int ynowMonth = ynow.Month; //当前月 
                        int ynowYear = ynow.Year; //当前年
                        int ypreYear = ynow.Year - 1;//前一年 
                        int ypreMonth = ynow.Month-1; //上月 
                        string ynowQuarter = "";
                        if (ynowMonth >= 1 && ynowMonth <= 3)
                        {
                            ynowQuarter = "一";
                        }
                        else if (ynowMonth >= 4 && ynowMonth <= 6)
                        {
                            ynowQuarter = "二";
                        }
                        else if (ynowMonth >= 7 && ynowMonth <= 9)
                        {
                            ynowQuarter = "三";
                        }
                        else { ynowQuarter = "四"; }
                        string ypreQuarter = "";

                        if (ypreMonth >= 1 && ypreMonth <= 3)
                        {
                            ypreQuarter = "一";
                        }
                        else if (ypreMonth >= 4 && ypreMonth <= 6)
                        {
                            ypreQuarter = "二";
                        }
                        else if (ypreMonth >= 7 && ypreMonth <= 9)
                        {
                            ypreQuarter = "三";
                        }
                        else { ypreQuarter = "四"; }

                        string ybgyear = ynowYear + "年";
                        string ypreyear = ypreYear + "年";

                        #endregion
                        #region 报告
                        string ybgmc = ybgyear + "服务热线工作分析报告";
                        string ybgmc1 = "一、" + ybgyear + "全媒体客服平台受理量统计及分析";
                        string ybgmc1_nr1 = "   郑州地铁服务热线" + ybgyear + "全媒体客服平台共受理乘客事务" + ystrcount[0] + "件，其中热线电话" + ystrcount[1] + "通、微博互动 " + ystrcount[2] + "人次、微信互动" + ystrcount[3] + "人次。";
                        string ybgmc1_nr2 = "同比" + ypreyear + "全媒体客服平台总受理量" + ystrcount[4] + "，其中热线电话受理量" + ystrcount[5] + "，微博互动量" + ystrcount[6] + "，微信互动量" + ystrcount[7] + "。（" + ypreyear + "全媒体客服平台共受理乘客事务" + ystrcount[8] + "件，其中热线电话" + ystrcount[9] + "通、微博互动" + ystrcount[10] + "人次、微信互动" + ystrcount[11] + "人次）。由上图所示，全年主要受理量在_________月份，其中城郊线、1号线二期开通运营和春节假期乘车等事宜导致___月份业务量全年最高，由于十九大期间安检升级导致______月份业务量增加。";
                        string ybgmc1_tb1 = yarr[1];
                        string ybgmc2 = "二、" + ybgyear + "服务热线电话受理量统计及分析";
                        string ybgmc2_nr1 = ybgyear + "热线电话共受理乘客事务" + ystrcount[1] + "通，占全媒体客服平台总受理量的" + ystrcount[12] + ",";

                        string ydata2 = ReportWorkOrderInfoQuarterNewTwo(dateParty);
                        yarr = ydata2.Split('^');
                        ystrcount = yarr[0].Split(',');

                        string ybgmc2_nr2 = "日均受理乘客事务约" + ystrcount[1] + "通/天，共接通" + ystrcount[2] + "通，接通率为" + ystrcount[3] + "。直接答复" + ystrcount[4] + "通，直接答复率" + ystrcount[5] + "。转办办理" + ystrcount[6] + "件，按期回复率" + ystrcount[7] + "。办理结果回访满意率___%。热线满意率___%,平均通话时长___分，来电高峰主要集中在___点至___点，热线客户评价总体满意率___%，乘客满意度较好。与" + ypreyear + "年相比，受理乘客事务总量____倍。";
                        string ybgmc2_tb1 = yarr[1];
                        string ybgmc2_part1 = "（一）乘客咨询部分";
                        string ybgmc2_part1_nr1 = "共接听咨询来电" + yarr[4] + "通，其中" + yarr[5] + "(其他类咨询主要包含咨询地铁计次票售卖相关事宜及列车车厢内广播相关事宜等。)";
                        string ybgmc2_part1_nr2 = "其中互联网购票类咨询占总咨询量的____。从互联网购票上线以来，多集中在以下几个问题：1、互联网支付成功，未出票；2、互联网购票多张，少出票；3、互联网购票订单显示已完成，未出票；4、目前1号线二期不支持互联网购票等相关问题。建议：1、在互联网购票机上提示乘客可使用扫码或者商户单号后八位取票；2、在1号线二期开展互联网购票相关事宜。";

                        string ydata3 = ReportWorkOrderInfoQuarterNewTwoZXMX(dateParty);
                        yarr = ydata3.Split('^');
                        ystrcount = yarr[0].Split(',');
                        string ybgmc2_tb2 = yarr[1];
                        string ybgmc2_part2 = "（二）乘客投诉部分";
                        string ybgmc2_part2_nr1 = ybgyear + "热线电话共受理乘客来电投诉" + yarr[4] + "件，其中转办相关责任部门" + yarr[5] + "件，由服务热线化解的投诉" + yarr[6] + "件，化解率达高达" + yarr[7] + "。同时，十九大期间全媒体客服平台共受理投诉____件，投诉化解率达___%，共计_____件，期间未产生不良报道。（附件一《安检等级升级期间全媒体客服平台信息统计报告》）";
                        string ybgmc2_part2_1 = "1、以受理方式为标准的分析情况";
                        string ybgmc2_tb4 = yarr[8];
                        string ybgmc2_part2_1_nr1 = "根据上表数据显示，热线电话受理的投诉量占总投诉量的"+ yarr[10] + "。";
                        string ybgmc2_part2_2 = "2、以责任部门为标准的分析情况（转办）";
                        string ybgmc2_tb5 = yarr[9];
                        string ybgmc2_part2_2_nr1 = "根据上表数据显示，客运服务类投诉占总投诉量的____%,安保类投诉占总投诉量____%。员工服务类投诉____件。客运类主要是员工服务态度不好造成的投诉居多，安保类投诉主要是安检处对喷雾等物品的检查标准不一致及员工服务态度欠佳等方面。下图所示，由于十九大会议期间安检升级导致投诉量直线暴增，并于____月逐步下降。其中，员工服务类投诉较多，占安检总投诉量的____ %。";
                        string ybgmc2_part2_2_nr2 = "由上图所示，员工服务类投诉占客运服务类总投诉量的____%。";

                        string ydata4 = ReportWorkOrderInfoQuarterNewTwoQTMX(dateParty);
                        yarr = ydata4.Split('^');
                        ystrcount = yarr[0].Split(',');
                        string ybgmc2_part3 = "（三）乘客建议部分";
                        string ybgmc2_part3_nr1 = "为确保地铁安全运营和倡导市民文明低碳出行服务热线也在第一时间将广大乘客反馈的合理化建议及意见反馈给公司。全年热线电话受理有效建议" + yarr[4] + "件，已反馈给相关责任部门并跟进处理完毕。";
                        string ybgmc2_part4 = "（四）乘客表扬、挂失部分";
                        string ybgmc2_part4_nr1 = ybgyear + "服务热线共帮助乘客找寻失物" + yarr[5] + "件，受到乘客来电表扬" + yarr[6] + "件。";

                        string ydata5 = ReportWorkOrderInfoQuarterNewTwoWBMX(dateParty);
                        yarr = ydata5.Split('^');
                        ystrcount = yarr[0].Split(',');
                        string ybgmc3 = "三、" + ybgyear + "微博互动受理量统计及分析";
                        string ybgmc3_nr1 = ybgyear + "微博互动受理乘客事务" + yarr[4] + "件，其中私信___人次、评论___人次、 ___人次。";
                        string ybgmc3_nr2 = "由上图所示，全年主要受理量在__________月份，其中城郊线、1号线二期开通运营和春节假期乘车等事宜导致___月份业务量全年最高，由于十九大期间安检升级导致_______月份业务量增加。";

                        string ydata6 = ReportWorkOrderInfoQuarterNewTwoWXMX(dateParty);
                        yarr = ydata6.Split('^');
                        ystrcount = yarr[0].Split(',');
                        string ybgmc4 = "四、" + ybgyear + "微信互动受理量统计及分析";
                        string ybgmc4_nr1 = ybgyear + "微信互动受理乘客事务" + yarr[4] + "人次。";
                        string ybgmc4_nr2 = "由上图所示，全年主要受理量在______________月份，其中城郊线、1号线二期开通运营和春节假期乘车等事宜导致___月份业务量全年最高，由于十九大期间安检升级导致______月份业务量增加，恶略天气及节前延迟运营时间等问题导致_____月份互动咨询量增加。";

                        res += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">";
                        res += "<tr><td><h1 style=\"text-align:center;font-family:方正小标宋简体;\">";
                        res += "<label id=\"bgmc\">" + ybgmc + "</label></h1></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc1\">" + ybgmc1 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc1_nr1\">" + ybgmc1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + ybgmc1_tb1 + "</td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc1_nr2\">" + ybgmc1_nr2 + "</label></h3></td></tr>";

                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc2\">" + ybgmc2 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_nr1\">" + ybgmc2_nr1 + "</label>";
                        res += "<label id=\"bgmc2_nr2\">" + ybgmc2_nr2 + "</label></h3></td></tr>";
                        res += "<tr><td>" + ybgmc2_tb1 + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part1\">" + ybgmc2_part1 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part1_nr1\">" + ybgmc2_part1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part1_nr2\">" + ybgmc2_part1_nr2 + "</label></h3></td></tr>";
                        res += "<tr><td>" + ybgmc2_tb2 + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2\">" + ybgmc2_part2 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_nr1\">" + ybgmc2_part2_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2_1\">" + ybgmc2_part2_1 + "</label></b></h2></td></tr>";
                        res += "<tr><td>" + ybgmc2_tb4 + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_1_nr1\">" + ybgmc2_part2_1_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part2_2\">" + ybgmc2_part2_2 + "</label></b></h2></td></tr>";
                        res += "<tr><td>" + ybgmc2_tb5 + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_2_nr1\">" + ybgmc2_part2_2_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part2_2_nr2\">" + ybgmc2_part2_2_nr2 + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part3\">" + ybgmc2_part3 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part3_nr1\">" + ybgmc2_part3_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:楷体;margin-top:15px;\"><b>";
                        res += "<label id=\"bgmc2_part4\">" + ybgmc2_part4 + "</label></b></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc2_part4_nr1\">" + ybgmc2_part4_nr1 + "</label></h3></td></tr>";

                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc3\">" + ybgmc3 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc3_nr1\">" + ybgmc3_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc3_nr2\">" + ybgmc3_nr2 + "</label></h3></td></tr>";

                        res += "<tr><td><h2 style=\"text-align:left;font-family:黑体;margin-top:15px;\">";
                        res += "<label id=\"bgmc4\">" + ybgmc4 + "</label></h2></td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc4_nr1\">" + ybgmc4_nr1 + "</label></h3></td></tr>";
                        res += "<tr><td>" + "" + "</td></tr>";
                        res += "<tr><td><h3 style=\"text-align:left;font-family:仿宋_GB2312;margin-top:15px;\">";
                        res += "<label id=\"bgmc4_nr2\">" + ybgmc4_nr2 + "</label></h3></td></tr></table>";
                        #endregion
                        break;
                    case "4":
                        name = "舆情周";
                        res = ReportWorkOrderInfoProduct(dateParty);
                        res = res.Split('^')[0];
                        break;
                }
            }
            catch
            { }
            string fileName = name+"报表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
            Response.Clear();
            Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName));
            Response.ContentType = "application/msword";
            Response.Write("<meta http-equiv=\"content-type\" content=\"application/msword; charset=gb2312\"/>" + res.ToString());
            Response.End();
            return null;
        }

        public DataTable WorkOrderTypeData(DateTime? NowDateTime, string dateParty)
        {
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }
            DataTable datas = recordBLL.GetWorkOrderBussTypeData(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("业务类型");
            newTable.Columns.Add("工单数量");

            if (datas != null && datas.Rows.Count > 0)
            {

                DataRow dataRow;

                foreach (DataRow thisRow in datas.Rows)
                {

                    if (thisRow["BusinessType"].ToString() == "6")
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "咨询";

                        int totalCount = 0;
                        string getCount = thisRow["callInCount"].ToString();
                        if (!string.IsNullOrEmpty(getCount))
                        {
                            totalCount = int.Parse(getCount);
                        }
                        dataRow["工单数量"] = totalCount;


                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "14"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "建议";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "18"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "表扬";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else if ((thisRow["BusinessType"].ToString() == "19"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "挂失";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "3"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "投诉";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }


                }

                datas.Clear();
                datas.Dispose();

            }
            return newTable;
        }

        /// <summary>
        /// 周报
        /// </summary>
        /// <returns></returns>
        [ActionName("ReportWorkOrderInfoOneWeek")]
        [HttpGet]
        public string ReportWorkOrderInfoOneWeek(string dateParty)
        {
           // dateParty = "2019-01-01 - 2019-12-31";
            string res = "^divWorkOrderInfoOneWeekPie";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddDays(-7).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddDays(-7).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddDays(-7).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddDays(-7).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;

            StringBuilder StrContent = new StringBuilder();

            StrContent.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
            StrContent.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:42.55pt;\">受理平台</td>");
            StrContent.Append("<td style=\"width:120.5pt;\">受理总量（件）</td>");
            StrContent.Append("<td style=\"width:70.85pt;\">同比上周</td>");
            StrContent.Append("<td style=\"width:77.95pt;\">咨询类数量及占比</td>");
            StrContent.Append("<td style=\"width:3.0cm;\">投诉类数量及占比</td>");
            StrContent.Append("<td style=\"width:99.25pt;\">化解投诉量及占比</td></tr>");

            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.WorkOrderDate(prestartDate, preendDate);
            //DataTable nowDataTable = WorkOrderTypeData(DateTime.Now, dateParty);
            //DataTable preDataTable = WorkOrderTypeData(DateTime.Now,predateParty);

            string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            #region 微信
            int wxallcount = 0;
            int wxpreallcount = 0;
            int wxzxcount = 0;
            int wxprezxcount = 0;
            string wxzxzb = "";
            int wxjycount = 0;
            int wxprejycount = 0;
            int wxbycount = 0;
            int wxprebycount = 0;
            int wxgscount = 0;
            int wxpregscount = 0;
            int wxtscount = 0;
            int wxpretscount = 0;
            string wxtszb = "0";
            string wxtb = "0";
            #endregion
            #region 微博
            int wballcount = 0;
            int wbpreallcount = 0;
            int wbzxcount = 0;
            int wbprezxcount = 0;
            string wbzxzb = "";
            int wbjycount = 0;
            int wbprejycount = 0;
            int wbbycount = 0;
            int wbprebycount = 0;
            int wbgscount = 0;
            int wbpregscount = 0;
            int wbtscount = 0;
            int wbpretscount = 0;
            string wbtszb = "0";
            string wbtb = "0";
            #endregion
            #region 投诉化解
            int tscounthj = 0;
            int kfclcount = 0;
            string tshjl = "";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音
                    int allcount = 0;
                    int preallcount = 0;
                    int zxcount = 0;
                    int prezxcount = 0;
                    string zxzb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            prezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int jycount = 0;
                    int prejycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            prejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int bycount = 0;
                    int prebycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            prebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int gscount = 0;
                    int pregscount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            pregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int tscount = 0;
                    int pretscount = 0;
                    string tszb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            pretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    allcount = zxcount + jycount + bycount + gscount + tscount;
                    preallcount = prezxcount + prejycount + prebycount + pregscount + pretscount;
                    string tb = "";
                    if (preallcount > allcount)
                    {
                        decimal tbint = (Convert.ToDecimal(preallcount) - Convert.ToDecimal(allcount)) * 100 / Convert.ToDecimal(preallcount);
                        tb = "减少" + tbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (preallcount == allcount)
                        {
                            tb = "相同";
                        }
                        else
                        {
                            if (preallcount > 0)
                            {
                                decimal tbint = (Convert.ToDecimal(allcount) - Convert.ToDecimal(preallcount)) * 100 / Convert.ToDecimal(preallcount);
                                tb = "增加" + tbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (allcount > 0)
                    {
                        zxzb = ((Convert.ToDecimal(zxcount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                        tszb = ((Convert.ToDecimal(tscount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                    }
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>" + allcount.ToString() + "</td><td>" + tb + "</td><td>" + zxcount.ToString() + "<br />" + zxzb + "</td><td>" + tscount.ToString() + "<br />" + tszb + "</td><td>-</td></tr>");
                    #endregion

                    #region 微信

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wxzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wxprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wxjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wxprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wxbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wxprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wxgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wxpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wxtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wxpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate, preendDate
                    wxallcount = wxzxcount + wxjycount + wxbycount + wxgscount + wxtscount;
                    wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                    wxpreallcount = wxprezxcount + wxprejycount + wxprebycount + wxpregscount + wxpretscount;
                    wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                    if (wxpreallcount > wxallcount)
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "减少" + wxtbint.ToString("f") + "%";
                        }
                    }
                    else
                    {
                        if (wxpreallcount == wxallcount)
                        {
                            wxtb = "相同";
                        }
                        else
                        {
                            if (wxpreallcount > 0)
                            {
                                decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                                wxtb = "增加" + wxtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wxallcount > 0)
                    {
                        wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                        wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    }

                    #endregion

                    #region 微博

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wbzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wbprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wbjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wbprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wbbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wbprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wbgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wbpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wbtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wbpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate,preendDate
                    wballcount = wbzxcount + wbjycount + wbbycount + wbgscount + wbtscount;
                    wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                    wbpreallcount = wbprezxcount + wbprejycount + wbprebycount + wbpregscount + wbpretscount;
                    wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                    if (wbpreallcount > wballcount)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "减少" + wbtbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (wbpreallcount == wballcount)
                        {
                            wbtb = "相同";
                        }
                        else
                        {
                            if (wbpreallcount > 0)
                            {
                                decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                                wbtb = "增加" + wbtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wballcount > 0)
                    {
                        wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                        wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    }

                    #endregion
                    #region 投诉化解
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscounthj += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'and 处理方式='客服处理' ");
                        foreach (DataRow row in rows)
                        {
                            kfclcount += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                }
                else
                {
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                }
            }
            else
            {
                StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
 #region 微信
            wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount; 
            wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
            if (wxpreallcount > wxallcount)
            {
                if (wxpreallcount > 0)
                {
                    decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                    wxtb = "减少" + wxtbint.ToString("f") + "%";
                }
            }
            else
            {
                if (wxpreallcount == wxallcount)
                {
                    wxtb = "相同";
                }
                else
                {
                    if (wxpreallcount > 0)
                    {
                        decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                        wxtb = "增加" + wxtbint.ToString("f") + "%";
                    }
                }
            }
            if (wxallcount > 0)
            {
                wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
            }
            #endregion
            #region  微博
            wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
            wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
            if (wbpreallcount > wballcount)
            {
                decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                wbtb = "减少" + wbtbint.ToString("f") + "%";
            }
            else
            {
                if (wbpreallcount == wballcount)
                {
                    wbtb = "相同";
                }
                else
                {
                    if (wbpreallcount > 0)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "增加" + wbtbint.ToString("f") + "%";
                    }
                }
            }
            if (wballcount > 0)
            {
                wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
            }
            #endregion
            }
           
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");

            //wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;

            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>" + wxallcount.ToString() + "</td><td>" + wxtb + "</td><td>" + wxzxcount.ToString() + "<br />" + wxzxzb + "</td><td>" + wxtscount.ToString() + "<br />" + wxtszb + "</td><td>-</td></tr>");

            //wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate,0) + wballcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>" + wballcount.ToString() + "</td><td>" + wbtb + "</td><td>" + wbzxcount.ToString() + "<br />" + wbzxzb + "</td><td>" + wbtscount.ToString() + "<br />" + wbtszb + "</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            StrContent.Append("</tbody></table>"); 
            #region 投诉化解率
            if (tscounthj > 0)
            {
                decimal kfclcountint = Convert.ToDecimal(kfclcount) * 100 / Convert.ToDecimal(tscounthj);
                tshjl = kfclcountint.ToString("f") + "%";
            }
            else
            {
                tshjl = "0%";
            }
            #endregion
            string divWorkOrderInfoOneWeekPie = "<br /><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 80px; width: 100%;text-align:center; background-color: #ffffff\"><br /><br />（本周客服已化解投诉共"+ kfclcount + "件，投诉化解率为："+ tshjl + "）<br /><br /></div>";


            return StrContent.ToString() + "^" + divWorkOrderInfoOneWeekPie + "^divWorkOrderInfoOneWeekPie" + "^" + json;
        }
        /// <summary>
        /// 舆情周报
        /// </summary>
        /// <returns></returns>
        [ActionName("ReportWorkOrderInfoProduct")]
        [HttpGet]
        public string ReportWorkOrderInfoProduct(string dateParty)
        {
           //dateParty = "2019-01-01 - 2019-12-31";
            //数据结果集
            string startDate = "";
            string endDate = ""; 
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
            } 

            StringBuilder StrContent = new StringBuilder();

            StrContent.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
            StrContent.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:42.55pt;\">全媒体客服平台</td>");
            StrContent.Append("<td style=\"width:120.5pt;\">受理量（件）</td></tr>");  
            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate); 
            string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            #region 微信
            int wxallcount = 0; 
            #endregion
            #region 微博
            int wballcount = 0;
            #endregion
            #region  语音
            int allcount = 0;
            #endregion
            #region 投诉化解
            int tscounthj = 0;
            int kfclcount = 0;
            string tshjl = "";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 微博 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博'");
                        foreach (DataRow row in rows)
                        {
                            wballcount += int.Parse(row["总数"].ToString());
                        } 
                    }
                    catch
                    { }  
                    #endregion
                    #region 微信 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' ");
                        foreach (DataRow row in rows)
                        {
                            wxallcount += int.Parse(row["总数"].ToString());
                        } 
                    }
                    catch
                    { }  
                     #endregion
                    #region 语音 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' ");
                        foreach (DataRow row in rows)
                        {
                            allcount += int.Parse(row["总数"].ToString());
                        } 
                    }
                    catch
                    { }
                    #endregion
                    #region 投诉化解
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscounthj += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'and 处理方式='客服处理' ");
                        foreach (DataRow row in rows)
                        {
                            kfclcount += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                }
            }
            #region 投诉化解率
            if (tscounthj > 0)
            {
                decimal kfclcountint = Convert.ToDecimal(kfclcount) * 100 / Convert.ToDecimal(tscounthj);
                tshjl = kfclcountint.ToString("f") + "%";
            }
            else
            {
                tshjl = "0%";
            }
            #endregion
            wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>新浪微博</td><td>" + wballcount.ToString() + "</td>" + "</tr>");

            wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信服务号</td><td>" + wxallcount.ToString() + "</td>" + "</tr>");

            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信订阅号</td><td>/</td>" + "</tr>");

            StrContent.Append("<tr style=\"height:36.95pt\"><td>官方网站</td><td>/</td>" + "</tr>");

            StrContent.Append("<tr style=\"height:36.95pt\"><td>热线电话</td><td>" + allcount.ToString() + "</td>" + "</tr>");

           StrContent.Append("</tbody></table>");

            string divWorkOrderInfoProductPie = "<br /><div id=\"divWorkOrderInfoProductPie\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><div id=\"divWorkOrderInfoProductPie\" style=\"height: 80px; width: 100%;text-align:center; background-color: #ffffff\"><br /><br />（本周客服已化解投诉共"+ kfclcount + "件，投诉化解率为："+ tshjl + "）<br />网站数据无法获取，仅生成微信、微博、电话受理量报表<br /></div>";


            return StrContent.ToString() + "^" + divWorkOrderInfoProductPie + "^divWorkOrderInfoProductPie" + "^" + json;
        }
        /// <summary>
        /// 两周报
        /// </summary>
        /// <returns></returns>
        [ActionName("ReportWorkOrderInfoTwoWeek")]
        [HttpGet]
        public string ReportWorkOrderInfoTwoWeek(string dateParty)
        {
            //数据结果集
           // dateParty = "2019-01-01 - 2019-12-31";
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddDays(-14).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddDays(-14).ToString("yyyy-MM-dd");
            }
            else
            { 
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.AddDays(-14).ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddDays(-14).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddDays(-14).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            StringBuilder StrContent = new StringBuilder();

            StrContent.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"90%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
            StrContent.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:42.55pt;\">受理平台</td>");
            StrContent.Append("<td style=\"width:120.5pt;\">受理总量（件）</td>");
            StrContent.Append("<td style=\"width:70.85pt;\">同比上两周</td>");
            StrContent.Append("<td style=\"width:77.95pt;\">咨询类数量及占比</td>");
            StrContent.Append("<td style=\"width:3.0cm;\">投诉类数量及占比</td>");
            StrContent.Append("<td style=\"width:99.25pt;\">化解投诉量及占比</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            //StrContent.Append("</tbody></table>");
            #region  两周报数据

            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.WorkOrderDate(prestartDate, preendDate);
            //DataTable nowDataTable = WorkOrderTypeData(DateTime.Now, dateParty);
            //DataTable preDataTable = WorkOrderTypeData(DateTime.Now,predateParty);

            string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            #region 微信
            int wxallcount = 0;
            int wxpreallcount = 0;
            int wxzxcount = 0;
            int wxprezxcount = 0;
            string wxzxzb = "";
            int wxjycount = 0;
            int wxprejycount = 0;
            int wxbycount = 0;
            int wxprebycount = 0;
            int wxgscount = 0;
            int wxpregscount = 0;
            int wxtscount = 0;
            int wxpretscount = 0;
            string wxtszb = "0";
            string wxtb = "0";
            #endregion
            #region 微博
            int wballcount = 0;
            int wbpreallcount = 0;
            int wbzxcount = 0;
            int wbprezxcount = 0;
            string wbzxzb = "";
            int wbjycount = 0;
            int wbprejycount = 0;
            int wbbycount = 0;
            int wbprebycount = 0;
            int wbgscount = 0;
            int wbpregscount = 0;
            int wbtscount = 0;
            int wbpretscount = 0;
            string wbtszb = "0";
            string wbtb = "0";
            #endregion
            #region 投诉化解
            int tscounthj = 0;
            int kfclcount = 0;
            string tshjl = "";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音
                    int allcount = 0;
                    int preallcount = 0;
                    int zxcount = 0;
                    int prezxcount = 0;
                    string zxzb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            prezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int jycount = 0;
                    int prejycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            prejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int bycount = 0;
                    int prebycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            prebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int gscount = 0;
                    int pregscount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            pregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int tscount = 0;
                    int pretscount = 0;
                    string tszb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            pretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    allcount = zxcount + jycount + bycount + gscount + tscount;
                    preallcount = prezxcount + prejycount + prebycount + pregscount + pretscount;
                    string tb = "";
                    if (preallcount > allcount)
                    {
                        decimal tbint = (Convert.ToDecimal(preallcount) - Convert.ToDecimal(allcount)) * 100 / Convert.ToDecimal(preallcount);
                        tb = "减少" + tbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (preallcount == allcount)
                        {
                            tb = "相同";
                        }
                        else
                        {
                            if (preallcount > 0)
                            {
                                decimal tbint = (Convert.ToDecimal(allcount) - Convert.ToDecimal(preallcount)) * 100 / Convert.ToDecimal(preallcount);
                                tb = "增加" + tbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (allcount > 0)
                    {
                        zxzb = ((Convert.ToDecimal(zxcount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                        tszb = ((Convert.ToDecimal(tscount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                    }
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>" + allcount.ToString() + "</td><td>" + tb + "</td><td>" + zxcount.ToString() + "<br />" + zxzb + "</td><td>" + tscount.ToString() + "<br />" + tszb + "</td><td>-</td></tr>");
                    #endregion

                    #region 微信

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wxzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wxprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wxjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wxprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wxbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wxprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wxgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wxpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wxtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wxpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                     //prestartDate, preendDate
                    wxallcount = wxzxcount + wxjycount + wxbycount + wxgscount + wxtscount;
                    wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                    wxpreallcount = wxprezxcount + wxprejycount + wxprebycount + wxpregscount + wxpretscount;
                    wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                    if (wxpreallcount > wxallcount)
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "减少" + wxtbint.ToString("f") + "%";
                        }
                    }
                    else
                    {
                        if (wxpreallcount == wxallcount)
                        {
                            wxtb = "相同";
                        }
                        else
                        {
                            if (wxpreallcount > 0)
                            {
                                decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                                wxtb = "增加" + wxtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wxallcount > 0)
                    {
                        wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                        wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    }

                    #endregion

                    #region 微博

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wbzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wbprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wbjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wbprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wbbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wbprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wbgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wbpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wbtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wbpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate,preendDate
                    wballcount = wbzxcount + wbjycount + wbbycount + wbgscount + wbtscount;
                    wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                    wbpreallcount = wbprezxcount + wbprejycount + wbprebycount + wbpregscount + wbpretscount;
                    wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                    if (wbpreallcount > wballcount)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "减少" + wbtbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (wbpreallcount == wballcount)
                        {
                            wbtb = "相同";
                        }
                        else
                        {
                            if (wbpreallcount > 0)
                            {
                                decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                                wbtb = "增加" + wbtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wballcount > 0)
                    {
                        wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                        wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    }

                    #endregion
                    #region 投诉化解
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscounthj += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("F_HOUSING='投诉'and 处理方式='客服处理' ");
                        foreach (DataRow row in rows)
                        {
                            kfclcount += int.Parse(row["总数"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                }
                else
                {
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                }
            }
            else
            {
                StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                #region 微信
                wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                if (wxpreallcount > wxallcount)
                {
                    if (wxpreallcount > 0)
                    {
                        decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                        wxtb = "减少" + wxtbint.ToString("f") + "%";
                    }
                }
                else
                {
                    if (wxpreallcount == wxallcount)
                    {
                        wxtb = "相同";
                    }
                    else
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "增加" + wxtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wxallcount > 0)
                {
                    wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                }
                #endregion
                #region  微博
                wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                if (wbpreallcount > wballcount)
                {
                    decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                    wbtb = "减少" + wbtbint.ToString("f") + "%";
                }
                else
                {
                    if (wbpreallcount == wballcount)
                    {
                        wbtb = "相同";
                    }
                    else
                    {
                        if (wbpreallcount > 0)
                        {
                            decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                            wbtb = "增加" + wbtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wballcount > 0)
                {
                    wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                }
                #endregion
            }

            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");

            //wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;

            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>" + wxallcount.ToString() + "</td><td>" + wxtb + "</td><td>" + wxzxcount.ToString() + "<br />" + wxzxzb + "</td><td>" + wxtscount.ToString() + "<br />" + wxtszb + "</td><td>-</td></tr>");

            //wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>" + wballcount.ToString() + "</td><td>" + wbtb + "</td><td>" + wbzxcount.ToString() + "<br />" + wbzxzb + "</td><td>" + wbtscount.ToString() + "<br />" + wbtszb + "</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            StrContent.Append("</tbody></table>"); 
         
            #region 投诉化解率
            if (tscounthj > 0)
            {
                decimal kfclcountint = Convert.ToDecimal(kfclcount) * 100 / Convert.ToDecimal(tscounthj);
                tshjl = kfclcountint.ToString("f") + "%";
            }
            else
            {
                tshjl = "0%";
            }
            #endregion
            string divWorkOrderInfoOneWeekPie = "<br /><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 80px; width: 100%;text-align:center; background-color: #ffffff\"><br /><br />（本周客服已化解投诉共"+ kfclcount + "件，投诉化解率为："+ tshjl + "）<br /><br /></div>";


            #endregion
            //return StrContent.ToString();
            return StrContent.ToString() + "^" + divWorkOrderInfoOneWeekPie + "^divWorkOrderInfoOneWeekPie" + "^" + json;
        }




        [ActionName("ReportWorkOrderInfoQuarterNew")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNew(string dateParty)
        { 
            string StrContent = "";
            string bgnrtb_1 = "<br /><div id=\"bgnrtb_1\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.WorkOrderDate(prestartDate, preendDate);
            //string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            string json = WorkOrderFromChartData(DateTime.Now, dateParty);
            
            #region 语音
            int allcount = 0;
            int preallcount = 0;
            int zxcount = 0;
            int prezxcount = 0;
            string zxzb = "";
            int jycount = 0;
            int prejycount = 0;
            int bycount = 0;
            int prebycount = 0;
            int gscount = 0;
            int pregscount = 0;
            int tscount = 0;
            int pretscount = 0;
            string tszb = "";
            string tb = "";
            string zzdttb = "";
            #endregion
            #region 微信
            int wxallcount = 0;
            int wxpreallcount = 0;
            int wxzxcount = 0;
            int wxprezxcount = 0;
            string wxzxzb = "";
            int wxjycount = 0;
            int wxprejycount = 0;
            int wxbycount = 0;
            int wxprebycount = 0;
            int wxgscount = 0;
            int wxpregscount = 0;
            int wxtscount = 0;
            int wxpretscount = 0;
            string wxtszb = "0";
            string wxtb = "0";
            #endregion
            #region 微博
            int wballcount = 0;
            int wbpreallcount = 0;
            int wbzxcount = 0;
            int wbprezxcount = 0;
            string wbzxzb = "";
            int wbjycount = 0;
            int wbprejycount = 0;
            int wbbycount = 0;
            int wbprebycount = 0;
            int wbgscount = 0;
            int wbpregscount = 0;
            int wbtscount = 0;
            int wbpretscount = 0;
            string wbtszb = "0";
            string wbtb = "0";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            prezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { } 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            prejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { } 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            prebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { } 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            pregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { } 
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            pretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    allcount = zxcount + jycount + bycount + gscount + tscount;
                    preallcount = prezxcount + prejycount + prebycount + pregscount + pretscount;
                   
                    if (preallcount > allcount)
                    {
                        decimal tbint = (Convert.ToDecimal(preallcount) - Convert.ToDecimal(allcount)) * 100 / Convert.ToDecimal(preallcount);
                        tb = "减少" + tbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (preallcount == allcount)
                        {
                            tb = "相同";
                        }
                        else
                        {
                            if (preallcount > 0)
                            {
                                decimal tbint = (Convert.ToDecimal(allcount) - Convert.ToDecimal(preallcount)) * 100 / Convert.ToDecimal(preallcount);
                                tb = "增加" + tbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (allcount > 0)
                    {
                        zxzb = ((Convert.ToDecimal(zxcount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                        tszb = ((Convert.ToDecimal(tscount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                    } 
                    #endregion 
                    #region 微信

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wxzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wxprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wxjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wxprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wxbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wxprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wxgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wxpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wxtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wxpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate, preendDate
                    wxallcount = wxzxcount + wxjycount + wxbycount + wxgscount + wxtscount;
                    wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                    wxpreallcount = wxprezxcount + wxprejycount + wxprebycount + wxpregscount + wxpretscount;
                    wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                    if (wxpreallcount > wxallcount)
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "减少" + wxtbint.ToString("f") + "%";
                        }
                    }
                    else
                    {
                        if (wxpreallcount == wxallcount)
                        {
                            wxtb = "相同";
                        }
                        else
                        {
                            if (wxpreallcount > 0)
                            {
                                decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                                wxtb = "增加" + wxtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wxallcount > 0)
                    {
                        wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                        wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    }

                    #endregion 
                    #region 微博

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wbzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wbprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wbjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wbprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wbbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wbprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wbgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wbpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wbtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wbpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate,preendDate
                    wballcount = wbzxcount + wbjycount + wbbycount + wbgscount + wbtscount;
                    wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                    wbpreallcount = wbprezxcount + wbprejycount + wbprebycount + wbpregscount + wbpretscount;
                    wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                    if (wbpreallcount > wballcount)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "减少" + wbtbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (wbpreallcount == wballcount)
                        {
                            wbtb = "相同";
                        }
                        else
                        {
                            if (wbpreallcount > 0)
                            {
                                decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                                wbtb = "增加" + wbtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wballcount > 0)
                    {
                        wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                        wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    }

                    #endregion
                } 
            } else
            {
                #region 微信
                wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                if (wxpreallcount > wxallcount)
                {
                    if (wxpreallcount > 0)
                    {
                        decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                        wxtb = "减少" + wxtbint.ToString("f") + "%";
                    }
                }
                else
                {
                    if (wxpreallcount == wxallcount)
                    {
                        wxtb = "相同";
                    }
                    else
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "增加" + wxtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wxallcount > 0)
                {
                    wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                }
                #endregion
                #region  微博
                wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                if (wbpreallcount > wballcount)
                {
                    decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                    wbtb = "减少" + wbtbint.ToString("f") + "%";
                }
                else
                {
                    if (wbpreallcount == wballcount)
                    {
                        wbtb = "相同";
                    }
                    else
                    {
                        if (wbpreallcount > 0)
                        {
                            decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                            wbtb = "增加" + wbtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wballcount > 0)
                {
                    wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                }
                #endregion
            }
            #region 平台总数
            int zzdtallcout = allcount + wballcount + wxallcount;
            int prezzdtallcout = preallcount + wbpreallcount + wxpreallcount;
            if (prezzdtallcout > zzdtallcout)
            {
                decimal zzdttbint = (Convert.ToDecimal(prezzdtallcout) - Convert.ToDecimal(zzdtallcout)) * 100 / Convert.ToDecimal(prezzdtallcout);
                zzdttb = "减少" + zzdttbint.ToString("f") + "%";
            }
            else
            {
                if (prezzdtallcout == zzdtallcout)
                {
                    zzdttb = "相同";
                }
                else
                {
                    if (prezzdtallcout > 0)
                    {
                        decimal zzdttbint = (Convert.ToDecimal(zzdtallcout) - Convert.ToDecimal(prezzdtallcout)) * 100 / Convert.ToDecimal(prezzdtallcout);
                        zzdttb = "增加" + zzdttbint.ToString("f") + "%";
                    }
                }
            }
            #endregion
            string rxzb = "";
            if (zzdtallcout > 0)
            {
                decimal rxzbint = Convert.ToDecimal(allcount) * 100 / Convert.ToDecimal(zzdtallcout);
                rxzb = rxzbint.ToString("f") + "%";
            }
            else {
                rxzb = "0%";
            }
            StrContent = zzdtallcout.ToString() + "," + allcount.ToString() +","+ wballcount.ToString() + "," + wxallcount.ToString() + ","
                + zzdttb.ToString() + "," + tb.ToString() + "," + wbtb.ToString() + "," + wxtb.ToString() + ","
                + prezzdtallcout.ToString() + "," + preallcount.ToString() + "," + wbpreallcount.ToString() + "," + wxpreallcount.ToString() + ","
                + rxzb;
            return StrContent.ToString() + "^" + bgnrtb_1 + "^bgnrtb_1" + "^" + json;
       }
        [ActionName("ReportWorkOrderInfoQuarterNewTwo")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNewTwo(string dateParty)
        {
            string StrContent = "";
            string bgmc2tb1 = "<br /><div id=\"bgmc2tb1\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            DataTable nowDataTable = recordBLL.GetWorkOrderTrainFunctionRX(startDate, endDate); 
            DataTable preDataTable = recordBLL.GetWorkOrderTrainFunctionRX(prestartDate, preendDate);
            DataTable nowZXYWMXDataTable = recordBLL.GetWorkOrderTrainFunctionRXMX(startDate, endDate, "  F_FILEFLAG=6 and  F_REPAIRLEVEL <>39");
            //string json = CallInTypeMatchChartData(DateTime.Now, dateParty);
            string json = WorkOrderTypeMathChartDataRX(DateTime.Now, dateParty);
            #region 语音
            int allcount = 0; 
            int zxcount = 0;  
            int kfclcount = 0; 
            int zbclcount = 0;
            string strzxywmx = "";
            int zxcounthj = 0;
            int lcskhj = 0;
            string lcskfx = "";
            int gpxxhj = 0;
            string gpxxfx = "";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音 
                    #region 处理方式 
                    //1转办，3客服处理
                    try
                    { 
                        DataRow[] rows = nowDataTable.Select("处理方式='3'");
                        foreach (DataRow row in rows)
                        {
                            kfclcount += int.Parse(row["业务量"].ToString());
                        } 

                    }    catch  { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("处理方式='1'");
                        foreach (DataRow row in rows)
                        {
                            zbclcount += int.Parse(row["业务量"].ToString());
                        }  
                    }
                    catch
                    { }
                    #endregion
                    #region 业务类型 
                    //3投诉 ，6咨询，14建议，18表扬，19挂失
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='6'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["业务量"].ToString());
                        }  
                    }
                    catch { }
                    #endregion
                    #region 咨询业务明细 
                    DataTable dt = new DataTable(); 
                    List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=6 ");
                    if (namelist != null)
                    {
                        dt = new BLL.T_Wo_WorkOrderBase().GetList("F_CREATEDATE>='" + startDate + "'and F_CREATEDATE<='" + endDate + "'").Tables[0];
                        int i = 0;
                        int count = 0; 
                        foreach (Model.T_Wo_WorkOrderType m in namelist)
                        {
                            count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + "and F_FILEFLAG=6").Length;
                            strzxywmx = strzxywmx + m.F_Name.Trim()+ count.ToString()+ "件,";
                            zxcounthj = zxcounthj + count;
                            i++;
                        }  
                    }
                    try
                    {
                        DataRow[] rows = nowZXYWMXDataTable.Select("F_REPAIRLEVEL='20'");
                        foreach (DataRow row in rows)
                        {
                            lcskhj += int.Parse(row["YWSL"].ToString());
                        }
                        if (zxcounthj>0)
                        {
                            decimal lcskhjint = Convert.ToDecimal(lcskhj) * 100 / Convert.ToDecimal(zxcounthj);
                            lcskfx = lcskhjint.ToString("f") + "%";
                        }
                        else
                        {
                            lcskfx = "0%";
                        }
                    }
                    catch { }
                    try
                    {
                        DataRow[] rows = nowZXYWMXDataTable.Select("F_REPAIRLEVEL='24'");
                        foreach (DataRow row in rows)
                        {
                            gpxxhj += int.Parse(row["YWSL"].ToString());
                        }
                        if (zxcounthj > 0)
                        {
                            decimal gpxxhjint = Convert.ToDecimal(gpxxhj) * 100 / Convert.ToDecimal(zxcounthj);
                            gpxxfx = gpxxhjint.ToString("f") + "%";
                        }
                        else
                        {
                            gpxxfx = "0%";
                        }
                    }
                    catch { }
                    #endregion
                    allcount = kfclcount+ zbclcount; 
                    #endregion 
                }
            }
            string rjsl = "";
            int rgjtcount = zxcount;
            string rgjtl = "";
            string zjhfl = "";
            string zbaqhfl = "100%";
            if (allcount > 0)
            {
                decimal rgjtint = Convert.ToDecimal(rgjtcount) * 100 / Convert.ToDecimal(allcount);
                rgjtl = rgjtint.ToString("f") + "%";
                decimal zjhfint = Convert.ToDecimal(kfclcount) * 100 / Convert.ToDecimal(allcount);
                zjhfl = zjhfint.ToString("f") + "%";
                rjsl=(Convert.ToDecimal(allcount)/90).ToString("f") + "%";
            }
            else
            {
                rgjtl = "0%";
                zjhfl = "0%";
            }
            StrContent = allcount.ToString() + "," + rjsl.ToString() + "," + rgjtcount.ToString() + ","
               + rgjtl.ToString()+","+ kfclcount.ToString()+ "," + zjhfl.ToString() + ","
               + zbclcount.ToString()+ "," + zbaqhfl.ToString();
            return StrContent.ToString() + "^" + bgmc2tb1 + "^bgmc2tb1" + "^" + json + "^" + zxcounthj.ToString() + "^" + strzxywmx+ "^" + lcskfx+ "^" + gpxxfx;
        }
        [ActionName("ReportWorkOrderInfoQuarterNewTwoZXMX")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNewTwoZXMX(string dateParty)
        {
            string StrContent = "";
            StringBuilder bgmc2tb4 = new StringBuilder();
            StringBuilder bgmc2tb5 = new StringBuilder();
            string bgmc2tb2 = "<br /><div id=\"bgmc2tb2\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
             //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            #region 以受理方式为标准的分析情况
            int TotalCount = 0;
           int TotalCount_wb = 0;
            int TotalCount_wx = 0;
            int TotalCount_dh = 0;
            string tsbl_wb = "";
            string tsbl_wx = "";
            string tsbl_dh = "";
            #endregion
            #region 以责任部门为标准的分析情况（转办）
            int TotalCount_ajry = 0;
            int TotalCount_kyry = 0;
            int TotalCount_qtry = 0;
            int TotalCountZB = 0;
            #endregion
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            DataTable nowDataTable = recordBLL.GetWorkOrderTrainFunctionRXQT(startDate, endDate);
            DataTable dataContent = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.GetWorkOrderTrainFunctionRXQT(prestartDate, preendDate);
             //string json = CallInTypeMatchChartData(DateTime.Now, dateParty);
            string json = zxywtypeWorkOrderPreMX(DateTime.Now, dateParty);
            #region 投诉 
            int kfclcount = 0;
            int zbclcount = 0; 
            int tscounthj = 0;
            string  tshjl = "";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音 
                    #region 处理方式 
                    //1转办，3客服处理
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='3' ");
                        foreach (DataRow row in rows)
                        {
                            tscounthj += int.Parse(row["业务量"].ToString());
                        }

                    }
                    catch { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='3' and 处理方式='3'");
                        foreach (DataRow row in rows)
                        {
                            kfclcount += int.Parse(row["业务量"].ToString());
                        }

                    }
                    catch { }
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='3' and 处理方式='1'");
                        foreach (DataRow row in rows)
                        {
                            zbclcount += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                    #endregion
                    #region 以受理方式为标准的分析情况 
                    bgmc2tb4.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
                    bgmc2tb4.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:102.5pt;\">受理方式</td>");
                    bgmc2tb4.Append("<td style=\"width:120.5pt;\">投诉件数</td><td style=\"width:120.5pt;\">处理方式</td>");
                    bgmc2tb4.Append("<td style=\"width:120.5pt;\">回访率</td><td style=\"width:120.5pt;\">满意度</td>");
                    bgmc2tb4.Append("<td style=\"width:120.5pt;\">占总投诉比例</td>");
                    if (dataContent != null)
                    {
                        #region 投诉总量和总投诉占比
                        DataRow[] rowswb = dataContent.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rowswb)
                        {
                            TotalCount_wb += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rowswx = dataContent.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rowswx)
                        {
                            TotalCount_wx += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rowsyy = dataContent.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rowsyy)
                        {
                            TotalCount_dh += int.Parse(row["总数"].ToString());
                        }
                        TotalCount = TotalCount_wb + TotalCount_wx + TotalCount_dh;
                        if (TotalCount > 0)
                        {
                            decimal tsbl_wbint = Convert.ToDecimal(TotalCount_wb) * 100 / Convert.ToDecimal(TotalCount);
                            tsbl_wb = tsbl_wbint.ToString("f") + "%";
                            decimal tsbl_wxint = Convert.ToDecimal(TotalCount_wx) * 100 / Convert.ToDecimal(TotalCount);
                            tsbl_wx = tsbl_wxint.ToString("f") + "%";
                            decimal tsbl_dhint = Convert.ToDecimal(TotalCount_dh) * 100 / Convert.ToDecimal(TotalCount);
                            tsbl_dh = tsbl_dhint.ToString("f") + "%";
                        }
                        else
                        {
                            tsbl_wb = "0%"; tsbl_wx = "0%"; tsbl_dh = "0%";
                        }
                        #endregion
                        #region 满意度

                        #endregion
                    }

                    bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>" + TotalCount_wb.ToString() + "</td><td>转办</td><td>100%</td><td>满意</td><td>" + tsbl_wb + "</td>" + "</tr>");

                    bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>" + TotalCount_wx.ToString() + "</td><td>转办</td><td>100%</td><td>满意</td><td>" + tsbl_wx + "</td>" + "</tr>");

                    bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>电话</td><td>" + TotalCount_dh.ToString() + "</td><td>转办+客服化解</td><td>100%</td><td>满意</td><td>" + tsbl_dh + "</td>" + "</tr>");

                    bgmc2tb4.Append("</tbody></table>");
                    #endregion
                    #region 以责任部门为标准的分析情况（转办）
                    bgmc2tb5.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
                    bgmc2tb5.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:120.55pt;\">部门</td>");
                    bgmc2tb5.Append("<td style=\"width:120.5pt;\">员工服务</td><td style=\"width:120.5pt;\">政策规定</td>");
                    bgmc2tb5.Append("<td style=\"width:120.5pt;\">设备</td><td style=\"width:120.5pt;\">合计</td>");
                    bgmc2tb5.Append("<td style=\"width:120.5pt;\">占总投诉比例</td>");
                    if (dataContent != null)
                    {
                        DataRow[] rowsZB = dataContent.Select("F_HOUSING='投诉' and 处理方式='转办' ");
                        foreach (DataRow row in rowsZB)
                        {
                            TotalCountZB += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rowsajry = dataContent.Select("F_HOUSING='投诉' and 处理方式='转办' and F_ADSLACCOUNT='投诉安检工作人员'");
                        foreach (DataRow row in rowsajry)
                        {
                            TotalCount_ajry += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rowskyry = dataContent.Select("F_HOUSING='投诉' and 处理方式='转办' and F_ADSLACCOUNT='投诉客运工作人员'");
                        foreach (DataRow row in rowskyry)
                        {
                            TotalCount_kyry += int.Parse(row["总数"].ToString());
                        }
                        TotalCount_qtry = TotalCountZB - TotalCount_ajry - TotalCount_kyry;
                    }
                    bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>安保部</td><td>" + TotalCount_ajry.ToString() + "</td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");

                    bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>站务中心</td><td>" + TotalCount_kyry.ToString() + " </td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");

                    bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>其他</td><td>" + TotalCount_qtry.ToString() + "</td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");

                    bgmc2tb5.Append("</tbody></table>");
                    #endregion
                    #region 化解率
                    kfclcount = tscounthj - zbclcount;
                    if (tscounthj > 0)
                    {
                        decimal kfclcountint = Convert.ToDecimal(kfclcount) * 100 / Convert.ToDecimal(tscounthj);
                        tshjl = kfclcountint.ToString("f") + "%";
                    }
                    else
                    {
                        tshjl = "0%";
                    }
                    #endregion
                }
            }
            else {
                bgmc2tb4.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
                bgmc2tb4.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:102.5pt;\">受理方式</td>");
                bgmc2tb4.Append("<td style=\"width:120.5pt;\">投诉件数</td><td style=\"width:120.5pt;\">处理方式</td>");
                bgmc2tb4.Append("<td style=\"width:120.5pt;\">回访率</td><td style=\"width:120.5pt;\">满意度</td>");
                bgmc2tb4.Append("<td style=\"width:120.5pt;\">占总投诉比例</td>");
                bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>0</td><td>转办</td><td>0%</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>0</td><td>转办</td><td>0%</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb4.Append("<tr style=\"height:36.95pt\"><td>电话</td><td>0</td><td>转办+客服化解</td><td>0%</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb4.Append("</tbody></table>");
                tsbl_dh = "0%";
                bgmc2tb5.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
                bgmc2tb5.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:120.55pt;\">部门</td>");
                bgmc2tb5.Append("<td style=\"width:120.5pt;\">员工服务</td><td style=\"width:120.5pt;\">政策规定</td>");
                bgmc2tb5.Append("<td style=\"width:120.5pt;\">设备</td><td style=\"width:120.5pt;\">合计</td>");
                bgmc2tb5.Append("<td style=\"width:120.5pt;\">占总投诉比例</td>");
                bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>安保部</td><td>0</td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>站务中心</td><td>0 </td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb5.Append("<tr style=\"height:36.95pt\"><td>其他</td><td>0</td><td>/</td><td>/</td><td>/</td><td>/</td>" + "</tr>");
                bgmc2tb5.Append("</tbody></table>");
            } 
            return StrContent.ToString() + "^" + bgmc2tb2 + "^bgmc2tb2" + "^" + json + "^" + tscounthj.ToString()
                + "^" + zbclcount.ToString()+"^" + kfclcount.ToString()+ "^" + tshjl + "^" + bgmc2tb4 + "^" + bgmc2tb5
                + "^" + tsbl_dh;
        }
        [ActionName("ReportWorkOrderInfoQuarterNewTwoQTMX")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNewTwoQTMX(string dateParty)
        {
            string StrContent = "";
            string bgmc2tb2 = "<br /><div id=\"bgmc2tb2\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            DataTable nowDataTable = recordBLL.GetWorkOrderTrainFunctionRXQT(startDate, endDate);
            DataTable preDataTable = recordBLL.GetWorkOrderTrainFunctionRXQT(prestartDate, preendDate);
            //string json = CallInTypeMatchChartData(DateTime.Now, dateParty);
            string json = zxywtypeWorkOrderPreMX(DateTime.Now, dateParty);
            #region   
            int jycount = 0;
            int bycount = 0;
            int gscount = 0; 
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                { 
                    #region 建议
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='14'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                    #region 表扬
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='18'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion
                    #region 挂失
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("业务类别='19'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { }
                    #endregion  
                }
            }



            return StrContent.ToString() + "^" + bgmc2tb2 + "^bgmc2tb2" + "^" + json + "^" + jycount.ToString()
                + "^" + gscount.ToString() + "^" + bycount.ToString();
        }
        [ActionName("ReportWorkOrderInfoQuarterNewTwoWXMX")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNewTwoWXMX(string dateParty)
        {
            string StrContent = "";
            string bgmc4tb1 = "<br /><div id=\"bgmc4tb1\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
            DataTable wxDataTable = recordBLL.GetWorkOrderTrainFunctionRXWX(startDate, endDate,"3");
             string json = zxywtypeWorkOrderPreMX(DateTime.Now, dateParty);
            #region   
            int wxcount = 0;
            int wxcountrx = 0;
            int wxxtCount = 0;
            #endregion
            #region 微信
            //微信业务工单数 
            wxxtCount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0);


             if (wxDataTable != null)
            {
                if (wxDataTable.Rows.Count > 0)
                {
                   
                    try
                    {
                        DataRow[] rows = wxDataTable.Select("");
                        foreach (DataRow row in rows)
                        {
                            wxcountrx += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { } 
                }
            }
            wxcount = wxcountrx + wxxtCount;
            #endregion

            return StrContent.ToString() + "^" + bgmc4tb1 + "^bgmc4tb1" + "^" + json + "^" + wxcount.ToString();
        }
        [ActionName("ReportWorkOrderInfoQuarterNewTwoWBMX")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarterNewTwoWBMX(string dateParty)
        {
            string StrContent = "";
            string bgmc3tb1 = "<br /><div id=\"bgmc3tb1\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><br>";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            //dateParty = "2019-01-01 - 2019-12-31";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;
             DataTable wbDataTable = recordBLL.GetWorkOrderTrainFunctionRXWX(startDate, endDate, "4");
            string json = zxywtypeWorkOrderPreMX(DateTime.Now, dateParty);
            #region   
            int wbcount = 0;
            int wbcountrx = 0;
            int wbxtCount = 0;
            #endregion
            #region 微信 
            //微博业务工单数 
             wbxtCount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0);
            if (wbDataTable != null)
            {
                if (wbDataTable.Rows.Count > 0)
                {

                    try
                    {
                        DataRow[] rows = wbDataTable.Select("");
                        foreach (DataRow row in rows)
                        {
                            wbcountrx += int.Parse(row["业务量"].ToString());
                        }
                    }
                    catch
                    { }
                }
            }
            wbcount = wbcountrx + wbxtCount;
            #endregion

            return StrContent.ToString() + "^" + bgmc3tb1 + "^bgmc3tb1" + "^" + json + "^" + wbcount.ToString();
        }
        //热线类型 图表
        public string WorkOrderTypeMathChartDataRX(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }
            DataTable datas = recordBLL.GetWorkOrderBussTypeDataRX(startDate, endDate);
            DataTable newTable = new DataTable();
            newTable.Columns.Add("业务类型");
            newTable.Columns.Add("工单数量");
            DataRow dataRow;
             
            if (datas != null && datas.Rows.Count > 0)
            {
                foreach (DataRow thisRow in datas.Rows)
                {

                    if (thisRow["BusinessType"].ToString() == "6")
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "咨询";

                        int totalCount = 0;
                        string getCount = thisRow["callInCount"].ToString();
                        if (!string.IsNullOrEmpty(getCount))
                        {
                            totalCount = int.Parse(getCount);
                        }
                        dataRow["工单数量"] = totalCount;


                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "14"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "建议";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "18"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "表扬";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                    else if ((thisRow["BusinessType"].ToString() == "19"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "挂失";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }
                    else if ((thisRow["BusinessType"].ToString() == "3"))
                    {
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = "投诉";
                        dataRow["工单数量"] = thisRow["callInCount"];
                        newTable.Rows.Add(dataRow);
                    }

                }


            }
            if (newTable != null && newTable.Rows.Count > 0)
            {
                string[] strArr = new string[newTable.Rows.Count];
                string contentArr = "";
                for (int i = 0; i < newTable.Rows.Count; i++)
                {
                    strArr[i] = newTable.Rows[i]["业务类型"].ToString();
                    if (i == 0)
                    {
                        contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";
                    }
                    else
                    {
                        contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";

                    }
                }

                dataModel.bottom = JsonConvert.SerializeObject(strArr);
                dataModel.datas = "[" + contentArr + "]";

            }
            return JsonConvert.SerializeObject(dataModel);
        }
        //热线咨询明细图表
        public string zxywtypeWorkOrderPreMX(DateTime? NowDateTime, string dateParty)
        {
            //数据结果集
            MainChartModel dataModel = new MainChartModel();
            string startDate = "";
            string endDate = "";
            DataTable dt = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(dateParty))
                {
                    startDate = dateParty.Substring(0, 10);
                    endDate = dateParty.Substring(12); 
                }
                else
                {
                    startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
                }
                DataTable newTable = new DataTable();
                newTable.Columns.Add("业务类型");
                newTable.Columns.Add("工单数量");
                List<Model.T_Wo_WorkOrderType> namelist = new BLL.T_Wo_WorkOrderType().GetModelList(" F_ParentId=6 ");

                if (namelist != null)
                {
                    dt = new BLL.T_Wo_WorkOrderBase().GetList("F_CREATEDATE>='" + startDate + "'and F_CREATEDATE<='" + endDate + "' and F_FILEFLAG=6").Tables[0];

                    //dt = new BLL.T_Wo_WorkOrderBase().GetList(" DATEDIFF(DAY,'" + startDate + "',F_CREATEDATE)>=0 and DATEDIFF(DAY,'" + endDate + "',F_CREATEDATE)<=0 ").Tables[0];
                    int i = 0;
                    int count = 0;
                    DataRow dataRow;
                    foreach (Model.T_Wo_WorkOrderType m in namelist)
                    {
                        count = dt.Select("F_REPAIRLEVEL=" + m.F_WorkOrderTypeId.ToString() + "").Length;
                        dataRow = newTable.NewRow();
                        dataRow["业务类型"] = m.F_Name.Trim();
                        dataRow["工单数量"] = count.ToString();
                        newTable.Rows.Add(dataRow);
                        i++;
                    }
                }
                if (newTable != null && newTable.Rows.Count > 0)
                {
                    string[] strArr = new string[newTable.Rows.Count];
                    string contentArr = "";
                    for (int i = 0; i < newTable.Rows.Count; i++)
                    {
                        strArr[i] = newTable.Rows[i]["业务类型"].ToString();
                        if (i == 0)
                        {
                            contentArr += " { value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";
                        }
                        else
                        {
                            contentArr += " ,{ value: " + newTable.Rows[i]["工单数量"].ToString() + ", name: '" + newTable.Rows[i]["业务类型"].ToString() + "' }";

                        }

                    }
                    dataModel.bottom = JsonConvert.SerializeObject(strArr);
                    dataModel.datas = "[" + contentArr + "]";

                }
            }
            catch (Exception ex) { }
            finally { dt.Clear(); dt.Dispose(); }
            return JsonConvert.SerializeObject(dataModel);
        }

        /// <summary>
        /// 季度
        /// </summary>
        /// <returns></returns>
        [ActionName("ReportWorkOrderInfoQuarter")]
        [HttpGet]
        public string ReportWorkOrderInfoQuarter(string dateParty)
        { 
            string res = "^divWorkOrderInfoOneWeekPie";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-3).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddMonths(-5).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddMonths(-3).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;

            StringBuilder StrContent = new StringBuilder();

            StrContent.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
            StrContent.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:42.55pt;\">受理平台</td>");
            StrContent.Append("<td style=\"width:120.5pt;\">受理总量（件）</td>");
            StrContent.Append("<td style=\"width:70.85pt;\">同比上季度</td>");
            StrContent.Append("<td style=\"width:77.95pt;\">咨询类数量及占比</td>");
            StrContent.Append("<td style=\"width:3.0cm;\">投诉类数量及占比</td>");
            StrContent.Append("<td style=\"width:99.25pt;\">化解投诉量及占比</td></tr>");

            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.WorkOrderDate(prestartDate, preendDate);
            //DataTable nowDataTable = WorkOrderTypeData(DateTime.Now, dateParty);
            //DataTable preDataTable = WorkOrderTypeData(DateTime.Now,predateParty);

            string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            #region 微信
            int wxallcount = 0;
            int wxpreallcount = 0;
            int wxzxcount = 0;
            int wxprezxcount = 0;
            string wxzxzb = "";
            int wxjycount = 0;
            int wxprejycount = 0;
            int wxbycount = 0;
            int wxprebycount = 0;
            int wxgscount = 0;
            int wxpregscount = 0;
            int wxtscount = 0;
            int wxpretscount = 0;
            string wxtszb = "0";
            string wxtb = "0";
            #endregion
            #region 微博
            int wballcount = 0;
            int wbpreallcount = 0;
            int wbzxcount = 0;
            int wbprezxcount = 0;
            string wbzxzb = "";
            int wbjycount = 0;
            int wbprejycount = 0;
            int wbbycount = 0;
            int wbprebycount = 0;
            int wbgscount = 0;
            int wbpregscount = 0;
            int wbtscount = 0;
            int wbpretscount = 0;
            string wbtszb = "0";
            string wbtb = "0";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音
                    int allcount = 0;
                    int preallcount = 0;
                    int zxcount = 0;
                    int prezxcount = 0;
                    string zxzb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            prezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int jycount = 0;
                    int prejycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            prejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int bycount = 0;
                    int prebycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            prebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int gscount = 0;
                    int pregscount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            pregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int tscount = 0;
                    int pretscount = 0;
                    string tszb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            pretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    allcount = zxcount + jycount + bycount + gscount + tscount;
                    preallcount = prezxcount + prejycount + prebycount + pregscount + pretscount;
                    string tb = "";
                    if (preallcount > allcount)
                    {
                        decimal tbint = (Convert.ToDecimal(preallcount) - Convert.ToDecimal(allcount)) * 100 / Convert.ToDecimal(preallcount);
                        tb = "减少" + tbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (preallcount == allcount)
                        {
                            tb = "相同";
                        }
                        else
                        {
                            if (preallcount > 0)
                            {
                                decimal tbint = (Convert.ToDecimal(allcount) - Convert.ToDecimal(preallcount)) * 100 / Convert.ToDecimal(preallcount);
                                tb = "增加" + tbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (allcount > 0)
                    {
                        zxzb = ((Convert.ToDecimal(zxcount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                        tszb = ((Convert.ToDecimal(tscount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                    }
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>" + allcount.ToString() + "</td><td>" + tb + "</td><td>" + zxcount.ToString() + "<br />" + zxzb + "</td><td>" + tscount.ToString() + "<br />" + tszb + "</td><td>-</td></tr>");
                    #endregion

                    #region 微信

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wxzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wxprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wxjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wxprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wxbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wxprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wxgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wxpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wxtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wxpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate, preendDate
                    wxallcount = wxzxcount + wxjycount + wxbycount + wxgscount + wxtscount;
                    wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                    wxpreallcount = wxprezxcount + wxprejycount + wxprebycount + wxpregscount + wxpretscount;
                    wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                    if (wxpreallcount > wxallcount)
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "减少" + wxtbint.ToString("f") + "%";
                        }
                    }
                    else
                    {
                        if (wxpreallcount == wxallcount)
                        {
                            wxtb = "相同";
                        }
                        else
                        {
                            if (wxpreallcount > 0)
                            {
                                decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                                wxtb = "增加" + wxtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wxallcount > 0)
                    {
                        wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                        wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    }

                    #endregion

                    #region 微博

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wbzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wbprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wbjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wbprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wbbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wbprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wbgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wbpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wbtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wbpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate,preendDate
                    wballcount = wbzxcount + wbjycount + wbbycount + wbgscount + wbtscount;
                    wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                    wbpreallcount = wbprezxcount + wbprejycount + wbprebycount + wbpregscount + wbpretscount;
                    wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                    if (wbpreallcount > wballcount)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "减少" + wbtbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (wbpreallcount == wballcount)
                        {
                            wbtb = "相同";
                        }
                        else
                        {
                            if (wbpreallcount > 0)
                            {
                                decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                                wbtb = "增加" + wbtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wballcount > 0)
                    {
                        wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                        wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    }

                    #endregion
                }
                else
                {
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                }
            }
            else
            {
                StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                #region 微信
                wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                if (wxpreallcount > wxallcount)
                {
                    if (wxpreallcount > 0)
                    {
                        decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                        wxtb = "减少" + wxtbint.ToString("f") + "%";
                    }
                }
                else
                {
                    if (wxpreallcount == wxallcount)
                    {
                        wxtb = "相同";
                    }
                    else
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "增加" + wxtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wxallcount > 0)
                {
                    wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                }
                #endregion
                #region  微博
                wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                if (wbpreallcount > wballcount)
                {
                    decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                    wbtb = "减少" + wbtbint.ToString("f") + "%";
                }
                else
                {
                    if (wbpreallcount == wballcount)
                    {
                        wbtb = "相同";
                    }
                    else
                    {
                        if (wbpreallcount > 0)
                        {
                            decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                            wbtb = "增加" + wbtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wballcount > 0)
                {
                    wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                }
                #endregion
            }

            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");

            //wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;

            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>" + wxallcount.ToString() + "</td><td>" + wxtb + "</td><td>" + wxzxcount.ToString() + "<br />" + wxzxzb + "</td><td>" + wxtscount.ToString() + "<br />" + wxtszb + "</td><td>-</td></tr>");

            //wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate,0) + wballcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>" + wballcount.ToString() + "</td><td>" + wbtb + "</td><td>" + wbzxcount.ToString() + "<br />" + wbzxzb + "</td><td>" + wbtscount.ToString() + "<br />" + wbtszb + "</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            StrContent.Append("</tbody></table>");

            string divWorkOrderInfoOneWeekPie = "<br /><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 80px; width: 100%;text-align:center; background-color: #ffffff\"><br /><br />（本周客服已化解投诉共16件，投诉化解率为：76%）<br /><br /></div>";


            return StrContent.ToString() + "^" + divWorkOrderInfoOneWeekPie + "^divWorkOrderInfoOneWeekPie" + "^" + json;
        }
        /// <summary>
        /// 年度
        /// </summary>
        /// <returns></returns>
        [ActionName("ReportWorkOrderInfoYear")]
        [HttpGet]
        public string ReportWorkOrderInfoYear(string dateParty)
        { 
            string res = "^divWorkOrderInfoOneWeekPie";
            //数据结果集
            string startDate = "";
            string endDate = "";
            string prestartDate = "";
            string preendDate = "";
            string predateParty = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
                prestartDate = Convert.ToDateTime(startDate).AddYears(-1).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddYears(-1).ToString("yyyy-MM-dd");

            }
            else
            {
                endDate = DateTime.Now.ToString("yyyy-MM-dd");
                startDate = DateTime.Now.ToString("yyyy-MM-dd");
                prestartDate = Convert.ToDateTime(startDate).AddYears(-1).ToString("yyyy-MM-dd");
                preendDate = Convert.ToDateTime(endDate).AddYears(-1).ToString("yyyy-MM-dd");
            }
            predateParty = prestartDate + " - " + preendDate;

            StringBuilder StrContent = new StringBuilder();

            StrContent.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" style=\"text-align:center; border-collapse:collapse;font-family:'Times New Roman';color:black;\">");
            StrContent.Append("<tbody><tr style=\"height:36.95pt\"><td style=\"width:42.55pt;\">受理平台</td>");
            StrContent.Append("<td style=\"width:120.5pt;\">受理总量（件）</td>");
            StrContent.Append("<td style=\"width:70.85pt;\">同比上年度</td>");
            StrContent.Append("<td style=\"width:77.95pt;\">咨询类数量及占比</td>");
            StrContent.Append("<td style=\"width:3.0cm;\">投诉类数量及占比</td>");
            StrContent.Append("<td style=\"width:99.25pt;\">化解投诉量及占比</td></tr>");

            DataTable nowDataTable = recordBLL.WorkOrderDate(startDate, endDate);
            DataTable preDataTable = recordBLL.WorkOrderDate(prestartDate, preendDate);
            //DataTable nowDataTable = WorkOrderTypeData(DateTime.Now, dateParty);
            //DataTable preDataTable = WorkOrderTypeData(DateTime.Now,predateParty);

            string json = WorkOrderTypeMathChartData(DateTime.Now, dateParty);
            #region 微信
            int wxallcount = 0;
            int wxpreallcount = 0;
            int wxzxcount = 0;
            int wxprezxcount = 0;
            string wxzxzb = "";
            int wxjycount = 0;
            int wxprejycount = 0;
            int wxbycount = 0;
            int wxprebycount = 0;
            int wxgscount = 0;
            int wxpregscount = 0;
            int wxtscount = 0;
            int wxpretscount = 0;
            string wxtszb = "0";
            string wxtb = "0";
            #endregion
            #region 微博
            int wballcount = 0;
            int wbpreallcount = 0;
            int wbzxcount = 0;
            int wbprezxcount = 0;
            string wbzxzb = "";
            int wbjycount = 0;
            int wbprejycount = 0;
            int wbbycount = 0;
            int wbprebycount = 0;
            int wbgscount = 0;
            int wbpregscount = 0;
            int wbtscount = 0;
            int wbpretscount = 0;
            string wbtszb = "0";
            string wbtb = "0";
            #endregion
            if (nowDataTable != null)
            {
                if (nowDataTable.Rows.Count > 0)
                {
                    #region 语音
                    int allcount = 0;
                    int preallcount = 0;
                    int zxcount = 0;
                    int prezxcount = 0;
                    string zxzb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            zxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            prezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int jycount = 0;
                    int prejycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            jycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            prejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int bycount = 0;
                    int prebycount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            bycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            prebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int gscount = 0;
                    int pregscount = 0;
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            gscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            pregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    int tscount = 0;
                    int pretscount = 0;
                    string tszb = "";
                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            tscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='语音' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            pretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    allcount = zxcount + jycount + bycount + gscount + tscount;
                    preallcount = prezxcount + prejycount + prebycount + pregscount + pretscount;
                    string tb = "";
                    if (preallcount > allcount)
                    {
                        decimal tbint = (Convert.ToDecimal(preallcount) - Convert.ToDecimal(allcount)) * 100 / Convert.ToDecimal(preallcount);
                        tb = "减少" + tbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (preallcount == allcount)
                        {
                            tb = "相同";
                        }
                        else
                        {
                            if (preallcount > 0)
                            {
                                decimal tbint = (Convert.ToDecimal(allcount) - Convert.ToDecimal(preallcount)) * 100 / Convert.ToDecimal(preallcount);
                                tb = "增加" + tbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (allcount > 0)
                    {
                        zxzb = ((Convert.ToDecimal(zxcount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                        tszb = ((Convert.ToDecimal(tscount) * 100 / Convert.ToDecimal(allcount))).ToString("f") + "%";
                    }
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>" + allcount.ToString() + "</td><td>" + tb + "</td><td>" + zxcount.ToString() + "<br />" + zxzb + "</td><td>" + tscount.ToString() + "<br />" + tszb + "</td><td>-</td></tr>");
                    #endregion

                    #region 微信

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wxzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wxprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wxjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wxprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wxbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wxprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wxgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wxpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wxtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微信' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wxpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate, preendDate
                    wxallcount = wxzxcount + wxjycount + wxbycount + wxgscount + wxtscount;
                    wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                    wxpreallcount = wxprezxcount + wxprejycount + wxprebycount + wxpregscount + wxpretscount;
                    wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                    if (wxpreallcount > wxallcount)
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "减少" + wxtbint.ToString("f") + "%";
                        }
                    }
                    else
                    {
                        if (wxpreallcount == wxallcount)
                        {
                            wxtb = "相同";
                        }
                        else
                        {
                            if (wxpreallcount > 0)
                            {
                                decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                                wxtb = "增加" + wxtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wxallcount > 0)
                    {
                        wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                        wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    }

                    #endregion

                    #region 微博

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows)
                        {
                            wbzxcount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='咨询'");
                        foreach (DataRow row in rows1)
                        {
                            wbprezxcount += int.Parse(row["总数"].ToString());
                        }
                        //zxcount = Convert.ToInt32(nowDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                        //prezxcount = Convert.ToInt32(preDataTable.Select("业务类型='咨询'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows)
                        {
                            wbjycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='建议'");
                        foreach (DataRow row in rows1)
                        {
                            wbprejycount += int.Parse(row["总数"].ToString());
                        }
                        //jycount = Convert.ToInt32(nowDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                        //prejycount = Convert.ToInt32(preDataTable.Select("业务类型='建议'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows)
                        {
                            wbbycount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='表扬'");
                        foreach (DataRow row in rows1)
                        {
                            wbprebycount += int.Parse(row["总数"].ToString());
                        }
                        //bycount = Convert.ToInt32(nowDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                        //prebycount = Convert.ToInt32(preDataTable.Select("业务类型='表扬'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows)
                        {
                            wbgscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='挂失'");
                        foreach (DataRow row in rows1)
                        {
                            wbpregscount += int.Parse(row["总数"].ToString());
                        }
                        //gscount = Convert.ToInt32(nowDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                        //pregscount = Convert.ToInt32(preDataTable.Select("业务类型='挂失'")[0]["工单数量"]);
                    }
                    catch
                    { }

                    try
                    {
                        DataRow[] rows = nowDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows)
                        {
                            wbtscount += int.Parse(row["总数"].ToString());
                        }
                        DataRow[] rows1 = preDataTable.Select("工单类型='微博' and F_HOUSING='投诉'");
                        foreach (DataRow row in rows1)
                        {
                            wbpretscount += int.Parse(row["总数"].ToString());
                        }
                        //tscount = Convert.ToInt32(nowDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                        //pretscount = Convert.ToInt32(preDataTable.Select("业务类型='投诉'")[0]["工单数量"]);
                    }
                    catch
                    { }
                    //prestartDate,preendDate
                    wballcount = wbzxcount + wbjycount + wbbycount + wbgscount + wbtscount;
                    wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                    wbpreallcount = wbprezxcount + wbprejycount + wbprebycount + wbpregscount + wbpretscount;
                    wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                    if (wbpreallcount > wballcount)
                    {
                        decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                        wbtb = "减少" + wbtbint.ToString("f") + "%";
                    }
                    else
                    {
                        if (wbpreallcount == wballcount)
                        {
                            wbtb = "相同";
                        }
                        else
                        {
                            if (wbpreallcount > 0)
                            {
                                decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                                wbtb = "增加" + wbtbint.ToString("f") + "%";
                            }
                        }
                    }
                    if (wballcount > 0)
                    {
                        wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                        wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    }

                    #endregion
                }
                else
                {
                    StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                }
            }
            else
            {
                StrContent.Append("<tr style=\"height:36.95pt\"><td>热线</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>");
                #region 微信
                wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;
                wxpreallcount = wxwbWorkOrderCount("wxcount", prestartDate, preendDate, 0) + wxpreallcount;
                if (wxpreallcount > wxallcount)
                {
                    if (wxpreallcount > 0)
                    {
                        decimal wxtbint = (Convert.ToDecimal(wxpreallcount) - Convert.ToDecimal(wxallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                        wxtb = "减少" + wxtbint.ToString("f") + "%";
                    }
                }
                else
                {
                    if (wxpreallcount == wxallcount)
                    {
                        wxtb = "相同";
                    }
                    else
                    {
                        if (wxpreallcount > 0)
                        {
                            decimal wxtbint = (Convert.ToDecimal(wxallcount) - Convert.ToDecimal(wxpreallcount)) * 100 / Convert.ToDecimal(wxpreallcount);
                            wxtb = "增加" + wxtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wxallcount > 0)
                {
                    wxzxzb = ((Convert.ToDecimal(wxzxcount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                    wxtszb = ((Convert.ToDecimal(wxtscount) * 100 / Convert.ToDecimal(wxallcount))).ToString("f") + "%";
                }
                #endregion
                #region  微博
                wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate, 0) + wballcount;
                wbpreallcount = wxwbWorkOrderCount("wbcount", prestartDate, preendDate, 0) + wbpreallcount;
                if (wbpreallcount > wballcount)
                {
                    decimal wbtbint = (Convert.ToDecimal(wbpreallcount) - Convert.ToDecimal(wballcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                    wbtb = "减少" + wbtbint.ToString("f") + "%";
                }
                else
                {
                    if (wbpreallcount == wballcount)
                    {
                        wbtb = "相同";
                    }
                    else
                    {
                        if (wbpreallcount > 0)
                        {
                            decimal wbtbint = (Convert.ToDecimal(wballcount) - Convert.ToDecimal(wbpreallcount)) * 100 / Convert.ToDecimal(wbpreallcount);
                            wbtb = "增加" + wbtbint.ToString("f") + "%";
                        }
                    }
                }
                if (wballcount > 0)
                {
                    wbzxzb = ((Convert.ToDecimal(wbzxcount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                    wbtszb = ((Convert.ToDecimal(wbtscount) * 100 / Convert.ToDecimal(wballcount))).ToString("f") + "%";
                }
                #endregion
            }

            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");

            //wxallcount = wxwbWorkOrderCount("wxcount", startDate, endDate, 0) + wxallcount;

            StrContent.Append("<tr style=\"height:36.95pt\"><td>微信</td><td>" + wxallcount.ToString() + "</td><td>" + wxtb + "</td><td>" + wxzxcount.ToString() + "<br />" + wxzxzb + "</td><td>" + wxtscount.ToString() + "<br />" + wxtszb + "</td><td>-</td></tr>");

            //wballcount = wxwbWorkOrderCount("wbcount", startDate, endDate,0) + wballcount;
            StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>" + wballcount.ToString() + "</td><td>" + wbtb + "</td><td>" + wbzxcount.ToString() + "<br />" + wbzxzb + "</td><td>" + wbtscount.ToString() + "<br />" + wbtszb + "</td><td>-</td></tr>");
            //StrContent.Append("<tr style=\"height:36.95pt\"><td>微博</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>");
            StrContent.Append("</tbody></table>");

            string divWorkOrderInfoOneWeekPie = "<br /><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 300px; width: 100%;background-color: #ffffff\"></div><div id=\"divWorkOrderInfoOneWeekPie\" style=\"height: 80px; width: 100%;text-align:center; background-color: #ffffff\"><br /><br />（本周客服已化解投诉共16件，投诉化解率为：76%）<br /><br /></div>";


            return StrContent.ToString() + "^" + divWorkOrderInfoOneWeekPie + "^divWorkOrderInfoOneWeekPie" + "^" + json;
        }

        #endregion

        #region 获取业务工单数据


        public ActionResult WorkOrderShow()
        {
            WorkOrderMyModel model = new WorkOrderMyModel();

            return View(model);


        }
        /// <summary>
        /// 获取工单信息
        /// </summary>
        /// <param name="page">当前页码</param>
        /// <param name="limit">每页数据量</param>
        /// <param name="sqlWhere">查询条件</param>
        /// <returns></returns>
        [ActionName("WorkOrderDate")]
        [HttpGet]
        public string WorkOrderDate(DateTime? NowDateTime, string dateParty)
        {
            //string time = "";
            //ExToExcelDZNEW(time);

            //数据结果集
            ResponseData dataModel = new ResponseData();
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);

            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            
            LogHelper.Default.WriteInfo("1");

            StringBuilder StrContent = new StringBuilder();
            DataTable datas = recordBLL.WorkOrderDate(startDate, endDate);
            
            LogHelper.Default.WriteInfo("2");

            //工单类型
            List<Model.T_Wo_WorkOrderType> orderTypeList = GetWorkTypeModelList();

            LogHelper.Default.WriteInfo("3");

            StrContent.Append("<table class=\"layui-table\" style=\"height:calc(100% -10px);overflow-y:scroll;\"   lay-size=\"sm\">");
            StrContent.Append(" <colgroup>");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col width=\"100\">");
            StrContent.Append(" <col>");
            StrContent.Append("  </colgroup>");
            StrContent.Append(" <thead>");
            StrContent.Append(" <tr>");
            StrContent.Append(" <th>一级指标</th>");
            StrContent.Append("<th>数量</th>");
            StrContent.Append("<th>二级指标</th>");
            StrContent.Append(" <th>数量</th>");
            StrContent.Append(" <th>三级指标</th>");
            StrContent.Append(" <th>数量</th>");
            StrContent.Append(" <th>四级指标</th>");
            StrContent.Append(" <th>数量</th>");
            StrContent.Append("  </tr> ");
            StrContent.Append(" </thead>");
            StrContent.Append("<tbody>");


            DataTable dt = new DataTable();

            LogHelper.Default.WriteInfo("4");

            dt.Columns.Add("一级指标", typeof(string));
            dt.Columns.Add("数量1", typeof(string));
            dt.Columns.Add("二级指标", typeof(string));
            dt.Columns.Add("数量2", typeof(string));
            dt.Columns.Add("三级指标", typeof(string));
            dt.Columns.Add("数量3", typeof(string));
            dt.Columns.Add("四级指标", typeof(string));
            dt.Columns.Add("数量4", typeof(string)); 
            
            if (datas != null)
            {

                LogHelper.Default.WriteInfo("5");

                int rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(StrContent, "语音", datas, model, rootOrder, startDate, endDate, "1", dt);
                    rootOrder++;
                }

                LogHelper.Default.WriteInfo("6");

                rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(StrContent, "微信", datas, model, rootOrder, startDate, endDate, "3", dt);
                    rootOrder++;
                }

                LogHelper.Default.WriteInfo("7");

                rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(StrContent, "微博", datas, model, rootOrder, startDate, endDate, "4", dt);
                    rootOrder++;
                }

                LogHelper.Default.WriteInfo("8");
            }
            else
            {
                StrContent.Append(" <tr >");

                DataRow dr = dt.NewRow();

                StrContent.Append("  <td colspan=\"8\" style=\"text-align:center\">暂无数据！</td>");

                dr["一级指标"] = "暂无数据！";

                StrContent.Append(" </tr>");

                dt.Rows.Add(dr);

                LogHelper.Default.WriteInfo("9");

            }
            //int zhj = RxworkCount + WxworkCount;

            int zhj = rxzhj + wxzhj + wbzhj ;
            StrContent.Append(" <tr>");

            LogHelper.Default.WriteInfo("10");

            DataRow drsv = dt.NewRow();

            LogHelper.Default.WriteInfo("11");

            StrContent.Append(" <td>业务工单总合计：");

            drsv["一级指标"] = "业务工单总合计：";

            StrContent.Append(" </td>");
            //StrContent.Append(" <td>" + zhj.ToString() + "</td>");
            StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + "业务工单数\",\"\",\"\",\"\",\"\",\"\")'>");
            StrContent.Append(zhj.ToString());
            StrContent.Append("</a></b></td>");

            LogHelper.Default.WriteInfo("12");


            drsv["数量1"] = zhj.ToString();

            StrContent.Append("<td>&nbsp;</td>");
            StrContent.Append(" <td>&nbsp;</td>");
            StrContent.Append(" <td>&nbsp;</td>");
            StrContent.Append(" <td>&nbsp;</td>");
            StrContent.Append(" <td>&nbsp;</td>");
            StrContent.Append(" <td>&nbsp;</td>");
            StrContent.Append(" </tr>");

            dt.Rows.Add(drsv);

            LogHelper.Default.WriteInfo("13");

            StrContent.Append(" </tbody>");
            StrContent.Append("</table>");

            LogHelper.Default.WriteInfo("14");

            return StrContent.ToString();
        }


        /// <summary>
        /// 新综合报表
        /// </summary>
        /// <param name="dateParty"></param>
        /// <returns></returns>
        public string ExToExcelDZNEW(string dateParty)
        {
            string startDate = "";
            string endDate = "";
            if (!string.IsNullOrEmpty(dateParty))
            {
                startDate = dateParty.Substring(0, 10);
                endDate = dateParty.Substring(12);
            }
            else
            {
                startDate = endDate = DateTime.Now.ToString("yyyy-MM-dd");
            }

            //startDate = "2020-02-04";
            //endDate = "2021-02-04";

            DataTable datas = recordBLL.WorkOrderDate(startDate, endDate);

            DataTable dt = new DataTable();

            dt.Columns.Add("一级指标", typeof(string));
            dt.Columns.Add("数量1", typeof(string));
            dt.Columns.Add("二级指标", typeof(string));
            dt.Columns.Add("数量2", typeof(string));
            dt.Columns.Add("三级指标", typeof(string));
            dt.Columns.Add("数量3", typeof(string));
            dt.Columns.Add("四级指标", typeof(string));
            dt.Columns.Add("数量4", typeof(string));

            List<Model.T_Wo_WorkOrderType> orderTypeList = GetWorkTypeModelList();
            if (datas != null)
            {
                StringBuilder sb = new StringBuilder();
                int rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(sb, "语音", datas, model, rootOrder, startDate, endDate, "1", dt);
                    rootOrder++;
                }


                rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(sb, "微信", datas, model, rootOrder, startDate, endDate, "3", dt);
                    rootOrder++;
                }

                rootOrder = 0;
                foreach (T_Wo_WorkOrderType model in orderTypeList)
                {
                    GetDataRow(sb, "微博", datas, model, rootOrder, startDate, endDate, "4", dt);
                    rootOrder++;
                }
            }
            else
            {
                DataRow dr = dt.NewRow();
                dr["一级指标"] = "暂无数据！";
                dt.Rows.Add(dr);
            }
            //int zhj = RxworkCount + WxworkCount;
            int zhj = rxzhj + wxzhj + wbzhj;
            DataRow drsv = dt.NewRow();
            drsv["一级指标"] = "业务工单总合计：";
            drsv["数量1"] = zhj.ToString();

            dt.Rows.Add(drsv);


            ResponseDataModel NewData = new ResponseDataModel();

            ExcelReadWrite erw = new ExcelReadWrite();
            byte[] Filebyte = erw.GetExcelByte(dt, "sheet1", true);

            int officeVersion = erw.OfficeType();


            NewData.Message = DateTime.Now.ToString("yyyy-MM-dd") + "综合报表.xls";

            NewData.Code = "0";
            NewData.Data = JsonConvert.SerializeObject(Filebyte);

            

            return JsonConvert.SerializeObject(NewData);

        }


        /// <summary>
        /// 获取行数据
        /// </summary>
        /// <param name="StrContent">字符串总html</param>
        /// <param name="tittleType">类型</param>
        /// <param name="dataContent">数据内容</param>
        /// <param name="orderTypeName">类型</param>
        public void GetDataRow(StringBuilder StrContent, string tittleType, DataTable dataContent, T_Wo_WorkOrderType orderTypeModel, int rootOrder, string startDate, string endDate,string Qdyw,DataTable dt)
        {
            //string Qdyw = "";
            if (rootOrder == 0)
            {
                //总数 
                int TotalCount = 0;
                if (dataContent != null)
                {
                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "'");
                  
                     TotalCount = rows.Sum(x => x.Field<int>("总数"));

                    #region
                    //foreach (DataRow row in rows)

                    //{

                    //    TotalCount += int.Parse(row["总数"].ToString()); 
                    //}
                    #endregion
                    if (tittleType == "语音")
                    {
                        rxzhj = TotalCount; 
                    }
                        if (tittleType == "微信")
                    {
                        int WxRealTotal = WXWorkOrderCount(3, startDate, endDate);
                        TotalCount = WxRealTotal + TotalCount;
                        wxzhj = TotalCount; 
                    }
                    if (tittleType == "微博")
                    {
                        int WxRealTotal = WXWorkOrderCount(4, startDate, endDate);
                        TotalCount = WxRealTotal + TotalCount;
                        wbzhj = TotalCount; 
                    }
                }

                DataRow dr = dt.NewRow();
               


                StrContent.Append(" <tr>");
                StrContent.Append("  <td>" + tittleType + "业务工单数</td>");

                dr["一级指标"] = tittleType+ "业务工单数";

                StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "业务工单数\",\"\",\"\","+ Qdyw + ",\"\",\"\")'>");

                StrContent.Append(TotalCount.ToString());
                StrContent.Append("</a></b></td>");

                dr["数量1"] = TotalCount.ToString();

                StrContent.Append(" <td>" + orderTypeModel.F_Name + "</td>");

                dr["二级指标"] = orderTypeModel.F_Name;

                StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType+"-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"\","+ Qdyw + ",\"\",\"\")'>");
                //子集总数
                int ChildTotalCount = 0;
                if (dataContent != null)
                {
                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "'");
                    ChildTotalCount = rows.Sum(x => x.Field<int>("总数"));
                    #region
                    //foreach (DataRow row in rows)
                    //{
                    //    ChildTotalCount += int.Parse(row["总数"].ToString());
                    //}
                    #endregion
                    if (tittleType == "微信" && orderTypeModel.F_Name=="咨询")
                    {
                        int WxRealTotal = WXWorkOrderCount(3, startDate, endDate);
                        if (WxRealTotal >= ChildTotalCount)
                        {
                            ChildTotalCount = WxRealTotal + ChildTotalCount;
                        }
                    }
                    if (tittleType == "微博" && orderTypeModel.F_Name == "咨询")
                    {
                        int WxRealTotal = WXWorkOrderCount(4, startDate, endDate);
                        if (WxRealTotal >= ChildTotalCount)
                        {
                            ChildTotalCount = WxRealTotal + ChildTotalCount;
                        }
                    }
                }
                StrContent.Append(ChildTotalCount.ToString());
                StrContent.Append("</a></b></td>");

                dr["数量2"] = ChildTotalCount.ToString();

                //子集
                if (orderTypeModel.WorkTypeModelList != null && orderTypeModel.WorkTypeModelList.Count > 0)
                {
                    StrContent.Append(" <td>" + orderTypeModel.WorkTypeModelList[0].F_Name + "</td>");

                    dr["三级指标"] = orderTypeModel.WorkTypeModelList[0].F_Name;

                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and F_ADSLACCOUNT='" + orderTypeModel.WorkTypeModelList[0].F_Name + "'");

                    if (rows.Length > 0)
                    {
                        StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\""+ orderTypeModel.WorkTypeModelList[0].F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                        StrContent.Append(rows[0]["总数"].ToString());
                        StrContent.Append("</a></b></td>");

                        dr["数量3"] = rows[0]["总数"].ToString();

                        //StrContent.Append(" <td>" + rows[0]["总数"].ToString() + "</td>");
                    }
                    else
                    {
                        StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + orderTypeModel.WorkTypeModelList[0].F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                        StrContent.Append("0");
                        StrContent.Append("</a></b></td>");

                        dr["数量3"] = "0";

                        //StrContent.Append(" <td>0</td>");
                    }

                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");

                }
                else
                {
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");

                }

                StrContent.Append(" </tr>");

                dt.Rows.Add(dr);

                //子集
                if (orderTypeModel.WorkTypeModelList != null && orderTypeModel.WorkTypeModelList.Count > 0)
                {
                    int i = 0;
                    foreach (T_Wo_WorkOrderType childNode in orderTypeModel.WorkTypeModelList)
                    {
                        if (i > 0)
                        {
                            StrContent.Append(" <tr>");

                            DataRow drs = dt.NewRow();


                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append(" <td>" + childNode.F_Name + "</td>");

                            drs["三级指标"] = childNode.F_Name;

                            DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and F_ADSLACCOUNT='" + childNode.F_Name + "'");

                            if (rows.Length > 0)
                            {
                                StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + childNode.F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                                StrContent.Append(rows[0]["总数"].ToString());
                                StrContent.Append("</a></b></td>");

                                drs["数量3"] = rows[0]["总数"].ToString();

                                //StrContent.Append(" <td>" + rows[0]["总数"].ToString() + "</td>");
                            }
                            else
                            {
                                StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + childNode.F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                                StrContent.Append("0");
                                StrContent.Append("</a></b></td>");


                                drs["数量3"] = "0";

                                //StrContent.Append(" <td>0</td>");
                            }

                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append(" </tr>");

                            dt.Rows.Add(drs);
                        }
                        i++;
                    }
                }
            }
            else
            {
                StrContent.Append(" <tr>");

                DataRow dr = dt.NewRow();

                StrContent.Append("  <td></td>");
                StrContent.Append("  <td></td>");
                StrContent.Append(" <td>" + orderTypeModel.F_Name + "</td>");

                dr["二级指标"] = orderTypeModel.F_Name;

                //StrContent.Append(" <td>");
                StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"\","+ Qdyw + ",\"\",\"\")'>");

                //子集总数
                int ChildTotalCount = 0;
                if (dataContent != null)
                {
                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "'");
                    foreach (DataRow row in rows)
                    {
                        ChildTotalCount += int.Parse(row["总数"].ToString());
                    }
                }
                StrContent.Append(ChildTotalCount.ToString());
                //StrContent.Append("</td>");
                StrContent.Append("</a></b></td>");

                dr["数量2"] = ChildTotalCount.ToString();
               
                if (tittleType.Equals("微博"))
                {
                    if (dr["二级指标"].ToString().Equals("投诉"))
                    {
                      
                        dr["数量2"] = (Convert.ToInt32(ChildTotalCount + WXWorkOrderCount(4, startDate, endDate))).ToString();
                        StrContent.Append(dr["数量2"].ToString());
                        //StrContent.Append("</td>");
                        StrContent.Append("</a></b></td>");
                    }
               
                }
                
               


                //子集
                if (orderTypeModel.WorkTypeModelList != null && orderTypeModel.WorkTypeModelList.Count > 0)
                {
                    StrContent.Append(" <td>" + orderTypeModel.WorkTypeModelList[0].F_Name + "</td>");

                    dr["三级指标"] = orderTypeModel.WorkTypeModelList[0].F_Name;

                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and F_ADSLACCOUNT='" + orderTypeModel.WorkTypeModelList[0].F_Name + "'");

                    int nodeCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + orderTypeModel.WorkTypeModelList[0].F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                    foreach (DataRow nodeRow in rows)
                    {
                        nodeCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(nodeCount.ToString());
                    StrContent.Append("</a></b></td>");

                    dr["数量3"] = nodeCount.ToString();

                    //StrContent.Append(" </td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");

                }
                else
                {
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");

                }
                StrContent.Append(" </tr>");

                dt.Rows.Add(dr);


                //子集
                if (orderTypeModel.WorkTypeModelList != null && orderTypeModel.WorkTypeModelList.Count > 0)
                {
                    int i = 0;
                    foreach (T_Wo_WorkOrderType childNode in orderTypeModel.WorkTypeModelList)
                    {
                        if (i > 0)
                        {
                            StrContent.Append(" <tr>");

                            DataRow drsb = dt.NewRow();

                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append(" <td>" + childNode.F_Name + "</td>");

                            drsb["三级指标"] = childNode.F_Name;


                            DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and F_ADSLACCOUNT='" + childNode.F_Name + "'");
                            int nodeCount = 0;
                            //StrContent.Append(" <td>");
                            StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + childNode.F_WorkOrderTypeId + "\"," + Qdyw + ",\"\",\"\")'>");
                           foreach (DataRow nodeRow in rows)
                            {
                                nodeCount += int.Parse(nodeRow["总数"].ToString());
                            }
                            StrContent.Append(nodeCount.ToString());
                            StrContent.Append("</a></b></td>");

                            drsb["数量3"] = nodeCount.ToString();

                            //StrContent.Append("</td>");

                            StrContent.Append("  <td></td>");
                            StrContent.Append("  <td></td>");
                            StrContent.Append(" </tr>");

                            dt.Rows.Add(drsb);

                        }
                        i++;
                    }
                }

                if (orderTypeModel.F_Name == "投诉")
                {
                    StrContent.Append(" <tr>");

                    DataRow drs = dt.NewRow();

                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append(" <td>客服处理</td>");

                    drs["三级指标"] = "客服处理";

                    DataRow[] rows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and 处理方式='客服处理'");
                    int nodeCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + "3" + "\"," + Qdyw + ",\"3\",\"\")'>");

                    foreach (DataRow nodeRow in rows)
                    {
                        nodeCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(nodeCount.ToString());
                    //StrContent.Append("</td>");
                    StrContent.Append("</a></b></td>");

                    drs["数量3"] = nodeCount.ToString();

                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append(" </tr>");

                    dt.Rows.Add(drs);

                    StrContent.Append(" <tr>");

                    DataRow drsa = dt.NewRow();


                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append(" <td>转办</td>");

                    drsa["三级指标"] = "转办";

                    DataRow[] transRows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and  处理方式='转办'");
                    int transCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"" + orderTypeModel.F_WorkOrderTypeId.ToString() + "\",\"" + "3" + "\"," + Qdyw + ",\"1\",\"\")'>");

                    foreach (DataRow nodeRow in transRows)
                    {
                        transCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(transCount.ToString());
                    //StrContent.Append("</td>");
                    StrContent.Append("</a></b></td>");

                    drsa["数量3"] =transCount.ToString();

                    StrContent.Append("  <td>回访满意</td>");

                    drsa["四级指标"] = "回访满意";

                    DataRow[] manyiRows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and  处理方式='转办' and 满意度='满意'");
                    int manyiRowsCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"\",\"" + "3" + "\"," + Qdyw + ",\"1\",\"1\")'>");

                    foreach (DataRow nodeRow in manyiRows)
                    {
                        manyiRowsCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(manyiRowsCount.ToString());
                    //StrContent.Append("</td>");
                    StrContent.Append("</a></b></td>");

                    drsa["数量4"] = manyiRowsCount.ToString();


                    StrContent.Append(" </tr>");

                    dt.Rows.Add(drsa);

                    StrContent.Append(" <tr>");

                    DataRow drsc = dt.NewRow();

                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td>回访一般</td>");

                    drsc["四级指标"] = "回访一般";

                    DataRow[] yibanRows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and  处理方式='转办' and 满意度='一般'");
                    int yibanRowsCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"\",\"" + "3" + "\"," + Qdyw + ",\"1\",\"2\")'>");

                    foreach (DataRow nodeRow in yibanRows)
                    {
                        yibanRowsCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(yibanRowsCount.ToString());
                    //StrContent.Append("</td>");
                    StrContent.Append("</a></b></td>");

                    drsc["数量4"] = yibanRowsCount.ToString();

                    StrContent.Append(" </tr>");

                    dt.Rows.Add(drsc);

                    StrContent.Append(" <tr>");

                    DataRow drsd = dt.NewRow();

                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td></td>");
                    StrContent.Append("  <td>回访不满意</td>");


                    drsd["四级指标"] = "回访不满意";

                    DataRow[] bumanyiRows = dataContent.Select("工单类型='" + tittleType + "' and F_HOUSING='" + orderTypeModel.F_Name + "' and  处理方式='转办' and 满意度='不满意'");
                    int bumanyiRowsCount = 0;
                    //StrContent.Append(" <td>");
                    StrContent.Append(" <td><b style='color: black; cursor:pointer'><a onclick='OpenWorkOrderList(\"" + Convert.ToDateTime(startDate).ToString("yyyy-MM-dd 00:00:00") + " ~ " + Convert.ToDateTime(endDate).ToString("yyyy-MM-dd 23:59:59") + "\",\"" + tittleType + "-" + orderTypeModel.F_Name + "业务工单数\",\"\",\"" + "3" + "\"," + Qdyw + ",\"1\",\"3\")'>");

                    foreach (DataRow nodeRow in bumanyiRows)
                    {
                        bumanyiRowsCount += int.Parse(nodeRow["总数"].ToString());
                    }
                    StrContent.Append(bumanyiRowsCount.ToString());
                    //StrContent.Append("</td>");
                    StrContent.Append("</a></b></td>");

                    drsd["数量4"] = bumanyiRowsCount.ToString();

                    StrContent.Append(" </tr>");

                    dt.Rows.Add(drsd);
                }
            }
            
        }
        /// <summary>
        /// 获取业务类型
        /// </summary>
        public List<Model.T_Wo_WorkOrderType> GetWorkTypeModelList()
        {
            //最终需要返回的菜单
            List<Model.T_Wo_WorkOrderType> newModelList = new List<T_Wo_WorkOrderType>();

            Model.PageData<Model.T_Wo_WorkOrderType> pageModel = new Model.PageData<Model.T_Wo_WorkOrderType>();
            BLL.T_Wo_WorkOrderType bll = new BLL.T_Wo_WorkOrderType();
            //获取业务类型列表
            List<Model.T_Wo_WorkOrderType> WorkTypeModelList = bll.GetModelList("");

            if (WorkTypeModelList != null && WorkTypeModelList.Count > 0)
            {
                //获取默认根节点
                Model.T_Wo_WorkOrderType rootNode = WorkTypeModelList.FirstOrDefault(m => m.F_ParentId == 0);
                //获取一级节点
                List<Model.T_Wo_WorkOrderType> rootModelList = WorkTypeModelList.Where(t => t.F_ParentId == rootNode.F_WorkOrderTypeId).ToList();
                if (rootModelList != null && rootModelList.Count > 0)
                {
                    foreach (T_Wo_WorkOrderType WorkOrderTypeModel in rootModelList)
                    {
                        List<Model.T_Wo_WorkOrderType> nullModelList = new List<T_Wo_WorkOrderType>();
                        WorkOrderTypeModel.WorkTypeModelList = nullModelList;
                        newModelList.Add(GetWorkTypeModelChild(WorkOrderTypeModel, WorkOrderTypeModel, WorkTypeModelList));
                    }
                }
            }
            return newModelList;
        }

        //获取所有子集
        public Model.T_Wo_WorkOrderType GetWorkTypeModelChild(T_Wo_WorkOrderType rootNode, T_Wo_WorkOrderType WorkOrderTypeModel, List<Model.T_Wo_WorkOrderType> WorkTypeModelList)
        {
            //获取子集节点
            List<Model.T_Wo_WorkOrderType> sonModelList = WorkTypeModelList.Where(t => t.F_ParentId == WorkOrderTypeModel.F_WorkOrderTypeId).ToList();

            if (sonModelList != null && sonModelList.Count > 0)
            {
                foreach (T_Wo_WorkOrderType workOrderTypeModel in sonModelList)
                {
                    //获取子子集
                    List<Model.T_Wo_WorkOrderType> childModelList = WorkTypeModelList.Where(t => t.F_ParentId == workOrderTypeModel.F_WorkOrderTypeId).ToList();

                    if (childModelList != null && childModelList.Count > 0)
                    {
                        GetWorkTypeModelChild(rootNode, workOrderTypeModel, WorkTypeModelList);
                    }
                    else
                    {
                        rootNode.WorkTypeModelList.Add(workOrderTypeModel);
                    }


                }

            }

            return rootNode;
        }

        #endregion


        #region 获取在线坐席

        /// <summary>
        /// 获取在线坐席
        /// </summary>
        /// <returns></returns>
        [ActionName("GetLoginUserInfo")]
        [HttpGet]
        public string GetLoginUserInfo()
        {
            //数据结果集
            ResponseData dataModel = new ResponseData();
            try
            {

                dataModel.code = 0;
                dataModel.data = recordBLL.GetLoginUserInfo();

                return JsonConvert.SerializeObject(dataModel);
            }
            catch (Exception ex)
            {
                dataModel.code = 200;
                dataModel.msg = ex.Message;
                return JsonConvert.SerializeObject(dataModel);
            }

        }

        #endregion



        #region 获取坐席微信/微博工单数量

        /// <summary>
        /// 获取坐席微信/微博工单数量
        /// </summary>
        /// <param name="StartDate">开始日期</param>
        /// <param name="EndDate">结束日期</param>
        /// <returns></returns>
        public int wxwbWorkOrderCount(string type, string startDate, string endDate, int wxwbtotalCount)
        {
            int totalCount = 0;
            try
            {
                StringBuilder returnStr = new StringBuilder();
                string wxAddUrl = "http://rexian.zzmetro.com/api/external/" + type;
                string paramsStr = "begin=" + startDate + "&end=" + endDate;
                string addWxResult = HttpHelper.HttpGet(wxAddUrl, paramsStr);
                WXResponseResult ResultModel = JsonConvert.DeserializeObject<WXResponseResult>(addWxResult);

                if (ResultModel != null)
                {
                    if (ResultModel.service != null && ResultModel.service > 0 && ResultModel.service > wxwbtotalCount)
                    {
                        totalCount = ResultModel.service - wxwbtotalCount;
                    }
                }
            }
            catch (Exception ex)
            {

            }

            return totalCount;
        }


        /// <summary>
        /// 获取坐席微信/微博工单数量
        /// </summary>
        /// <param name="StartDate">开始日期</param>
        /// <param name="EndDate">结束日期</param>
        /// <returns></returns>
        public int WorkOrderCount(int? busType, string startDate, string endDate)
        {
            int totalCount = 0;
            try
            {
                //工单数量busType=1， F_REPAIRMANID<=2是语音；busType=2， F_REPAIRMANID=3微信；busType=3， F_REPAIRMANID==4微博
                totalCount = recordBLL.WorkOrderCount(busType, startDate, endDate);

                StringBuilder returnStr = new StringBuilder();
                string wxAddUrl = "http://rexian.zzmetro.com/api/external/wxcount";
               
                string paramsStr = "begin=" + startDate + "&end=" + endDate;
                string addWxResult = HttpHelper.HttpGet(wxAddUrl, paramsStr);
                WXResponseResult ResultModel = JsonConvert.DeserializeObject<WXResponseResult>(addWxResult);

                if (ResultModel != null)
                {
                    if (ResultModel.service != null && ResultModel.service > 0 && ResultModel.service > totalCount)
                    {
                        totalCount = ResultModel.service - totalCount;
                    }

                    //if (ResultModel.customer != null && ResultModel.customer > 0 && ResultModel.customer > totalCount)
                    //{
                    //    totalCount = ResultModel.customer - totalCount;
                    //}
                }
            }
            catch(Exception ex)
            {

            }

            return totalCount;
        }

        /// <summary>
        /// 获取其他坐席微信/微博工单数量
        /// </summary>
        /// <param name="StartDate">开始日期</param>
        /// <param name="EndDate">结束日期</param>
        /// <returns></returns>
        public int WorkOrderOtherCount(int? busType, string startDate, string endDate)
        {
            int totalCount = 0;
            try
            {
                //工单数量
                int allWXCount = recordBLL.WorkOrderCount(busType, startDate, endDate);

                StringBuilder returnStr = new StringBuilder();
                string wxAddUrl = "http://rexian.zzmetro.com/api/external/wxcount";
                // rexian.zzmetro.com
                string paramsStr = "begin=" + startDate + "&end=" + endDate;
                string addWxResult = HttpHelper.HttpGet(wxAddUrl, paramsStr);
                WXResponseResult ResultModel = JsonConvert.DeserializeObject<WXResponseResult>(addWxResult);

                if (ResultModel != null)
                {
                    if (ResultModel.service != null && ResultModel.service > 0 && ResultModel.service > totalCount)
                    {
                        totalCount = ResultModel.service - allWXCount - allWXCount;
                    }
                }
            }
            catch(Exception ex)
            {

            }


            return totalCount;
        }
        #endregion



        #region  其他报表  流失率

        #endregion



        #region 地铁 大屏
        //一 首页

        ///

        /// <summary>
        /// 左1 1.滚动播报最近5条实时受理信息  （类型，时间，标题）
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetFiveWorkOrder()
        {
            JsonSerializerSettings timeConvert = new JsonSerializerSettings() { DateFormatString = "yyyy'-'MM'-'dd' 'HH':'mm':'ss" };
            ResponseData dataModel = new ResponseData();
            dataModel.data = workorderBLL.GetFiveList().Tables[0];
            dataModel.code = 0;
            return JsonConvert.SerializeObject(dataModel, timeConvert);



        }

        //左2   
        //全媒体客服平台历史峰值，日最高受理量，和日最长话务时间  
        public string GetHistoryDayMaxCount()
        {
            DataTable dt= workorderBLL.GetHistoryDayMax();
            return JsonConvert.SerializeObject(dt);
             
        }
        //左2
        //全媒体客服平台历史峰值， 日最长话务时间
        public string  GetHistoryDayLongTel()
        {
            DataTable dt = workorderBLL.GetHistoryDayLongTel();
            return JsonConvert.SerializeObject(dt);
            
        }


        //左下 全媒体客服平台渠道趋势 本月开始最近一年

        [HttpGet]
        public string GetDataFluctuation()
        {
            DataTable dt = workorderBLL.GetDataFluctuation();
        
            string currentMonth = DateTime.Now.ToString("yyyyMM");
          
            DataTable returndt = new DataTable();
      
            returndt.Columns.Add("month", Type.GetType("System.String"));
            returndt.Columns.Add("hwamount", Type.GetType("System.Int32"));
            returndt.Columns.Add("wxamount", Type.GetType("System.Int32"));
            returndt.Columns.Add("wbamount", Type.GetType("System.Int32"));
            for (int i =0; i>-12; i--)
            {
                currentMonth = DateTime.Now.AddMonths(i).ToString("yyyyMM");
                DataRow[] drs = dt.Select("yearmonth='"+currentMonth+"'");

                DataRow dr1 = returndt.NewRow();
                int huawucount = 0;
                int weibocount = 0;
                int wxcount = 0;
                foreach (DataRow DataRow in drs)
                {
                    
                    if (DataRow[0].ToString() == "留言工单")
                    {
                        huawucount += (int) DataRow[2];
                    }
                    if (DataRow[0].ToString() == "语音工单")
                    {
                        huawucount += (int)DataRow[2];
                    }
                    
                    if (DataRow[0].ToString() == "微博工单")
                    {
                        weibocount += (int)DataRow[2];
                    }              
                }
              
                dr1["month"] = currentMonth;                
                dr1["hwamount"] = huawucount;
                DateTime dtday = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
            
                //倒着读取该月份第一天，i是负数
                string startDate = dtday.AddMonths(i).AddDays(1 - dtday.Day).ToString("yyyy-MM-dd") + " 00:00:00";

                DateTime s = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
                DateTime ss = s.AddDays(1 - s.Day);

                //倒着读取月份最后一天
                string endDate = ss.AddMonths(i+1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59";

                wxcount = WXWorkOrderCount(3, startDate, endDate);

                dr1["wxamount"] = wxcount;
                dr1["wbamount"] = weibocount;
               
                returndt.Rows.Add(dr1);

            }

            ResponseData dataModel = new ResponseData();
            dataModel.data = returndt;
            dataModel.code = 0;
            return JsonConvert.SerializeObject(dataModel);

        }



        //中间1 .截止目前当日累计受理量
        [HttpGet]
        public int GetTodayCount()
        {
            return workorderBLL.GetTodayCount();
        }




        /// <summary>
        /// 中间2.本年度、本月度、本周日均受理量(主页面中间为本年度、本月度、本周日均受理量，取倒推1年、1月、1周数据。)
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetAverageAcceptAmount()
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;

            dataModel.data = workorderBLL.GetAverageAcceptAmount();
            return JsonConvert.SerializeObject(dataModel);
        }
        //1.当日话务、微博、微信受理量占比
        //  2.各线路受理量对比
        //3.当日咨询、建议、表扬、挂失、投诉占比


        /// <summary>
        /// 右1 “全媒体平台受理占比统计” 修改为“全媒体客服平台渠道占比”，显示x年x月x日，例：；电话改称话务，数据取当日数据（因当日微博数据不能及时获取，故暂时只显示话务、微信数据，预留微博接口）。
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetTodayFromTypeAmount(string startTime)
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;
            //string startDate = DateTime.Now.ToString("yyyyMMdd") + "00:00:00";
            //string endDate = DateTime.Now.ToString("yyyyMMdd") + "23:59:59";

            string startDate = startTime.Substring(0, 10) + " 00:00:00";
            string endDate = startTime.Substring(12) + " 23:59:59";

            int WxRealTotal = WXWorkOrderCount(3, startDate, endDate);
            DataTable dt = workorderBLL.GetTodayFromTypeAmount(startTime);
            dt.Rows[1]["amount"] = WxRealTotal;
            dataModel.data = dt;
            return JsonConvert.SerializeObject(dataModel);
        }



        //右二 话务受理线路分布
        [HttpGet]
        public string GetTodayLineDistribution(string startTime)
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;
         DataTable dt=  workorderBLL.GetTodayLineDistribution(startTime);     
            dataModel.data = dt;
            return JsonConvert.SerializeObject(dataModel);
        }


        /// <summary>
        ///      右三 当天热线受理类型统计
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetTodayTelType(string startTime)
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;

            dataModel.data = workorderBLL.GetTodayTelType(startTime);
            return JsonConvert.SerializeObject(dataModel);
        }



        //二.次页
        /// <summary>
        ///      中间      当月每日话务统计  改成近30天话务统计
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetEverydayOfMonthTelAmount()
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;
            dataModel.data = workorderBLL.GetEverydayOfMonthTelAmount();
            return JsonConvert.SerializeObject(dataModel);

        }

        /// <summary>
        /// 下一  年度话务统计
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetYearTelAmount()
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;           
            dataModel.data = workorderBLL.GetYearTelAmount();
            return JsonConvert.SerializeObject(dataModel);
        }



        /// <summary>
        /// 下二月度话务统计（倒推六个月的数据）
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetSixMonthTelAmount()
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;
            dataModel.data = workorderBLL.GetSixMonthTelAmount();
            return JsonConvert.SerializeObject(dataModel);        

        }


        // 下 三 话务自动回复数据 
        //来电按钮统计 当天的数据
        [HttpGet]
        public string GetPressKeyValue(string startTime)
        {
            ResponseData dataModel = new ResponseData();
            dataModel.code = 0;
            dataModel.data = workorderBLL.GetPressKeyValue(startTime);
            return JsonConvert.SerializeObject(dataModel);

        }





        //  第三张。
        //左 微信相关的

        /// <summary>
        ///  微信自动回复数据
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string GetWxAutoReply(string startTime) 
        {
            string result = "";

            //string begintime = DateTime.Now.Date.ToString();
            //string endtime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";

            //string begintime = startTime+" 00:00:00";
            // string endtime = startTime + " 23:59:59";

            string begintime = startTime.Substring(0, 10) + " 00:00:00";
            string endtime = startTime.Substring(12) + " 23:59:59";



            string Url = "http://rexian.zzmetro.com/api/external/wxautoreply?begin="+ begintime+ "&end="+ endtime;

            result=   WebHelper.HttpWebRequest(Url);
            result = Regex.Unescape(result);
            Dictionary<string, int> dic = new Dictionary<string, int>();
            if (result == "[]")
            {
                dic.Add("线路查询", 0);
                dic.Add("站点查询", 0);
                dic.Add("时间查询", 0);
                dic.Add("票价查询", 0);

                dic.Add("乘车指南", 0);
                dic.Add("新闻公告", 0);
                dic.Add("在线购票", 0);
                dic.Add("常见咨询问题", 0);
                return JsonConvert.SerializeObject(dic);

            }
            JObject jo = (JObject)JsonConvert.DeserializeObject(result);
            int xlcx = 0;
            int zdcx = 0;
            int sjcx = 0;
            int pjcx = 0;

            int cczn = 0;
            int xwgg = 0;
            int zxgp = 0;
            int cjcxwt = 0;
            #region
            if (jo.Property("线路查询") != null)
            {
                xlcx += Convert.ToInt32( jo["线路查询"]);
            }
            if (jo.Property("1") != null)
            {
                
                    xlcx += Convert.ToInt32(jo["1"]);
                
            }
            if (jo.Property("2") != null)
            {
                zdcx += Convert.ToInt32(jo["2"]);
            }
            if (jo.Property("站点查询") != null)
            {
                zdcx += Convert.ToInt32(jo["站点查询"]);
            }


            if (jo.Property("3") != null)
            {
                sjcx += Convert.ToInt32(jo["3"]);
            }
            if (jo.Property("时间查询") != null)
            {
                sjcx += Convert.ToInt32(jo["时间查询"]);
            }


            if (jo.Property("4") != null)
            {
                pjcx += Convert.ToInt32(jo["4"]);
            }
            if (jo.Property("票价查询") != null)
            {
                pjcx += Convert.ToInt32(jo["票价查询"]);
            }

            if (jo.Property("5") != null)
            {
                cczn += Convert.ToInt32(jo["5"]);
            }
            if (jo.Property("乘车指南") != null)
            {
                cczn += Convert.ToInt32(jo["乘车指南"]);
            }

            if (jo.Property("6") != null)
            {
                xwgg += Convert.ToInt32(jo["6"]);
            }
            if (jo.Property("新闻公告") != null)
            {
                xwgg += Convert.ToInt32(jo["新闻公告"]);
            }


            if (jo.Property("7") != null)
            {
                zxgp += Convert.ToInt32(jo["7"]);
            }
            if (jo.Property("在线购票") != null)
            {
                zxgp += Convert.ToInt32(jo["在线购票"]);
            }


            if (jo.Property("8") != null)
            {
                cjcxwt += Convert.ToInt32(jo["8"]);
            }
            if (jo.Property("常见咨询问题") != null)
            {
                cjcxwt += Convert.ToInt32(jo["常见咨询问题"]);
            }
            #endregion
            
            dic.Add("线路查询", xlcx);
            dic.Add("站点查询", zdcx);
            dic.Add("时间查询", sjcx);
            dic.Add("票价查询", pjcx);

            dic.Add("乘车指南", cczn);
            dic.Add("新闻公告", xwgg);
            dic.Add("在线购票", zxgp);
            dic.Add("常见咨询问题", cjcxwt);      

            return JsonConvert.SerializeObject(dic);
        }

        //右 1 微信当月统计
        [HttpGet]
        public string WXCurrentMonth()
        {
            string result = "";
            string Url = "http://rexian.zzmetro.com/api/external/wxcurrentmonth" ;

            result = WebHelper.HttpWebRequest(Url);
            result = Regex.Unescape(result);
            return result;


        }

        //右 下1   微信年度统计
        [HttpGet]
        public string WXYears()
        {
            string result = "";
            string Url = "http://rexian.zzmetro.com/api/external/wxyear";

            result = WebHelper.HttpWebRequest(Url);
            result = Regex.Unescape(result);
            return result;

        }
        //右 下2.微信季度统计
        [HttpGet]
        public string WXQuarteres()
        {
            string result = "";
            string Url = "http://rexian.zzmetro.com/api/external/wxquarter";

            result = WebHelper.HttpWebRequest(Url);
            result = Regex.Unescape(result);
            return result;

        }

        #endregion

    }


}
