From 54250e64bbf22f92420b71b89784a416ded76d73 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Tue, 17 Aug 2021 12:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E6=9C=89=E8=A9=B3=E7=B4=B0=E8=B3=87?= =?UTF-8?q?=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implement/PowerStationRepository.cs | 4 +- .../PowerStation/PowerStationEdit.cshtml | 112 ++++++++++++++++-- .../Views/PowerStation/_Inverter.cshtml | 4 +- SolarPower/Views/StationOverview/Index.cshtml | 1 + SolarPower/wwwroot/js/workers/workers.js | 10 ++ 5 files changed, 114 insertions(+), 17 deletions(-) create mode 100644 SolarPower/wwwroot/js/workers/workers.js diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 50c1d09..7c69c30 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -5047,10 +5047,10 @@ namespace SolarPower.Repository.Implement { var sql = @$"SELECT b.*,c.InverterName as INVERTERName,c.ID as ID FROM ( - SELECT MAX(aa.TIMESTAMP) AS maxtime ,aa.INVERTERID from (SELECT * from {site_db}.{site_table} LIMIT 500) aa GROUP BY INVERTERID + SELECT MAX(aa.TIMESTAMP) AS maxtime ,aa.INVERTERID from (SELECT * from {site_db}.{site_table} ORDER BY ID desc LIMIT 1000) aa GROUP BY INVERTERID ) a LEFT JOIN - (SELECT * from {site_db}.{site_table} LIMIT 500) b ON a.maxtime = b.TIMESTAMP AND a.INVERTERID = b.INVERTERID + (SELECT * from {site_db}.{site_table} ORDER BY ID desc LIMIT 1000) b ON a.maxtime = b.TIMESTAMP AND a.INVERTERID = b.INVERTERID LEFT JOIN {site_db}.inverter c ON b.INVERTERID = c.InverterId WHERE b.INVERTERID in @ids "; diff --git a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml index 3a06227..3763f45 100644 --- a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml +++ b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml @@ -43,6 +43,11 @@ 裝置列表 + - +
@@ -73,6 +74,10 @@ @Html.Partial("_DeviceSetting")
+
+ @Html.Partial("_Inverter") +
+
@Html.Partial("_Operation")
@@ -85,9 +90,7 @@ @Html.Partial("_Exception")
-
- @Html.Partial("_Inverter") -
+ @@ -897,6 +900,15 @@ //#endregion GetInverterCard(stationId); + + if (typeof (Worker) !== "undefined") { + var worker = new Worker('../js/workers/workers.js'); + worker.onmessage = function (event) { + if (event.data == "ok") { + GetInverterCard(stationId); + } + } + } }); //#region 代管切換 @@ -2879,8 +2891,9 @@ $("#Invertercard-kwh").html(rel.data.kwh); $("#Invertercard-money").html(rel.data.today_Money); $("#Invertercard-pr").html(rel.data.today_PR); - var str = "
" + + var str = "
" + "
" + $('#prbar').remove(); $("#Invertercard").append(str); var TypeName = ""; switch (rel.data.solarType) { @@ -2924,10 +2937,10 @@ return; } $("#ullist").empty(); - var long = rel.data.length <= 3 ? rel.data.length : 4; + var long = rel.data.length <= 4 ? rel.data.length : 4; for (var a = 0; a < long; a++) { - var str = "
  • "; + var str = "
  • "; str += '
    '; str += '
    '; str += '

    ' + rel.data[a].name + '

    '; @@ -2936,12 +2949,18 @@ str += '
    '; str += '
    '; str += '

    設備狀態

    '; + if (rel.data[a].type == 1) { + str += '

    正常

    '; + } + else { + str += '

    異常

    '; + } - str += '

    正常

    '; + - str += '

    詳細資料

    '; + str += '

    詳細資料

    '; str += '
    '; str += '
    '; str += '
    '; @@ -2981,8 +3000,75 @@ $("#ullist").append(str); } + if (rel.data.length >= 4) + { + for (var a = 4; a < rel.data.length; a++) + { + + + + var str = '
      '; + str += '
      '; + str += '
      '; + str += '

      ' + rel.data[a].name + '

      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '

      設備狀態

      '; + if (rel.data[a].type == 1) { + str += '

      正常

      '; + } + else { + str += '

      異常

      '; + } + + str += '

      詳細資料

      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '

      輸出功率

      '; + str += '

      ' + rel.data[a].output.toFixed(2) + '

      '; + str += '

      kw

      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '

      輸入功率

      '; + str += '

      ' + rel.data[a].input.toFixed(2) + '

      '; + str += '

      kw

      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += 'PR ' + rel.data[a].pr.toFixed(2) + '%'; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '

      日發電量

      '; + str += '

      ' + rel.data[a].todaykwh.toFixed(2) + '

      '; + str += '

      kWh

      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
      '; + str += '
    '; + + $("#li_" + a % 4).append(str); + + } + }; }); } + + function InverterInfoDetail(id) { + $("#inverterdetailmodal").modal(); + } } \ No newline at end of file diff --git a/SolarPower/Views/PowerStation/_Inverter.cshtml b/SolarPower/Views/PowerStation/_Inverter.cshtml index e4f4dd0..907508b 100644 --- a/SolarPower/Views/PowerStation/_Inverter.cshtml +++ b/SolarPower/Views/PowerStation/_Inverter.cshtml @@ -90,7 +90,7 @@

    設備狀態

    正常

    -

    詳細資料

    +

    詳細資料

    @@ -325,7 +325,7 @@
    -