solar_App: IrrDayHour取值時,增加時間欄位至小時;(修改update時,時間不符合導致null)

This commit is contained in:
wanling040@gmail.com 2022-08-04 18:37:19 +08:00
parent c32abb1d63
commit 01bc1845a5
2 changed files with 3 additions and 3 deletions

View File

@ -639,10 +639,10 @@ from temp_invDay{_powerStationID}_s1 a join
left join
(
select powerStationID, `TIMESTAMP` report_date, irradiance, Temperature, IrrDay, IrrDayHour
select powerStationID, LEFT(`TIMESTAMP`, 13) report_date, irradiance, Temperature, IrrDay, IrrDayHour
from sensor_history_hour
where powerstationid = {_powerStationID} and left(`TIMESTAMP`,10) = '{_date1}'
) d on a.powerStationid = d.powerStationid and a.`report_date` = d.report_date
) d on a.powerStationid = d.powerStationid and LEFT(a.`report_date`, 13) = d.report_date
where a.inverterid = '{inv01}' # right(a.inverterid, 4) = '0001'
GROUP BY left(a.report_date, 13)
order by a.report_date ;";

View File

@ -259,7 +259,7 @@ namespace solarApp.Service
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust, WingDirection, irrDay, irrDayHour)
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.Temperature, a.envTemperature, a.humidity, a.Vane, a.Dust, WingDirection, irrDay, 0 from
(
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(avg(" + modelTempCol + @"), 4) Temperature,
select @powerStationID powerstationID, concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') 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 + "." + tableName + @"
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1