Merge branch 'master' of https://github.com/shanghohui-Company/SolarPower
This commit is contained in:
commit
e09c908071
@ -3086,6 +3086,8 @@ namespace SolarPower.Controllers
|
||||
|
||||
await powerStationRepository.DropShareDevice(stationId, powerstation.SiteDB);
|
||||
|
||||
await powerStationRepository.DeleteALLPowerStationOperationPersonnel(stationId);
|
||||
|
||||
await powerStationRepository.DeleteOne(stationId);
|
||||
|
||||
apiResult.Msg = "刪除成功";
|
||||
|
||||
@ -32,11 +32,12 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
case 0:
|
||||
string timerange = Convert.ToDateTime(post.Timerange).ToString("yyyy-MM-dd");
|
||||
sql = $@"SELECT m.*,n.* FROM
|
||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
||||
(
|
||||
SELECT AVG(KWHKWP) AS All_KWH_KWP ,SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,SUM(TOTALCARBON) AS All_Carbon,
|
||||
AVG(PR) AS All_PR
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from power_station_history_month
|
||||
WHERE PowerStationId IN @ids
|
||||
)
|
||||
@ -55,15 +56,24 @@ namespace SolarPower.Repository.Implement
|
||||
ON c.maxTIMESTAMP = b.`TIMESTAMP`
|
||||
WHERE PowerStationId IN @ids
|
||||
)
|
||||
AS n";
|
||||
AS n,
|
||||
(
|
||||
SELECT
|
||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||
AVG(avg_PR) AS All_PR
|
||||
from power_station
|
||||
WHERE Id IN @ids
|
||||
)
|
||||
AS o";
|
||||
break;
|
||||
case 1:
|
||||
var time = post.Timerange.Split('-');
|
||||
sql = $@"SELECT m.*,n.* FROM
|
||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
||||
(
|
||||
SELECT AVG(KWHKWP) AS All_KWH_KWP, SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon,
|
||||
AVG(PR) AS All_PR
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from power_station_history_month
|
||||
WHERE PowerStationId IN @ids
|
||||
)
|
||||
@ -78,17 +88,23 @@ namespace SolarPower.Repository.Implement
|
||||
FROM power_station_history_day b
|
||||
WHERE PowerStationId IN @ids AND TIMESTAMP BETWEEN '{time[0]}' AND '{time[1]}'
|
||||
)
|
||||
AS n";
|
||||
break;
|
||||
case 2:
|
||||
sql = $@"SELECT m.*,n.* FROM
|
||||
AS n,
|
||||
(
|
||||
SELECT
|
||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||
AVG(avg_PR) AS All_PR
|
||||
from power_station
|
||||
WHERE Id IN @ids
|
||||
)
|
||||
AS o";
|
||||
break;
|
||||
case 2:
|
||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
||||
(
|
||||
SELECT
|
||||
AVG(KWHKWP) AS All_KWH_KWP,
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon,
|
||||
AVG(PR) AS All_PR
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from power_station_history_month
|
||||
WHERE PowerStationId IN @ids
|
||||
)
|
||||
@ -103,14 +119,23 @@ namespace SolarPower.Repository.Implement
|
||||
FROM power_station_history_day b
|
||||
WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y-%m') = '{post.Timerange}'
|
||||
)
|
||||
AS n";
|
||||
AS n,
|
||||
(
|
||||
SELECT
|
||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||
AVG(avg_PR) AS All_PR
|
||||
from power_station
|
||||
WHERE Id IN @ids
|
||||
)
|
||||
AS o";
|
||||
break;
|
||||
case 3:
|
||||
sql = $@"SELECT m.*,n.* FROM
|
||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
||||
(
|
||||
SELECT AVG(KWHKWP) AS All_KWH_KWP, SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon,
|
||||
AVG(PR) AS All_PR
|
||||
SELECT
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from power_station_history_month
|
||||
WHERE PowerStationId IN @ids
|
||||
)
|
||||
@ -126,7 +151,15 @@ namespace SolarPower.Repository.Implement
|
||||
FROM power_station_history_month b
|
||||
WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y') = '{post.Timerange}'
|
||||
)
|
||||
AS n";
|
||||
AS n,
|
||||
(
|
||||
SELECT
|
||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||
AVG(avg_PR) AS All_PR
|
||||
from power_station
|
||||
WHERE Id IN @ids
|
||||
)
|
||||
AS o";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -5396,5 +5396,35 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteALLPowerStationOperationPersonnel(int stationId)
|
||||
{
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
using (var trans = conn.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = @$"UPDATE power_station_operation_personnel
|
||||
SET Deleted = 1
|
||||
WHERE PowerStationId = {stationId} ";
|
||||
|
||||
await conn.ExecuteAsync(sql, trans);
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,5 +602,6 @@ namespace SolarPower.Repository.Interface
|
||||
Task<List<ApicallList>> GetApicallList(int PowerStationId, string Type);
|
||||
Task<List<string>> GetShareDevicePowerstationName(int Id, string DBname);
|
||||
Task DropShareDevice(int powerstationId, string DBname);
|
||||
Task DeleteALLPowerStationOperationPersonnel(int stationId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日發電量</p>
|
||||
<p id="today_kwh_label">當日發電量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh">0.00</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -101,7 +101,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p id="money-card-subtitle-avg">今日發電金額</p>
|
||||
<p id="today_money_label">當日發電金額</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_money">0.00</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -118,11 +118,11 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日有效日照時數 </p>
|
||||
<p id="today_kwhkwp_label">當日有效日照時數 </p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwhkwp">0.00</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均有效日照時數</p>
|
||||
<p>平均有效日照時數(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_kwhkwp">0.00</span></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -134,11 +134,11 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日PR值</p>
|
||||
<p id="today_PR_label">當日PR值</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_PR">0.00</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>平均 PR 值</p>
|
||||
<p>平均 PR 值(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_PR">0.00</span></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -151,7 +151,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<p>今日減碳量</p>
|
||||
<p id="today_carbon_label">當日減碳量</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_carbon">0.00</span></p>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -242,12 +242,16 @@
|
||||
document.getElementById("DateGettextdiv").style.display = "none";//隱藏
|
||||
document.getElementById("DateGet").style.display = "";//隱藏
|
||||
$(e).removeClass("btn-secondary").addClass("btn-success");
|
||||
var timename = "";
|
||||
|
||||
|
||||
switch (type) {
|
||||
case 0: $('#DateGet').prop({ 'type': 'date' });
|
||||
$(".btn-change-quickSearch1").html("今天");
|
||||
$(".btn-change-quickSearch2").html("昨天");
|
||||
var today = new Date().toISOString().substring(0, 10);
|
||||
$('#DateGet').val(today);
|
||||
timename = "當日";
|
||||
break;
|
||||
case 1:
|
||||
|
||||
@ -282,13 +286,14 @@
|
||||
document.getElementById("DateGet").style.display = "none";//隱藏
|
||||
//#endregion
|
||||
$('#DateGettext').val(dateLimit_format + ' - ' + today_format);
|
||||
|
||||
timename = "期間";
|
||||
break;
|
||||
case 2: $('#DateGet').prop({ 'type': 'month' });
|
||||
$(".btn-change-quickSearch1").html("本月");
|
||||
$(".btn-change-quickSearch2").html("上個月");
|
||||
var now_month = new Date().toISOString().substring(0, 7);
|
||||
$('#DateGet').val(now_month);
|
||||
timename = "當月";
|
||||
break;
|
||||
case 3:
|
||||
$(".btn-change-quickSearch1").html("今年");
|
||||
@ -296,8 +301,17 @@
|
||||
var now_year = new Date().toISOString().substring(0, 4);
|
||||
$('#DateGet').prop({ 'type': 'number', 'min': 1900, 'max': now_year, 'step': 1 });
|
||||
$('#DateGet').val(now_year);
|
||||
timename = "當年";
|
||||
break;
|
||||
}
|
||||
|
||||
$("#today_kwh_label").html(timename + "發電量");
|
||||
$("#today_money_label").html(timename + "發電金額");
|
||||
$("#today_kwhkwp_label").html(timename + "有效日照時數");
|
||||
$("#today_PR_label").html(timename + "PR值");
|
||||
$("#today_carbon_label").html(timename + "減碳量");
|
||||
|
||||
|
||||
if (type == 1) {
|
||||
timerange = $('#DateGettext').val();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user