示例#1
0
        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));
                }
            }
        }
示例#2
0
        // 下面是RFID 部分用到的DAL
        public static goodDetail getDetailByID(string ID)
        {
            DataSet a   = new DataSet();
            String  sql = "select distinct GoodsRFID.Good_ID, stockdetail_table.Goodsname, stockdetail_table.Goodsinprice from GoodsRFID,stockdetail_table where GoodsRFID.RFID_ID ='" + ID + "' and stockdetail_table.GoodsID = GoodsRFID.Good_ID";

            //通过商品的RFID扫描得到商品详细信息:商品ID(非RFID),商品名称,商品单价,以goodDetail类型返回
            a = Datameans.getDataSet(sql);
            if (a.Tables[0].Rows.Count != 0)
            {
                string        name   = a.Tables[0].Rows[0][1].ToString();
                string        GoodID = a.Tables[0].Rows[0][0].ToString();
                string        price  = a.Tables[0].Rows[0][2].ToString();
                List <string> temp   = new List <string>();
                temp.Add(name);
                temp.Add(price);
                temp.Add(GoodID);
                goodDetail temp2 = new goodDetail(temp[2], temp[0], Convert.ToDouble(temp[1]));
                return(temp2);
            }
            return(null);
        }