123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- diff a/LeaRun.Application/LeaRun.Application.Service/PipeNetworkManage/AnalysisService.cs b/LeaRun.Application/LeaRun.Application.Service/PipeNetworkManage/AnalysisService.cs (rejected hunks)
- @@ -7,6 +7,7 @@
- using System.Threading.Tasks;
- using LeaRun.Data;
- using LeaRun.Util;
- +using LeaRun.Util.WebControl;
-
- namespace LeaRun.Application.Service.PipeNetworkManage
- {
- @@ -21,7 +22,7 @@
- /// <param name="devId"></param>
- /// <param name="time"></param>
- /// <returns></returns>
- - public string GetYearAnalysis(string departId, string typeID, string devId, string time)
- + public string GetYearAnalysis(string departId, string typeID, string devId, string time,Pagination pagination)
- {
- string strSql = "";
- if (!string.IsNullOrEmpty(departId))
- @@ -30,7 +31,7 @@
- {
- //var mIds = departId;
- //var child = new DeviceService().GetList(Convert.ToInt32(departId));
- -
- +
- //foreach (var item in child)
- //{
- // mIds += item.ID;
- @@ -50,11 +51,12 @@
- strSql = "Select MeterAssessmentId,MeterAssessmentName From MeterAssessmentBase Where MeterAssessmentId=" + devId;
- }
-
- -
- DateTime dateTime = DateTime.Parse(time + "-01-01");
- -
- int months = 12;
- - DataTable dt = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + int total = pagination.records;
- + //DataTable dt = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + DataTable dt = sqlHelper.ExecuteDataTable(strSql, "", false, pagination.rows, pagination.page, out total, null);
- + pagination.records = total;
- StringBuilder builder = new StringBuilder();
- builder.Append("[");
- for (int i = 0; i < dt.Rows.Count; i++)
- @@ -70,14 +72,11 @@
-
- DateTime startDay = dateTime;
- for (int j = 0; j < months; j++)
- - {
- -
- - //builder.Append("\"Day\"").Append(j + 1).Append("\":\"");
- + {
- DateTime nowDay = startDay.AddMonths(j);
- DateTime endDay = nowDay.AddMonths(1);
- - //strSql = "Select 净累计流量 From " + strTableName + " Where 净累计流量<>0 And 净累计流量 is not null And 采集时间 between '" + nowDay.ToString("yyyy-MM-dd") + "' And '" + endDay.ToString("yyyy-MM-dd") + "' Order by 采集时间";
- - strSql = "Select NetCumulativeFlow From " + strTableName + " Where NetCumulativeFlow<>0 And NetCumulativeFlow is not null And GetDateTime between '" + nowDay.ToString("yyyy-MM-dd") + "' And '" + endDay.ToString("yyyy-MM-dd") + "' Order by GetDateTime";
- - DataTable table = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + strSql = "Select GetDateTime,NetCumulativeFlow From " + strTableName + " Where NetCumulativeFlow<>0 And NetCumulativeFlow is not null And GetDateTime between '" + nowDay.ToString("yyyy-MM-dd") + "' And '" + endDay.ToString("yyyy-MM-dd") + "'";
- + DataTable table = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- if (table.Rows.Count > 0)
- {
- decimal min = decimal.Parse(table.Rows[0]["NetCumulativeFlow"].ToString());
- @@ -118,7 +117,7 @@
- /// <param name="devId"></param>
- /// <param name="time"></param>
- /// <returns></returns>
- - public string GetMonthAnalysis(string departId, string typeID, string devId, string time)
- + public string GetMonthAnalysis(string departId, string typeID, string devId, string time,Pagination pagination)
- {
- string strSql = "";
- if (!string.IsNullOrEmpty(departId))
- @@ -150,8 +149,10 @@
-
- DateTime dateTime = DateTime.Parse(time);
- int days = LeaRun.Util.Time.GetDaysOfMonth(dateTime.Year, dateTime.Month);
- -
- - DataTable dt = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + int total = pagination.records;
- + //DataTable dt = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + DataTable dt = sqlHelper.ExecuteDataTable(strSql, "", false, pagination.rows, pagination.page, out total, null);
- + pagination.records = total;
- StringBuilder builder = new StringBuilder();
- builder.Append("[");
- for (int i = 0; i < dt.Rows.Count; i++)
- @@ -160,8 +161,7 @@
- string name = dt.Rows[i]["MeterAssessmentName"].ToString();
- builder.Append("{");
- builder.Append("\"ID\":\"").Append(deviceId).Append("\",");
- - builder.Append("\"DevName\":\"").Append(name).Append("\",");
- - //string strTableName = "历史记录_" + ("000000" + deviceId).Substring(deviceId.Length, 6) + "_" + dateTime.Year.ToString();
- + builder.Append("\"DevName\":\"").Append(name).Append("\",");
- string strTableName = "MeterAssessment_" + deviceId;
- if (sqlHelper.DBTableIsExists(strTableName))
- {
- @@ -171,9 +171,8 @@
- {
- DateTime nowDay = startDay.AddDays(j);
- DateTime endDay = nowDay.AddDays(1);
- - strSql = "Select NetCumulativeFlow From " + strTableName + " Where NetCumulativeFlow<>0 And NetCumulativeFlow is not null And GetDateTime between '" + nowDay.ToString("yyyy-MM-dd") + "' And '" + endDay.ToString("yyyy-MM-dd") + "' Order by GetDateTime";
- -
- - DataTable table = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- + strSql = "Select GetDateTime, NetCumulativeFlow From " + strTableName + " Where NetCumulativeFlow<>0 And NetCumulativeFlow is not null And GetDateTime between '" + nowDay.ToString("yyyy-MM-dd") + "' And '" + endDay.ToString("yyyy-MM-dd") + "'";
- + DataTable table = sqlHelper.ExecuteDataTable(strSql, CommandType.Text, null);
- if (table.Rows.Count > 0)
- {
- decimal min = decimal.Parse(table.Rows[0]["NetCumulativeFlow"].ToString());
|