This commit is contained in:
b110212000 2021-07-20 11:42:19 +08:00
commit 873ddc32c2
6 changed files with 15 additions and 28 deletions

View File

@ -107,7 +107,6 @@ namespace SolarPower.Controllers
int stationId = stationId_param == "new" ? 0 : int.Parse(stationId_param); int stationId = stationId_param == "new" ? 0 : int.Parse(stationId_param);
if (stationId > 0) if (stationId > 0)
{ {
var hasSubTagNum = false; var hasSubTagNum = false;
@ -133,16 +132,7 @@ namespace SolarPower.Controllers
i++; i++;
} }
} }
else
{
//電站管理的新增電站
ViewData["SubNum"] = myPowerStationSummaries.Count();
ViewData["TagNum"] = 0;
}
}else if(controllerName == "PowerStation" && actionName == "Index")
{
ViewData["SubNum"] = myPowerStationSummaries.Count();
ViewData["TagNum"] = 0;
} }
ViewBag.auths = auth_arr; ViewBag.auths = auth_arr;

View File

@ -146,8 +146,6 @@ namespace SolarPower.Quartz.Jobs
calcPowerStation.Id = powerStation.Id; calcPowerStation.Id = powerStation.Id;
var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd"); var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd");
dateNowDay = "2021-07-19";
#region step2-1. 30 #region step2-1. 30
var table_name = String.Format("`{0}`.`s{1}01_station`", powerStation.SiteDB, powerStation.Code); var table_name = String.Format("`{0}`.`s{1}01_station`", powerStation.SiteDB, powerStation.Code);
logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay);

View File

@ -68,7 +68,7 @@ namespace SolarPower.Quartz.Jobs
var calcPowerStation = new PowerStation(); var calcPowerStation = new PowerStation();
calcPowerStation.Id = powerStation.Id; calcPowerStation.Id = powerStation.Id;
var dateTime = DateTimeNow.AddHours(-3).ToString("yyyy-MM-dd HH"); var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
#region step2-1. #region step2-1.
var table_name = String.Format("`{0}`.s{1}01_station", powerStation.SiteDB, powerStation.Code); var table_name = String.Format("`{0}`.s{1}01_station", powerStation.SiteDB, powerStation.Code);
@ -355,8 +355,8 @@ namespace SolarPower.Quartz.Jobs
"Today_kwh", "Today_kwh",
"Total_kwh", "Total_kwh",
"today_kwhkwp", "today_kwhkwp",
"today_monery", "today_money",
"total_monery", "total_money",
"today_PR", "today_PR",
"today_carbon", "today_carbon",
"total_carbon", "total_carbon",

View File

@ -578,8 +578,8 @@ namespace SolarPower.Repository.Implement
`Total_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '', `Total_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '',
`today_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT 'kwhkwp', `today_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT 'kwhkwp',
`avg_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '30kwhkwp', `avg_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '30kwhkwp',
`today_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '', `today_money` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',
`total_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '', `total_money` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',
`today_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值', `today_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值',
`avg_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值', `avg_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT 'Pr值',
`today_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '', `today_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '',

View File

@ -53,8 +53,8 @@ namespace SolarPower.Repository.Implement
AVG(ps.avg_PR) AS avg_PR, AVG(ps.avg_PR) AS avg_PR,
AVG(ps.today_kwhkwp) AS today_kwhkwp, AVG(ps.today_kwhkwp) AS today_kwhkwp,
AVG(ps.avg_kwhkwp) AS avg_kwhkwp, AVG(ps.avg_kwhkwp) AS avg_kwhkwp,
SUM(ps.today_monery) AS today_monery, SUM(ps.today_money) AS today_monery,
SUM(ps.total_monery) AS total_monery, SUM(ps.total_money) AS total_monery,
SUM(ps.today_carbon) AS today_carbon, SUM(ps.today_carbon) AS today_carbon,
SUM(ps.total_carbon) AS total_carbon SUM(ps.total_carbon) AS total_carbon
FROM power_station ps FROM power_station ps
@ -200,7 +200,7 @@ namespace SolarPower.Repository.Implement
{ {
var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp,'%H %p') AS Label, ps.KWH AS PowerData, pyr.Irradiance AS IrradianceData var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp,'%H %p') AS Label, ps.KWH AS PowerData, pyr.Irradiance AS IrradianceData
FROM power_station_history_hour ps FROM power_station_history_hour ps
LEFT JOIN sensor_history_hour pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d %H') = DATE_FORMAT(pyr.timestamp, '%Y-%m-%d %H') LEFT JOIN sensor_history_hour pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d %H') = DATE_FORMAT(pyr.timestamp, '%Y-%m-%d %H')
WHERE ps.PowerStationId = @PowerStationId WHERE ps.PowerStationId = @PowerStationId
AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = @NowDay"; AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = @NowDay";
@ -224,7 +224,7 @@ namespace SolarPower.Repository.Implement
var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m-%d') AS Label, ps.TODAYKWH AS PowerData, pyr.Irradiance AS IrradianceData var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m-%d') AS Label, ps.TODAYKWH AS PowerData, pyr.Irradiance AS IrradianceData
FROM power_station_history_day ps FROM power_station_history_day ps
LEFT JOIN sensor_history_day pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = DATE_FORMAT(FROM_UNIXTIME(pyr.timestamp), '%Y-%m-%d') LEFT JOIN sensor_history_day pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = DATE_FORMAT(pyr.timestamp, '%Y-%m-%d')
WHERE ps.PowerStationId = @PowerStationId WHERE ps.PowerStationId = @PowerStationId
AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') BETWEEN @StartDay AND @NowDay"; AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') BETWEEN @StartDay AND @NowDay";
@ -248,7 +248,7 @@ namespace SolarPower.Repository.Implement
var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m-%d') AS Label, ps.TODAYKWH AS PowerData, pyr.Irradiance AS IrradianceData var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m-%d') AS Label, ps.TODAYKWH AS PowerData, pyr.Irradiance AS IrradianceData
FROM power_station_history_day ps FROM power_station_history_day ps
LEFT JOIN sensor_history_day pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = DATE_FORMAT(FROM_UNIXTIME(pyr.timestamp), '%Y-%m-%d') LEFT JOIN sensor_history_day pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') = DATE_FORMAT(pyr.timestamp, '%Y-%m-%d')
WHERE ps.PowerStationId = @PowerStationId WHERE ps.PowerStationId = @PowerStationId
AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') BETWEEN @StartDay AND @NowDay"; AND DATE_FORMAT(ps.timestamp, '%Y-%m-%d') BETWEEN @StartDay AND @NowDay";
@ -273,7 +273,7 @@ namespace SolarPower.Repository.Implement
var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m') AS Label, ps.MONTHKWH AS PowerData, pyr.Irradiance AS IrradianceData var sql_power = @$"SELECT DATE_FORMAT(ps.timestamp, '%Y-%m') AS Label, ps.MONTHKWH AS PowerData, pyr.Irradiance AS IrradianceData
FROM power_station_history_month ps FROM power_station_history_month ps
LEFT JOIN sensor_history_month pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m') = DATE_FORMAT(FROM_UNIXTIME(pyr.timestamp), '%Y-%m') LEFT JOIN sensor_history_month pyr ON ps.PowerStationId = pyr.PowerStationId AND DATE_FORMAT(ps.timestamp, '%Y-%m') = DATE_FORMAT(pyr.timestamp, '%Y-%m')
WHERE ps.PowerStationId = @PowerStationId WHERE ps.PowerStationId = @PowerStationId
AND DATE_FORMAT(ps.timestamp, '%Y') = @Year"; AND DATE_FORMAT(ps.timestamp, '%Y') = @Year";
@ -385,7 +385,7 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql_power = @$"SELECT DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d %H') AS TIMESTAMP, var sql_power = @$"SELECT DATE_FORMAT(inv.TIMESTAMP, '%H %p') AS TIMESTAMP,
inv.INVERTERID, inv.INVERTERID,
inv.KWH inv.KWH
FROM inverter_history_hour inv FROM inverter_history_hour inv

View File

@ -18,7 +18,7 @@
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
<div class="panel-container show"> <div class="panel-container show">
<div class="panel-content"> <div class="panel-content">
<div class="row subheader"> <div class="row subheader d-flex justify-content-between">
<div class="col-xl-2"> <div class="col-xl-2">
<h1 class="subheader-title"> <h1 class="subheader-title">
<span class="icon-stack fa-1x"> <span class="icon-stack fa-1x">
@ -2229,8 +2229,7 @@
data: listirradiance data: listirradiance
}, { }, {
type: 'bar', type: 'bar',
borderColor: 'rgba(103, 180, 172, 1)', backgroundColor: 'rgba(103, 180, 172, 1)',
backgroundColor: 'rgba(103, 180, 172, 0.2)',
borderWidth: 1, borderWidth: 1,
label: '發電量(kWh)', label: '發電量(kWh)',
yAxisID: 'A', yAxisID: 'A',