From 383b2fa30f80f85a454f8a5a5d6437e6aac7ef31 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Thu, 18 Aug 2022 13:47:00 +0800 Subject: [PATCH] =?UTF-8?q?solar=5FApp:=20=E5=BB=B6=E9=95=B7sql=E5=9F=B7?= =?UTF-8?q?=E8=A1=8C=E6=99=82=E9=96=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- solarApp/Service/getInvSvc.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/solarApp/Service/getInvSvc.cs b/solarApp/Service/getInvSvc.cs index b4a1d30..dd12442 100644 --- a/solarApp/Service/getInvSvc.cs +++ b/solarApp/Service/getInvSvc.cs @@ -29,7 +29,7 @@ namespace solarApp.Service from " + siteDB + ".s" + siteID + @"_inv where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 10) = '" + reportDate + "' and inverterid = '" + invID + "'"; //List ds = conn.Query(sql, new { kind = kind }).ToList(); - List ds = conn.Query(sql).AsList(); + List ds = conn.Query(sql, commandTimeout: 600).AsList(); conn.Close(); return ds; } @@ -69,7 +69,7 @@ namespace solarApp.Service // from " + siteDB + ".s" + siteID + @"_inv // where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + @"' and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 2) = '55' and inverterid = '" + invID + @"' // )b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid "; - List ds = conn.Query(sql).AsList(); + List ds = conn.Query(sql, commandTimeout: 600).AsList(); conn.Close(); return ds; } @@ -106,7 +106,7 @@ namespace solarApp.Service string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H:%i') reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR from inverter_history_hour where crdDate = '" + reportDate + "' and inverterid = '" + invID + "' "; - List ds = conn.Query(sql).AsList(); + List ds = conn.Query(sql, commandTimeout: 600).AsList(); conn.Close(); return ds; } @@ -130,7 +130,7 @@ from inverter_history_day a left join ( group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), inverterid ) b on a.inverterid = b.inverterid and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate where crdDate between '" + date1 + "' and '" + date2 + "' and a.inverterid = '" + invID + "' order by 1"; - List ds = conn.Query(sql).AsList(); + List ds = conn.Query(sql, commandTimeout: 600).AsList(); conn.Close(); return ds; } @@ -143,7 +143,7 @@ where crdDate between '" + date1 + "' and '" + date2 + "' and a.inverterid = '" conn.Open(); string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR from inverter_history_month where left(`TIMESTAMP`, 7) between '" + date1 + "' and '" + date2 + "' and inverterid = '" + invID + "' "; - List ds = conn.Query(sql).AsList(); + List ds = conn.Query(sql, commandTimeout: 600).AsList(); conn.Close(); return ds; }