電站報表-修改綜合報表匯出的格式
This commit is contained in:
parent
ad5386ca7f
commit
52589c37c4
@ -1664,6 +1664,7 @@ namespace SolarPower.Controllers
|
|||||||
ICell cell;
|
ICell cell;
|
||||||
double kwhkwp = 0;
|
double kwhkwp = 0;
|
||||||
double kwp = 0;
|
double kwp = 0;
|
||||||
|
double totalGeneratingCapacity = 0;
|
||||||
CellRangeAddress region;
|
CellRangeAddress region;
|
||||||
List<CityArray> cityArrays = new List<CityArray>();
|
List<CityArray> cityArrays = new List<CityArray>();
|
||||||
foreach (var form in Formbody.Result.Data)
|
foreach (var form in Formbody.Result.Data)
|
||||||
@ -1681,19 +1682,51 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(form.Kwh,2));
|
//cell.SetCellValue(form.PowerstationType);
|
||||||
|
switch (form.PowerstationType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
cell.SetCellValue("自建躉售");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
cell.SetCellValue("租建躉售");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
cell.SetCellValue("自發自用");
|
||||||
|
break;
|
||||||
|
}
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(form.AvgKWHKWP,2));
|
cell.SetCellValue(form.ElectricityMeterAt);
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(form.Irradiance,2));
|
cell.SetCellValue(Math.Round(form.PowerRate, 2));
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.TodayMoney/form.GeneratingCapacity/form.Days, 2));//日均獲利
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2));//日均發電度數
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.Kwh,2));//發電量
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
//index++;
|
||||||
|
//cell = row.CreateCell(index);
|
||||||
|
//cell.SetCellValue(Math.Round(form.Irradiance,2));
|
||||||
|
//cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(form.AvgPR,2));
|
cell.SetCellValue(Math.Round(form.AvgPR,2));
|
||||||
@ -1740,14 +1773,16 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
kwp += form.Kwh;
|
kwp += form.Kwh;
|
||||||
kwhkwp += form.AvgKWHKWP;
|
kwhkwp += form.AvgKWHKWP;
|
||||||
|
totalGeneratingCapacity += form.GeneratingCapacity;
|
||||||
RowPosition++;
|
RowPosition++;
|
||||||
CityArray cityinfo = new CityArray
|
CityArray cityinfo = new CityArray
|
||||||
{
|
{
|
||||||
City = form.CityName,
|
City = form.CityName,
|
||||||
Count = 1,
|
Count = 1,
|
||||||
Kwh = form.Kwh,
|
Kwh = form.TotalKWH,
|
||||||
SolarHour = form.SolarHour,
|
SolarHour = form.SolarHour,
|
||||||
Kwhkwp = form.AvgKWHKWP
|
Kwhkwp = form.AvgKWHKWP,
|
||||||
|
GeneratingCapacity = form.GeneratingCapacity
|
||||||
};
|
};
|
||||||
if( cityArrays.Where(a=>a.City == form.CityName).Count() > 0)
|
if( cityArrays.Where(a=>a.City == form.CityName).Count() > 0)
|
||||||
{
|
{
|
||||||
@ -1756,6 +1791,7 @@ namespace SolarPower.Controllers
|
|||||||
city.Kwh += cityinfo.Kwh;
|
city.Kwh += cityinfo.Kwh;
|
||||||
city.SolarHour += cityinfo.SolarHour;
|
city.SolarHour += cityinfo.SolarHour;
|
||||||
city.Kwhkwp += cityinfo.Kwhkwp;
|
city.Kwhkwp += cityinfo.Kwhkwp;
|
||||||
|
city.GeneratingCapacity += cityinfo.GeneratingCapacity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1772,9 +1808,13 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
"區域",
|
"區域",
|
||||||
"電站名稱",
|
"電站名稱",
|
||||||
|
"電站類型",
|
||||||
|
"掛錶日期",
|
||||||
|
"躉售費率",
|
||||||
|
"每kw日均獲利",
|
||||||
|
"日均發電度數",
|
||||||
"發電量",
|
"發電量",
|
||||||
"有效發電小時",
|
//"平均日照",
|
||||||
"平均日照",
|
|
||||||
"PR"
|
"PR"
|
||||||
};
|
};
|
||||||
if (Formhead.Result.Data.ShowMoney == 1)
|
if (Formhead.Result.Data.ShowMoney == 1)
|
||||||
@ -1811,7 +1851,17 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round((cityArray.Kwh / cityArray.Count), 2));
|
cell.SetCellValue(Math.Round(cityArray.GeneratingCapacity, 2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(cityArray.Kwh, 3));
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
sheet.AddMergedRegion(region);
|
sheet.AddMergedRegion(region);
|
||||||
@ -1822,7 +1872,7 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round((cityArray.Kwhkwp / cityArray.Count), 2));
|
cell.SetCellValue(Math.Round((cityArray.Kwh / cityArray.GeneratingCapacity), 2));
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
sheet.AddMergedRegion(region);
|
sheet.AddMergedRegion(region);
|
||||||
@ -1846,7 +1896,7 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue("平均發電量(kWp)");
|
cell.SetCellValue("裝置容量");
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
sheet.AddMergedRegion(region);
|
sheet.AddMergedRegion(region);
|
||||||
@ -1856,7 +1906,17 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue("有效發電小時");
|
cell.SetCellValue("總發電量");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("日均發電度數");
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
sheet.AddMergedRegion(region);
|
sheet.AddMergedRegion(region);
|
||||||
@ -1924,7 +1984,7 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
index ++;
|
index ++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(kwhkwp / Formbody.Result.Data.Count, 2));
|
cell.SetCellValue(Math.Round(kwp / totalGeneratingCapacity, 2));
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
sheet.AddMergedRegion(region);
|
sheet.AddMergedRegion(region);
|
||||||
@ -2037,10 +2097,10 @@ namespace SolarPower.Controllers
|
|||||||
cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2));
|
cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2));
|
||||||
cell.CellStyle = styleLine12;
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
index++;
|
//index++;
|
||||||
cell = row.CreateCell(index);
|
//cell = row.CreateCell(index);
|
||||||
cell.SetCellValue(Math.Round(form.Irradiance, 2));
|
//cell.SetCellValue(Math.Round(form.Irradiance, 2));
|
||||||
cell.CellStyle = styleLine12;
|
//cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
cell = row.CreateCell(index);
|
cell = row.CreateCell(index);
|
||||||
|
|||||||
@ -504,16 +504,6 @@ namespace SolarPower.Repository.Implement
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//var day1 = post.SearchType switch
|
|
||||||
//{
|
|
||||||
// 0 => $"{1} 'Days'",
|
|
||||||
// 1 => $"TIMESTAMPDIFF(DAY,'{times[0]}','{times[1]}') 'Days'",
|
|
||||||
// 2 => $"TIMESTAMPDIFF(DAY,'{FirstDay}','{LastDay}') 'Days'",
|
|
||||||
// 3 => $"TIMESTAMPDIFF(DAY,'{yFirstDay}','{yLastDay}') 'Days'",
|
|
||||||
// _ => ""
|
|
||||||
//};
|
|
||||||
|
|
||||||
var wheretime = post.SearchType switch
|
var wheretime = post.SearchType switch
|
||||||
{
|
{
|
||||||
0 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Time}'",
|
0 => $"AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Time}'",
|
||||||
|
|||||||
@ -872,12 +872,11 @@
|
|||||||
str += "<th>電站名稱</th>";
|
str += "<th>電站名稱</th>";
|
||||||
str += "<th>電站類型</th>";
|
str += "<th>電站類型</th>";
|
||||||
str += "<th>掛錶日期</th>";
|
str += "<th>掛錶日期</th>";
|
||||||
str += "<th>裝置容量</th>";
|
/*str += "<th>裝置容量</th>";*/
|
||||||
str += "<th>躉售費率</th>";
|
str += "<th>躉售費率</th>";
|
||||||
str += "<th>每kw日均獲利</th>";
|
str += "<th>每kw日均獲利</th>";
|
||||||
str += "<th>日均發電度數</th>";
|
str += "<th>日均發電度數</th>";
|
||||||
str += "<th>發電量</th>";
|
str += "<th>發電量</th>";
|
||||||
str += "<th>累積日照量</th>";
|
|
||||||
str += "<th>PR</th>";
|
str += "<th>PR</th>";
|
||||||
if (rel.data.showMoney == 1) {
|
if (rel.data.showMoney == 1) {
|
||||||
str += "<th>發電金額</th>";
|
str += "<th>發電金額</th>";
|
||||||
@ -1535,8 +1534,10 @@
|
|||||||
var CityInfoBody = "";
|
var CityInfoBody = "";
|
||||||
var TotalHead = "";
|
var TotalHead = "";
|
||||||
var TotalBody = "";
|
var TotalBody = "";
|
||||||
|
var powerStationTypeName = "";
|
||||||
var kwhkwp = 0;
|
var kwhkwp = 0;
|
||||||
var kwp = 0;
|
var kwp = 0;
|
||||||
|
var totalGeneratingCapacity = 0;
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
toast_warning(rel.msg);
|
toast_warning(rel.msg);
|
||||||
@ -1602,25 +1603,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (data.powerstationType) {
|
||||||
|
case 0:
|
||||||
|
powerStationTypeName = "自建躉售";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
powerStationTypeName = "租建躉售";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
powerStationTypeName = "自發自用";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
StrInfoBody += "<tr>";
|
StrInfoBody += "<tr>";
|
||||||
StrInfoBody += "<td>" + data.cityName + data.areaName + "</td>";
|
StrInfoBody += "<td>" + data.cityName + data.areaName + "</td>";
|
||||||
StrInfoBody += "<td>" + data.powerstationName + "</td>";
|
StrInfoBody += "<td>" + data.powerstationName + "</td>";
|
||||||
StrInfoBody += "<td>" + data.powerstationType + "</td>";
|
StrInfoBody += "<td>" + powerStationTypeName + "</td>";
|
||||||
StrInfoBody += "<td>" + data.electricityMeterAt + "</td>";
|
StrInfoBody += "<td>" + data.electricityMeterAt + "</td>";
|
||||||
StrInfoBody += "<td>" + data.generatingCapacity.toFixed(2) + "</td>";
|
/*StrInfoBody += "<td>" + data.generatingCapacity.toFixed(2) + "</td>";*/
|
||||||
StrInfoBody += "<td>" + data.powerRate.toFixed(2) + "</td>";
|
StrInfoBody += "<td>" + data.powerRate.toFixed(2) + "</td>";
|
||||||
StrInfoBody += "<td>" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "</td>";//每kw日均獲利
|
StrInfoBody += "<td>" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "</td>";//每kw日均獲利
|
||||||
StrInfoBody += "<td>" + toThousands(data.avgKWHKWP.toFixed(2)) + "</td>"; // 日均發電度數
|
StrInfoBody += "<td>" + toThousands(data.avgKWHKWP.toFixed(2)) + "</td>"; // 日均發電度數
|
||||||
StrInfoBody += "<td>" + toThousands(data.kwh.toFixed(2)) + "</td>"; // 發電量
|
StrInfoBody += "<td>" + toThousands(data.kwh.toFixed(2)) + "</td>"; // 發電量
|
||||||
StrInfoBody += "<td>" + toThousands(data.irradiance.toFixed(2)) + "</td>"; // 累積日照
|
/*StrInfoBody += "<td>" + toThousands(data.irradiance.toFixed(2)) + "</td>"; // 累積日照*/
|
||||||
StrInfoBody += "<td>" + toThousands(data.avgPR.toFixed(2)) + "</td>";
|
StrInfoBody += "<td>" + toThousands(data.avgPR.toFixed(2)) + "</td>";
|
||||||
if (showmoney == 1) {
|
if (showmoney == 1) {
|
||||||
|
|
||||||
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney)) + "</td>";
|
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney, 2)) + "</td>";
|
||||||
|
|
||||||
StrInfoBody += "<td>" + Math.round(data.todayMoney * hirerate * 0.01)+ "</td>";
|
StrInfoBody += "<td>" + Math.round(data.todayMoney * hirerate * 0.01, 2)+ "</td>";
|
||||||
|
|
||||||
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney)) + "</td>";
|
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney, 2)) + "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1628,7 +1641,7 @@
|
|||||||
StrInfoBody += "</tr>";
|
StrInfoBody += "</tr>";
|
||||||
kwp += data.kwh;
|
kwp += data.kwh;
|
||||||
kwhkwp += data.avgKWHKWP;
|
kwhkwp += data.avgKWHKWP;
|
||||||
|
totalGeneratingCapacity += data.generatingCapacity;
|
||||||
})
|
})
|
||||||
//中間
|
//中間
|
||||||
$.each(CityArray, function (index, data) {
|
$.each(CityArray, function (index, data) {
|
||||||
@ -1659,7 +1672,7 @@
|
|||||||
|
|
||||||
|
|
||||||
TotalBody += "<th>" + toThousands(kwp.toFixed(2)) + "</th>";
|
TotalBody += "<th>" + toThousands(kwp.toFixed(2)) + "</th>";
|
||||||
TotalBody += "<th>" + toThousands((kwhkwp / rel.data.length).toFixed(2)) + "</th>";
|
TotalBody += "<th>" + toThousands((kwp / totalGeneratingCapacity).toFixed(2)) + "</th>";
|
||||||
TotalBody += "</tr>";
|
TotalBody += "</tr>";
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user