一厂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.
 
 
 
 
 

87 lines
2.6 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PaintingPC
{
public partial class FrmRePrint : Form
{
public FrmRePrint()
{
InitializeComponent();
}
public event Action<string> OkBtnClick;
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
try
{
string barcode = "";
if (e.KeyCode == Keys.Enter)
{
#region 校验数据
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("条码不能为空!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
textBox1.SelectAll();
return;
}
#region 判断扫描的是一维码还是二维码,如果是二维码转一维码
if (textBox1.Text.Trim().Contains('.')) //二维码
{
barcode = Function.TransToBarCodeOne(textBox1.Text.Trim());
if (string.IsNullOrEmpty(barcode))
{
MessageBox.Show("条码在系统中不存在!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
textBox1.SelectAll();
return;
}
}
else
{
barcode = textBox1.Text.Trim();
}
#endregion
DataTable dt1 = Function1.isPack(textBox1.Text.Trim());
if (dt1 != null && dt1.Rows.Count > 0)
{
}
else
{
MessageBox.Show("此零件未打包!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
textBox1.SelectAll();
return;
}
#endregion
}
}
catch (Exception ex)
{
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}