1. 修改背景執行 金額計算
This commit is contained in:
parent
f8015966d8
commit
866f64cc10
@ -131,16 +131,32 @@ namespace SolarPower.Quartz.Jobs
|
||||
#endregion
|
||||
|
||||
#region 發電金額
|
||||
//發電金額
|
||||
|
||||
history.MONEY = history.KWH * powerStation.PowerRate;
|
||||
|
||||
//即時發電金額
|
||||
switch (powerStation.SolarType)
|
||||
{
|
||||
case (int)SolarTypeEnum.SelfSold: //自建躉售
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率
|
||||
calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate;
|
||||
history.MONEY = history.KWH * powerStation.PowerRate;
|
||||
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate;
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||
}
|
||||
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率,如有上筆資料,需累加 上一筆金額
|
||||
//calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate;
|
||||
calcPowerStation.Today_Money = history.TODAYMONEY;
|
||||
|
||||
////總發電金額 計算方式:totalkWh * 授電費率,如有上筆資料,需累加 上一筆金額
|
||||
//calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate;
|
||||
calcPowerStation.Total_Money = history.TOTALMONEY;
|
||||
break;
|
||||
case (int)SolarTypeEnum.HireSold: //租建躉售
|
||||
//找出該電站的所有土地房屋資訊
|
||||
@ -154,21 +170,43 @@ namespace SolarPower.Quartz.Jobs
|
||||
}
|
||||
//avgLeaseRate = sumLeaseRate / landBuildings.Count();
|
||||
|
||||
//今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均)
|
||||
calcPowerStation.Today_Money = history.TodayKWh * sumLeaseRate;
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
|
||||
history.MONEY = history.KWH * sumLeaseRate;
|
||||
//今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均)
|
||||
calcPowerStation.Today_Money = lastmoneyhistorybyhour.TODAYMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate);
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history.TotalKWH * sumLeaseRate;
|
||||
calcPowerStation.Total_Money = lastmoneyhistorybyhour.TOTALMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||
|
||||
calcPowerStation.Today_Money = history.KWH * powerStation.PowerRate * sumLeaseRate;
|
||||
calcPowerStation.Total_Money = history.KWH * powerStation.PowerRate * sumLeaseRate;
|
||||
}
|
||||
break;
|
||||
case (int)SolarTypeEnum.SelfUse: //自建自用
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率
|
||||
calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate;
|
||||
|
||||
history.MONEY = history.KWH * powerStation.PowerRate;
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||
}
|
||||
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率
|
||||
calcPowerStation.Today_Money = history.TODAYMONEY;
|
||||
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate;
|
||||
calcPowerStation.Total_Money = history.TOTALMONEY;
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
@ -186,26 +224,29 @@ namespace SolarPower.Quartz.Jobs
|
||||
#region 減碳量
|
||||
carbonRate = Convert.ToDouble(await powerStationRepository.GetOneVariableByName("CarbonRate"));
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history.TodayKWh * carbonRate;
|
||||
|
||||
history.CARBON = history.KWH * carbonRate;
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate;
|
||||
history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate;
|
||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history.TODAYCARBON;
|
||||
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history.TOTALCARBON;
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYCARBON = history.KWH * carbonRate;
|
||||
history.TOTALCARBON = history.KWH * carbonRate;
|
||||
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history.TODAYCARBON;
|
||||
|
||||
history.CARBON = history.KWH * carbonRate;
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -4420,6 +4420,7 @@ namespace SolarPower.Repository.Implement
|
||||
var temp_sql = $@"SELECT
|
||||
FROM_UNIXTIME(inv.TIMESTAMP/1000, '%H:%i') AS TIMESTAMP,
|
||||
inv.INVERTERID,
|
||||
i.InverterName AS INVERTERName,
|
||||
sen.{entity.Sensor} AS Irradiance,
|
||||
((inv.DC1W + inv.DC2W + inv.DC3W + inv.DC4W + inv.DC5W) / 1000) AS DCKW,
|
||||
((inv.AC1W + inv.AC2W + inv.AC3W) / 1000) AS ACKW,
|
||||
@ -4466,8 +4467,9 @@ namespace SolarPower.Repository.Implement
|
||||
inv.RA5
|
||||
FROM {table_name} inv
|
||||
LEFT JOIN {sensor_table_name} sen ON FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i') = FROM_UNIXTIME(sen.TIMESTAMP/1000, '%Y-%m-%d %H:%i')
|
||||
LEFT JOIN {entity.SiteDB}.inverter i ON inv.INVERTERID = i.InverterId
|
||||
WHERE FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d') = @NowDay
|
||||
AND INVERTERID IN ('{inverterIds}')";
|
||||
AND inv.INVERTERID IN ('{inverterIds}')";
|
||||
|
||||
sql_perSiteDB.Add(temp_sql);
|
||||
}
|
||||
@ -4503,6 +4505,7 @@ namespace SolarPower.Repository.Implement
|
||||
var temp_sql = $@"SELECT
|
||||
DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP,
|
||||
INVERTERID,
|
||||
i.InverterName AS INVERTERName,
|
||||
inv.Irradiance,
|
||||
inv.KWH,
|
||||
inv.TODAYKWH,
|
||||
@ -4513,6 +4516,7 @@ namespace SolarPower.Repository.Implement
|
||||
inv.RA4,
|
||||
inv.RA5
|
||||
FROM inverter_history_day inv
|
||||
LEFT JOIN {entity.SiteDBName}.inverter i ON inv.INVERTERID = i.InverterId
|
||||
WHERE inv.PowerStationId = {entity.PowerStationId}
|
||||
AND inv.INVERTERID IN ('{inverterIds}')
|
||||
AND inv.TIMESTAMP BETWEEN @StartDay AND @EndDay";
|
||||
@ -4551,6 +4555,7 @@ namespace SolarPower.Repository.Implement
|
||||
var temp_sql = $@"SELECT
|
||||
DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP,
|
||||
INVERTERID,
|
||||
i.InverterName AS INVERTERName,
|
||||
inv.KWH,
|
||||
inv.TODAYKWH,
|
||||
inv.PR,
|
||||
@ -4560,6 +4565,7 @@ namespace SolarPower.Repository.Implement
|
||||
inv.RA4,
|
||||
inv.RA5
|
||||
FROM inverter_history_month inv
|
||||
LEFT JOIN {entity.SiteDBName}.inverter i ON inv.INVERTERID = i.InverterId
|
||||
WHERE inv.PowerStationId = {entity.PowerStationId}
|
||||
AND inv.INVERTERID IN ('{inverterIds}')
|
||||
AND DATE_FORMAT(inv.TIMESTAMP, '%Y') = @Year";
|
||||
|
||||
@ -111,22 +111,6 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span>有效日照時數</h4>
|
||||
<div class="ml-auto">hr</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<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>平均有效日照時數(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_kwhkwp">0.00</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> PR值</h4>
|
||||
@ -143,7 +127,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span>有效日照時數</h4>
|
||||
<div class="ml-auto">hr</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between">
|
||||
<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>平均有效日照時數(30天)</p>
|
||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_kwhkwp">0.00</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-cow mr-1"></span> 減碳量</h4>
|
||||
|
||||
@ -278,10 +278,10 @@
|
||||
'<div id="bodyContent">' +
|
||||
'<div class="row">' +
|
||||
'<div class="col-12">' +
|
||||
'<div>即時總發電量:' + item.today_kWh + '</div>'+
|
||||
'<div>即時平均日照度:' + item.today_irradiance + '</div>'+
|
||||
'<div>發電小時:' + item.solarHour + '</div>' +
|
||||
'<div>裝置容量:' + item.generatingCapacity.toFixed(3) + '</div>' +
|
||||
'<div>今日發電量(kW h):' + item.today_kWh + '</div>'+
|
||||
'<div>今日日照度(k W/m<sup>2</sup>):' + item.today_irradiance + '</div>'+
|
||||
'<div>今日發電小時(hr):' + item.solarHour + '</div>' +
|
||||
'<div>裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '</div>' +
|
||||
'<div>掛錶日期:' + item.electricityMeterAt + '</div>' +
|
||||
'<div>天氣:' + item.wx + '</div>'+
|
||||
'</div>' +
|
||||
|
||||
@ -675,9 +675,11 @@
|
||||
//#region 新增維修單
|
||||
function AddRecord() {
|
||||
selected_id = 0;
|
||||
record = undefined;
|
||||
$("#record-form-modal .modal-title .main-title").html("維修單");
|
||||
$("#record-form-modal .modal-title .sub-title").html("");
|
||||
$("#power_station_select_modal").attr("disabled", false);
|
||||
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
|
||||
$(".fix-div").show();
|
||||
$("#record-form").trigger("reset");
|
||||
$("input[name=status_modal][value='" + 0 + "']").prop('checked', true); //狀態
|
||||
|
||||
@ -135,7 +135,6 @@
|
||||
<table id="solarTable" class="table table-bordered table-hover m-0 text-center">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>編號</th>
|
||||
<th>電站名稱</th>
|
||||
<th>裝置容量(kWp)</th>
|
||||
<th>逆變器數量</th>
|
||||
@ -353,8 +352,7 @@
|
||||
}
|
||||
|
||||
$('#solarTable' + val.cityId).find('tbody').append('<tr data-id="' + val.id + '" datacity-id="' + val.cityId + '"">' +
|
||||
'<td>' + val.id + '</td>' +
|
||||
'<td>' + val.name + '</td>' +
|
||||
'<td><a href="' + localurl + '/edit?stationId=' + val.id +'">' + val.name + '</td>' +
|
||||
'<td>' + val.generatingCapacity.toFixed(3) + '</td>' +
|
||||
'<td>' + val.inverterAmount + '</td>' +
|
||||
|
||||
|
||||
@ -425,7 +425,8 @@
|
||||
$('#card_' + val.id).find('#stationtype').html(type);
|
||||
var time = new Date(val.createdAt);
|
||||
$('#card_' + val.id).find('#editSolarUrl').attr('href', localurl + '/Info?stationId=' + val.id);
|
||||
$('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes());
|
||||
@*$('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes());*@
|
||||
$('#card_' + val.id).find('#date').html(val.electricityMeterAt);
|
||||
$('#card_' + val.id).find('#today_kwh').html(val.today_kWh.toFixed(2));
|
||||
$('#card_' + val.id).find('#Capacity').html(val.generatingCapacity.toFixed(3));
|
||||
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
|
||||
|
||||
@ -158,21 +158,21 @@ namespace solarApp.Service
|
||||
|
||||
select b.id PowerStationId, concat(FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H'), ':00:00') reportdate, a.siteid, a.siteType,
|
||||
a.KWH, TODAYKWH, TOTALKWH, KWHKWP , PR, MP, a.SOLARHOUR ,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.KWH * c.LeaseRate
|
||||
/* CASE
|
||||
WHEN b.SolarType = 1 THEN a.KWH * PowerRate * c.LeaseRate
|
||||
ELSE a.KWH * PowerRate
|
||||
END MONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TODAYKWH * c.LeaseRate
|
||||
WHEN b.SolarType = 1 THEN a.TODAYKWH * PowerRate * c.LeaseRate
|
||||
ELSE a.TODAYKWH * PowerRate
|
||||
END TODAYMONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * c.LeaseRate
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * PowerRate * c.LeaseRate
|
||||
ELSE a.TOTALKWH * PowerRate
|
||||
END TOTALMONEY,
|
||||
-- (a.KWH * PowerRate) MONEY,
|
||||
-- (a.TODAYKWH * PowerRate) TODAYMONEY,
|
||||
-- (a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
END TOTALMONEY,*/
|
||||
(a.KWH * PowerRate) MONEY,
|
||||
(a.TODAYKWH * PowerRate) TODAYMONEY,
|
||||
(a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
(a.KWH * CarbonRate) CARBON, (a.TODAYKWH * CarbonRate) TODAYCARBON, round((a.TOTALKWH * CarbonRate), 3) TOTALCARBON
|
||||
from " + _siteDB + ".s" + _siteID01 + @"_station a join
|
||||
(select id, `code` siteID, PowerRate, (select `value` from solar_master.`variable` where `name` = 'CarbonRate') as CarbonRate, SolarType
|
||||
@ -196,16 +196,16 @@ namespace solarApp.Service
|
||||
PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON)
|
||||
|
||||
select b.id PowerStationId, a.reportdate, b.siteID, a.siteType, a.TODAYKWH, a.TOTALKWH, a.KWHKWP, a.PR, a.MP, a.SOLARHOUR,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.KWH * c.LeaseRate
|
||||
/*CASE
|
||||
WHEN b.SolarType = 1 THEN a.KWH * PowerRate * c.LeaseRate
|
||||
ELSE a.KWH * PowerRate
|
||||
END MONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * c.LeaseRate
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * PowerRate * c.LeaseRate
|
||||
ELSE a.TOTALKWH * PowerRate
|
||||
END TOTALMONEY,
|
||||
-- (KWH * PowerRate) MONEY,
|
||||
-- (a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
END TOTALMONEY,*/
|
||||
(KWH * PowerRate) MONEY,
|
||||
(a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
(KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON
|
||||
from
|
||||
(
|
||||
@ -240,16 +240,16 @@ namespace solarApp.Service
|
||||
PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON)
|
||||
|
||||
select b.id PowerStationId, a.reportdate, b.siteID, a.siteType, TODAYKWH as monthKwh , a.TOTALKWH, a.KWHKWP, a.PR, a.MP, a.SOLARHOUR,
|
||||
CASE
|
||||
/*CASE
|
||||
WHEN b.SolarType = 1 THEN a.TODAYKWH * c.LeaseRate
|
||||
ELSE a.TODAYKWH * PowerRate
|
||||
END MONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * c.LeaseRate
|
||||
ELSE a.TOTALKWH * PowerRate
|
||||
END TOTALMONEY,
|
||||
-- (TODAYKWH * PowerRate) MONEY,
|
||||
-- (a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
END TOTALMONEY,*/
|
||||
(TODAYKWH * PowerRate) MONEY,
|
||||
(a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
(TODAYKWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON
|
||||
from
|
||||
(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user