修改補償機制 Part1
This commit is contained in:
parent
c2533ddd95
commit
5f4a352972
@ -158,12 +158,34 @@ 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 ,
|
||||
(a.KWH * PowerRate) MONEY, (a.TODAYKWH * PowerRate) TODAYMONEY, (a.TOTALKWH * PowerRate) TOTALMONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.KWH * c.LeaseRate
|
||||
ELSE a.KWH * PowerRate
|
||||
END MONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TODAYKWH * c.LeaseRate
|
||||
ELSE a.KWH * PowerRate
|
||||
END TODAYMONEY,
|
||||
CASE
|
||||
WHEN b.SolarType = 1 THEN a.TOTALKWH * c.LeaseRate
|
||||
ELSE a.KWH * PowerRate
|
||||
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
|
||||
from solar_master.power_station where `code` = @siteID
|
||||
) b on a.siteID = b.siteID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
SUM(lb.LeaseRate) LeaseRate,
|
||||
ps.Code siteID FROM " + _siteDB + @".land_building lb
|
||||
LEFT JOIN solar_master.power_station ps ON lb.PowerStationId = ps.Id
|
||||
WHERE ps.Code = @siteID
|
||||
GROUP BY lb.PowerStationId
|
||||
) c ON a.siteID = c.siteID
|
||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and a.SITEID = @siteID ";
|
||||
int ct = conn.Execute(sql, new { date1 = _date1, siteID = _siteID });
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user