public void GetSoringBeltInfo(string text, List <Group> list, bool isonline) { try { String OpcFJConnectionService = "S7:[FJCONNECTIONGROUP"; //OPC服务器名 groupno = Convert.ToDecimal(System.Text.RegularExpressions.Regex.Replace(text, @"[^0-9]+", "")); list[0].RemovedItem(); //在给OPCItem添加Item之前清空 list[1].RemovedItem(); if (isonline) { groupno = GroupnotoBigg(groupno); OpcFJConnectionService = OpcFJConnectionService + groupno + "]"; list[0].addItem(ItemCollection.GetASortingItem(OpcFJConnectionService)); list[1].addItem(ItemCollection.GetBSortingItem(OpcFJConnectionService)); ListSort = list; isOnLine = isonline; lblyaobai.Text = groupno + "组预分拣"; Text = groupno + "组预分拣"; HandleRead task = ReadDBinfo; task.BeginInvoke(groupno, null, null); } else { lblErorr.Text = "与服务器断开连接...."; } } catch (Exception ex) { lblloading.Text = "服务器连接失败,请检查网络!" + ex.Message; } }
public void OnRead(IReadStream readStream) { if (HandleRead == null) { Logger.Debug($"{nameof(HandleRead)}没添加事件!"); } else { try { HandleRead.Invoke(readStream); } catch (Exception e) { Logger.Error(e); } } }