Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Thread.Sleep(100);
            //实例化全局变量regs对象
            //this.regs = new MyClass.Register();

            if (ValidControlRegister())
            {
                GetControlRegister(this.regs);

                bool result = MyClass.Register.Select(cmbCardID.Text.Trim());
                if (result)
                {
                    MessageBox.Show("此卡已登记");
                }
                else
                {
                    bool Temp = this.regs.Insert();
                    if (Temp)
                    {
                        MessageBox.Show("登记成功");
                        this.regs = new MyClass.Register();
                        // this.cargo.Tab_Name = this.regs.Tab_Name;
                        //
                    }
                    else
                    {
                        MessageBox.Show("登记失败");
                    }
                }
            }
        }
Esempio n. 2
0
        private void ReadCard()
        {
            //this.regs = new MyClass.Register();
            while (true)
            {
                try
                {
                    int      tagCount  = 0;
                    string[] tagNumber = null;
                    byte     result    = MyClass.ClassAll.Reader.Inventory(KV_ISO15693.ModulateMethod.FSK, KV_ISO15693.InventoryModel.Multiple, ref tagCount, ref tagNumber);
                    //MessageBox.Show(result.ToString());
                    Thread.Sleep(100);
                    if (result == 0x00)
                    {
                        String TagCard = tagNumber[0];

                        AddCard(TagCard);

                        bool f*g = MyClass.Register.Select(cmbCardID.Text.Trim());
                        if (f*g)
                        {
                            this.regs = new MyClass.Register(cmbCardID.Text.Trim());

                            SetControlRegister(this.regs);
                        }

                        Thread.Sleep(100);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 3
0
 private void SetControlRegister(MyClass.Register regi)
 {
     this.txtName.Text    = regi.Name;
     this.cmbAntenna.Text = regi.Tab_Name.ToString();
     this.txtPrice.Text   = regi.Price.ToString();
     this.txtLife.Text    = regi.Life.ToString();
     this.dtpProduce.Text = regi.Produce.ToString();
 }
Esempio n. 4
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         MyClass.Register reg = this.listView1.SelectedItems[0].Tag as MyClass.Register;
         this.label2.Text = reg.Name;
     }
 }
Esempio n. 5
0
        private void GetControlRegister(MyClass.Register regs)
        {
            regs.TagID    = this.cmbCardID.Text.Trim();
            regs.Tab_Name = Convert.ToInt32(this.cmbAntenna.Text.Trim());
            regs.Name     = this.txtName.Text.Trim();

            regs.Price = Convert.ToInt32(this.txtPrice.Text.Trim());
            regs.Life  = Convert.ToInt32(this.txtLife.Text.Trim());

            regs.Status  = 0;   //0 表示商品登记
            regs.Produce = Convert.ToDateTime(this.dtpProduce.Text.Trim());
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            //实例化Register类与Cargo类
            regs  = new MyClass.Register();
            cargo = new MyClass.Cargo();

            regs.TagID = cmbCardID.Text.Trim();

            //获取登记商品的通道号
            int value = MyClass.Register.TabSelect(cmbCardID.Text.Trim());

            txtSeat.Text   = value.ToString();
            cargo.Tab_Name = Convert.ToInt32(txtSeat.Text.Trim());

            int result = MyClass.Register.StatusSelect(cmbCardID.Text.Trim());

            //MessageBox.Show(result.ToString());
            if (result == 0)
            {
                int num = cargo.GetGoodsCount();
                //传递一个状态值为 1,入库时间为当前时间,出库时间为空。
                bool Temp = regs.Update(1, DateTime.Now);

                if (Temp)
                {
                    num++;
                    cargo.Update(num);
                    MessageBox.Show("入库成功");
                    //设置通道号和设置LED屏状态显示
                    MyClass.ClassAll.Antenna(txtSeat.Text.Trim(), false);
                }
                else
                {
                    MessageBox.Show("入库失败");
                }
            }
            else if (result == 1)
            {
                MessageBox.Show("该商品已经入库");
            }
            else
            {
                MessageBox.Show("该商品已经出库了,无法再入库");
            }
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Thread.Sleep(100);

            regs       = new MyClass.Register();
            cargo      = new MyClass.Cargo();
            regs.TagID = cmbCardID.Text.Trim();

            //将商品所在入库的通道号的值显示在控件中
            int value = MyClass.Register.TabSelect(cmbCardID.Text.Trim());

            txtSeat.Text   = value.ToString();
            cargo.Tab_Name = Convert.ToInt32(txtSeat.Text.Trim());

            int result = MyClass.Register.StatusSelect(cmbCardID.Text.Trim());

            if (result == 1)
            {
                int num = cargo.GetGoodsCount();
                //传递一个状态值为 1,入库时间为当前时间,出库时间为空。
                bool Temp = regs.Update(2, DateTime.Now);

                if (Temp)
                {
                    num--;
                    cargo.Update(num);
                    MessageBox.Show("出库成功");

                    MyClass.ClassAll.Antenna(txtSeat.Text.Trim(), false);
                }
                else
                {
                    MessageBox.Show("出库失败");
                }
            }
            else if (result == 0)
            {
                MessageBox.Show("该商品未入库,请先入库");
            }
            else
            {
                MessageBox.Show("该商品已经出库");
            }
        }