注塑喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.6 KiB

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.Windows.Forms;
using gregn6Lib;
using MESClassLibrary.BLL.Log;
using PunchAndWeld.DataSouce;
namespace PunchAndWeld
{
public partial class FrmPrintOrder : Form
{
public FrmPrintOrder()
{
InitializeComponent();
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
try
{
this.listView1.Items.Clear();
DataTable dt = ProScreenFunc.GetPlanInfoByOrderNo(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
{
string filename = System.AppDomain.CurrentDomain.BaseDirectory + "订单.grf";
DataTable headTable = new DataTable();
headTable.Columns.Add("OrderNo");
DataRow row = headTable.NewRow();
row["OrderNo"] = textBox1.Text.Trim();
string reportName = ConfigurationManager.AppSettings["PrinterName"];
headTable.Rows.Add(row);
DataTable dtDetail = ProScreenFunc.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());
}
}
}
}