Procházet zdrojové kódy

话务统计数据优化

zhengbingbing %!s(int64=6) %!d(string=před) roky
rodič
revize
997e7f35de
3 změnil soubory, kde provedl 72 přidání a 26 odebrání
  1. 7 0
      BLL/T_Report.cs
  2. 16 0
      DAL/T_Report.cs
  3. 49 26
      Web/Report/TotalCount_Report.aspx.cs

+ 7 - 0
BLL/T_Report.cs

@@ -69,6 +69,13 @@ namespace XYFDRQ.BLL
69 69
         {
70 70
             return dal.GetCallCountReport2(strWhere);
71 71
         }
72
+        /// <summary>
73
+        ///获取话务量统计(表格形式)
74
+        /// </summary>
75
+        public DataTable GetCallCountReport3(string strWhere)
76
+        {
77
+            return dal.GetCallCountReport3(strWhere);
78
+        }
72 79
         #endregion  Method
73 80
     }
74 81
 }

+ 16 - 0
DAL/T_Report.cs

@@ -126,6 +126,22 @@ where MYD is not null and UserId is not null ");
126 126
             //strSql.Append(@" group by CallId");
127 127
             return DbHelperSQL.Query(strSql.ToString()).Tables[0];
128 128
         }
129
+        /// <summary>
130
+        ///获取话务量统计(表格形式)
131
+        /// </summary>
132
+        public DataTable GetCallCountReport3(string strWhere)
133
+        {
134
+            StringBuilder strSql = new StringBuilder();
135
+            strSql.Append(@" select CONVERT(varchar(100), BeginTime, 112) dates,DATEPART(hh,BeginTime) hh,calltype,COUNT(1) con FROM T_Call_CallRecords where 1 = 1 ");
136
+
137
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
138
+            {
139
+                strSql.Append(strWhere);
140
+            }
141
+            strSql.Append(@" group by CONVERT(varchar(100), BeginTime, 112) ,DATEPART(hh, BeginTime),calltype");
142
+            strSql.Append(@" order by CONVERT(varchar(100), BeginTime, 112) ,DATEPART(hh, BeginTime),calltype");
143
+            return DbHelperSQL.Query(strSql.ToString()).Tables[0];
144
+        }
129 145
 
130 146
         #endregion  Method
131 147
     }

+ 49 - 26
Web/Report/TotalCount_Report.aspx.cs

@@ -48,7 +48,7 @@ public partial class Report_TotalCount_Report : System.Web.UI.Page
48 48
         html.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" >");
49 49
         try
50 50
         {
51
-            //标题第一行
51
+            #region 标题第一行
52 52
             html.Append("<tr style=\"text-align: center;\"><td class=\"formtabletitle\" style=\"height: 35px;background-color: #D5EDFE;border:1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">小时/时间</td>");
53 53
             html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">00时-01时 呼出量</td>");
54 54
             html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">00时-01时 呼入量</td>");
@@ -99,6 +99,17 @@ public partial class Report_TotalCount_Report : System.Web.UI.Page
99 99
             html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">23时-24时 呼出量</td>");
100 100
             html.Append("<td class=\"formtabletitle1\"style=\"height: 25px;background-color: #D5EDFE;border-left: 0px solid #FFFFFF;border-right: 1px solid #CCCCCC;border-top: 1px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;padding: 3px 3px 3px 3px;text-align:center;\">23时-24时 呼入量</td>");
101 101
             html.Append("</tr>");
102
+            #endregion
103
+
104
+            string sql = "";
105
+            #region 筛选
106
+            if (string.IsNullOrEmpty(_operations[0]))
107
+                sql += " and BeginTime>'" + Convert.ToDateTime(_operations[0]).ToString("yyyy-MM-dd") + " 00:00:00' ";
108
+            if (string.IsNullOrEmpty(_operations[1]))
109
+                sql += " and BeginTime<'" + Convert.ToDateTime(_operations[1]).ToString("yyyy-MM-dd") + " 23:59:59' ";
110
+            #endregion
111
+
112
+            DataTable dtnew = bll_T_Report.GetCallCountReport3(sql);
102 113
             //SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
103 114
             //DateTime ssss = sim.parse(_operations[0]);
104 115
             for (DateTime dttime = Convert.ToDateTime(_operations[0]); dttime < Convert.ToDateTime(_operations[1]).AddDays(1);dttime= dttime.AddDays(1))
@@ -110,32 +121,44 @@ public partial class Report_TotalCount_Report : System.Web.UI.Page
110 121
                 html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + dttime.ToString().Substring(0,dttime.ToString().Length-7) + "&nbsp;</td>");
111 122
                 for (int i = 0; i < 24;i++ )
112 123
                 {
113
-                    if (i == 23)
114
-                    {
115
-                        dt = bll_T_Report.GetCallCountReport2("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
116
-                        //dt = bll_T_Report.GetCallCountReport1("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
117
-                    }
118
-                    else
119
-                    {
120
-                        int j = i + 1;
121
-                        dt = bll_T_Report.GetCallCountReport2("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
122
-                        //dt = bll_T_Report.GetCallCountReport1("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
123
-                    }
124
-                    html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">"+dt.Rows[0][0].ToString()+"&nbsp;</td>");
125
-                    if (i == 23)
126
-                    {
127
-                        dt = bll_T_Report.GetCallCountReport2("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
128
-                        //dt = bll_T_Report.GetCallCountReport1("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
129
-                    }
130
-                    else
131
-                    {
132
-                        int j = i + 1;
133
-                        dt = bll_T_Report.GetCallCountReport2("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
134
-                        //dt = bll_T_Report.GetCallCountReport1("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
135
-                    }
136
-                    html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">"+dt.Rows[0][0].ToString()+"&nbsp;</td>");
124
+                    var drIn = dtnew.Select("dates='" + dttime.ToString("yyyyMMdd") + "' and hh='" + i + "' and calltype=0");
125
+                    int conIn = (from DataRow dr in drIn select dr.Field<int>("con")).FirstOrDefault();
126
+
127
+                    var drOut = dtnew.Select("dates='" + dttime.ToString("yyyyMMdd") + "' and hh='" + i + "' and calltype=1");
128
+                    int conOut = (from DataRow dr in drOut select dr.Field<int>("con")).FirstOrDefault();
129
+
130
+                    html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + conOut.ToString() + "&nbsp;</td>");
131
+                    html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">" + conIn.ToString() + "&nbsp;</td>");
132
+
133
+
134
+                    #region 优化 20190730
135
+                    //if (i == 23)
136
+                    //{
137
+                    //    dt = bll_T_Report.GetCallCountReport2("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
138
+                    //    //dt = bll_T_Report.GetCallCountReport1("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
139
+                    //}
140
+                    //else
141
+                    //{
142
+                    //    int j = i + 1;
143
+                    //    dt = bll_T_Report.GetCallCountReport2("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
144
+                    //    //dt = bll_T_Report.GetCallCountReport1("and CallType=1  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
145
+                    //}
146
+                    //html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">"+dt.Rows[0][0].ToString()+"&nbsp;</td>");
147
+                    //if (i == 23)
148
+                    //{
149
+                    //    dt = bll_T_Report.GetCallCountReport2("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
150
+                    //    //dt = bll_T_Report.GetCallCountReport1("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " 23:59:59'");
151
+                    //}
152
+                    //else
153
+                    //{
154
+                    //    int j = i + 1;
155
+                    //    dt = bll_T_Report.GetCallCountReport2("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
156
+                    //    //dt = bll_T_Report.GetCallCountReport1("and CallType=0  and BeginTime>'" + dttime1 + " " + i + ":00:00' and BeginTime<'" + dttime1 + " " + j + ":00:00'");
157
+                    //}
158
+                    //html.Append("<td class=\"formtable_td\" style=\"vertical-align: middle;border-top: 0px solid #CCCCCC;border-bottom: 1px solid #CCCCCC;border-left: 1px solid #CCCCCC;border-right: 1px solid #CCCCCC;padding-left: 2px;height: 25px;padding-top: 3px;padding-bottom: 3px;\">"+dt.Rows[0][0].ToString()+"&nbsp;</td>");
159
+                    #endregion
137 160
                 }
138
-                    html.Append("</tr>");
161
+                html.Append("</tr>");
139 162
             
140 163
             }
141 164
             ////合计