Пример #1
0
        private void txtOuterScan_Leave(object sender, System.EventArgs e)
        {
            string       scan = txtOuterScan.Text;
            BarcodeUtil2 gdu  = new BarcodeUtil2();

            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);
            Dictionary <string, string> BarcodeDecodeDictionary;

            BarcodeDecodeDictionary = gdu.decodeBarcodeGS1Pharma(scan);
            string pstring;

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

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

            txtInnerscan.Focus();
        }
Пример #2
0
 private void ParseBarcode(string pBarCode)
 {
     // pBarCode = RPI.BarCode;
     if (pBarCode.Length > 21)
     // Assume it is a 2d barcode
     {
         BarcodeUtil2 gs1 = new BarcodeUtil2();
         Dictionary <String, String> DGS1;
         DGS1 = gs1.decodeBarcodeGS1Pharma(pBarCode);
         string gtin         = DGS1["01"];
         string expirationdt = DGS1["17"];
         string lot          = "";
         DGS1.TryGetValue("10", out lot);
         string SerialNumber = "";
         DGS1.TryGetValue("21", out SerialNumber);
         RPI.Lot = lot;
         // RPI.SerialNumber = SerialNumber;
         RPI.ItemNumber = gtin.Substring(3, 10);
         //the day could be 00
         if (expirationdt.Substring(4, 2) == "00")
         {
             expirationdt = expirationdt.Substring(0, 4) + "28";
         }
         RPI.ExpireDate = DateTime.ParseExact(expirationdt, "yyMMdd", CultureInfo.InvariantCulture);
         RPI.Save();
     }
 }
Пример #3
0
        private void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e)
        {
            if (e.PropertyName.ToUpper() == "SCAN")
            {
                if (e.NewValue.ToString().Length > 12)
                {
                    // Might be a valid 2d barcode
                    string scan = e.NewValue.ToString();
                    //BarcodeUtil2 gdu = new BarcodeUtil2();
                    if (scan.ToString() == string.Empty)
                    {
                        return;
                    }
                    if (scan.Length < 30)
                    {
                        string message = "You did not scan a GS1 2d barcode.";
                        string caption = "Error Detected in Input";
                    }

                    Dictionary <string, string> ScanDecodeDictionary;
                    ScanDecodeDictionary = gdu.decodeBarcodeGS1Pharma(scan);
                    int rtn = LoadScan(ScanDecodeDictionary, e);
                }
                else
                {
                }
            }
        }
Пример #4
0
        /// <summary>
        ///Scanning will cause this to trigger
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtBarcode_Leave(object sender, System.EventArgs e)
        {
            string       scan = txtBarcode.Text;
            BarcodeUtil2 gdu  = new BarcodeUtil2();

            if (scan.ToString() == string.Empty)
            {
                return;
            }
            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);
                txtBarcode.Text = string.Empty;
                txtBarcode.Focus();

                txtBarcode.Clear();
                return;
            }

            Dictionary <string, string> BarcodeDecodeDictionary;

            BarcodeDecodeDictionary = gdu.decodeBarcodeGS1Pharma(scan);

            string pstring;

            BarcodeDecodeDictionary.TryGetValue("01", out pstring);

            txtItemNumber.Text = pstring;


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

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

            BarcodeDecodeDictionary.TryGetValue("21", out pstring);
            txtSerialNumber.Text = pstring;

            if (FindBarcodeInlist(scan) < 1)
            {
                string[] row = new string[] { txtItemNumber.Text, gdu.GtinToNDC(txtItemNumber.Text), txtSerialNumber.Text, txtExpDt.Text, txtLot.Text, scan };
                RecordgridList.Rows.Add(row);



                this.addItemSummary(gdu.GtinToNDC(txtItemNumber.Text), txtLot.Text, txtExpDt.Text, 1);
            }

            txtBarcode.Focus();
            txtBarcode.Clear();
        }
Пример #5
0
        protected override void OnChanged(string propertyName, object oldValue, object newValue)
        {
            if (IsLoading)
            {
                return;
            }
            //    if (classInfo == null) return;
            if (propertyName == "LastBarcodescan" && newValue.ToString().Length > 15)
            {
                BarcodeUtil2 gs1 = new BarcodeUtil2();
                Dictionary <String, String> DGS1;

                DGS1 = gs1.decodeBarcodeGS1Pharma(newValue.ToString());

                string gtin         = DGS1["01"];
                string expirationdt = DGS1["17"];
                string lot          = "";
                DGS1.TryGetValue("10", out lot);
                string SerialNumber = "";
                DGS1.TryGetValue("21", out SerialNumber);

                ReceiverPackageItems Ritem = new ReceiverPackageItems(Session);
                Ritem.BarCode = newValue.ToString();
                Ritem.Lot     = lot;
                // Ritem.SerialNumber = SerialNumber;
                Ritem.ItemNumber = gtin.Substring(3, 10);
                //the day could be 00
                if (expirationdt.Substring(4, 2) == "00")
                {
                    expirationdt = expirationdt.Substring(0, 4) + "28";
                }

                Ritem.ReceiverPackageId = this;

                Ritem.ExpireDate = DateTime.ParseExact(expirationdt, "yyMMdd", CultureInfo.InvariantCulture);
                Ritem.Save();



                int x = 1;
            }

            base.OnChanged(propertyName, oldValue, newValue);
        }
Пример #6
0
        private void txtInnerscan_Leave(object sender, System.EventArgs e)
        {
            string scan = txtInnerscan.Text;

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

            //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();
            }

            Dictionary <string, string> BarcodeDecodeDictionary;

            BarcodeDecodeDictionary = gdu.decodeBarcodeGS1Pharma(scan);
            //
            //gdu.GS1DataConvert(scan);

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

            BarcodeDecodeDictionary.TryGetValue("01", out pgtin);
            BarcodeDecodeDictionary.TryGetValue("17", out pexpdate);
            BarcodeDecodeDictionary.TryGetValue("10", out plot);
            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++;
        }
Пример #7
0
        private void ObjectToShow_LastScanChangedEvent(object sender, string Scan)
        {
            string       itemnumber;
            string       lot;
            string       expdate;
            string       serialnumber;
            string       scan = Scan;
            BarcodeUtil2 gdu  = new BarcodeUtil2();

            if (scan.ToString() == string.Empty)
            {
                return;
            }
            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);



                //  txtBarcode.Text = string.Empty;
                //  txtBarcode.Focus();

                //  txtBarcode.Clear();
                return;
            }
            Dictionary <string, string> BarcodeDecodeDictionary;

            BarcodeDecodeDictionary = gdu.decodeBarcodeGS1Pharma(scan);


            string pstring;

            BarcodeDecodeDictionary.TryGetValue("01", out pstring);

            itemnumber = pstring;


            BarcodeDecodeDictionary.TryGetValue("17", out pstring);
            expdate = pstring;

            BarcodeDecodeDictionary.TryGetValue("10", out pstring);
            lot = pstring;

            BarcodeDecodeDictionary.TryGetValue("21", out pstring);
            serialnumber = pstring;
            int ret = 1;

            if (serialnumber != null)
            {
                ret = AddToSerialNumber(itemnumber, lot, serialnumber, expdate, scan);
            }


            if (ret > 0)
            {
                ret = AddToItems(sender, itemnumber, lot, expdate, scan);
            }

            this.View.Refresh();
            this.View.ObjectSpace.ReloadObject(sender);


            PropertyEditor editor = ((DetailView)createdView).FindItem("LastScan") as PropertyEditor;

            if (editor != null)
            {
                // IIB.LastScan = string.Empty;
                (editor.Control as Control).Focus();
                (editor.Control as Control).Select();
                (editor.Control as Control).ResetText();
            }



            // ret = AddToSerialNumber(itemnumber, lot, serialnumber, expdate, scan);

            //  txtBarcode.Focus();
            //  txtBarcode.Clear();
        }