//汽蚀试验导出报表按钮 private void button4_Click(object sender, EventArgs e) { ExcelFormatOptions excelFormat = new ExcelFormatOptions(); excelFormat.ExcelTabHasColumnHeadings = false; excelFormat.ExcelUseConstantColumnWidth = true; excelFormat.ExcelConstantColumnWidth = 24.0; string rptPath = string.Empty; if (radioButton1.Checked == true) { rptPath = AppDomain.CurrentDomain.BaseDirectory + "\\试验报表RPT\\汽蚀报表(中).rpt"; this.reportDocument1.Load(rptPath); 汽蚀试验模型 ds = this.GetRePortModel2(); this.reportDocument1.SetDataSource(ds); // this.reportDocument1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.RichText, this.path + string.Format("\\汽蚀试验{0}(中).rtf", ds.基础数据表[0].型号规格)); this.reportDocument1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, this.path + string.Format("\\汽蚀试验{0}(中).xls", ds.基础数据表[0].型号规格)); } else { rptPath = AppDomain.CurrentDomain.BaseDirectory + "\\试验报表RPT\\汽蚀报表(英).rpt"; this.reportDocument1.Load(rptPath); 汽蚀试验模型 ds = this.GetRePortModel2(); this.reportDocument1.SetDataSource(ds); // this.reportDocument1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.RichText, this.path + string.Format("\\汽蚀试验{0}(英).rtf", ds.基础数据表[0].型号规格)); this.reportDocument1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, this.path + string.Format("\\汽蚀试验{0}(英).xls", ds.基础数据表[0].型号规格)); } }
public 汽蚀试验模型 GetRePortModel2() { decimal id = 当前试验组信息.试验ID; 汽蚀试验模型 ds = new 汽蚀试验模型(); string sql = "select * from 水泵基础信息 where id=" + 当前试验组信息.试验ID; 数据库操作类.FillDataSet(ds, ds.基础数据表.TableName, sql); sql = "select a.流量,a.输入功率,a.转速,a.轴功率,a.进口压力,a.出口压力,a.扬程,a.汽蚀余量," + "a.额定转速下_流量 as 额定转速流量,a.额定转速下_扬程 as 额定转速扬程,a.额定转速下_轴功率 as 额定转速轴功率," + "a.额定转速下_泵效率 as 额定转速泵效率,a.额定转速下_汽蚀余量 as 额定汽蚀余量,a.电压,a.电流,'' as 序号" + " from dbo.汽蚀试验 a where a.groupid=" + 当前试验组信息.试验ID + " order by a.流量"; 数据库操作类.FillDataSet(ds, ds.测试数据表.TableName, sql); 设置行状态2(ds); int len = ds.测试数据表.Count; for (int i = 0; i < len; i++) { int order = i + 1; ds.测试数据表[i].序号 = order.ToString(); } sql = "select 汽蚀试验 as 汽蚀试验图片信息 from 生成试验组 where ID = " + id; 数据库操作类.FillDataSet(ds, ds.性能曲线表.TableName, sql); if (ds.基础数据表.Count > 0) { //ds.基础数据表[0].进出口表距 = "0 / " + ds.基础数据表[0].进出口表距; ds.基础数据表[0].测试日期 = System.Convert.ToDateTime(ds.基础数据表[0].测试日期).ToShortDateString(); } return ds; }
public 汽蚀试验模型 GetRePortModel2() { decimal id = 当前试验组信息.试验ID; 汽蚀试验模型 ds = new 汽蚀试验模型(); string sql = "select * from 水泵基础信息 where id=" + 当前试验组信息.试验ID; 数据库操作类.FillDataSet(ds, ds.基础数据表.TableName, sql); sql = "select a.流量,a.输入功率,a.转速,a.轴功率,a.进口压力,a.出口压力,a.扬程,a.汽蚀余量," + "a.额定转速下_流量 as 额定转速流量,a.额定转速下_扬程 as 额定转速扬程,a.额定转速下_轴功率 as 额定转速轴功率," + "a.额定转速下_泵效率 as 额定转速泵效率,a.额定转速下_汽蚀余量 as 额定汽蚀余量,a.电压,a.电流,'' as 序号" + " from dbo.汽蚀试验 a where a.groupid=" + 当前试验组信息.试验ID + " order by a.流量"; 数据库操作类.FillDataSet(ds, ds.测试数据表.TableName, sql); 设置行状态2(ds); int len = ds.测试数据表.Count; for (int i = 0; i < len; i++) { int order = i + 1; ds.测试数据表[i].序号 = order.ToString(); } sql = "select 汽蚀试验 as 汽蚀试验图片信息 from 生成试验组 where ID = " + id; 数据库操作类.FillDataSet(ds, ds.性能曲线表.TableName, sql); if (ds.基础数据表.Count > 0) { //ds.基础数据表[0].进出口表距 = "0 / " + ds.基础数据表[0].进出口表距; ds.基础数据表[0].测试日期 = System.Convert.ToDateTime(ds.基础数据表[0].测试日期).ToShortDateString(); } return(ds); }
public void 设置行状态2(汽蚀试验模型 ds) { int len = ds.测试数据表.Count; for (int i = 0; i < len; i++) { ds.测试数据表[i].行状态 = 获取行状态(i); if (i == len - 1) { ds.测试数据表[i].行状态 = "结束"; } } }