diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index 7582b1c..29f8ebe 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -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 ;"; diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs index c772403..d8d6a7b 100644 --- a/solarApp/Service/procSensorSvc.cs +++ b/solarApp/Service/procSensorSvc.cs @@ -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