Beispiel #1
0
        /// <summary>
        /// 业务处理入口
        /// </summary>
        public void BizListen()
        {
            //IBiz biz = null;
            foreach (var loc in mRfIdReadList)
            {
                if (!myUHFreader.ContainsKey(loc.LocNo))
                {
                    UHFreader MyReader = new UHFreader();

                    bool result = MyReader.NetConnect(loc.IPAddress, int.Parse(loc.PortNo));
                    if (result)
                    {
                        myUHFreader.Add(loc.LocNo, MyReader);
                        TagInfo tagInfo = MyReader.TagTimeSpanInventory(300);//时间段盘点标签的时间建议在200ms以上,否则比较容易读取失败,读取时间大约在 time + 50 ms
                        //判断是否为空
                        string readInfo = null;
                        if (tagInfo.EPC != null)
                        {
                            readInfo = System.Text.Encoding.ASCII.GetString(tagInfo.EPC);
                        }
                        if (LastReadInfo != readInfo)
                        {
                            ShowFormData.Instance.ShowFormInfo(new ShowInfoData($"{readInfo}", loc.LocNo, InfoType.locStatus));
                            ShowFormData.Instance.ShowFormInfo(new ShowInfoData($"当前读取RFID:{readInfo}", loc.LocNo, InfoType.logInfo));

                            UpdatePemLocStatus(loc.LocNo, readInfo);
                            LastReadInfo = readInfo;
                        }
                    }
                }
                else
                {
                    UHFreader myReader = myUHFreader.SingleOrDefault(k => k.Key == loc.LocNo).Value;
                    TagInfo   tagInfo  = myReader.TagTimeSpanInventory(300);
                    string    readInfo = null;
                    if (tagInfo.EPC != null)
                    {
                        readInfo = System.Text.Encoding.ASCII.GetString(tagInfo.EPC);
                    }
                    if (LastReadInfo != readInfo)
                    {
                        ShowFormData.Instance.ShowFormInfo(new ShowInfoData($"{readInfo}", loc.LocNo, InfoType.locStatus));
                        ShowFormData.Instance.ShowFormInfo(new ShowInfoData($"当前读取RFID:{readInfo}", loc.LocNo, InfoType.logInfo));

                        UpdatePemLocStatus(loc.LocNo, readInfo);
                        LastReadInfo = readInfo;
                    }
                }
            }
        }