public Barcode(string data, TYPE iType) { this.RawData = data; this.Encoded_Type = iType; switch (iType) { case TYPE.EAN13: ibarcode = new EAN13(data); country = ((EAN_UPCBase)ibarcode).Country; break; case TYPE.EAN8: ibarcode = new EAN8(data); country = ((EAN_UPCBase)ibarcode).Country; break; case TYPE.UPCA: ibarcode = new UPCA(data); break; case TYPE.UPCE: ibarcode = new UPCE(data); break; case TYPE.Interleaved2of5: ibarcode = new Interleaved2of5(data); break; case TYPE.ITF14: ibarcode = new ITF14(data); break; case TYPE.CODE128A: ibarcode = new Code128(data, CharSet.A); break; case TYPE.CODE128B: ibarcode = new Code128(data, CharSet.B); break; case TYPE.CODE128C: ibarcode = new Code128(data, CharSet.C); break; case TYPE.CODE128: ibarcode = new Code128(data, CharSet.Auto); break; case TYPE.GS1_128: ibarcode = new GS1_128(data); break; } RawData = ibarcode.RawData; EncodeValue = ibarcode.GetEncode(); SetFontSize(RawData); }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { //Box Information String BoxNumber = Global.BoxNumberScanned; EBoxNumber = Global.BoxNumberScanned; //Package Information String ShippingNumber = Global.ShippingNumber; //Shipping information cstShippingTbl shippingTbl = Global.controller.GetShippingTbl(ShippingNumber); List <cstPackageDetails> _packingDetails = Global.controller.GetPackingDetailTbl(BoxNumber); model_Shipment _shipment = Global.controller.getModelShipment(ShippingNumber); string upccode = Global.controller.SKUnameToUPCCode(_packingDetails[Global.counter].SKUNumber); //String UPC_Code = _shipment.ShipmentDetailSage.SingleOrDefault(i => i.SKU == item.UPCCode).UPCCode; txtaddress.Text = shippingTbl.ToAddressLine1 + shippingTbl.ToAddressLine2 + shippingTbl.ToAddressLine3 + shippingTbl.ToAddressCity + shippingTbl.ToAddressState + shippingTbl.ToAddressCountry + shippingTbl.ToAddressZipCode; txtponumber.Text = shippingTbl.CustomerPO; // txtvendorname.Text = shippingTbl.VendorName; txtWH.Text = Global.WH; txtupc.Text = upccode; txtQty.Text = _packingDetails[Global.counter].SKUQuantity.ToString(); txtPartNumber.Text = _packingDetails[Global.counter].SKUNumber.ToString(); txtCarton.Text = GetCarton(BoxNumber); txtBoxNumber.Text = GetBox(BoxNumber); UPCA upca = new UPCA(); if (this.txtupc.Text.Length == 12) { this.txtupc.Text = this.txtupc.Text.Substring(0, 11) + upca.GetCheckSum(this.txtupc.Text).ToString(); System.Drawing.Image img; img = upca.CreateBarCode(this.txtupc.Text, 3); var imges = new System.Drawing.Bitmap(img); var newimag = Imaging.CreateBitmapSourceFromHBitmap(imges.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); image.Source = newimag; } else { this.image.Source = null; } }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { BarcodeLib.Barcode b = new BarcodeLib.Barcode(); _lsInfoSlip = clGlobal.lsSlipInfo; string SRnumber = _lsInfoSlip[0].SRNumber; string SKUName = _lsInfoSlip[0].ProductName; string productname = _lsInfoSlip[0].EANCode; DateTime ReceivedDate = _lsInfoSlip[0].ReceivedDate; DateTime Expiration = _lsInfoSlip[0].Expiration; string UserName = _lsInfoSlip[0].ReceivedBY; string RMAStatusReal = "N/A"; String RMAStatus = _lsInfoSlip[0].RMAStatus; //if (Views.clGlobal.ScenarioType == "HomeDepot") //{ if (RMAStatus == "0") { RMAStatusReal = "Incomplete"; } else if (RMAStatus == "1") { RMAStatusReal = "Complete"; //"Rejected"; } else if (RMAStatus == "2") { RMAStatusReal = "Wrong RMA"; //"Rejected"; } //} //if (Views.clGlobal.ScenarioType == "Lowes") //{ // RMAStatusReal = "Accepted"; //} //if (Views.clGlobal.ScenarioType == "Others") //{ // if (Views.clGlobal.Warranty == "1") // { // RMAStatusReal = "Accepted"; // } // else if (Views.clGlobal.Warranty == "0") // { // RMAStatusReal = "N/A"; //"Rejected"; // } //} string ItemStatus = _lsInfoSlip[0].ItemStatus; string Reason = "N/A"; if (_lsInfoSlip[0].Reason != "") { Reason = _lsInfoSlip[0].Reason; } var sBoxNumber = b.Encode(BarcodeLib.TYPE.CODE128, SRnumber, System.Drawing.Color.Black, System.Drawing.Color.Transparent, 1500, 550); // var sproductname = b.Encode(BarcodeLib.TYPE.UPCA, productname, System.Drawing.Color.Black, System.Drawing.Color.Transparent, 2000, 500); txtTextToAdd.Text = _lsInfoSlip[0].EANCode; if (_lsInfoSlip[0].EANCode == "" || _lsInfoSlip[0].EANCode == "N/A") { txtTextToAdd.Text = "000000000000"; SKUName = "*[UPC Code Not Found] " + SKUName; } UPCA upca = new UPCA(); if (this.txtTextToAdd.Text.Length == 12) { this.txtTextToAdd.Text = this.txtTextToAdd.Text.Substring(0, 11) + upca.GetCheckSum(this.txtTextToAdd.Text).ToString(); System.Drawing.Image img; img = upca.CreateBarCode(this.txtTextToAdd.Text, 3); //this.image.Left = System.Convert.ToInt32((this.image.Width / 2) - (img.Width / 2)); var imges = new System.Drawing.Bitmap(img); var newimag = Imaging.CreateBitmapSourceFromHBitmap(imges.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); image.Source = newimag; //this.pctBarCode.Image = img; this.txtTextToAdd.SelectAll(); } else { this.image.Source = null; } var bitmapBox = new System.Drawing.Bitmap(sBoxNumber); // var pbitmapBox = new System.Drawing.Bitmap(sproductname); var bBoxSource = Imaging.CreateBitmapSourceFromHBitmap(bitmapBox.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); // var pproduct = Imaging.CreateBitmapSourceFromHBitmap(pbitmapBox.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); bitmapBox.Dispose(); imageBarcode.Source = bBoxSource; // image.Source = pproduct; txtExpiration.Text = Expiration.ToString("MMM dd, yyyy"); txtReceivedDate.Text = ReceivedDate.ToString("MMM dd, yyyy"); txtReceived.Text = UserName; txtReason.Text = Reason; txtSRNumber.Text = SRnumber; txtproductName.Text = SKUName; txtRMAStatus.Text = RMAStatusReal; txtItemStatus.Text = ItemStatus; // txtEANcode.Text = _lsInfoSlip[0].EANCode; }
public override char CalcCheckChar(char[] acText, int cc) { return(UPCA.s_CalcCheckChar(acText, cc)); }
public override CharDef CalcCharDef(CharDef[][] aaABC, byte[] aCharsetSel, char[] text, int ind) { return(UPCA.s_CalcCharDef(aaABC, aCharsetSel, text, ind)); }
}//Encode() /// <summary> /// Encodes the raw data into binary form representing bars and spaces. /// </summary> internal Image Encode() { DateTime dtStartTime = DateTime.Now; //make sure there is something to encode if (Raw_Data.Trim() == "") { throw new System.Exception("EENCODE-1: Input data not allowed to be blank."); } if (this.EncodedType == EncodingType.UNSPECIFIED) { throw new System.Exception("EENCODE-2: Symbology type not allowed to be unspecified."); } this.Encoded_Value = ""; this._Country_Assigning_Manufacturer_Code = "N/A"; IBarcode ibarcode; switch (this.Encoded_Type) { case EncodingType.UCC12: case EncodingType.UPCA: //Encode_UPCA(); ibarcode = new UPCA(Raw_Data); break; case EncodingType.UCC13: case EncodingType.EAN13: //Encode_EAN13(); ibarcode = new EAN13(Raw_Data); break; case EncodingType.Interleaved2of5: //Encode_Interleaved2of5(); ibarcode = new Interleaved2of5(Raw_Data); break; case EncodingType.Industrial2of5: case EncodingType.Standard2of5: //Encode_Standard2of5(); ibarcode = new Standard2of5(Raw_Data); break; case EncodingType.LOGMARS: case EncodingType.CODE39: //Encode_Code39(); ibarcode = new Code39(Raw_Data); break; case EncodingType.CODE39Extended: ibarcode = new Code39(Raw_Data, true); break; case EncodingType.Codabar: //Encode_Codabar(); ibarcode = new Codabar(Raw_Data); break; case EncodingType.PostNet: //Encode_PostNet(); ibarcode = new Postnet(Raw_Data); break; case EncodingType.ISBN: case EncodingType.BOOKLAND: //Encode_ISBN_Bookland(); ibarcode = new ISBN(Raw_Data); break; case EncodingType.JAN13: //Encode_JAN13(); ibarcode = new JAN13(Raw_Data); break; case EncodingType.UPC_SUPPLEMENTAL_2DIGIT: //Encode_UPCSupplemental_2(); ibarcode = new UPCSupplement2(Raw_Data); break; case EncodingType.MSI_Mod10: case EncodingType.MSI_2Mod10: case EncodingType.MSI_Mod11: case EncodingType.MSI_Mod11_Mod10: case EncodingType.Modified_Plessey: //Encode_MSI(); ibarcode = new MSI(Raw_Data, Encoded_Type); break; case EncodingType.UPC_SUPPLEMENTAL_5DIGIT: //Encode_UPCSupplemental_5(); ibarcode = new UPCSupplement5(Raw_Data); break; case EncodingType.UPCE: //Encode_UPCE(); ibarcode = new UPCE(Raw_Data); break; case EncodingType.EAN8: //Encode_EAN8(); ibarcode = new EAN8(Raw_Data); break; case EncodingType.USD8: case EncodingType.CODE11: //Encode_Code11(); ibarcode = new Code11(Raw_Data); break; case EncodingType.CODE128: //Encode_Code128(); ibarcode = new Code128(Raw_Data); break; case EncodingType.CODE128A: ibarcode = new Code128(Raw_Data, Code128.TYPES.A); break; case EncodingType.CODE128B: ibarcode = new Code128(Raw_Data, Code128.TYPES.B); break; case EncodingType.CODE128C: ibarcode = new Code128(Raw_Data, Code128.TYPES.C); break; case EncodingType.ITF14: ibarcode = new ITF14(Raw_Data); break; case EncodingType.CODE93: ibarcode = new Code93(Raw_Data); break; default: throw new System.Exception("EENCODE-2: Unsupported encoding type specified."); }//switch this.Encoded_Value = ibarcode.Encoded_Value; this.Raw_Data = ibarcode.RawData; this.Formatted_Data = ibarcode.FormattedData; this._EncodingTime = ((TimeSpan)(DateTime.Now - dtStartTime)).TotalMilliseconds; _Encoded_Image = (Image)Generate_Image(); _XML = GetXML(); return(EncodedImage); }//Encode
private void btnImprimirCodigoBarras_Click(object sender, System.EventArgs e) { CodigoBarras codigoBarras; switch (cboCodigoBarras.SelectedIndex) { case 0: codigoBarras = new EAN8(); break; case 1: codigoBarras = new EAN13();break; case 2: codigoBarras = new CODABAR();break; case 3: codigoBarras = new CODE39();break; case 4: codigoBarras = new CODE93();break; case 5: codigoBarras = new CODE128();break; case 6: codigoBarras = new ISBN();break; case 7: codigoBarras = new ITF();break; case 8: codigoBarras = new MSI();break; case 9: codigoBarras = new PDF417();break; case 10: codigoBarras = new PLESSEY();break; case 11: codigoBarras = new UPCA();break; case 12: codigoBarras = new UPCE();break; default: codigoBarras = new EAN13();break; } codigoBarras.Codigo = txtCodigoBarras.Text; // fonte if (rbtFonteNormal.Checked) { codigoBarras.Fonte = CodigoBarras.FonteLegenda.Normal; } else { codigoBarras.Fonte = CodigoBarras.FonteLegenda.Condensada; } // largura das barras if (rbtFina.Checked) { codigoBarras.Largura = CodigoBarras.LarguraBarra.Fina; } else if(rbtMedia.Checked) { codigoBarras.Largura = CodigoBarras.LarguraBarra.Media; } else { codigoBarras.Largura = CodigoBarras.LarguraBarra.Grossa; } // posicao legenda if (rbtCaracteresAbaixoCodigo.Checked) { codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Abaixo; } else if(rbtCaracteresAcimaCodigo.Checked) { codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Acima; } else if(rbtCaracteresAcimaAbaixoCodigo.Checked) { codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.AcimaAbaixo; } else { codigoBarras.Posicao = CodigoBarras.PosicaoLegenda.Nenhuma; } try { miniPrinter.Imprimir(codigoBarras); } catch (BematechException erro) { MessageBox.Show(erro.Message, "TestMiniPrinter", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private static string GetSymbology(string Data, Enums.Type EncodingType) { ISymbology SymbologyUsing = null; switch (EncodingType) { case Enums.Type.UCC12: case Enums.Type.UPCA: SymbologyUsing = new UPCA(Data); break; case Enums.Type.UCC13: case Enums.Type.EAN13: SymbologyUsing = new EAN13(Data); break; case Enums.Type.Interleaved2of5: SymbologyUsing = new Interleaved2of5(Data); break; case Enums.Type.Industrial2of5: case Enums.Type.Standard2of5: SymbologyUsing = new Standard2of5(Data); break; case Enums.Type.LOGMARS: case Enums.Type.CODE39: SymbologyUsing = new Code39(Data); break; case Enums.Type.CODE39Extended: SymbologyUsing = new Code39(Data); break; case Enums.Type.Codabar: SymbologyUsing = new Codabar(Data); break; case Enums.Type.PostNet: SymbologyUsing = new Postnet(Data); break; case Enums.Type.ISBN: case Enums.Type.BOOKLAND: SymbologyUsing = new ISBN(Data); break; case Enums.Type.JAN13: SymbologyUsing = new JAN13(Data); break; case Enums.Type.UPC_SUPPLEMENTAL_2DIGIT: SymbologyUsing = new UPCSupplement2(Data); break; case Enums.Type.MSI_Mod10: case Enums.Type.MSI_2Mod10: case Enums.Type.MSI_Mod11: case Enums.Type.MSI_Mod11_Mod10: case Enums.Type.Modified_Plessey: SymbologyUsing = new MSI(Data); break; case Enums.Type.UPC_SUPPLEMENTAL_5DIGIT: SymbologyUsing = new UPCSupplement5(Data); break; case Enums.Type.UPCE: SymbologyUsing = new UPCE(Data); break; case Enums.Type.EAN8: SymbologyUsing = new EAN8(Data); break; case Enums.Type.USD8: case Enums.Type.CODE11: SymbologyUsing = new Code11(Data); break; case Enums.Type.CODE128: SymbologyUsing = new Code128(Data); break; case Enums.Type.CODE128A: SymbologyUsing = new Code128A(Data); break; case Enums.Type.CODE128B: SymbologyUsing = new Code128B(Data); break; case Enums.Type.CODE128C: SymbologyUsing = new Code128C(Data); break; case Enums.Type.ITF14: SymbologyUsing = new ITF14(Data); break; case Enums.Type.CODE93: SymbologyUsing = new Code93(Data); break; case Enums.Type.TELEPEN: SymbologyUsing = new Telepen(Data); break; } return(SymbologyUsing.Encode()); }
public static char s_CalcCheckChar(char[] acText, int cc) { int num; char[] chArray = new char[11]; for (num = 0; num < 11; num++) { chArray[num] = '0'; } char ch = acText[6]; switch (ch) { case '0': case '1': case '2': num = 0; while (num < 3) { chArray[num] = acText[num]; num++; } chArray[3] = ch; for (num = 0; num < 3; num++) { chArray[num + 8] = acText[num + 3]; } break; case '3': num = 0; while (num < 4) { chArray[num] = acText[num]; num++; } for (num = 0; num < 2; num++) { chArray[num + 9] = acText[num + 4]; } break; case '4': for (num = 0; num < 5; num++) { chArray[num] = acText[num]; } chArray[10] = acText[5]; break; case '5': case '6': case '7': case '8': case '9': for (num = 0; num < 6; num++) { chArray[num] = acText[num]; } chArray[10] = ch; break; } return(UPCA.s_CalcCheckChar(chArray, 11)); }