Exemple #1
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                //BTPrintClass.PrintClass.SetStatusEvent("KeyDown pressed");
                //this.textBox1.Text = e.KeyValue.ToString();
                //this.textBox1.Text = e.KeyCode.ToString();
                if (e.KeyCode == Keys.Enter)
                {

                    if (textBox1.Text != string.Empty)
                        OnScanned(textBox1.Text);


                    return;
                }
                if (e.KeyCode == Keys.Escape)
                {
                    this.Close();
                    return;
                }
                if (e.KeyValue == (int)SpecialButton.RedBtn)
                {

                    if (_mode == CarScanMode.BoxScan && fullAcceptEnabled && !fullAccepted)
                    {
                        
                        //using (DialogForm dlgfrm =
                                //new DialogForm(
                        DialogResult dr = DialogFrm.ShowMessage(
                                   lblQtySku.Text,
                                    lblQtyTotal.Text,
                                     "Вы уверены?",
                                     "Принять полностью");//)
                        //{
                            if (dr == DialogResult.Yes)
                            {
                                ActionsClass.Action.AcceptFullBoxWProductsActionProc(_currentBoxBarcode);
                                RefreshData(_currentBoxBarcode);
    
                            }
                        //}

                    }

                    return;
                }
                if (e.KeyValue == (int)SpecialButton.BlueBtn)
                {

                    return;
                }
                if (e.KeyValue == (int)SpecialButton.YellowBtn)
                {
                    if (_mode == CarScanMode.BoxScan)
                    {
                        /*int totals = 0;
                        int totalBk = 0;
                        ActionsClass.Action.CalculateTotalsWOPriority(
                            TSDUtils.ActionCode.IncomeBox,
                            DateTime.Today,
                            out totalBk,
                            out totals);*/
                        try
                        {
                            /*ScanClass.Scaner.OnScanned -= scannedDelegate;
                            using (DialogForm dlgfrm =
                                        new DialogForm(
                                            string.Format("За {0} отсканировано",
                                            DateTime.Today.ToString("dd.MM.yyyy"))
                                            , string.Format(" {0} правильных коробов", totalBk)
                                            , ""
                                            , "Подсчет коробов"))
                            {
                                dlgfrm.ShowDialog();
                            }
                            */
                            using (ViewBoxForm boxFrm =
                                new ViewBoxForm(_currentBoxBarcode, (byte)TSDUtils.ActionCode.BoxWProducts))
                            {
                                boxFrm.ShowDialog();
                            }
                            RefreshData(_currentBoxBarcode);

                        }
                        finally
                        {
                            //ScanClass.Scaner.OnScanned += scannedDelegate;

                        }
                    }
                    else
                    {
                        using (ViewTtnForm vFrm = new ViewTtnForm(TtnStruct))
                        {
                            vFrm.ShowDialog();
                        }
                    }
                    

                    return;
                }
                if (e.KeyValue == (int)SpecialButton.GreenBtn) //GreenBtn
                {
                    if (_mode == CarScanMode.CarsScan)
                    {
                        int total = 0;

                        foreach (string incomeDoc in TtnStruct[_currentTTNBarcode].Keys)
                        {//цикл по всем накладным
                            foreach (string navCodeBox in TtnStruct[_currentTTNBarcode][incomeDoc].Keys)
                            {
                                if (TtnStruct[_currentTTNBarcode][incomeDoc][navCodeBox].Accepted)
                                    total++;
                            }
                        }


                        //using (DialogForm dlgfrm =
                        //        new DialogForm(
                        DialogResult dr = DialogFrm.ShowMessage(
                                    "Вы хотите закончить просчет ТТН?"
                                    , ""//string.Format("Посчитано: {0} кодов", totalBk)
                                    , string.Format("Итого: {0} коробов", total)
                                    , "Закрытие ТТН");//)
                        //{
                            if (dr == DialogResult.Yes)
                            {

                                ActionsClass.Action.CloseDoc(
                                    _currentTTNBarcode,
                                    TSDUtils.ActionCode.Cars,
                                    total);

                                this.Close();
                            }
                        //}

                    }
                    else
                    {
                        if (!fullAccepted)
                        {
                            try
                            {


                                enableScan = false;
                                ScanClass.Scaner.StopScan();
                                ScanClass.Scaner.OnScanned -= scannedDelegate;
                                //ScanClass.Scaner.OnScanned =null;
                                //this.Visible = false;
                                //this.Enabled = false;
                                ScanClass.Scaner.StopScan();
                                using (ViewProductForm prodfrm =
                                    new ViewProductForm(
                                        WorkMode.BoxScan,
                                        _currentBoxBarcode))
                                {
                                    prodfrm.ShowDialog();
                                }
                                RefreshData(_currentBoxBarcode);

                            }
                            catch (Exception err)
                            {
                                //using (DialogForm frmErr =
                                //    new DialogForm("Ошибка инв-ции",
                                //        err.Message,
                                //        "ДА – продолжить. Нет – выйти",
                                //         "Ошибка"))
                                //{
                                //    if (frmErr.ShowDialog() == DialogResult.No)
                                //        return;
                                //}
                            }
                            finally
                            {
                                ScanClass.Scaner.OnScanned += scannedDelegate;
                                ScanClass.Scaner.InitScan();
                                enableScan = true;
                                //this.Visible = true;
                                //this.Enabled = true;
                                //ScanClass.Scaner.InitScan();
                                //ScanClass.Scaner.OnScanned += new Scanned(OnScanned);
                            }
                        }
                    }
                    return;
                }
            }
            finally
            {
                this.Refresh();
            }
             
        }
Exemple #2
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                //BTPrintClass.PrintClass.SetStatusEvent("KeyDown pressed");
                //this.textBox1.Text = e.KeyValue.ToString();
                //this.textBox1.Text = e.KeyCode.ToString();
                if (e.KeyCode == Keys.Enter)
                {
                    if (textBox1.Text != string.Empty)
                        OnScanned(textBox1.Text);

                    return;
                }
                if (e.KeyCode == Keys.Escape)
                {
                    this.Close();
                    return;
                }
                if (e.KeyValue == (int)SpecialButton.RedBtn)
                {
                    if (!closedCar && currentTtnBarcode != string.Empty)
                    {
                        enableScan = false;
                        ScanClass.Scaner.OnScanned -= scannedDelegate;
                        try
                        {
                            using (IncomeForm income =
                                new IncomeForm(TtnStruct, currentTtnBarcode))
                            {

                                income.ShowDialog();
                            }
                        }
                        finally
                        {
                            enableScan = true;
                            ScanClass.Scaner.InitScan();
                            ScanClass.Scaner.OnScanned += scannedDelegate;
                        }
                        CheckStatus(currentTtnBarcode);
                    }
                    return;
                }
                if (e.KeyValue == (int)SpecialButton.BlueBtn)
                {

                    return;
                }
                if (e.KeyValue == (int)SpecialButton.YellowBtn)
                {
                    enableScan = false;
                    try
                    {
                        if (currentTtnBarcode != string.Empty &&
                            Boxrows != null &&
                            Boxrows.Count > 0)
                        {

                            using (ViewTtnForm vFrm = new ViewTtnForm(TtnStruct))
                            {
                                vFrm.ShowDialog();
                            }
                        }

                    }
                    finally
                    {
                        enableScan = true;
                    }

                    /*int totals=0;
                    int totalBk=0;
                    ActionsClass.Action.CalculateTotalsWOPriority(
                        TSDUtils.ActionCode.IncomeBox,
                        DateTime.Today,
                        out totalBk,
                        out totals);
                    try
                    {
                        ScanClass.Scaner.OnScanned -= scannedDelegate;
                        using (DialogForm dlgfrm =
                                    new DialogForm(
                                        string.Format("За {0} отсканировано",
                                        DateTime.Today.ToString("dd.MM.yyyy"))
                                        , string.Format(" {0} правильных коробов", totalBk)
                                        , ""
                                        , "Подсчет коробов"))
                        {
                            dlgfrm.ShowDialog();
                        }
                    }
                    finally
                    {
                        ScanClass.Scaner.OnScanned += scannedDelegate;

                    }
                     * */

                    return;
                }
                if (e.KeyValue == (int)SpecialButton.GreenBtn) //GreenBtn
                {

                    return;
                }

            }
            finally
            {
                this.Refresh();
            }
        }