Beispiel #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();
        }
Beispiel #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();
     }
 }
        /// <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();
        }
Beispiel #4
0
        private void IIB_LastScanChangedEvent(object sender, string e)
        {
            ItemInventoryBatch iib = (ItemInventoryBatch)sender;

            if (e == string.Empty)
            {
                return;
            }

            scancount++;
            string         scan = e;
            PropertyEditor editor;
            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;
                Application.ShowViewStrategy.ShowMessage(message);

                editor = ((DetailView)View).FindItem("LastScan") as PropertyEditor;
                if (editor != null)
                {
                    (editor.Control as Control).Focus();
                }


                return;
            }
            if (iib.Oid == -1)
            {
                iib.Save();
            }



            AddToItem(iib, e);
            AddToItemSerial(iib, e);

            // now set the focus back to LastScan and empty out values
            editor = ((DetailView)View).FindItem("LastScan") as PropertyEditor;
            if (editor != null)
            {
                IIB.LastScan = string.Empty;


                (editor.Control as Control).Focus();
            }
        }
        private void txtOuterScan_Leave(object sender, System.EventArgs e)
        {
            string scan = txtOuterScan.Text;
            // GS1DataUtil gdu = new GS1DataUtil();
            BarcodeUtil2 gdu = new BarcodeUtil2();

            if (scan.Length != 20)
            {
                string            message = "Scan Length wrong";
                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;
            }

            string pstring;

            pstring      = scan.Substring(2);
            txtSSCC.Text = pstring;
            string s = scan.Substring(2, 1);

            this.txtSerial.Text = s + scan.Substring(10, scan.Length - 11);

            IObjectSpace objectSpace = this.application.CreateObjectSpace();

            CriteriaOperator  op         = CriteriaOperator.Parse("SerialNo = ? ", txtSerial.Text);
            RepackLotSerialNo lsnOutside = objectSpace.FindObject <RepackLotSerialNo>(op);

            if (lsnOutside == null)
            {
                return;
            }
            this.txtLot.Text     = lsnOutside.RepackLot.LotId;
            this.txtExpDt.Text   = lsnOutside.RepackLot.LotExpirationDt.ToString();
            this.TxtContent.Text = lsnOutside.RepackLot.RepackItem.Gtin;
            //gdu.BarcodeDecodeDictionary.TryGetValue("01", out pstring);
            //txtSSCC.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();
        }
Beispiel #6
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);
        }
        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++;
        }
Beispiel #8
0
 public ShippingController()
 {
     InitializeComponent();
     gdu = new BarcodeUtil2();
     // Target required Views (via the TargetXXX properties) and create their Actions.
 }
        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();
        }