From 52589c37c4b75f8d7fe169a143368a81ee839a08 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Mon, 1 Aug 2022 12:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=BB=E7=AB=99=E5=A0=B1=E8=A1=A8-=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=B6=9C=E5=90=88=E5=A0=B1=E8=A1=A8=E5=8C=AF=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 92 +++++++++++++++---- .../Implement/StationReportRepository.cs | 10 -- SolarPower/Views/StationReport/Index.cshtml | 33 +++++-- 3 files changed, 99 insertions(+), 36 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index db19d7e..cab003a 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -1664,6 +1664,7 @@ namespace SolarPower.Controllers ICell cell; double kwhkwp = 0; double kwp = 0; + double totalGeneratingCapacity = 0; CellRangeAddress region; List cityArrays = new List(); foreach (var form in Formbody.Result.Data) @@ -1681,19 +1682,51 @@ namespace SolarPower.Controllers 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; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.AvgKWHKWP,2)); + cell.SetCellValue(form.ElectricityMeterAt); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.Irradiance,2)); + cell.SetCellValue(Math.Round(form.PowerRate, 2)); 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++; cell = row.CreateCell(index); cell.SetCellValue(Math.Round(form.AvgPR,2)); @@ -1740,14 +1773,16 @@ namespace SolarPower.Controllers kwp += form.Kwh; kwhkwp += form.AvgKWHKWP; + totalGeneratingCapacity += form.GeneratingCapacity; RowPosition++; CityArray cityinfo = new CityArray { City = form.CityName, Count = 1, - Kwh = form.Kwh, + Kwh = form.TotalKWH, SolarHour = form.SolarHour, - Kwhkwp = form.AvgKWHKWP + Kwhkwp = form.AvgKWHKWP, + GeneratingCapacity = form.GeneratingCapacity }; if( cityArrays.Where(a=>a.City == form.CityName).Count() > 0) { @@ -1756,6 +1791,7 @@ namespace SolarPower.Controllers city.Kwh += cityinfo.Kwh; city.SolarHour += cityinfo.SolarHour; city.Kwhkwp += cityinfo.Kwhkwp; + city.GeneratingCapacity += cityinfo.GeneratingCapacity; } else { @@ -1772,9 +1808,13 @@ namespace SolarPower.Controllers { "區域", "電站名稱", + "電站類型", + "掛錶日期", + "躉售費率", + "每kw日均獲利", + "日均發電度數", "發電量", - "有效發電小時", - "平均日照", + //"平均日照", "PR" }; if (Formhead.Result.Data.ShowMoney == 1) @@ -1811,7 +1851,17 @@ namespace SolarPower.Controllers 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; region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1822,7 +1872,7 @@ namespace SolarPower.Controllers 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; region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1846,7 +1896,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue("平均發電量(kWp)"); + cell.SetCellValue("裝置容量"); cell.CellStyle = styleLine12; region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1856,7 +1906,17 @@ namespace SolarPower.Controllers 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; region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1924,7 +1984,7 @@ namespace SolarPower.Controllers 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; region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -2037,10 +2097,10 @@ namespace SolarPower.Controllers cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2)); cell.CellStyle = styleLine12; - index++; - cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.Irradiance, 2)); - cell.CellStyle = styleLine12; + //index++; + //cell = row.CreateCell(index); + //cell.SetCellValue(Math.Round(form.Irradiance, 2)); + //cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 7fb1e31..8dde273 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -503,16 +503,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 { diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index 6278c0e..3f2b927 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -872,12 +872,11 @@ str += "電站名稱"; str += "電站類型"; str += "掛錶日期"; - str += "裝置容量"; + /*str += "裝置容量";*/ str += "躉售費率"; str += "每kw日均獲利"; str += "日均發電度數"; str += "發電量"; - str += "累積日照量"; str += "PR"; if (rel.data.showMoney == 1) { str += "發電金額"; @@ -1535,8 +1534,10 @@ var CityInfoBody = ""; var TotalHead = ""; var TotalBody = ""; + var powerStationTypeName = ""; var kwhkwp = 0; var kwp = 0; + var totalGeneratingCapacity = 0; $.post(url, send_data, function (rel) { if (rel.code != "0000") { toast_warning(rel.msg); @@ -1602,25 +1603,37 @@ } } + switch (data.powerstationType) { + case 0: + powerStationTypeName = "自建躉售"; + break; + case 1: + powerStationTypeName = "租建躉售"; + break; + case 2: + powerStationTypeName = "自發自用"; + break; + } + StrInfoBody += ""; StrInfoBody += "" + data.cityName + data.areaName + ""; StrInfoBody += "" + data.powerstationName + ""; - StrInfoBody += "" + data.powerstationType + ""; + StrInfoBody += "" + powerStationTypeName + ""; StrInfoBody += "" + data.electricityMeterAt + ""; - StrInfoBody += "" + data.generatingCapacity.toFixed(2) + ""; + /*StrInfoBody += "" + data.generatingCapacity.toFixed(2) + "";*/ StrInfoBody += "" + data.powerRate.toFixed(2) + ""; StrInfoBody += "" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "";//每kw日均獲利 StrInfoBody += "" + toThousands(data.avgKWHKWP.toFixed(2)) + ""; // 日均發電度數 StrInfoBody += "" + toThousands(data.kwh.toFixed(2)) + ""; // 發電量 - StrInfoBody += "" + toThousands(data.irradiance.toFixed(2)) + ""; // 累積日照 + /*StrInfoBody += "" + toThousands(data.irradiance.toFixed(2)) + ""; // 累積日照*/ StrInfoBody += "" + toThousands(data.avgPR.toFixed(2)) + ""; if (showmoney == 1) { - StrInfoBody += "" + toThousands(Math.round(data.todayMoney)) + ""; + StrInfoBody += "" + toThousands(Math.round(data.todayMoney, 2)) + ""; - StrInfoBody += "" + Math.round(data.todayMoney * hirerate * 0.01)+ ""; + StrInfoBody += "" + Math.round(data.todayMoney * hirerate * 0.01, 2)+ ""; - StrInfoBody += "" + toThousands(Math.round(data.todayMoney)) + ""; + StrInfoBody += "" + toThousands(Math.round(data.todayMoney, 2)) + ""; } @@ -1628,7 +1641,7 @@ StrInfoBody += ""; kwp += data.kwh; kwhkwp += data.avgKWHKWP; - + totalGeneratingCapacity += data.generatingCapacity; }) //中間 $.each(CityArray, function (index, data) { @@ -1659,7 +1672,7 @@ TotalBody += "" + toThousands(kwp.toFixed(2)) + ""; - TotalBody += "" + toThousands((kwhkwp / rel.data.length).toFixed(2)) + ""; + TotalBody += "" + toThousands((kwp / totalGeneratingCapacity).toFixed(2)) + ""; TotalBody += ""; //#endregion