1. 統一 計算方式
2. 修改 合併電站計算方式
This commit is contained in:
parent
18f76e4b84
commit
7c79b97825
@ -84,8 +84,6 @@ namespace SolarPower.Quartz.Jobs
|
||||
logger.LogError("【{0}】{1}", "CalcPowerStationJob", ex.Message);
|
||||
observation = null;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region step2. 從電站的DB及電站編號找出該電站的控制器
|
||||
@ -103,7 +101,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
|
||||
if (string.IsNullOrEmpty(exist))
|
||||
{
|
||||
logger.LogError("【CalcPowerStationJob】【查無電站[{0}]的s{0}01_station資料表】", powerStation.Code);
|
||||
logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_station資料表】");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -139,24 +137,24 @@ namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
case (int)SolarTypeEnum.SelfSold: //自建躉售
|
||||
|
||||
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;
|
||||
}
|
||||
//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;
|
||||
//今日發電金額 計算方式: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;
|
||||
////總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate;
|
||||
//calcPowerStation.Total_Money = history.TOTALMONEY;
|
||||
break;
|
||||
case (int)SolarTypeEnum.HireSold: //租建躉售
|
||||
//找出該電站的所有土地房屋資訊
|
||||
@ -170,43 +168,49 @@ namespace SolarPower.Quartz.Jobs
|
||||
}
|
||||
//avgLeaseRate = sumLeaseRate / landBuildings.Count();
|
||||
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
//if (lastmoneyhistorybyhour != null)
|
||||
//{
|
||||
// history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||
// history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||
|
||||
//今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均)
|
||||
calcPowerStation.Today_Money = lastmoneyhistorybyhour.TODAYMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate);
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = lastmoneyhistorybyhour.TOTALMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||
// //今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均)
|
||||
// calcPowerStation.Today_Money = lastmoneyhistorybyhour.TODAYMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate);
|
||||
// //總發電金額 計算方式:totalkWh * 授電費率
|
||||
// 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;
|
||||
//}
|
||||
|
||||
calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate * sumLeaseRate;
|
||||
calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate * sumLeaseRate;
|
||||
|
||||
calcPowerStation.Today_Money = history.KWH * powerStation.PowerRate * sumLeaseRate;
|
||||
calcPowerStation.Total_Money = history.KWH * powerStation.PowerRate * sumLeaseRate;
|
||||
}
|
||||
break;
|
||||
case (int)SolarTypeEnum.SelfUse: //自建自用
|
||||
|
||||
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;
|
||||
}
|
||||
//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;
|
||||
//calcPowerStation.Today_Money = history.TODAYMONEY;
|
||||
calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate;
|
||||
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history.TOTALMONEY;
|
||||
//calcPowerStation.Total_Money = history.TOTALMONEY;
|
||||
calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate;
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
@ -225,29 +229,24 @@ namespace SolarPower.Quartz.Jobs
|
||||
carbonRate = Convert.ToDouble(await powerStationRepository.GetOneVariableByName("CarbonRate"));
|
||||
|
||||
history.CARBON = history.KWH * carbonRate;
|
||||
if (lastmoneyhistorybyhour != null)
|
||||
{
|
||||
history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate;
|
||||
history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate;
|
||||
//if (lastmoneyhistorybyhour != null)
|
||||
//{
|
||||
// history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate;
|
||||
// history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// history.TODAYCARBON = history.KWH * carbonRate;
|
||||
// history.TOTALCARBON = history.KWH * carbonRate;
|
||||
//}
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history.TODAYCARBON;
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
//calcPowerStation.Today_Carbon = history.TODAYCARBON;
|
||||
calcPowerStation.Today_Carbon = history.TodayKWh * carbonRate;
|
||||
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history.TOTALCARBON;
|
||||
}
|
||||
else
|
||||
{
|
||||
history.TODAYCARBON = history.KWH * carbonRate;
|
||||
history.TOTALCARBON = history.KWH * carbonRate;
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history.TODAYCARBON;
|
||||
|
||||
history.CARBON = history.KWH * carbonRate;
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||
}
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
//calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -269,7 +268,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var sensoravg_table_exist = await powerStationRepository.ExistTable(powerStation.SiteDB, sensoravg_table_name);
|
||||
if (string.IsNullOrEmpty(sensoravg_table_exist))
|
||||
{
|
||||
logger.LogError("【CalcPowerStationJob】【查無電站[0]的s{0}01_sensoravg資料表】", powerStation.Code);
|
||||
logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_sensoravg資料表】");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -534,7 +533,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var exist_meter_table = await powerStationRepository.ExistTable(powerStation.SiteDB, meter_table_name);
|
||||
if (string.IsNullOrEmpty(exist_meter_table))
|
||||
{
|
||||
logger.LogError("【CalcPowerStationJob】【查無電站[{0}]的s{0}01_meter資料表】", powerStation.Code);
|
||||
logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_meter資料表】");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -38,8 +38,8 @@ namespace SolarPower.Repository.Implement
|
||||
SUM(TOTALMONEY) AS All_money,
|
||||
SUM(TOTALKWH) AS All_kwh,
|
||||
SUM(TOTALCARBON) AS All_Carbon
|
||||
from power_station_history_month
|
||||
WHERE PowerStationId IN @ids
|
||||
from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN (8) GROUP BY PowerStationId) a
|
||||
LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP
|
||||
)
|
||||
AS m,
|
||||
(
|
||||
|
||||
@ -432,7 +432,7 @@
|
||||
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
|
||||
{
|
||||
<text>
|
||||
$('#card_' + val.id).find('#PowerRate').html((val.today_kWh * val.powerRate).toFixed());
|
||||
$('#card_' + val.id).find('#PowerRate').html((val.today_Money).toFixed());
|
||||
</text>
|
||||
}
|
||||
$('#card_' + val.id).find('#PR').html(val.today_PR);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user