示例#1
0
        public RemoveFinishForm(ProductsDataSet.ProductsTblRow datarow, ProductsDataSet.DocsTblRow docsRow)
            :this()
        {
            _datarow = datarow;
            _docsRow = docsRow;

        }
示例#2
0
        //public ViewDocsForm(ProductsDataSet.ProductsTblRow productRow):this()
        //{
        //    this.panel2.SuspendLayout();
        //    this.SuspendLayout();
        //    _productRow = productRow;
        //    StringBuilder sb = new StringBuilder();
        //    sb.AppendFormat(System.Globalization.CultureInfo.CurrentCulture,
        //        "Код: {0} \nШтрихкод: {1} \nНазвание: {2}",
        //        _productRow.NavCode,
        //        _productRow.Barcode,
        //        _productRow.ProductName);
        //    this.label.Text = sb.ToString();

        //    Label l = new Label();
        //    l.Size = new System.Drawing.Size(231, 90);
        //    l.Name = string.Format("label{0}", 0);
        //    l.Left = 0;
        //    l.Top = 0;
        //    l.Text = "По данному товару \nнет никаких документов, \nнажмите желтую кнопку \nеще раз для выхода";
        //    l.BackColor = System.Drawing.Color.PaleGreen;
            
        //    this.panel2.Controls.Add(l);
        //    this.panel1.ResumeLayout(false);
        //    this.ResumeLayout();
        //}
        public ViewDocsForm(ProductsDataSet.ProductsTblRow productRow,
            ProductsDataSet.DocsTblRow[] docsRows,
            ScannedProductsDataSet scannedProducts):this()
        {
            this.panel2.SuspendLayout();
            this.SuspendLayout();

            _productRow = productRow;
            _scannedProducts = scannedProducts;
            _docsRows = docsRows;
            //this.listBox1.KeyDown += new KeyEventHandler(listBox1_KeyDown);
            this.Load += new EventHandler(ViewDocsForm_Load);
            int docCounter = 0;
            //this.Paint += new PaintEventHandler(ViewDocsForm_Paint);
            if (_productRow != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat(System.Globalization.CultureInfo.CurrentCulture,
                    "Код: {0} \nШтрихкод: {1} \nНазвание: {2}",
                    _productRow.NavCode,
                    _productRow.Barcode,
                    _productRow.ProductName);
                this.label.Text = sb.ToString();

                if (_docsRows != null && _docsRows.Length > 0)
                {
                    foreach (ProductsDataSet.DocsTblRow doc in _docsRows)
                    {

                        ScannedProductsDataSet.ScannedBarcodesRow srow =
                        _scannedProducts
                                .ScannedBarcodes
                                .FindByBarcodeDocTypeDocId(_productRow.Barcode,
                                                            doc.DocType,
                                                            doc.DocId);

                        DocumentClass d = new DocumentClass();
                        d.DocDate = doc.DocumentDate;
                        d.DocId = doc.DocId;
                        d.DocType = doc.DocType;
                        d.Text1 = doc.Text1;
                        d.Text2 = doc.Text2;
                        d.Text3 = doc.Text3;

                        d.PlanQuantity = doc.Quantity;
                        if (srow != null &&
                            srow["FactQuantity"] != System.DBNull.Value)
                            d.FactQuantity = srow.FactQuantity;
                        else
                            d.FactQuantity = 0;



                        Label l = new Label();
                        l.Size = new System.Drawing.Size(231, 60);
                        l.Name = string.Format("label{0}", documents.Count);
                        l.Left = 0;
                        l.Top = documents.Count * 60;
                        l.Text = d.ToString();
                        l.BackColor = System.Drawing.Color.PaleGreen;
                        l.TextAlign = ContentAlignment.TopCenter;
                        documents.Add(d);
                        this.panel2.Controls.Add(l);
                        selectedItem = 0;
                        docCounter++;

                    }
                }
               else
                {
                    Label l = new Label();
                    l.Size = new System.Drawing.Size(231, 60);
                    l.Name = string.Format("label{0}", 0);
                    l.Left = 0;
                    l.Top = 0;
                    l.Text = "По данному товару \nнет никаких документов";
                    l.BackColor = System.Drawing.Color.PaleGreen;
                    l.TextAlign = ContentAlignment.TopCenter;
                    this.panel2.Controls.Add(l);
                    docCounter++;
                }
                Label l1 = new Label();
                l1.Size = new System.Drawing.Size(231, 30);
                l1.Name = string.Format("label{0}", docCounter + 1);
                l1.Left = 0;
                l1.Top = (docCounter * 60);
                l1.Text = "Нажмите желтую кнопку или Clr-Fn\nеще раз для выхода";
                l1.BackColor = System.Drawing.Color.PaleGreen;
                l1.TextAlign = ContentAlignment.TopCenter;
                this.panel2.Controls.Add(l1);

            }

            this.panel1.ResumeLayout(false);
            this.ResumeLayout();
        }
示例#3
0
        private void DoAction(ProductsDataSet.ProductsTblRow row)
        {
            if (_mEvt.WaitOne(5000, false) == false)
            {
                this.Close();
            }
            try
            {

                //tmr.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

                label5.Text = "";
                label6.Text = "";
                label7.Text = "";
                label8.Text = "";
                label9.Text = "";
                label20.Text = "";
                label21.Text = "";
                //label17.Text = "";
                actionLabel.Text = "";
                navCodeTB.Text = "";
                currentProductRow = row;

                if (row != null)
                {
                    label17.Text = row.Barcode.ToString("0000000000000");
                    if (row.ProductName.Length > 15)
                    {
                        label5.Text = row.ProductName.Substring(0, 15);
                        label6.Text = row.ProductName.Substring(15);
                    }
                    else
                        label5.Text = row.ProductName;
                    navCodeTB.Text = row.NavCode;

                    label7.Text = (row["NewPrice"] == System.DBNull.Value ||
                        row["NewPrice"] == null) ? string.Empty : row.NewPrice.ToString("######.00");
                    label8.Text = (row["OldPrice"] == System.DBNull.Value ||
                        row["OldPrice"] == null) ? string.Empty : row.OldPrice.ToString("######.00");
                    if (label8.Text != label7.Text)
                        label7.Font = boldFont;
                    else
                        label7.Font = normalFont;


                    label9.Text = (row["Article"] == System.DBNull.Value ||
                        row["Article"] == null) ? string.Empty : row.Article;
                    switch (_mode)
                    {
                        case WorkMode.ProductsScan:
                            {
                                #region prod
                                ProductsDataSet.DocsTblRow[] docRows =
                           ActionsClass.Action.GetDataByNavCode(row.NavCode);
                                actionDict.Clear();
                                currentdocRows = docRows;

                                if (docRows != null)
                                {

                                    foreach (ProductsDataSet.DocsTblRow docRow in docRows)
                                    {
                                        ScannedProductsDataSet.ScannedBarcodesRow scannedRow =
                                            ActionsClass.Action.AddScannedRow(
                                            row.Barcode,
                                            docRow.DocType,
                                            docRow.DocId,
                                            docRow.Quantity,
                                            docRow.Priority);
                                        /*_scannedProducts.ScannedBarcodes.FindByBarcodeDocTypeDocId(
                                        row.Barcode,
                                        docRow.DocType,
                                        docRow.DocId);
                                    if (scannedRow == null)
                                    {
                                        scannedRow =
                                            _scannedProducts.ScannedBarcodes.NewScannedBarcodesRow();
                                        scannedRow.Barcode = row.Barcode;
                                        scannedRow.DocId = docRow.DocId;
                                        scannedRow.DocType = docRow.DocType;
                                        scannedRow.PlanQuanity = docRow.Quantity;
                                        scannedRow.Priority = docRow.Priority;
                                        scannedRow.ScannedDate = DateTime.Today;
                                        scannedRow.TerminalId = Program.TerminalId;
                                        _scannedProducts.ScannedBarcodes.AddScannedBarcodesRow(scannedRow);
                                    }*/
                                        byte actionCodes = docRow.DocType;
                                        if (!actionDict.ContainsKey(actionCodes))
                                            actionDict.Add(actionCodes, docRow);
                                    }
                                    foreach (byte acode in actionDict.Keys)
                                    {
                                        ActionsClass.Action.InvokeAction((TSDUtils.ActionCode)acode, row, actionDict[acode]);
                                        //this.Refresh();
                                    }
                                }
                                else
                                {
                                    ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.DocNotFound, row, null);
                                }
                                break;
#endregion
                            }
                        case WorkMode.InventarScan:
                            {
                                #region inv
                                if (_invMode == InventarMode.DontUseReturns)
                                {
                                    inventRow.NavCode = row.NavCode;
                                    ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.InventoryGlobal,
                                        row,
                                        inventRow
                                        );
                                }
                                else
                                {
                                    ProductsDataSet.DocsTblRow[] arrofdocs = ActionsClass.Action.GetDataByNavCodeAndType(
                                        row.NavCode,
                                        (byte)TSDUtils.ActionCode.Returns);

                                    if (arrofdocs != null &&
                                        arrofdocs.Length > 0)
                                    {
                                        ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.ReturnInInventory);
                                        ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.ReturnInInventory);

                                        string str = string.Format("{0}-{1}-{2}",
                                            arrofdocs[0].DocId,
                                            arrofdocs[0].Text2,
                                            arrofdocs[0].Text1);



                                        DialogResult dr = DialogFrm.ShowMessage(
                                          row.NavCode + " " + row.ProductName
                                        , "Этот товар участвует в возврате"
                                        , str
                                        , "Режим инвентаризации");
                                    }
                                    else
                                    {
                                        inventRow.NavCode = row.NavCode;
                                        ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.InventoryGlobal,
                                            row,
                                            inventRow
                                            );
                                    }

                                }
                                break;
                                //this.Refresh();
                                //ActionsClass.Action.InventoryGlobalActionProc(
                                //    row,
                                //    inventRow);
#endregion
                            }
                        case WorkMode.BoxScan:
                            {
                                #region box
                                try
                                {
                                    ProductsDataSet.DocsTblRow docRow =
                                        ActionsClass.Action.GetDataByNavcodeDocIdAndType(row.NavCode,
                                            inventRow.DocId,
                                            (byte)TSDUtils.ActionCode.BoxWProducts
                                        );
                                    if (docRow != null)
                                    {
                                        /*
                                         * ScannedProductsDataSet.ScannedBarcodesRow srows
                                            = ActionsClass.Action.FindByBarcodeDocTypeDocId(row.Barcode.ToString(),
                                            (byte)TSDUtils.ActionCode.BoxWProducts,
                                            inventRow.DocId
                                            );*/

                                        ScannedProductsDataSet.ScannedBarcodesRow[] rowsS
                                            = ActionsClass.Action.FindByDocIdAndDocType(inventRow.DocId,
                                            (byte)TSDUtils.ActionCode.BoxWProducts);

                                        int fQty = 0;
                                        for (int i = 0; i < rowsS.Length; i++)
                                        {
                                            if (rowsS[i].Barcode == currentProductRow.Barcode)
                                                fQty += rowsS[i].FactQuantity;
                                        }

                                        if (rowsS.Length > 0)
                                        {
                                            if (docRow.Quantity < (fQty + quantityKoeff))
                                            {
                                                ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);
                                                ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);


                                                //using (DialogForm dlgfrm =
                                                //new DialogForm(
                                                DialogResult dr = DialogFrm.ShowMessage(
                                            string.Format("Товар уже принят {0} из {1}",
                                            fQty,
                                            docRow.Quantity)
                                            , string.Format("Принять еще {0} шт", quantityKoeff)//string.Format("Посчитано: {0} кодов", totalBk)
                                            , row.ProductName
                                            , "Прием товара");//)
                                                // {
                                                if (dr == DialogResult.Yes)
                                                {
                                                    //inventRow.NavCode = row.NavCode;
                                                    ActionsClass.Action.BoxWProductsActionProc(
                                                        row,
                                                        docRow,
                                                        quantityKoeff
                                                        );
                                                    return;//приняли
                                                }
                                                else //не хотим принимать
                                                    return;
                                                //}
                                            }
                                        }
                                        //если не сработали условия - то принимаем
                                        //inventRow.NavCode = row.NavCode;
                                        ActionsClass.Action.BoxWProductsActionProc(
                                                             row,
                                                             docRow,
                                                             quantityKoeff
                                                             );
                                        /*ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.BoxWProducts,
                                            row,
                                            docRow
                                            );*/


                                    }
                                    else
                                    {
                                        ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox);
                                        ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox);

                                        //using (DialogForm dlgfrm =
                                        //new DialogForm(
                                        DialogResult dr = DialogFrm.ShowMessage(
                                            "Товар не входит в короб!"
                                            , string.Format("Принять этот товар {0}", row.Barcode)//string.Format("Посчитано: {0} кодов", totalBk)
                                            , row.ProductName
                                            , "Прием товара");//)
                                        //{
                                        if (dr == DialogResult.Yes)
                                        {
                                            inventRow.NavCode = row.NavCode;
                                            ActionsClass.Action.BoxWProductsActionProc(
                                                        row,
                                                        inventRow,
                                                        quantityKoeff
                                                        );
                                            return;
                                        }
                                        //}

                                    }
                                }
                                finally
                                {
                                    quantityLabel.Visible = false;
                                    quantityKoeff = 1;
                                }
                                break;
#endregion
                            }
                        case WorkMode.SimpleIncome:
                            {
                                #region income
                                inventRow.NavCode = row.NavCode;

                                if (row.AcceptDefect == 0)
                                {
                                    /*
2. Нужно изменить функционирование кнопки "5 - накладные".
Сначала там вопрос насчет "поданных на возврат" - оставляем как есть.
Изменения в самом просчете товара.
* Если поле 11 у товара = 1, то оставляем "как есть"
* Если поле 11 у товара = 0, то где-то ярко пишем "БРАК"
при этом посчет товара не меняется, формируетс один файл на накладную, как и сейчас.
                                     */
                                    if (row["ProductName"] == System.DBNull.Value)
                                        label6.Text = "Нет названия";
                                    else
                                        if (row.ProductName.Length <30)
                                            label6.Text = row.ProductName;
                                        else
                                            label6.Text = row.ProductName.Substring(0, 30);

                                    label5.Text = "      БРАК     ";
                                    label5.BackColor = Color.Red;


                                }
                                else
                                {

                                    //label5.BackColor = System.Drawing.Color.PaleGreen;
                                    if (_invMode == InventarMode.UseReturns)
                                        label5.BackColor = System.Drawing.Color.Turquoise;
                                    else
                                        label5.BackColor = System.Drawing.Color.PaleGreen;

                                    

                                    if (row.ProductName.Length > 15)
                                    {
                                        label5.Text = row.ProductName.Substring(0, 15);
                                        label6.Text = row.ProductName.Substring(15);
                                    }
                                    else
                                        label5.Text = row.ProductName;
                                }


                                if (_invMode == InventarMode.DontUseReturns)
                                {
                                    //inventRow.NavCode = row.NavCode;
                                    ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.SimpleIncome,
                                        row,
                                        inventRow
                                        );
                                }
                                else
                                {
                                    ProductsDataSet.DocsTblRow[] arrofdocs = ActionsClass.Action.GetDataByNavCodeAndType(
                                        row.NavCode,
                                        (byte)TSDUtils.ActionCode.Returns);

                                    if (arrofdocs != null &&
                                        arrofdocs.Length > 0)
                                    {
                                        ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.ReturnInInventory);
                                        ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.ReturnInInventory);

                                        string str = string.Format("{0}-{1}-{2}",
                                            arrofdocs[0].DocId,
                                            arrofdocs[0].Text2,
                                            arrofdocs[0].Text1);



                                        DialogResult dr = DialogFrm.ShowMessage(
                                          row.NavCode + " " + row.ProductName
                                        , "Этот товар участвует в возврате"
                                        , str
                                        , "Режим накладных");
                                    }
                                    else
                                    {
                                        //inventRow.NavCode = row.NavCode;
                                        ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.SimpleIncome,
                                            row,
                                            inventRow
                                            );
                                    }
                                }
                                #endregion
                                break;
                            }
                        case WorkMode.ReturnBoxWProducts:
                            {
                                #region box
                                try
                                {
                                //ProductsDataSet.DocsTblRow docRow =
                                //    ActionsClass.Action.GetActualBoxReturnsDocRow();

                                    //if (docRow != null)
                                    //{
                                        /*
                                         * ScannedProductsDataSet.ScannedBarcodesRow srows
                                            = ActionsClass.Action.FindByBarcodeDocTypeDocId(row.Barcode.ToString(),
                                            (byte)TSDUtils.ActionCode.BoxWProducts,
                                            inventRow.DocId
                                            );*/

                                        //ScannedProductsDataSet.ScannedBarcodesRow[] rowsS
                                        //    = ActionsClass.Action.FindByDocIdAndDocType(inventRow.DocId,
                                        //    (byte)TSDUtils.ActionCode.BoxWProducts);

                                        //int fQty = 0;
                                        //for (int i = 0; i < rowsS.Length; i++)
                                        //{
                                        //    if (rowsS[i].Barcode == currentProductRow.Barcode)
                                        //        fQty += rowsS[i].FactQuantity;
                                        //}

                                        //if (rowsS.Length > 0)
                                        //{
                                        //    if (docRow.Quantity < (fQty + quantityKoeff))
                                        //    {
                                        //        ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);
                                        //        ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);


                                        //        //using (DialogForm dlgfrm =
                                        //        //new DialogForm(
                                        //        DialogResult dr = DialogFrm.ShowMessage(
                                        //    string.Format("Товар уже принят {0} из {1}",
                                        //    fQty,
                                        //    docRow.Quantity)
                                        //    , string.Format("Принять еще {0} шт", quantityKoeff)//string.Format("Посчитано: {0} кодов", totalBk)
                                        //    , row.ProductName
                                        //    , "Прием товара");//)
                                        //        // {
                                        //        if (dr == DialogResult.Yes)
                                        //        {
                                        //            //inventRow.NavCode = row.NavCode;
                                        //            ActionsClass.Action.BoxWProductsActionProc(
                                        //                row,
                                        //                docRow,
                                        //                quantityKoeff
                                        //                );
                                        //            return;//приняли
                                        //        }
                                        //        else //не хотим принимать
                                        //            return;
                                        //        //}
                                        //    }
                                        //}
                                        //если не сработали условия - то принимаем
                                        //inventRow.NavCode = row.NavCode;
                                    ActionsClass.Action.ReturnBoxWProductsActionProc(
                                                             row,
                                                             inventRow
                                                             );
                                        /*ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.BoxWProducts,
                                            row,
                                            docRow
                                            );*/


                                    //}
                                    //else
                                    //{
                                    //    ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox);
                                    //    ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox);

                                    //    //using (DialogForm dlgfrm =
                                    //    //new DialogForm(
                                    //    DialogResult dr = DialogFrm.ShowMessage(
                                    //        "Товар не входит в короб!"
                                    //        , string.Format("Принять этот товар {0}", row.Barcode)//string.Format("Посчитано: {0} кодов", totalBk)
                                    //        , row.ProductName
                                    //        , "Прием товара");//)
                                    //    //{
                                    //    if (dr == DialogResult.Yes)
                                    //    {
                                    //        inventRow.NavCode = row.NavCode;
                                    //        ActionsClass.Action.BoxWProductsActionProc(
                                    //                    row,
                                    //                    inventRow,
                                    //                    quantityKoeff
                                    //                    );
                                    //        return;
                                    //    }
                                    //    //}

                                    //}
                                //}
                                finally
                                {
                                    //quantityLabel.Visible = false;
                                    //quantityKoeff = 1;
                                }
                                break;
                                #endregion
                            }
                            
                        default:
                            {
                                currentdocRows = null;
                                currentProductRow = null;
                                ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.NotFound, null, null);
                                label5.Text = "...Действие ";
                                label6.Text = "  не определено ...";
                                label17.Text = "";
                                break;
                            }
                    }
#region old code
                    /*if (_mode == WorkMode.ProductsScan)
                    {
                        ProductsDataSet.DocsTblRow[] docRows =
                            ActionsClass.Action.GetDataByNavCode(row.NavCode);
                        actionDict.Clear();
                        currentdocRows = docRows;

                        if (docRows != null)
                        {

                            foreach (ProductsDataSet.DocsTblRow docRow in docRows)
                            {
                                ScannedProductsDataSet.ScannedBarcodesRow scannedRow =
                                    ActionsClass.Action.AddScannedRow(
                                    row.Barcode,
                                    docRow.DocType,
                                    docRow.DocId,
                                    docRow.Quantity,
                                    docRow.Priority);
                            //    _scannedProducts.ScannedBarcodes.FindByBarcodeDocTypeDocId(
                            //    row.Barcode,
                            //    docRow.DocType,
                            //    docRow.DocId);
                            //if (scannedRow == null)
                            //{
                            //    scannedRow =
                            //        _scannedProducts.ScannedBarcodes.NewScannedBarcodesRow();
                            //    scannedRow.Barcode = row.Barcode;
                            //    scannedRow.DocId = docRow.DocId;
                            //    scannedRow.DocType = docRow.DocType;
                            //    scannedRow.PlanQuanity = docRow.Quantity;
                            //    scannedRow.Priority = docRow.Priority;
                            //    scannedRow.ScannedDate = DateTime.Today;
                            //    scannedRow.TerminalId = Program.TerminalId;
                            //    _scannedProducts.ScannedBarcodes.AddScannedBarcodesRow(scannedRow);
                            //}
                     
                                byte actionCodes = docRow.DocType;
                                if (!actionDict.ContainsKey(actionCodes))
                                    actionDict.Add(actionCodes, docRow);
                            }
                            foreach (byte acode in actionDict.Keys)
                            {
                                ActionsClass.Action.InvokeAction((TSDUtils.ActionCode)acode, row, actionDict[acode]);
                                //this.Refresh();
                            }
                        }
                        else
                        {
                            ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.DocNotFound, row, null);
                        }
                    }
                    else
                    {
                        if (_mode == WorkMode.SimpleIncome)
                        {
                            inventRow.NavCode = row.NavCode;
                            ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.SimpleIncome,
                                row,
                                inventRow
                                );
                        }
                        if (_mode == WorkMode.InventarScan)
                        {
                            if (_invMode == InventarMode.DontUseReturns)
                            {
                                inventRow.NavCode = row.NavCode;
                                ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.InventoryGlobal,
                                    row,
                                    inventRow
                                    );
                            }
                            else
                            {
                                ProductsDataSet.DocsTblRow[] arrofdocs = ActionsClass.Action.GetDataByNavCodeAndType(
                                    row.NavCode,
                                    (byte)TSDUtils.ActionCode.Returns);

                                if (arrofdocs != null &&
                                    arrofdocs.Length > 0)
                                {
                                    ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.ReturnInInventory);
                                    ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.ReturnInInventory);

                                    string str = string.Format("{0}-{1}-{2}",
                                        arrofdocs[0].DocId,
                                        arrofdocs[0].Text2,
                                        arrofdocs[0].Text1);



                                    DialogResult dr = DialogFrm.ShowMessage(
                                      row.NavCode + " " + row.ProductName
                                    , "Этот товар участвует в возврате"
                                    , str
                                    , "Режим инвентаризации");
                                }
                                else
                                {
                                    inventRow.NavCode = row.NavCode;
                                    ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.InventoryGlobal,
                                        row,
                                        inventRow
                                        );
                                }

                            }

                            //this.Refresh();
                            //ActionsClass.Action.InventoryGlobalActionProc(
                            //    row,
                            //    inventRow);


                        }
                        else
                        {//BoxScan
                            //_mode == WorkMode.BoxScan
                            try
                            {
                                ProductsDataSet.DocsTblRow docRow =
                                    ActionsClass.Action.GetDataByNavcodeDocIdAndType(row.NavCode,
                                        inventRow.DocId,
                                        (byte)TSDUtils.ActionCode.BoxWProducts
                                    );
                                if (docRow != null)
                                {
                                    //
                                    //  ScannedProductsDataSet.ScannedBarcodesRow srows
                                    //    = ActionsClass.Action.FindByBarcodeDocTypeDocId(row.Barcode.ToString(),
                                    //    (byte)TSDUtils.ActionCode.BoxWProducts,
                                    //    inventRow.DocId
                                    //    );

                                    ScannedProductsDataSet.ScannedBarcodesRow[] rowsS
                                        = ActionsClass.Action.FindByDocIdAndDocType(inventRow.DocId,
                                        (byte)TSDUtils.ActionCode.BoxWProducts);

                                    int fQty = 0;
                                    for (int i = 0; i < rowsS.Length; i++)
                                    {
                                        if (rowsS[i].Barcode == currentProductRow.Barcode)
                                            fQty += rowsS[i].FactQuantity;
                                    }

                                    if (rowsS.Length > 0)
                                    {
                                        if (docRow.Quantity < (fQty + quantityKoeff))
                                        {
                                            ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);
                                            ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.AlreadyAccepted);


                                            //using (DialogForm dlgfrm =
                                            //new DialogForm(
                                            DialogResult dr = DialogFrm.ShowMessage(
                                        string.Format("Товар уже принят {0} из {1}",
                                        fQty,
                                        docRow.Quantity)
                                        , string.Format("Принять еще {0} шт", quantityKoeff)//string.Format("Посчитано: {0} кодов", totalBk)
                                        , row.ProductName
                                        , "Прием товара");//)
                                            // {
                                            if (dr == DialogResult.Yes)
                                            {
                                                //inventRow.NavCode = row.NavCode;
                                                ActionsClass.Action.BoxWProductsActionProc(
                                                    row,
                                                    docRow,
                                                    quantityKoeff
                                                    );
                                                return;//приняли
                                            }
                                            else //не хотим принимать
                                                return;
                                            //}
                                        }
                                    }
                                    //если не сработали условия - то принимаем
                                    //inventRow.NavCode = row.NavCode;
                                    ActionsClass.Action.BoxWProductsActionProc(
                                                         row,
                                                         docRow,
                                                         quantityKoeff
                                                         );
                                    //ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.BoxWProducts,
                                    //    row,
                                    //    docRow
                                    //    );


                                }
                                else
                                {
                                    ActionsClass.Action.PlaySoundAsync((byte)TSDUtils.ActionCode.StrangeBox);
                                    ActionsClass.Action.PlayVibroAsync((byte)TSDUtils.ActionCode.StrangeBox);

                                    //using (DialogForm dlgfrm =
                                    //new DialogForm(
                                    DialogResult dr = DialogFrm.ShowMessage(
                                        "Товар не входит в короб!"
                                        , string.Format("Принять этот товар {0}", row.Barcode)//string.Format("Посчитано: {0} кодов", totalBk)
                                        , row.ProductName
                                        , "Прием товара");//)
                                    //{
                                    if (dr == DialogResult.Yes)
                                    {
                                        inventRow.NavCode = row.NavCode;
                                        ActionsClass.Action.BoxWProductsActionProc(
                                                    row,
                                                    inventRow,
                                                    quantityKoeff
                                                    );
                                        return;
                                    }
                                    //}

                                }
                            }
                            finally
                            {
                                quantityLabel.Visible = false;
                                quantityKoeff = 1;
                            }
                            //this.Refresh();

                        }
                        
                    }*/

#endregion 

                }
                else
                {
                    currentdocRows = null;
                    currentProductRow = null;
                    ActionsClass.Action.InvokeAction(TSDUtils.ActionCode.NotFound, null, null);
                    label5.Text = "...Товар не ";
                    label6.Text = "   найден...";
                    label17.Text = "";
                    //NativeClass.Play("ding.wav");
                }
            }
            finally
            {
                navCodeTB.SelectAll();
                this.Refresh();
            }
        }