一厂MES,含注塑,喷涂,冲孔
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.

120 lines
3.5 KiB

3 months ago
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;
using System.Windows.Forms;
using gregn6Lib;
using MESClassLibrary.BLL.BasicInfo;
using MESClassLibrary.BLL.Log;
namespace InjectionPC
{
public partial class FrmZc : Form
{
public FrmZc()
{
InitializeComponent();
}
private void FrmZc_Load(object sender, EventArgs e)
{
try
{
Control.CheckForIllegalCrossThreadCalls = false;
Thread t = new Thread(new ThreadStart(TimeGo));
t.Start();
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
}
}
private void TimeGo()
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Enabled = true;
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick);
}
private void timer_Tick(object sender, EventArgs e)
{
label2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Thread.Sleep(500);
}
private void label2_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
try
{
BarCodeBLL bll = new BarCodeBLL();
#region 校验数据有效性
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
textBox1.SelectAll();
return;
}
if (!bll.IsExist(textBox1.Text.Trim()))
{
MessageBox.Show("条码有误!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
textBox1.SelectAll();
return;
}
#endregion
#region 打印总成标签
string path = "", reportName = "";
path = Application.StartupPath + @"\ZC.grf";
DataTable headTable = new DataTable();
headTable.Columns.Add("barCode");
DataRow row = headTable.NewRow();
//row["barCode"] = textBox1.Text.Trim() + "/" + textBox2.Text.Trim() + "/" + textBox3.Text.Trim();
reportName = ConfigurationManager.AppSettings["PrinterName"];
headTable.Rows.Add(row);
ReportHelper rp = new ReportHelper(path, headTable, null,
(int)GRPaperOrientation.grpoDefault, 1, reportName);
rp.Report.Print(false);
#endregion
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
}
}
}
private void label9_Click(object sender, EventArgs e)
{
FrmQuality_new frm = new FrmQuality_new();
frm.Show();
}
}
}