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.
747 lines
26 KiB
747 lines
26 KiB
using MESClassLibrary.BLL.PunchAndWeld;
|
|
using OPCAutomation;
|
|
using PunchAndWeld.DataSouce;
|
|
using PunchAndWeld.WebReference;
|
|
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;
|
|
|
|
namespace PunchAndWeld
|
|
{
|
|
public partial class FrmProScreenBumper : Form
|
|
{
|
|
OPCHelper opcHelper = new OPCHelper();
|
|
private string strHostIP = "";
|
|
private string strHostName = "";
|
|
PunchAdressBLL bll = new PunchAdressBLL();
|
|
public bool IsChangeBox = false;
|
|
public bool IsPass = false;
|
|
string stationNo = "", stationId="";
|
|
|
|
public FrmProScreenBumper()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmProScreenBumper_Load(object sender, EventArgs e)
|
|
{
|
|
stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
label1.Text = ProScreenFunc.GetStation(stationNo);
|
|
stationId = ProScreenFunc.GetStationId(stationNo);
|
|
Control.CheckForIllegalCrossThreadCalls = false;
|
|
Thread t = new Thread(new ThreadStart(TimeGo));
|
|
t.Start();
|
|
|
|
LoadScreen();
|
|
textBox1.TabIndex = 0;
|
|
textBox1.Select();
|
|
|
|
timer1.Enabled = true;
|
|
|
|
try
|
|
{
|
|
if (opcHelper.CreateServer())
|
|
{
|
|
if (opcHelper.ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
|
|
{
|
|
opcHelper.Connected = true;
|
|
|
|
opcHelper.opcGroups = opcHelper.opcServer.OPCGroups;
|
|
opcHelper.opcGroup1 = opcHelper.opcGroups.Add("DeviceRead");
|
|
opcHelper.opcGroup2 = opcHelper.opcGroups.Add("DeviceWrite");
|
|
opcHelper.SetGroupProperty(opcHelper.opcGroup1, 500);
|
|
opcHelper.SetGroupProperty(opcHelper.opcGroup2, 500);
|
|
|
|
|
|
opcHelper.opcItems1 = opcHelper.opcGroup1.OPCItems;
|
|
opcHelper.opcItems1.DefaultIsActive = true;
|
|
|
|
DataTable dt = bll.SearchInfo(ConfigurationManager.AppSettings["DeviceNo"], 0);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
opcHelper.opcItemm1 = new OPCItem[dt.Rows.Count];
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
opcHelper.opcItemm1[i] = opcHelper.opcItems1.AddItem(dt.Rows[i]["Address"].ToString(), i);
|
|
}
|
|
}
|
|
opcHelper.opcItems2 = opcHelper.opcGroup2.OPCItems;
|
|
opcHelper.opcItems2.DefaultIsActive = true;
|
|
|
|
DataTable dt1 = bll.SearchInfo(ConfigurationManager.AppSettings["DeviceNo"], 1);
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
{
|
|
opcHelper.opcItemm2 = new OPCItem[dt1.Rows.Count];
|
|
for (int i = 0; i < dt1.Rows.Count; i++)
|
|
{
|
|
opcHelper.opcItemm2[i] = opcHelper.opcItems2.AddItem(dt1.Rows[i]["Address"].ToString(), i);
|
|
}
|
|
}
|
|
opcHelper.opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
|
|
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC1(2).ToLower() == "true")
|
|
{
|
|
lbState.Text = "等待放件状态";
|
|
}
|
|
else
|
|
{
|
|
lbState.Text = "设备未准备OK";
|
|
}
|
|
if (opcHelper.ReadSingleValueFromOPC1(0).ToLower() == "true")
|
|
{
|
|
lbFinish.Text = "运行完成";
|
|
//textBox1.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
lbFinish.Text = "正在运行";
|
|
//textBox1.Enabled = false;
|
|
}
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC1(4).ToLower() == "true")
|
|
{
|
|
lbOK.Text = "NG";
|
|
}
|
|
else
|
|
{
|
|
lbOK.Text = "OK";
|
|
}
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC2(1) == 1)
|
|
{
|
|
lbmode.Text = "手动";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 2)
|
|
{
|
|
lbmode.Text = "复位";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 3)
|
|
{
|
|
lbmode.Text = "自动";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 4)
|
|
{
|
|
lbmode.Text = "半自动";
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
|
|
opcHelper.Connected = false;
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text + "创建OPC服务失败!", MethodBase.GetCurrentMethod().Name);
|
|
return;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void TimeGo()
|
|
{
|
|
System.Timers.Timer timer = new System.Timers.Timer();
|
|
timer.Interval = 10;
|
|
timer.Enabled = true;
|
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick);
|
|
}
|
|
|
|
private void timer_Tick(object sender, EventArgs e)
|
|
{
|
|
label9.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
Thread.Sleep(500);
|
|
}
|
|
|
|
public void LoadScreen()
|
|
{
|
|
//string stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreen(stationNo);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
SetPage(dt);
|
|
}
|
|
}
|
|
|
|
public void SetPage(DataTable dt)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
PanelRD.Visible = false;
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
#region 页面赋值
|
|
label1.Text = dt.Rows[0]["Des"].ToString();
|
|
label2.Text = dt.Rows[0]["OrderNo"].ToString();
|
|
label3.Text = dt.Rows[0]["PartNo"].ToString();
|
|
label4.Text = dt.Rows[0]["ProductName"].ToString();
|
|
//label5.Text = dt.Rows[0]["Des"].ToString();
|
|
label6.Text = dt.Rows[0]["OrderCount"].ToString();
|
|
label7.Text = dt.Rows[0]["CompleteCount"].ToString();
|
|
label8.Text = dt.Rows[0]["OrderNo"].ToString().Substring(0, 1) + "班";
|
|
label10.Text = dt.Rows[0]["BadCount"].ToString();
|
|
|
|
this.Tag = dt.Rows[0]["ID"].ToString(); //计划ID
|
|
textBox1.Tag = dt.Rows[0]["ProductID1"].ToString();
|
|
textBox1.Text = "";
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string sbState = lbState.Text.Trim();
|
|
if (string.IsNullOrWhiteSpace(sbState) || sbState.Contains("未"))
|
|
{
|
|
MessageBox.Show("设备未准备OK");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
CheckPartAndProduct();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void CheckPartAndProduct()
|
|
{
|
|
textBox1.SelectAll();
|
|
string barcode = textBox1.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
if (ProScreenFunc.SjBarCodeIsInStockIn(barcode) == false)
|
|
{
|
|
MessageBox.Show($"扫描条码[{barcode}]不存在喷涂下线记录,请更换其他油漆件重新操作!");
|
|
textBox1.Text = "";
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
if (ProScreenFunc.HaveScan(barcode))
|
|
{
|
|
DialogResult result = MessageBox.Show("条码为" + barcode + "的蒙皮已经冲孔,是否重新冲孔?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
FrmPassWord pass = new FrmPassWord();
|
|
pass.OkBtnClick += (arg1) =>
|
|
{
|
|
if (!string.IsNullOrEmpty(arg1) &&
|
|
arg1.ToLower() == ConfigurationManager.AppSettings["password"].ToLower())
|
|
{
|
|
pass.Close();
|
|
|
|
ScanBarcode(barcode);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误,请重新输入!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
};
|
|
pass.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ScanBarcode(barcode);
|
|
}
|
|
|
|
}
|
|
|
|
private void ScanBarcode(string barcode)
|
|
{
|
|
string productID1 = textBox1.Tag.ToString().Trim();
|
|
string productID2 = "";
|
|
|
|
string[] codeSpecial = { "2200000057", "2200000058" };
|
|
string code = barcode.Substring(0, 10);
|
|
if (codeSpecial.Contains(code))
|
|
{
|
|
productID2 = ProScreenFunc.GetProductID(code, "");
|
|
AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
if (barcode.Substring(0, 2) != "22")
|
|
{
|
|
string stockNo = barcode.Substring(0, 10);
|
|
productID2 = ProScreenFunc.GetProductID(stockNo, "");
|
|
}
|
|
else
|
|
{
|
|
productID2 = ProScreenFunc.GetProductID(barcode);
|
|
}
|
|
|
|
if (!ProScreenFunc.CheckPartAndProduct(productID1, productID2))
|
|
{
|
|
MessageBox.Show("当前扫描的零件与总成不匹配,请检查后再扫描");
|
|
textBox1.Text = "";
|
|
}
|
|
else
|
|
{
|
|
|
|
ScanAll.ScanResult = false;
|
|
|
|
OtherPart parts = ProScreenFunc.HaveOtherPart(label1.Text.Trim(), productID1);
|
|
if ((parts != null) && ((!string.IsNullOrWhiteSpace(parts.productID3)) || (!string.IsNullOrWhiteSpace(parts.productID4)) || (!string.IsNullOrWhiteSpace(parts.productID5))))
|
|
{
|
|
FrmProScreen3 frm3 = new FrmProScreen3(parts);
|
|
frm3.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
ScanAll.ScanResult = true;
|
|
}
|
|
|
|
|
|
if (ScanAll.ScanResult)
|
|
{
|
|
AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void AfterScanBarcode(string barcode, string productID2, string productID1, string planID)
|
|
{
|
|
|
|
if (IsChangeBox)
|
|
{
|
|
PanelRD.Visible = true;
|
|
}
|
|
|
|
if (IsPass)
|
|
{
|
|
|
|
try
|
|
{
|
|
LogHelper.WriteSysLogBase("条码号:" + barcode + "工位:" + label1.Text.Trim() + ",一码到底调用WMS接口", MethodBase.GetCurrentMethod().Name);
|
|
|
|
string stockNo = "";
|
|
string batchNo = "";
|
|
string partNo = "";
|
|
ProScreenFunc.GetCode(barcode, out stockNo, out batchNo, out partNo);
|
|
|
|
partNo = label3.Text.Trim();
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 1);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
|
|
ProScreenFunc.SavePartAndProduct(barcode, productID2, productID1, label2.Text, label8.Text, planID,stationId, ConfigurationManager.AppSettings["StationDescription"]);
|
|
ProScreenFunc.SaveZcCode(barcode, label3.Text.Trim());
|
|
|
|
ProScreenFunc.AddCompleteCount(this.Tag.ToString().Trim());
|
|
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(this.Tag.ToString().Trim()))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
else
|
|
{
|
|
label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) + 1).ToString();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
string orderNo = label2.Text.Trim();
|
|
if (string.IsNullOrWhiteSpace(orderNo))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
}
|
|
|
|
public void LoadPlanScreen(string id, string plan)
|
|
{
|
|
//string stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenPlan(id, stationNo, plan);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
SetPage(dt);
|
|
}
|
|
else
|
|
{
|
|
if (plan == "下一计划")
|
|
MessageBox.Show("无下一计划");
|
|
else
|
|
MessageBox.Show("无上一计划");
|
|
}
|
|
}
|
|
|
|
#region 按钮
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
LoadPlanScreen(this.Tag.ToString(), "上一计划");
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
LoadPlanScreen(this.Tag.ToString(), "下一计划");
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
textBox2.Visible = true;
|
|
textBox2.Focus();
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
textBox3.Visible = true;
|
|
textBox3.Focus();
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
FrmProScreen2 frm = new FrmProScreen2();
|
|
frm.Show();
|
|
}
|
|
|
|
private void textBox2_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string barcode = textBox2.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
|
|
if (ProScreenFunc.HaveScan(barcode))
|
|
{
|
|
|
|
string planID = ProScreenFunc.GetPlanIDByBarcode(barcode);
|
|
ProScreenFunc.AddBadCount(planID.Trim());
|
|
ProScreenFunc.SubCompleteCount(planID.Trim());
|
|
|
|
ProScreenFunc.SaveRecord2(barcode, "0", planID);
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(this.Tag.ToString().Trim());
|
|
SetPage(dt);
|
|
|
|
//label10.Text = (Tools.NumericParse.StringToInt(label10.Text.Trim()) + 1).ToString();
|
|
//label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) - 1).ToString();
|
|
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("还未进行装配!", "提示");
|
|
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
else if (e.KeyCode == Keys.Escape)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void textBox3_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string barcode = textBox3.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
if (ProScreenFunc.SjBarCodeIsInStockIn(barcode) == false)
|
|
{
|
|
MessageBox.Show($"扫描条码[{barcode}]不存在喷涂下线记录,请更换其他油漆件重新操作!");
|
|
textBox3.Text = "";
|
|
return;
|
|
}
|
|
|
|
string planID = ProScreenFunc.GetPlanIDByBarcode(barcode);
|
|
ProScreenFunc.SubBadCount(planID.Trim());
|
|
ProScreenFunc.AddCompleteCount(planID.Trim());
|
|
|
|
ProScreenFunc.SaveRecord2(barcode, "1", planID);
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(this.Tag.ToString().Trim()))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
else
|
|
{
|
|
//label10.Text = (Tools.NumericParse.StringToInt(label10.Text.Trim()) - 1).ToString();
|
|
//label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) + 1).ToString();
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(this.Tag.ToString().Trim());
|
|
SetPage(dt);
|
|
}
|
|
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
else if (e.KeyCode == Keys.Escape)
|
|
{
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void textBox3_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
|
|
private void textBox2_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
private void label9_Click(object sender, EventArgs e)
|
|
{
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
|
|
void opcGroup1_DataChange(int TransactionID, int NumItems, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps)
|
|
{
|
|
try
|
|
{
|
|
for (int i = 1; i <= NumItems; i++)
|
|
{
|
|
int handle = Convert.ToInt32(ClientHandles.GetValue(i).ToString().Trim());
|
|
string value = ItemValues.GetValue(i).ToString();
|
|
string address = opcHelper.opcItemm1[(Convert.ToInt32(ClientHandles.GetValue(i)))].ItemID;
|
|
|
|
|
|
if (handle == 0)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbFinish.Text = "运行完成";
|
|
|
|
}
|
|
else
|
|
{
|
|
lbFinish.Text = "正在运行";
|
|
}
|
|
}
|
|
if (handle == 1)
|
|
{
|
|
if (value == "1")
|
|
{
|
|
lbmode.Text = "手动";
|
|
}
|
|
else if (value == "2")
|
|
{
|
|
lbmode.Text = "复位";
|
|
}
|
|
else if (value == "3")
|
|
{
|
|
lbmode.Text = "自动";
|
|
}
|
|
else if (value == "4")
|
|
{
|
|
lbmode.Text = "半自动";
|
|
}
|
|
}
|
|
|
|
if (handle == 2)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbState.Text = "等待放件状态";
|
|
}
|
|
else
|
|
{
|
|
lbState.Text = "设备未准备OK";
|
|
}
|
|
}
|
|
if (handle == 3 || handle == 4)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
IsChangeBox = true;
|
|
}
|
|
else
|
|
{
|
|
IsChangeBox = false;
|
|
}
|
|
}
|
|
|
|
if (handle == 5)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbOK.Text = "NG";
|
|
}
|
|
else
|
|
{
|
|
lbOK.Text = "OK";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
{
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
PanelRD.Visible = false;
|
|
}
|
|
|
|
private void txtBoxL_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string[] barCode1 = txtBoxL.Text.Split('.');
|
|
if (barCode1.Length > 0)
|
|
{
|
|
string[] part = barCode1[0].Split('-');
|
|
if (part.Length == 2)
|
|
{
|
|
txtBoxR.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("左雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("左雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txtBoxR_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string color1 = "", color2 = "";
|
|
|
|
string[] barCode2 = txtBoxR.Text.Split('.');
|
|
|
|
if (barCode2.Length > 0)
|
|
{
|
|
string[] part = barCode2[0].Split('-');
|
|
if (part.Length == 2)
|
|
{
|
|
color2 = part[1].ToString();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("右雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxR.SelectAll();
|
|
return;
|
|
}
|
|
|
|
string[] barCode1 = txtBoxL.Text.Split('.');
|
|
string[] part1 = barCode1[0].Split('-');
|
|
|
|
color1 = part1[1].ToString();
|
|
|
|
if (color1 != color2)
|
|
{
|
|
MessageBox.Show("左右雷达支架不匹配,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxR.SelectAll();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
IsPass = true;
|
|
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
PanelRD.Visible = false;
|
|
|
|
textBox1.Focus();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("右雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|