using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Drawing; using System.Data; using FastReport; using FastReport.Data; using FastReport.Dialog; using FastReport.Barcode; using FastReport.Table; using FastReport.Utils; using FastReport.Matrix; namespace FastReport { public class ReportScript { private void tb_PptLot_BeforePrint(object sender, EventArgs e) { DataSourceBase rowdata = Report.GetDataSource("planMain"); rowdata.Init(); Cell2.Text = rowdata.Report.GetColumnValue("planMain.recipematerialname").ToString(); Cell7.Text = rowdata.Report.GetColumnValue("planMain.equipcode").ToString(); Cell17.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}",Convert.ToDateTime(rowdata.Report.GetColumnValue("planMain.realstarttime").ToString())); Cell4.Text = rowdata.Report.GetColumnValue("planMain.itemname").ToString(); Cell9.Text = rowdata.Report.GetColumnValue("planMain.shiftclassname").ToString(); Cell19.Text = String.Format("{0:yyyy-MM-dd HH:mm:ss}",Convert.ToDateTime(rowdata.Report.GetColumnValue("planMain.realendtime").ToString())); Cell26.Text = rowdata.Report.GetColumnValue("planMain.realnum").ToString(); Cell27.Text = rowdata.Report.GetColumnValue("planMain.PlanNum").ToString(); } private void Table1_BeforePrint(object sender, EventArgs e) { DataSourceBase rowData = Report.GetDataSource("planAvgAndSumMain"); rowData.Init(); Cell46.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgDoneAllRtime")).ToString(); //平均配方时间 Cell47.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgDoneRtime")).ToString(); //平均炼胶时间 Cell48.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgBwbTime")).ToString(); //平均间隔时间 Cell63.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPolydistime")).ToString(); //平均加胶时间 Cell61.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgCBdistime")).ToString(); //平均加炭黑时间 Cell59.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgOilDistime")).ToString(); //平均加油1时间 Cell57.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgOil2Distime")).ToString(); //平均加油2时间 Cell49.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPowderDisTime")).ToString(); //平均加粉料时间 Cell164.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPjTemp")).ToString(); //平均排胶温度 Cell165.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgPjPower")).ToString(); //平均排胶功率 Cell166.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.avgLotEnergy")).ToString(); //平均排胶能量 Cell65.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumDoneAllRtime")).ToString(); //配方时间和 Cell66.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumDoneRtime")).ToString(); //炼胶时间和 Cell67.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumBwbTime")).ToString(); //间隔时间和 Cell68.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPolyDistime")).ToString(); //加胶时间和 Cell69.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumCBDistime")).ToString(); //加炭黑时间和 Cell70.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumOilDistime")).ToString(); //加油1时间和 Cell71.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumOil2Distime")).ToString(); //加油2时间和 Cell72.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPowderDisTime")).ToString(); //加粉料时间和 Cell167.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPjTemp")).ToString(); //排胶温度和 Cell168.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumPjPower")).ToString(); //排胶功率和 Cell169.Text = Convert.ToDouble(rowData.Report.GetColumnValue("planAvgAndSumMain.sumLotEnergy")).ToString(); //排胶能量和 } private void Table2_ManualBuild(object sender, EventArgs e) { DataSourceBase rowData = Report.GetDataSource("MaterialDetailInfo"); rowData.Init(); int count = 0; int temp = 53; // now enumerate the data source and print the table body while (rowData.HasMoreRows) { if(count < 22 ) { if(count % 21 == 0) { Table2.PrintRow(0); Table2.PrintColumns(); } } if(count > 45 ) { if(count % temp == 0) { Table2.PrintRow(0); Table2.PrintColumns(); temp = temp + 32; } } Cell153.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.StartDatetime").ToString().Substring(0,8); //开始时间 Cell93.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.serialid").ToString(); // Cell94.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.doneallrtime").ToString(); //配方时间 Cell95.Text = rowData.Report.GetColumnValue("MaterialDetailInfo.donertime").ToString(); //炼胶时间 Cell96.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.bwbtime")).ToString(); //间隔时间 Cell112.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PolyDisTime")).ToString(); //加胶时间 Cell107.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.CBDisTime")).ToString(); //加炭黑时间 Cell102.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.OilDisTime")).ToString(); //加油1时间 Cell127.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.Oil2DisTime")).ToString(); //加油2时间 Cell122.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PowderDistime")).ToString(); //加粉料时间 Cell117.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PjTemp")).ToString(); //排胶温度 Cell157.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.pjpower")).ToString(); //排胶功率 Cell158.Text = Convert.ToDouble(rowData.Report.GetColumnValue("MaterialDetailInfo.PjEner")).ToString(); //排胶能量 Table2.PrintRow(1); Table2.PrintColumns(); rowData.Next(); count ++; } // print the last table row - it is a footer Table2.PrintRow(2); Table2.PrintColumns(); } } }