コード例 #1
0
        private void ImprimirEtiqueta(string shipTo, string caja)
        {
            var info = InfoShippingBusiness.GetInfoShipping(shipTo);

            if (info != null && impresora != "")
            {
                zebraInstructions = new StringBuilder();
                zebraInstructions.Append("^XA");

                zebraInstructions.Append("^FT413,153^A0N,39,38^FH\\^FDCountry:^FS");
                zebraInstructions.Append("^FT572,153^A0N,39,38^FH\\^FD" + info.country + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT21,371^A0N,39,38^FH\\^FDState:^FS");
                zebraInstructions.Append("^FT192,367^A0N,28,28^FH\\^FD" + info.state + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT21,270^A0N,39,38^FH\\^FDCity:^FS");
                zebraInstructions.Append("^FT167,263^A0N,25,24^FH\\^FD" + info.city + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT21,219^A0N,39,38^FH\\^FDAddress:^FS");
                zebraInstructions.Append("^FT165,213^A0N,25,24^FH\\^FD" + info.address + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT23,420^A0N,39,38^FH\\^FDClient:^FS");
                zebraInstructions.Append("^FT175,420^A0N,39,30^FH\\^FD" + info.client + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT23,465^A0N,39,38^FH\\^FDContact:^FS");
                zebraInstructions.Append("^FT175,465^A0N,39,38^FH\\^FD" + info.contact + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT22,153^A0N,39,38^FH\\^FDShip To:^FS");
                zebraInstructions.Append("^^FT184,153^A0N,39,38^FH\\^FD" + info.shipTo + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT195,66^A0N,39,38^FH\\^FDBOXID:^FS" + Environment.NewLine);
                zebraInstructions.Append("^BY3,3,56^FT327,76^BCN,,Y,N");
                zebraInstructions.Append("^FD>:" + caja + "^FS" + Environment.NewLine);

                //Codigo QR
                zebraInstructions.Append("^FT687,112^BQN,2,4" + Environment.NewLine);
                zebraInstructions.Append(@"^FH\^FDLA" + caja + "^FS");

                zebraInstructions.Append("^FT21,320^A0N,39,38^FH\\^FDZip Code:^FS");
                zebraInstructions.Append("^FT192,316^A0N,28,28^FH\\^FD" + info.zipcode + "^FS" + Environment.NewLine);

                zebraInstructions.Append("^FT23,506^A0N,39,38^FH\\^FDEmail:^FS");
                zebraInstructions.Append("^FT175,505^A0N,39,38^FH\\^FD" + info.email + "^FS" + Environment.NewLine);
                zebraInstructions.Append("^PQ1,0,1,Y^XZ");

                string selectedPrinterName = impresora;
                var    z = new ZebraPrinter(selectedPrinterName);
                z.Print(zebraInstructions.ToString());
                z.Print(zebraInstructions.ToString());
            }
        }
コード例 #2
0
        public PrintingList(DataTable itemList, String printerName)
        {
            this.printerName = printerName;
            DataRow item  = itemList.Rows[0];
            int     i     = 0;
            int     count = 0;

            BarcodeLabel label;
            var          printer = new ZebraPrinter(printerName);

            do
            {
                label = null;
                count = Int32.Parse(item[5].ToString());
                label = new BarcodeLabel()
                {
                    Barcode      = item[4].ToString(),
                    ItemId       = item[1].ToString(),
                    Description  = item[3].ToString(),
                    Currency     = item[8].ToString(),
                    PriceWithTax = Decimal.Parse(item[9].ToString()),
                    Count        = Int32.Parse(item[5].ToString()),
                    PackingDate  = item[10].ToString(),
                    ExpairyDate  = item[11].ToString(),
                    NeedMasing   = (bool)item[12]
                };
                if (label != null)
                {
                    try
                    {
                        string       tempLog = string.Format("{0:dd MMM yyyy HH:mm:ss}{1}", DateTime.Now, label.ELN);
                        const string file    = "log.txt";
                        using (StreamWriter w = File.AppendText(file))
                        {
                            w.WriteLine(tempLog);
                        }
                    }
                    catch (Exception)
                    {
                        Debug.Assert(true, "Loging error");
                    }
                    printer.Print(label.ELN);
                }
                itemList.Rows.Remove(item);
                item = itemList.Rows[0];
                //Int32.TryParse(item[5].ToString(), out temp);
                //((Barcode)item[7]).NumberOfPrint = temp;
                //tempStr = (item[0]).ToString();
                //Boolean.TryParse(tempStr , out f);
                //tempStr = (item[2]).ToString();
                //Boolean.TryParse(tempStr, out f);
                //this.Add((Barcode)item[7]);
            } while (itemList.Rows.Count > 0);
            //this.print();
        }