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