Exemplo n.º 1
0
        private void stxqrcode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                string[] barcodes = this.stxqrcode.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                if (barcodes.Length >= 7)
                {
                    string orderkey = this.orderkeytxt.Text;
                    string dropid   = this.dropidtxt.Text;
                    string sku      = barcodes[0];
                    string qty      = barcodes[1];
                    int    intqty   = 0;
                    if (!int.TryParse(qty, out intqty))
                    {
                        checker.PlayAlarm();
                        this.stxqrcode.Text = string.Empty;
                        CleanTextBox();
                        //string[] spqty = qty.Split(new string[]{"K"}, StringSplitOptions.RemoveEmptyEntries);
                        //if (spqty.Length > 0)
                        //{
                        //    string kqty = spqty[0];

                        //    if()
                        //}
                    }
                    string als     = barcodes[3];
                    string lotno   = barcodes[2];
                    string ven     = barcodes[4];
                    string trace   = barcodes[5];
                    string dcode   = barcodes[6];
                    bool   isok    = checker.checkingSku(orderkey, dropid, ven.Replace("\n", ""), sku.Replace("\n", ""));
                    bool   isblack = checker.ValidateBackList(ven, sku, als, lotno, dcode, trace);
                    if (isblack)
                    {
                        MessageBox.Show("发现黑名单");
                        checker.PlayAlarm();
                        checker.PlayAlarm();

                        CleanTextBox();
                        this.stxqrcode.BackColor = Color.Red;
                        this.stxqrcode.Text      = string.Empty;
                        this.GetOrderQtyInfo();
                        this.ReloadCheckResult();
                        return;
                    }
                    if (isok)
                    {
                        this.lbbox.Text = this.skupickinglist[sku].ToString();
                        checker.insertLog(this.orderkeytxt.Text, this.dropidtxt.Text, ven.Replace("\n", ""), sku.Replace("\n", ""), Convert.ToInt32(qty.Replace("\n", "")), this.stxqrcode.Text);
                        checker.PlayOK();
                        //int no = this.skupickinglist[sku];
                        //checker.PlayNumSound(no);
                        CleanTextBox();
                        this.stxqrcode.BackColor = Color.Green;
                        this.stxqrcode.Text      = string.Empty;
                    }
                    else
                    {
                        checker.PlayAlarm();

                        CleanTextBox();
                        this.stxqrcode.BackColor = Color.Red;
                        this.stxqrcode.Text      = string.Empty;
                    }
                    this.GetOrderQtyInfo();
                    this.ReloadCheckResult();
                    //MessageBox.Show(sku + "\\" + qty + "\\" + ven);

                    //this.stxqrcode.Text = string.Empty;
                }
            }
        }