Example #1
0
        private void equalButton_Click(object sender, EventArgs e)
        {
            if (sureflag)
            {
                string num = numberTextBox.Text;
                if (count.Equals(ParentWindow.DeliveryGoods.ToString()))
                {
                    deliveryGoods.itemInput(num);
                }
                else if (count.Equals(ParentWindow.ReturnGoods.ToString()))
                {
                    returnGoods.itemInput(num);
                }
                else if (count.Equals(ParentWindow.CustomerDelivery.ToString()))
                {
                    customerDelivery.itemInput(num);
                }
                numberTextBox.Text = "";
                sureflag           = false;
                return;
            }
            string bar = numberTextBox.Text;

            numberTextBox.Text = "";
            string good_id  = null;
            string good_num = null;
            string good_wei = null;

            if (bar.Length == 18)
            {
                good_id  = bar.Substring(2, 5);
                good_num = bar.Substring(7, 5);
                good_wei = bar.Substring(12, 5);
                //MessageBox.Show("good_id:" + good_id + ";good_num:" + good_num + ";good_wei:" + good_wei + ";bar:" + bar);
            }
            else
            {
                good_id = bar;
            }
            QueryGoods query = null;

            if (this.count.Equals(ParentWindow.DeliveryGoods.ToString()))
            {
                deliveryGoods.setbar(good_id, good_num, good_wei);
                query = new QueryGoods(deliveryGoods, good_id, "1");
            }
            else if (this.count.Equals(ParentWindow.ReturnGoods.ToString()))
            {
                query = new QueryGoods(returnGoods, good_id, "1");
            }
            else if (this.count.Equals(ParentWindow.CustomerDelivery.ToString()))
            {
                customerDelivery.setbar(good_id, good_num, good_wei);
                query = new QueryGoods(customerDelivery, good_id, "1");
            }
            item = query.queryExistGood(log);//查询后获得
            if (item == 0)
            {
                MessageBox.Show("商品不存在,请重新输入", "提示", MessageBoxButtons.OK);
            }
            else if (item == 1)
            {
                numberTextBox.Text = "";
            }
            else if (item > 1 && item < 50)
            {
                ScanGood scanGood = null;
                if (this.count.Equals(ParentWindow.DeliveryGoods.ToString()))
                {
                    scanGood = new ScanGood(deliveryGoods, good_id, "1");
                }
                else if (this.count.Equals(ParentWindow.ReturnGoods.ToString()))
                {
                    scanGood = new ScanGood(returnGoods, good_id, "1");
                }
                else if (this.count.Equals(ParentWindow.CustomerDelivery.ToString()))
                {
                    scanGood = new ScanGood(customerDelivery, good_id, "1");
                }

                scanGood.ShowDialog();
                numberTextBox.Text = "";
            }
            else if (item >= 50)
            {
                MessageBox.Show("匹配的商品记录数大于[50]条,请输入更多内容以减少匹配范围", "提示", MessageBoxButtons.OK);
            }
        }
Example #2
0
        private void sureButton_Click(object sender, EventArgs e)
        {
            if (num.StartsWith("."))//以小数点开头
            {
                numberTextBox.Text = "0" + numberTextBox.Text;
            }
            bar = barCodeTextBox.Text;
            num = numberTextBox.Text;
            if (bar.Equals(""))
            {
                barCodeTextBox.Focus();
            }
            else
            {
                QueryGoods query = null;
                if (this.count.Equals(ParentWindow.DeliveryGoods.ToString()))
                {
                    query = new QueryGoods(deliveryGoods, bar, num);
                }
                else if (this.count.Equals(ParentWindow.ReturnGoods.ToString()))
                {
                    query = new QueryGoods(returnGoods, bar, num);
                }
                else if (this.count.Equals(ParentWindow.CustomerDelivery.ToString()))
                {
                    query = new QueryGoods(customerDelivery, bar, num);
                }
                //MessageBox.Show(query.ToString());
                item = query.queryExistGood(log);//查询后获得
                if (item == 0)
                {
                    MessageBox.Show("商品不存在,请重新输入", "提示", MessageBoxButtons.OK);
                }
                else if (item == 1)
                {
                    barCodeTextBox.Text = "";
                }
                else if (item > 1 && item < 50)
                {
                    ScanGood scanGood = null;
                    if (this.count.Equals(ParentWindow.DeliveryGoods.ToString()))
                    {
                        scanGood = new ScanGood(deliveryGoods, bar, num);
                    }
                    else if (this.count.Equals(ParentWindow.ReturnGoods.ToString()))
                    {
                        scanGood = new ScanGood(returnGoods, bar, num);
                    }
                    else if (this.count.Equals(ParentWindow.CustomerDelivery.ToString()))
                    {
                        scanGood = new ScanGood(customerDelivery, bar, num);
                    }

                    scanGood.ShowDialog();
                    barCodeTextBox.Text = "";
                }
                else if (item >= 50)
                {
                    MessageBox.Show("匹配的商品记录数大于[50]条,请输入更多内容以减少匹配范围", "提示", MessageBoxButtons.OK);
                }
                barCodeTextBox.Focus();
            }
            textbox_focus = true;
        }