solar_App: 延長sql執行時間

This commit is contained in:
wanling040@gmail.com 2022-08-18 13:47:00 +08:00
parent a189bcc2f4
commit 383b2fa30f

View File

@ -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 + "'"; from " + siteDB + ".s" + siteID + @"_inv where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 10) = '" + reportDate + "' and inverterid = '" + invID + "'";
//List<raw_inv> ds = conn.Query<raw_inv>(sql, new { kind = kind }).ToList(); //List<raw_inv> ds = conn.Query<raw_inv>(sql, new { kind = kind }).ToList();
List<raw_inv> ds = conn.Query<raw_inv>(sql).AsList<raw_inv>(); List<raw_inv> ds = conn.Query<raw_inv>(sql, commandTimeout: 600).AsList<raw_inv>();
conn.Close(); conn.Close();
return ds; return ds;
} }
@ -69,7 +69,7 @@ namespace solarApp.Service
// from " + siteDB + ".s" + siteID + @"_inv // 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 + @"' // 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 "; // )b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid ";
List<raw_inv_hour> ds = conn.Query<raw_inv_hour>(sql).AsList<raw_inv_hour>(); List<raw_inv_hour> ds = conn.Query<raw_inv_hour>(sql, commandTimeout: 600).AsList<raw_inv_hour>();
conn.Close(); conn.Close();
return ds; 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 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 + "' "; from inverter_history_hour where crdDate = '" + reportDate + "' and inverterid = '" + invID + "' ";
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>(); List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql, commandTimeout: 600).AsList<web_inv_hour>();
conn.Close(); conn.Close();
return ds; return ds;
} }
@ -130,7 +130,7 @@ from inverter_history_day a left join (
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), inverterid 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 ) 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"; where crdDate between '" + date1 + "' and '" + date2 + "' and a.inverterid = '" + invID + "' order by 1";
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>(); List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql, commandTimeout: 600).AsList<web_inv_hour>();
conn.Close(); conn.Close();
return ds; return ds;
} }
@ -143,7 +143,7 @@ where crdDate between '" + date1 + "' and '" + date2 + "' and a.inverterid = '"
conn.Open(); conn.Open();
string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR 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 + "' "; from inverter_history_month where left(`TIMESTAMP`, 7) between '" + date1 + "' and '" + date2 + "' and inverterid = '" + invID + "' ";
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>(); List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql, commandTimeout: 600).AsList<web_inv_hour>();
conn.Close(); conn.Close();
return ds; return ds;
} }