diff --git a/SolarPower/Repository/Implement/CompanyRepository.cs b/SolarPower/Repository/Implement/CompanyRepository.cs
index 5889505..054e337 100644
--- a/SolarPower/Repository/Implement/CompanyRepository.cs
+++ b/SolarPower/Repository/Implement/CompanyRepository.cs
@@ -732,7 +732,8 @@ 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`.`Status` AS status, (`{db_name}`.`inverter`.`Model` collate utf8mb4_unicode_ci) AS `Model`
+ `{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`";
temp_sub_sql.Add(sub_sql);
diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml
index 25458c6..0dcabd3 100644
--- a/SolarPower/Views/StationReport/Index.cshtml
+++ b/SolarPower/Views/StationReport/Index.cshtml
@@ -292,7 +292,11 @@
-
+
+
+
@@ -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
diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs
index a4dc788..f97611d 100644
--- a/solarApp/Service/procSensorSvc.cs
+++ b/solarApp/Service/procSensorSvc.cs
@@ -225,20 +225,28 @@ namespace solarApp.Service
#endregion 獲取 Sensor 類別
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";