/// <summary> /// 计算耗热量并将结果集传回 /// </summary> /// <returns></returns> public WccResultSet CalcWccResultSet() { WccResultSet wccrSet = new WccResultSet(); for (int i = 0; i < _wccwns.Count; i++) { WastingCaloricCalculatorWithName wccwn = _wccwns[i]; string stname = wccwn.StationName; WccResultsCollection wccrs = new WccResultsCollection(stname); WastingCaloricCalculatorsCollection wccs = wccwn.WastingCaloricCalculatorsCollection; for (int j = 0; j < wccs.Count; j++) { WastingCaloricCalculator wcc = wccs[j]; int wc = wcc.Calc(); DateTime date = wcc.Date; WccResult wccr = new WccResult(date, wc); wccrs.Add(wccr); } wccrSet.Add(wccrs); } return(wccrSet); }
/// <summary> /// /// </summary> /// <param name="wccresult"></param> public void Add(WccResult wccresult) { if (wccresult == null) { throw new ArgumentNullException("wccresult"); } _list.Add(wccresult); }
/// <summary> /// /// </summary> public void Export() { // (row, col) // // StationName form (4,1) row ++ // Date from (3,2) col ++ DateTime dt1 = DateTime.Now; Excel.ApplicationClass excel = OpenExcel(); DateTime dt2 = DateTime.Now; MsgBox.Show("open excel: ", (dt2 - dt1).ToString()); if (excel == null) { return; } excel.Cells[1, 1] = GetReportTitle(); WriteDate(excel, this._beginDate, this._endDate); int rowOffset = 4; int colOffset = 2; for (int i = 0; i < _wccrSet.Count; i++) { WccResultsCollection wccs = _wccrSet[i]; string stname = wccs.StationName; int row = rowOffset + i; excel.Cells[row, 1] = stname; for (int j = 0; j < wccs.Count; j++) { WccResult wccr = wccs[j]; DateTime dt = wccr.Date; int wc = wccr.WastingCaloric; //int col = colOffset + j + 1; int col = GetDateCol(dt) + colOffset; // 0 - 无数据 // 1 - 只有一条记录无法计算 // if (wccr.WastingCaloric > 0 && wccr.WastingCaloric != 0 && wccr.WastingCaloric != 1) { excel.Cells[row, col] = wccr.WastingCaloric; } } } excel.Visible = true; }