private void updateTagData(TagReadData tag) { string EBdData = tag.EPCString; int isMem = EBdData.IndexOf("A"); if (isMem == 0) { if (EBdData.Length != 8) { return; } curEPC = EBdData; meb = InStock.getMemDetailByID(EBdData.Replace("A", "")); meb.EPCStr = EBdData; if (ID_Text.InvokeRequired) { Action <string> IDDel = (x) => { ID_Text.Text = x.ToString(); }; ID_Text.Invoke(IDDel, meb.name); } else { ID_Text.Text = meb.ID; } tagList.Add(new tagInfo(tag)); } else if (EBdData.IndexOf("B") == 0) { byte[] TIDByte = tag.EbdData; string TIDStr = ByteArrayToHexString(TIDByte); goodDetail good = InStock.getDetailByID(TIDStr); if (good == null) { tagList.Add(new tagInfo(tag)); return; } if (InStock.isSold(TIDStr) == 0) { InStock.refreshRFIDInfo(TIDStr, good.ID, 1); goodsDetailList.Add(good); if (details_Num.ContainsKey(good.name)) { ArrayList temp = details_Num[good.name]; temp[1] = (int)temp[1] + 1; temp[0] = (double)temp[0] + good.cost; } else { ArrayList temp = new ArrayList(); temp.Add(good.cost); temp.Add(1); details_Num.Add(good.name, temp); } tagList.Add(new tagInfo(tag)); } } }
//用户离开后刷新页面内容为空 private void initialAllInfo() { meb = null; tagList.Clear(); goodsDetailList.Clear(); details_Num.Clear(); goodsList.Clear(); if (Items_Details.InvokeRequired) { Action listDel = () => { bs.DataSource = new BindingList <goodInfo>(goodsList); Items_Details.Refresh(); }; Items_Details.Invoke(listDel); } else { bs.DataSource = new BindingList <goodInfo>(goodsList); Items_Details.Refresh(); } if (Cost_Text.InvokeRequired) { Action <string> CostDel = (x) => { Cost_Text.Text = x.ToString(); }; Cost_Text.Invoke(CostDel, ""); } else { Cost_Text.Text = ""; } if (ID_Text.InvokeRequired) { Action <string> IDDel = (x) => { ID_Text.Text = x.ToString(); }; ID_Text.Invoke(IDDel, ""); } else { ID_Text.Text = ""; } billNumber = ""; }