通过扫码识别座椅零件是否正确
#region 串口声明 //声明该委托对象 UpdateTextEventHandler updateText; SerialPort sPort = new SerialPort(); #endregion #region 串口显示赋值 public void spReceive_DataReceived(object Sender, EventArgs e) { System.Threading.Thread.Sleep(100); byte[] readBuffer = new byte[sPort.ReadBufferSize]; sPort.Read(readBuffer, 0, readBuffer.Length); this.Invoke(updateText, new string[] { Encoding.ASCII.GetString(readBuffer) }); //string readString = sPort.ReadExisting(); //this.Invoke(updateText, new string[] { readString}); } private void UpdateTextBox(string text) { try { string[] str1 = File.ReadAllLines("ProductNo.txt", Encoding.UTF8); if (DateTime.Now.ToString("dd") == str1[0]) { productNo = int.Parse(str1[1]); } else { productNo = 1; } } catch { } tBoxBarCode.Text = text; if (text == "#############") { opc.WriteOPCItemString(opc.kepGroup, "MES.PLC.BarCode", "#############"); //MessageBox.Show("写入#已执行"); } string str ="";//这里设置字符串a的值 if (text.IndexOf("'")==1) { str=text.Remove(0, 1); } else { str = text; } if (text.IndexOf("'")==text.Length) { str=str.Remove(text.Length,1); } ////新修改的防错使用不使用苗提出 //if(opc.ReadOPC("MES.PLC.ErrorProofingUseSelect")=="True") //{ //比较条码 ltextCompareResult.Text =mainClass.JudgePuductNo(ref dtVehicle, dGViewProduct, "ProductNo", text, ref pageNo); if (pageNo != 1) { mainClass.OpenPdfFile(axAcroPDF, @"D:\OperationInstruction", pageNo); } } #endregion
评论