diff --git a/SolarPower/Controllers/MyBaseController.cs b/SolarPower/Controllers/MyBaseController.cs index 15fa25b..9e639fe 100644 --- a/SolarPower/Controllers/MyBaseController.cs +++ b/SolarPower/Controllers/MyBaseController.cs @@ -107,7 +107,6 @@ namespace SolarPower.Controllers int stationId = stationId_param == "new" ? 0 : int.Parse(stationId_param); - if (stationId > 0) { var hasSubTagNum = false; @@ -133,16 +132,7 @@ namespace SolarPower.Controllers 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; diff --git a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs index 2f504c0..c724a75 100644 --- a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs @@ -146,8 +146,6 @@ namespace SolarPower.Quartz.Jobs calcPowerStation.Id = powerStation.Id; var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd"); - dateNowDay = "2021-07-19"; - #region step2-1. 計算該電站的30天平均資料 var table_name = String.Format("`{0}`.`s{1}01_station`", powerStation.SiteDB, powerStation.Code); logger.LogInformation("【CalcAvgPowerStationJob】【開始計算電站[{0}]在{1}的30天平均資料】", powerStation.Code, dateNowDay); diff --git a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs index a3d7421..2059d13 100644 --- a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs @@ -68,7 +68,7 @@ namespace SolarPower.Quartz.Jobs var calcPowerStation = new PowerStation(); 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. 取得該電站的當前這小時的歷史資料 var table_name = String.Format("`{0}`.s{1}01_station", powerStation.SiteDB, powerStation.Code); @@ -355,8 +355,8 @@ namespace SolarPower.Quartz.Jobs "Today_kwh", "Total_kwh", "today_kwhkwp", - "today_monery", - "total_monery", + "today_money", + "total_money", "today_PR", "today_carbon", "total_carbon", diff --git a/SolarPower/Repository/Implement/CompanyRepository.cs b/SolarPower/Repository/Implement/CompanyRepository.cs index f7263a4..942b5d2 100644 --- a/SolarPower/Repository/Implement/CompanyRepository.cs +++ b/SolarPower/Repository/Implement/CompanyRepository.cs @@ -578,8 +578,8 @@ namespace SolarPower.Repository.Implement `Total_kwh` DECIMAL(10,3) UNSIGNED NOT NULL DEFAULT '0.000' COMMENT '總發電量', `today_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '今日kwhkwp', `avg_kwhkwp` DECIMAL(10,3) NULL DEFAULT NULL COMMENT '30天平均kwhkwp', - `today_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '今日金額', - `total_monery` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '總金額', + `today_money` 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值', `avg_PR` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '平均Pr值', `today_carbon` DECIMAL(10,2) NULL DEFAULT NULL COMMENT '今日減碳量', diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index 523104f..38dfbe7 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -53,8 +53,8 @@ namespace SolarPower.Repository.Implement AVG(ps.avg_PR) AS avg_PR, AVG(ps.today_kwhkwp) AS today_kwhkwp, AVG(ps.avg_kwhkwp) AS avg_kwhkwp, - SUM(ps.today_monery) AS today_monery, - SUM(ps.total_monery) AS total_monery, + SUM(ps.today_money) AS today_monery, + SUM(ps.total_money) AS total_monery, SUM(ps.today_carbon) AS today_carbon, SUM(ps.total_carbon) AS total_carbon 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 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 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 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 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 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 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 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 AND DATE_FORMAT(ps.timestamp, '%Y') = @Year"; @@ -385,7 +385,7 @@ namespace SolarPower.Repository.Implement { 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.KWH FROM inverter_history_hour inv diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index a55a7c2..7a653e5 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -18,7 +18,7 @@