基本信息
源码名称:汽车座椅装配条码防错
源码大小:30.51M
文件格式:.rar
开发语言:C#
更新时间:2016-11-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

通过扫码识别座椅零件是否正确


#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