debug 月報表匯出 - 平均發電量為 0

This commit is contained in:
jiahao 2023-10-08 01:03:53 +08:00
parent c0a7a2a7dc
commit 37f769d4f5
2 changed files with 12 additions and 5 deletions

View File

@ -472,7 +472,7 @@ namespace SolarPower.Controllers
#region body //RowPosition = 1
RowPosition++;
var avghour = "0"; var avgKWHKWP = "0"; var avgdayKWH = "0"; var monthKWH = "0"; var monthmoney = "0"; var monthmoneyone = "0";
var avghour = "0"; var avgKWHKWP = "0"; var avgdayKWH = "0"; double avgdayKWH_value = 0; var monthKWH = "0"; var monthmoney = "0"; var monthmoneyone = "0";
var monthGeneratingCapacity = "";
var check_hire = false;
var sitedb = "";
@ -488,7 +488,7 @@ namespace SolarPower.Controllers
avghour = Convert.ToString( dbody["tothour"]) ?? "NaN";
avgKWHKWP = Convert.ToString(dbody["KWHKWP"]) ?? "NaN";
avgKWHKWP = Convert.ToString(dbody["dayKWH"]) ?? "NaN";
avgdayKWH = Convert.ToString(dbody["dayKWH"]) ?? "NaN";
//if (dbody.TryGetValue("tothour", out vv))
// avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
@ -507,7 +507,14 @@ namespace SolarPower.Controllers
//avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
//avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
//avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
//累加 平均發電量(日)
if (avgdayKWH != "NaN")
avgdayKWH_value += Convert.ToDouble(avgdayKWH);
// avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
monthmoneyone = dbody["monthmoneyone"] == null ? "0" : dbody["monthmoneyone"].ToString();
@ -635,7 +642,7 @@ namespace SolarPower.Controllers
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);
cell.SetCellValue(Math.Round(Convert.ToDouble(avgdayKWH) / Useday,2));
cell.SetCellValue(Math.Round(avgdayKWH_value / Useday, 2));
cell.CellStyle = styleLine12;
index++;
cell = row.CreateCell(index);

View File

@ -42,7 +42,7 @@ namespace solarApp.Service
// string yyyymm = System.DateTime.Now.AddMonths(-2).ToString("yyyy-MM");
_siteID = siteID;
//搬移的月份
move_month = System.DateTime.Now.AddMonths(-1).ToString("yyyy-MM")+ "--01";
move_month = System.DateTime.Now.AddMonths(-2).ToString("yyyy-MM")+ "--01";
// move_month = System.DateTime.Now.ToString("yyyy-MM") + "--01"; //這個月
//_date1 = date1;
get_siteInfo();