示例#1
0
        private void txtOuterScan_Leave(object sender, System.EventArgs e)
        {
            string      scan = txtOuterScan.Text;
            GS1DataUtil gdu  = new GS1DataUtil();

            if (scan.Length < 30)
            {
                string            message = "You did not scan a GS1 2d barcode.";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result            = MessageBox.Show(message, caption, buttons);
                txtOuterScan.Text = string.Empty;

                txtOuterScan.Focus();
                return;
            }
            gdu.GS1DataConvert(scan);

            string pstring;

            gdu.BarcodeDecodeDictionary.TryGetValue("01", out pstring);
            txtGTIN.Text = pstring;
            gdu.BarcodeDecodeDictionary.TryGetValue("17", out pstring);
            txtExpDt.Text = pstring;

            gdu.BarcodeDecodeDictionary.TryGetValue("10", out pstring);
            txtLot.Text = pstring;
            gdu.BarcodeDecodeDictionary.TryGetValue("21", out pstring);
            txtSerial.Text = pstring;

            txtInnerscan.Focus();
        }
示例#2
0
        private void txtInnerscan_Leave(object sender, System.EventArgs e)
        {
            string scan = txtInnerscan.Text;

            if (scan == string.Empty)
            {
                return;
            }
            GS1DataUtil gdu = new GS1DataUtil();

            if (scan.Length < 30)
            {
                string            message = "You did not scan a GS1 2d barcode.";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result            = MessageBox.Show(message, caption, buttons);
                txtInnerscan.Text = string.Empty;
                txtInnerscan.Focus();
            }
            gdu.GS1DataConvert(scan);

            string pgtin;
            string pexpdate;
            string plot;
            string pserial;

            gdu.BarcodeDecodeDictionary.TryGetValue("01", out pgtin);
            gdu.BarcodeDecodeDictionary.TryGetValue("17", out pexpdate);
            gdu.BarcodeDecodeDictionary.TryGetValue("10", out plot);
            gdu.BarcodeDecodeDictionary.TryGetValue("21", out pserial);
            if (plot != txtLot.Text)
            {
                string            message = "Inner Lot does not match Outer Lot.";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result            = MessageBox.Show(message, caption, buttons);
                txtInnerscan.Text = string.Empty;
                txtInnerscan.Focus();
                return;
            }

            if (INBCList.Exists(x => x.serial == pserial))
            {
                string            message = string.Format("Duplicate Serial Number {0} found.", pserial);
                string            caption = "Error Duplicate Scan";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result            = MessageBox.Show(message, caption, buttons);
                txtInnerscan.Text = string.Empty;
                txtInnerscan.Focus();
                return;
            }

            INBCList.Add(new InnerBarcode(pgtin, plot, pserial, pexpdate));
            txtInnerscan.Text = string.Empty;
            txtInnerscan.Focus();
            lbInnerscanns.Items.Add(pgtin + ", " + plot + ", " + pserial);
            innercount++;
        }