diff --git a/SolarPower/Controllers/StationOverviewController.cs b/SolarPower/Controllers/StationOverviewController.cs index b6827f0..8c4e0f1 100644 --- a/SolarPower/Controllers/StationOverviewController.cs +++ b/SolarPower/Controllers/StationOverviewController.cs @@ -68,7 +68,6 @@ namespace SolarPower.Controllers MapOverview mapOverview = new MapOverview(); try { - List powerStationIds = new List() { 1, 2, 3 }; var overview = await overviewRepository.GetOverviewByPowerStationIds(post.Ids); mapOverview.Today_kwh = overview.Today_kwh; mapOverview.Total_kwh = overview.Total_kwh; @@ -95,8 +94,6 @@ namespace SolarPower.Controllers mapOverview.TotalPowerStationCount = totalPowerStationCount; mapOverview.TotalCapacity = totalCapacity; - mapOverview.PowerStations = await overviewRepository.GetListPowerStationByPowerStationIds(powerStationIds); - mapOverview.UpdatedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); @@ -116,11 +113,55 @@ namespace SolarPower.Controllers } + [HttpPost] + public async Task> GetOneStationUpToDateInfo(StationIds post) + { + ApiResult apiResult = new ApiResult(); + + StationOverview stationOverview = new StationOverview(); + try + { + var overview = await overviewRepository.GetOverviewByPowerStationIds(post.Ids); + stationOverview.Today_kwh = overview.Today_kwh; + stationOverview.Total_kwh = overview.Total_kwh; + stationOverview.Today_irradiance = overview.Today_irradiance; + stationOverview.Avg_irradiance = overview.Avg_irradiance; + stationOverview.Today_PR = overview.Today_PR; + stationOverview.Avg_PR = overview.Avg_PR; + stationOverview.Today_kwhkwp = overview.Today_kwhkwp; + stationOverview.Avg_kwhkwp = overview.Avg_kwhkwp; + stationOverview.Today_monery = overview.Today_monery; + stationOverview.Total_monery = overview.Total_monery; + stationOverview.Today_carbon = overview.Today_carbon; + stationOverview.Total_carbon = overview.Total_carbon; + + stationOverview.UpdatedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + if (myUser.Role.Auths.Contains("ShowMoney")) + { + stationOverview.IsShowMoney = 1; + } + else + { + stationOverview.IsShowMoney = 0; + stationOverview.Today_monery = 0; + stationOverview.Total_monery = 0; + } + + + apiResult.Code = "0000"; + apiResult.Data = stationOverview; + + } + catch (Exception exception) + { + apiResult.Code = "9999"; + Logger.LogError("【" + controllerName + "/" + actionName + "】"); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + apiResult.Msg = errorCode.GetString(apiResult.Code); + return apiResult; + } } - - - - - } - diff --git a/SolarPower/Models/Overview.cs b/SolarPower/Models/Overview.cs index 481a73f..c7614b4 100644 --- a/SolarPower/Models/Overview.cs +++ b/SolarPower/Models/Overview.cs @@ -16,6 +16,8 @@ namespace SolarPower.Models public double Avg_PR { get; set; } //平均 PR 值(30天) public double Today_kwhkwp { get; set; } //即時平均 kWh / kWp public double Avg_kwhkwp { get; set; } //平均 kWh / kWp (30天) + public double Today_monery { get; set; } //今日金額 + public double Total_monery { get; set; } //今日金額 public double Today_carbon { get; set; } //今日減碳量 public double Total_carbon { get; set; } //累積減碳量 } @@ -46,4 +48,10 @@ namespace SolarPower.Models { public List Ids { get; set; } } + + public class StationOverview : Overview + { + public byte IsShowMoney { get; set; } //是否顯示發電金額 + public string UpdatedAt { get; set; } //畫面資料更新時間 + } } diff --git a/SolarPower/Properties/launchSettings.json b/SolarPower/Properties/launchSettings.json index ee7c7f9..5191b82 100644 --- a/SolarPower/Properties/launchSettings.json +++ b/SolarPower/Properties/launchSettings.json @@ -8,7 +8,7 @@ }, "iisExpress": { "applicationUrl": "http://localhost:63003", - "sslPort": 44398 + "sslPort": 0 } }, "profiles": { diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index 03fb6aa..6e8c790 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -53,6 +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_carbon) AS today_carbon, SUM(ps.total_carbon) AS total_carbon FROM power_station ps diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index cd25e12..2c86a4f 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -202,9 +202,10 @@ namespace SolarPower.Repository.Implement conn.Open(); try { - var sql = @$"SELECT ps.*, c.Name AS CityName, u.Name AS CreatorName FROM {tableName} ps + var sql = @$"SELECT ps.*, c.Name AS CityName, a.Name AS AreaName, u.Name AS CreatorName FROM {tableName} ps LEFT JOIN user u ON ps.CreatedBy = u.Id LEFT JOIN city c ON ps.CityId = c.Id + LEFT JOIN area a ON ps.AreaId = a.Id WHERE ps.Deleted = 0 AND ps.Id = @Id"; result = await conn.QueryFirstOrDefaultAsync(sql, new { Id = id }); diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index 8957e97..acc04ea 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -30,7 +30,7 @@
-

日照度

+

日照度

@@ -236,6 +236,7 @@ $("#today_kwhkwp").html(mapOverview.today_kwhkwp); $("#avg_kwhkwp").html(mapOverview.avg_kwhkwp); $("#today_carbon").html(mapOverview.today_carbon); + $("#total_carbon").html(mapOverview.total_carbon); $("#total_power_station_count").html(mapOverview.totalPowerStationCount); $("#total_capacity").html(mapOverview.totalCapacity); $("#update_at").html(mapOverview.updatedAt); diff --git a/SolarPower/Views/PowerStation/_StationInfo.cshtml b/SolarPower/Views/PowerStation/_StationInfo.cshtml index c5bf32b..e7a262a 100644 --- a/SolarPower/Views/PowerStation/_StationInfo.cshtml +++ b/SolarPower/Views/PowerStation/_StationInfo.cshtml @@ -148,32 +148,34 @@
-
-
逆變器
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- - -
-
+ @* +
+
逆變器
+
+
+ +
+ +
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ *@
光電板
@@ -325,8 +327,6 @@
- -
diff --git a/SolarPower/Views/Shared/_Layout.cshtml b/SolarPower/Views/Shared/_Layout.cshtml index 33a7096..d7a6a8e 100644 --- a/SolarPower/Views/Shared/_Layout.cshtml +++ b/SolarPower/Views/Shared/_Layout.cshtml @@ -90,7 +90,7 @@ -->
  • - + 總覽
      @@ -122,7 +122,7 @@
    • - + 交叉分析
        @@ -145,7 +145,7 @@
      • - + 報表查詢
          @@ -169,7 +169,7 @@
        • - + 即時告警
            @@ -183,7 +183,7 @@
          • - + 運維管理
              @@ -201,7 +201,7 @@
            • - + 系統管理
                diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 9bfbba6..40b6ec3 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -35,32 +35,32 @@ @@ -99,15 +99,81 @@ } \ No newline at end of file diff --git a/SolarPower/Views/StationOverview/_Info.cshtml b/SolarPower/Views/StationOverview/_Info.cshtml index e75769b..df41238 100644 --- a/SolarPower/Views/StationOverview/_Info.cshtml +++ b/SolarPower/Views/StationOverview/_Info.cshtml @@ -1 +1,268 @@ -

                3

                \ No newline at end of file +
                +
                + +
                + +
                電站基本資料
                +
                +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                +

                +

                + + +
                +

                +
                +
                +
                + +
                + +
                +
                +
                + +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                +
                +
                光電板
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                +
                +
                +
                +
                +
                + +
                +
                + +
                + +
                經濟部能源局與台電資訊
                +
                +
                +
                +
                +
                經濟部能源局
                +
                +
                + + +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                +
                +
                +
                台電資訊
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                +
                +
                + +
                +
                +
                +
                + +
                +
                +
                +
                +
                +
                +
                +
                +
                +
                +
                + +
                + +
                單線圖
                +
                +
                +
                +
                +
                +
                +
                \ No newline at end of file diff --git a/SolarPower/Views/StationOverview/_UpToDate.cshtml b/SolarPower/Views/StationOverview/_UpToDate.cshtml index 2759cb4..83d3ec7 100644 --- a/SolarPower/Views/StationOverview/_UpToDate.cshtml +++ b/SolarPower/Views/StationOverview/_UpToDate.cshtml @@ -1 +1,140 @@ -

                6

                \ No newline at end of file +
                +
                +
                +
                +

                發電量

                +
                kwh
                +
                +
                +
                +

                今日發電量

                +

                126,161.72

                +
                +
                +

                累積發電量

                +

                4,069.73

                +
                +
                +
                +
                +
                +

                發電金額

                +
                NTD
                +
                +
                +
                +

                總發金額

                +

                126,161.72

                +
                +
                +

                平均發電金額

                +

                4,069.73

                +
                +
                +
                +
                +
                +

                日照度

                +
                kw/m2
                +
                +
                +
                +

                即時平均日照度

                +

                126,161.72

                +
                +
                +

                平均日照度(30天)

                +

                4,069.73

                +
                +
                +
                +
                +
                +

                PR值

                +
                +
                +
                +

                即時平均 PR 值

                +

                119.04

                +
                +
                +

                平均 PR 值(30天)

                +

                3.84

                +
                +
                +
                +
                +
                +

                kWh / kWp

                +
                +
                +
                +

                即時平均 kWh / kWp

                +

                140.39

                +
                +
                +

                平均 kWh / kWp (30天)

                +

                4.53

                +
                +
                +
                +
                +
                +

                減碳量

                +
                kG
                +
                +
                +
                +

                今日減碳量

                +

                6,091.78

                +
                +
                +

                累積減碳量

                +

                985.98

                +
                +
                +
                +
                +
                + +
                +
                + +
                +
                + +
                +
                +
                +
                + +
                +
                + +
                +
                \ No newline at end of file diff --git a/SolarPower/wwwroot/upload/power_station/1/08d2e127-759a-4ecb-a64a-2bb33de96fe1.png b/SolarPower/wwwroot/upload/power_station/1/08d2e127-759a-4ecb-a64a-2bb33de96fe1.png new file mode 100644 index 0000000..3f5406d Binary files /dev/null and b/SolarPower/wwwroot/upload/power_station/1/08d2e127-759a-4ecb-a64a-2bb33de96fe1.png differ diff --git a/SolarPower/wwwroot/upload/power_station/1/39c4a5c6-991a-4afa-9d05-490150f035b9.png b/SolarPower/wwwroot/upload/power_station/1/39c4a5c6-991a-4afa-9d05-490150f035b9.png new file mode 100644 index 0000000..3f5406d Binary files /dev/null and b/SolarPower/wwwroot/upload/power_station/1/39c4a5c6-991a-4afa-9d05-490150f035b9.png differ diff --git a/SolarPower/wwwroot/upload/power_station/1/405a06c2-9a39-4b22-b577-af09cfa2e6dc.png b/SolarPower/wwwroot/upload/power_station/1/405a06c2-9a39-4b22-b577-af09cfa2e6dc.png new file mode 100644 index 0000000..a4e3eb2 Binary files /dev/null and b/SolarPower/wwwroot/upload/power_station/1/405a06c2-9a39-4b22-b577-af09cfa2e6dc.png differ diff --git a/SolarPower/wwwroot/upload/power_station/1/e9b17558-c72f-43a4-b3db-cecc6337633a.png b/SolarPower/wwwroot/upload/power_station/1/e9b17558-c72f-43a4-b3db-cecc6337633a.png new file mode 100644 index 0000000..2088e69 Binary files /dev/null and b/SolarPower/wwwroot/upload/power_station/1/e9b17558-c72f-43a4-b3db-cecc6337633a.png differ