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.
106 lines
3.3 KiB
106 lines
3.3 KiB
3 months ago
|
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 FrmDelChaimUp : Form
|
||
|
{
|
||
|
public FrmDelChaimUp()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
public event Action<string> OkBtnClick;
|
||
|
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
this.Close();
|
||
|
}
|
||
|
|
||
|
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('.')) //二维码
|
||
|
{
|
||
|
DataTable bardt = Function1.oneBarcode(textBox1.Text.Trim());
|
||
|
if (bardt != null && bardt.Rows.Count > 0)
|
||
|
{
|
||
|
barcode = bardt.Rows[0][""].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("条码在系统中不存在!", "提示", MessageBoxButtons.OK);
|
||
|
textBox1.Focus();
|
||
|
textBox1.SelectAll();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
barcode = textBox1.Text.Trim();
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
DataTable dt = Function1.GetBarCodeInfo(barcode);
|
||
|
if (dt != null && dt.Rows.Count > 0)
|
||
|
{
|
||
|
DataTable dt1 = Function1.isPack(textBox1.Text.Trim());
|
||
|
if (dt1 != null && dt1.Rows.Count > 0)
|
||
|
{
|
||
|
MessageBox.Show("此零件已打包!", "提示", MessageBoxButtons.OK);
|
||
|
textBox1.Focus();
|
||
|
textBox1.SelectAll();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("条码在系统中不存在!", "提示", MessageBoxButtons.OK);
|
||
|
textBox1.Focus();
|
||
|
textBox1.SelectAll();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
if (OkBtnClick != null)
|
||
|
{
|
||
|
OkBtnClick(barcode);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|