電站月報表改用post
This commit is contained in:
parent
008c98feec
commit
e965795e33
@ -732,6 +732,7 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
var sub_sql = $@"select '{db_name}' AS `dbName`,(`{db_name}`.`inverter`.`InverterId` collate utf8mb4_unicode_ci) AS `InverterId`,
|
||||
(`{db_name}`.`inverter`.`Brand` collate utf8mb4_unicode_ci) AS `Brand`,`{db_name}`.`inverter`.`Enabled` AS `enabled`,
|
||||
`{db_name}`.`inverter`.`Deleted` AS `Deleted`,
|
||||
`{db_name}`.`inverter`.`Status` AS status, (`{db_name}`.`inverter`.`Model` collate utf8mb4_unicode_ci) AS `Model`
|
||||
from `{db_name}`.`inverter`";
|
||||
|
||||
|
||||
@ -292,7 +292,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<form id="report" name="report" method="post">
|
||||
<input type="hidden" id="post" name="post"/>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
@ -1244,7 +1248,10 @@
|
||||
if (send_data.FormType != null && send_data.PowerStation.length != 0 && send_data.FormType != 2) {
|
||||
$.post("/StationReport/CheckExcel", send_data, function (rel) {
|
||||
if (rel.code == "0000") {
|
||||
window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data);
|
||||
//window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data);
|
||||
$("#post").val(JSON.stringify(send_data));
|
||||
document.report.action = "StationReport/ExportExcel";
|
||||
document.report.submit();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@ -227,18 +227,26 @@ namespace solarApp.Service
|
||||
try
|
||||
{
|
||||
#region hour
|
||||
// 暫時解法 儘針對整個 Device 都是共享的情況 ---------------
|
||||
string tableName = "s" + _siteID01 + "_sensorAvg";
|
||||
foreach (var item in ds_sensor)
|
||||
{
|
||||
tableName = item.TableName;
|
||||
break;
|
||||
}
|
||||
|
||||
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust, WingDirection, irrDay)
|
||||
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.Temperature, a.envTemperature, a.humidity, a.Vane, a.Dust, WingDirection, irrDay from
|
||||
(
|
||||
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(avg(" + modelTempCol + @"), 4) Temperature,
|
||||
avg(" + evnTempCol + @") envTemperature, avg(" + humCol + @") humidity, avg(" + vanCol + @") Vane, avg(" + dustCol + @") Dust, avg(" + winCol + @") WingDirection, max(" + irrDayCol + @") irrDay
|
||||
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
|
||||
from " + _siteDB + "." + tableName + @"
|
||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1
|
||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
||||
) a left join
|
||||
(
|
||||
select concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, round(avg(" + irrCol + @"), 6) irrAvg
|
||||
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
|
||||
from " + _siteDB + "." + tableName + @"
|
||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 " + irrNot0 + @" #需要過濾 0 的數值
|
||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
||||
)b on a.reportdate = b.reportdate";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user