Exemplo n.º 1
0
            //显示处理
            private void ProcessRfidRead(TagReadData[] tags)
            {
                try
                {
                    ////在主窗口中显示数据
                    //ActingThread AcT = new ActingThread(form.ProcessRfidTag);
                    //form.BeginInvoke(AcT, new object[] { readingHead, tags });
                    //TimeSpan ts = DateTime.Now.Subtract(rfidReader.readTime);

                    string[] epcdata = new string[tags.Count()];

                    List<string> list = new List<string>();
                    foreach (KeyValuePair<string, TagInfo> tagInfo in tagDic)
                    {
                        if (DateTime.Now.Ticks - tagInfo.Value.time.Ticks > 10 * 10000000)
                        {
                            list.Add(tagInfo.Key);
                        }
                    }
                    foreach (string s in list)
                    {
                        tagDic.Remove(s);
                    }
                    list.Clear();

                    foreach (TagReadData tagData in tags)
                    {
                        if (!tagDic.ContainsKey(tagData.EPCString))
                        {
                            TagInfo tagInfo = new TagInfo();
                            tagInfo.ip = this.readingHead.ascmReadingHead.ip;
                            tagInfo.time = DateTime.Now;
                            tagInfo.tagEpc = tagData.EPCString;
                            tagDic.Add(tagData.EPCString, tagInfo);
                            //每次读取标签创建线程进行上传
                            ThreadPool.QueueUserWorkItem(new WaitCallback(UpLoad), tagInfo);
                        }
                    }

                    //if (this.readingHead.ascmReadingHead.ip == "10.46.11.244")
                    //{
                    //    foreach (TagReadData tagData in tags)
                    //    {
                    //        WriteLogFile(Thread.CurrentThread.ManagedThreadId + " " + "汇总显示" + this.readingHead.ascmReadingHead.address + " " + tagData.EPCString);
                    //    }
                    //}
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
Exemplo n.º 2
0
 private void ProcessRfidTag(ReadingHead readingHead, TagReadData[] tags)
 {
     string[] epcdata = new string[tags.Count()];
     for (int i = 0; i < tags.Count(); i++)
     {
         if (tags[i] != null)
         {
             epcdata[i] = tags[i].EPCString;
             AddLog("读到值:" + epcdata[i]);
             //ListViewItem item = new ListViewItem();
             //listView1.Items.Add(epcdata[i]);
             //MessageBox.Show(epcdata[i]);
         }
     }
 }