using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using gregn6Lib; using MESClassLibrary.BLL.Log; using MESClassLibrary.BLL.Mistake247; using MESClassLibrary.BLL.Plan243; namespace PurchingMistakeNew { public partial class FrmPrint_243 : Form { public FrmPrint_243() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { Plan243BLL bll = new Plan243BLL(); this.listView1.Items.Clear(); DataTable dt = bll.SearhByOrderNo(textBox1.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { ListViewItem lvi = new ListViewItem(dt.Rows[i]["OrderNo"].ToString()); lvi.SubItems.Add(dt.Rows[i]["PartNo"].ToString()); //后面添加的Item都为SubItems ,即为子项 lvi.SubItems.Add(dt.Rows[i]["PartName2"].ToString()); lvi.SubItems.Add(dt.Rows[i]["OrderCount"].ToString()); listView1.Items.Add(lvi); } } } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); } } private void button2_Click(object sender, EventArgs e) { try { Plan243BLL bll = new Plan243BLL(); string filename = System.AppDomain.CurrentDomain.BaseDirectory + "订单.grf"; ; //DataTable dt = new DataTable(); //dt = bll.SearhByOrderNo(textBox1.Text.Trim()); DataTable headTable = new DataTable(); headTable.Columns.Add("OrderNo"); DataRow row = headTable.NewRow(); row["OrderNo"] = textBox1.Text.Trim(); string reportName = ConfigurationManager.AppSettings["Printer3"].ToString(); headTable.Rows.Add(row); DataTable dtDetail = bll.DetailOrderNo(textBox1.Text.Trim()); ReportHelper rp = new ReportHelper(filename, headTable, dtDetail, (int)GRPaperOrientation.grpoDefault, 1, reportName); rp.Report.Print(false); } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); } } private void FrmPrint_243_Load(object sender, EventArgs e) { this.listView1.Columns.Clear(); this.listView1.Columns.Add("序号", 100, HorizontalAlignment.Center); this.listView1.Columns.Add("零件号", 100, HorizontalAlignment.Center); this.listView1.Columns.Add("零件名称", 200, HorizontalAlignment.Center); this.listView1.Columns.Add("数量", 60, HorizontalAlignment.Center); } } }