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;
namespace FastReport
{
public class ReportScript
{
private void tb_PptLot_BeforePrint(object sender, EventArgs e)
{
DataSourceBase rowData = Report.GetDataSource("PptLotData");
rowData.Init();
while (rowData.HasMoreRows)
{
txtTitle.Text = "车报表详细信息『" + rowData.Report.GetColumnValue("PptLotData.BarCode").ToString().Trim()+ "』";
Cell2.Text = rowData.Report.GetColumnValue("PptLotData.ClassName").ToString();
Cell4.Text = rowData.Report.GetColumnValue("PptLotData.ShiftName").ToString();
Cell26.Text = rowData.Report.GetColumnValue("PptLotData.MaterName").ToString();
Cell36.Text = rowData.Report.GetColumnValue("PptLotData.MaterCode").ToString();
Cell7.Text = rowData.Report.GetColumnValue("PptLotData.EquipName").ToString();
Cell9.Text = rowData.Report.GetColumnValue("PptLotData.SerialID").ToString() ;
Cell27.Text = rowData.Report.GetColumnValue("PptLotData.PolyDisTime").ToString();
Cell37.Text = rowData.Report.GetColumnValue("PptLotData.MixStatus").ToString() == "0"?"本控":"遥控";
Cell12.Text = rowData.Report.GetColumnValue("PptLotData.DoneRtime").ToString();
Cell14.Text = rowData.Report.GetColumnValue("PptLotData.BwbTime").ToString();
Cell28.Text = rowData.Report.GetColumnValue("PptLotData.DoneAllRtime").ToString();
Cell38.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptLotData.PjTemp")).ToString();
Cell17.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptLotData.LotEnergy")).ToString();
Cell19.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptLotData.PjPower")).ToString();
Cell39.Text = rowData.Report.GetColumnValue("PptLotData.StartDatetime").ToString();
Cell22.Text = rowData.Report.GetColumnValue("PptLotData.MemNote").ToString();
rowData.Next();
}
}
private void tb_PptWeight_ManualBuild(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase rowData = Report.GetDataSource("PptWeighData");
// init the data source
rowData.Init();
tb_PptWeight.PrintRow(0);
tb_PptWeight.PrintColumns();
decimal sumValue = 0;
// now enumerate the data source and print the table body
while (rowData.HasMoreRows)
{
sumValue += (decimal)rowData.Report.GetColumnValue("PptWeighData.SetWeight");
Cell61.Text = rowData.Report.GetColumnValue("PptWeighData.WeighType").ToString();
Cell62.Text = rowData.Report.GetColumnValue("PptWeighData.MaterName").ToString();
Cell63.Text = rowData.Report.GetColumnValue("PptWeighData.MaterCode").ToString();
Cell64.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptWeighData.SetWeight")).ToString();
Cell75.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptWeighData.RealWeight")).ToString();
Cell70.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptWeighData.ErrorAllow")).ToString();
Cell65.Text = rowData.Report.GetColumnValue("PptWeighData.WeighState").ToString() == "0" ? "手动":"自动";
tb_PptWeight.PrintRow(1);
tb_PptWeight.PrintColumns();
rowData.Next();
}
Text5.Text = Convert.ToDouble(sumValue).ToString();
}
private void tb_PptMixData_ManualBuild(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase rowData = Report.GetDataSource("PptMixingData");
// init the data source
rowData.Init();
tb_PptMixData.PrintRow(0);
tb_PptMixData.PrintColumns();
// now enumerate the data source and print the table body
while (rowData.HasMoreRows)
{
Cell96.Text = rowData.Report.GetColumnValue("PptMixingData.MixID").ToString();
Cell97.Text = rowData.Report.GetColumnValue("PptMixingData.TermCode").ToString();
Cell98.Text = rowData.Report.GetColumnValue("PptMixingData.SetTime").ToString();
Cell99.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptMixingData.SeTemp")).ToString();
Cell100.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptMixingData.SetPower")).ToString();
Cell105.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptMixingData.SetEner")).ToString();
Cell110.Text = rowData.Report.GetColumnValue("PptMixingData.ActCode").ToString();
Cell115.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptMixingData.SetRota")).ToString();
Cell120.Text = Convert.ToDouble(rowData.Report.GetColumnValue("PptMixingData.SetPres")).ToString();
tb_PptMixData.PrintRow(1);
tb_PptMixData.PrintColumns();
rowData.Next();
}
}
private void tb_PptAlarm_ManualBuild(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase rowData = Report.GetDataSource("PptAlarmData");
// init the data source
rowData.Init();
if(rowData.RowCount != 0)
{
tb_PptAlarm.PrintRow(0);
tb_PptAlarm.PrintColumns();
// now enumerate the data source and print the table body
while (rowData.HasMoreRows)
{
Cell141.Text = rowData.Report.GetColumnValue("PptAlarmData.OperTime").ToString();
Cell142.Text = rowData.Report.GetColumnValue("PptAlarmData.AlarmStr").ToString();
tb_PptAlarm.PrintRow(1);
tb_PptAlarm.PrintColumns();
rowData.Next();
}
}
}
private void MSChart1_BeforePrint(object sender, EventArgs e)
{
DataSourceBase rowData = Report.GetDataSource("PptCurve");
rowData.Init();
int count = 1;
while (rowData.HasMoreRows)
{
string temp = rowData.Report.GetColumnValue("PptCurve.MixingTemp").ToString();
string time = rowData.Report.GetColumnValue("PptCurve.SecondSpan").ToString();
string power = rowData.Report.GetColumnValue("PptCurve.MixingPower").ToString();
string energy = rowData.Report.GetColumnValue("PptCurve.MixingEnergy").ToString();
string press = rowData.Report.GetColumnValue("PptCurve.MixingPress").ToString();
string speed = rowData.Report.GetColumnValue("PptCurve.MixingSpeed").ToString();
Series1.AddValue(time,temp);
Series2.AddValue(time,power);
Series3.AddValue(time,press);
Series4.AddValue(time,energy);
Series5.AddValue(time,speed);
rowData.Next();
}
}
private void Text4_BeforePrint(object sender, EventArgs e)
{
// get the data source by its name
DataSourceBase rowData = Report.GetDataSource("PptAlarmData");
// init the data source
rowData.Init();
if(rowData.RowCount == 0)
{
Text4.Text = "";
}
}
}
}