示例#1
0
        internal void UpdateBarcode(string text, string productCode, string barcode)
        {
            if (!ScanManagerView.InitCigaretteScanInfoStack())
            {
                return;
            }
            ProductDal productDal = new ProductDal();

            if (barcode != string.Empty && productDal.Exist(barcode))
            {
                return;
            }
            DataTable table = productDal.FindProduct(productCode);

            if (table.Rows.Count > 0)
            {
                UpdateBarcodeDialog updateBarcodeDialog = new UpdateBarcodeDialog(CigaretteScanInfoStack.Values.ToArray());
                updateBarcodeDialog.setInformation(text, barcode);
                if (updateBarcodeDialog.ShowDialog() == DialogResult.OK)
                {
                    if (updateBarcodeDialog.IsPass && updateBarcodeDialog.Barcode.Length == 6)
                    {
                        productCode = updateBarcodeDialog.SelectedCigaretteCode;
                        barcode     = updateBarcodeDialog.Barcode;
                        productDal.UpdateBarcode(productCode, barcode);
                        CigaretteScanInfoStack[productCode].Barcode = barcode;
                        AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack);
                    }
                    else
                    {
                        XtraMessageBox.Show("验证码错误,或者条码格式不对!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }