diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 638a361..172f302 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -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); diff --git a/solarApp/Service/archiveLowData.cs b/solarApp/Service/archiveLowData.cs index 64c1a36..289816f 100644 --- a/solarApp/Service/archiveLowData.cs +++ b/solarApp/Service/archiveLowData.cs @@ -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();