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.
104 lines
3.4 KiB
104 lines
3.4 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.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
using grproLib;
|
||
|
using PaintingPC.Model;
|
||
|
|
||
|
namespace PaintingPC
|
||
|
{
|
||
|
public partial class FrmPack : Form
|
||
|
{
|
||
|
public FrmPack()
|
||
|
{
|
||
|
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
|
||
|
{
|
||
|
if (e.KeyCode == Keys.Enter)
|
||
|
{
|
||
|
string barcode = "",partNo="",packNo="",partDes="",batch="",qLevel="", type="",color="",filename="",date="";
|
||
|
int packCount = 0;
|
||
|
|
||
|
#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
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|