示例#1
0
        private static void DataReceivedHandler(
            object sender,
            SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = (SerialPort)sender;
            string     indata = sp.ReadExisting();

            // If received "Detected!" from arduino Port
            if (indata.Contains("D"))
            {
                //MessageBox.Show("Is Dot Net Perls awesome?", "Important Question", MessageBoxButtons.YesNo);
                // Setup printer to print something
                TSCLIB_DLL.openport("TSC TDP-225");                                           //Open specified printer driver
                TSCLIB_DLL.setup("25", "220", "1", "8", "1", "6", "0");                       //Setup the media size and sensor type info
                TSCLIB_DLL.clearbuffer();                                                     //Clear image buffer
                //TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "270", "2", "2", "Barcode Test"); //Drawing barcode
                //TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
                //TSCLIB_DLL.windowsfont(100, 300, 24, 270, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
                //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
                TSCLIB_DLL.sendcommand("QRCODE 30,30,M,6,0,M2,\"BRADY123\"");
                //TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
                //Drawing PCX graphic
                TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
                TSCLIB_DLL.closeport();
            }
        }
示例#2
0
        // Function to perform printing module!
        private void PrintDemoLabel(bool reprint)
        {
            // Read from DB to get counter. return 1 if db not found.
            // append the string with time,gate and counter
            // write time, gate, count and reprint to DB.
            // Print out ticket accordingly.
            // Update the label for counter.
            // if reprtint, do not increment the counter.
            String printformat = UpdateDB(reprint);

            // Update the counter at here
            LABEL_COUNT.Invoke(new EventHandler(delegate
            {
                LABEL_COUNT.Text = printformat.Split('/').Last();
            }));
            String gatePrint  = "Gate: " + printformat.Split('/')[1];
            String CountPrint = "Counter: " + printformat.Split('/').Last();

            TSCLIB_DLL.openport("TSC TDP-225");                                                 //Open specified printer driver
            TSCLIB_DLL.setup("40", "450", "12", "8", "1", "6", "300");                          //Setup the media size and sensor type info
            TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
            TSCLIB_DLL.barcode("100", "470", "128", "100", "0", "270", "2", "2", printformat);  //Drawing barcode
            TSCLIB_DLL.printerfont("140", "480", "5", "90", "1", "1", gatePrint);               //Print Gate number
            TSCLIB_DLL.printerfont("210", "480", "5", "90", "1", "1", CountPrint);              //Print Ticket Counter
            TSCLIB_DLL.sendcommand($"QRCODE 80,0,M,7,M,0,M2,S1,\"A{printformat}\"");            //Draw QR Code
            TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
            TSCLIB_DLL.closeport();                                                             //Close specified printer driver
        }
示例#3
0
        private void btn_Box_Click(object sender, EventArgs e)//bar测试
        {
            TSCLIB_DLL.openport("TSC TDP-245");

            TSCLIB_DLL.sendcommand("CLS");
            TSCLIB_DLL.sendcommand("SIZE 80 mm,50 mm");
            TSCLIB_DLL.sendcommand("BAR 24,0,0,400");
            TSCLIB_DLL.sendcommand("BAR 30,0,3,400");
            TSCLIB_DLL.sendcommand("BAR 42,0,6,400");
            TSCLIB_DLL.sendcommand("BAR 60,0,9,400");
            TSCLIB_DLL.sendcommand("BAR 80,0,12,400");
            TSCLIB_DLL.sendcommand("BAR 114,0,15,400");
            TSCLIB_DLL.sendcommand("BAR 150,0,18,400");
            TSCLIB_DLL.sendcommand("BAR 192,0,21,400");
            TSCLIB_DLL.sendcommand("BAR 240,0,24,400");
            TSCLIB_DLL.sendcommand("BAR 294,0,27,400");
            TSCLIB_DLL.sendcommand("BAR 354,0,30,400");
            TSCLIB_DLL.sendcommand("BAR 420,0,33,400");
            TSCLIB_DLL.sendcommand("BAR 24,0,400,0");
            TSCLIB_DLL.sendcommand("BAR 24,6,400,3");
            TSCLIB_DLL.sendcommand("BAR 24,18,400,6");
            TSCLIB_DLL.sendcommand("BAR 24,36,400,9");
            TSCLIB_DLL.sendcommand("BAR 24,60,400,12");
            TSCLIB_DLL.sendcommand("BAR 24,90,400,15");
            TSCLIB_DLL.sendcommand("BAR 24,126,400,18");
            TSCLIB_DLL.sendcommand("BAR 24,168,400,21");
            TSCLIB_DLL.sendcommand("BAR 24,216,400,24");
            TSCLIB_DLL.sendcommand("BAR 24,270,400,27");
            TSCLIB_DLL.sendcommand("BAR 24,330,400,30");
            TSCLIB_DLL.sendcommand("BAR 24,396,400,33");

            TSCLIB_DLL.sendcommand("PRINT 1");

            TSCLIB_DLL.closeport();
        }
示例#4
0
        private void price4030(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon, string item_unit)
        {
            try
            {
                string point_number_s = "";

                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 40 mm, 30 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 4.2 mm,0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price));
                TSCLIB_DLL.clearbuffer();

                TSCLIB_DLL.windowsfont(16, 0, 100, 0, 2, 0, "Agency FB", CenterString(price, 10));
                TSCLIB_DLL.windowsfont(230, 81, 35, 0, 1, 0, "Century Gothic", price_cur);

                TSCLIB_DLL.windowsfont(16, 118, 26, 0, 2, 0, "Century Gothic", CenterString(item_code, 30));
                if (item_name.Length > 28)
                {
                    TSCLIB_DLL.windowsfont(16, 145, 20, 0, 2, 0, "Century Gothic", item_name.Substring(0, 26) + "-");
                    TSCLIB_DLL.windowsfont(16, 162, 20, 0, 2, 0, "Century Gothic", item_name.Substring(26, item_name.Length - 26));
                }
                else
                {
                    TSCLIB_DLL.windowsfont(8, 149, 20, 0, 2, 0, "Century Gothic", CenterString(item_name, 32));
                }

                TSCLIB_DLL.windowsfont(235, 175, 20, 0, 3, 0, "Century Gothic", item_unit);

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }

            catch (Exception e)
            {
                Log.set("HATA: PriceForm>4030 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#5
0
        private void btnSendBTCommand_Click(object sender, EventArgs e)
        {
            try
            {
                Alert(TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter).ToString());
                TSCLIB_DLL.clearbuffer();
                List <string> cmdLines = new List <string>();
                for (int i = 0; i < rtbBarTenderCommand.Lines.Length; i++)
                {
                    cmdLines.Add(rtbBarTenderCommand.Lines[i]);
                    Alert(TSCLIB_DLL.sendcommand(rtbBarTenderCommand.Lines[i]).ToString());
                }

                //int result = TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter);
                ////TSCLIB_DLL.clearbuffer();

                //result = TSCLIB_DLL.sendcommand("DMATRIX 120,8,400,400");
                //TSCLIB_DLL.printlabel("1", "1");

                TSCLIB_DLL.closeport();
            }
            catch (Exception ex)
            {
                Alert(ex.ToString());
            }
        }
示例#6
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string text = textBox1.Text;

                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                if (label_style == "Ribonlı yazdırım")
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.clearbuffer();



                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
                TSCLIB_DLL.windowsfont(16, 34, 40, 0, 3, 0, "Century Gothic", CenterString(text, 22));



                TSCLIB_DLL.printlabel("1", numericUpDown1.Value.ToString());
                TSCLIB_DLL.closeport();
                this.Close();
            }
        }
示例#7
0
        private void BtnPrnSticker_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            string WT1 = txtName.Text.Trim();
            string B1  = txtBarcode.Text.Trim();

            byte[] result_unicode = System.Text.Encoding.GetEncoding("utf-16").GetBytes("unicode test");
            byte[] result_utf8    = System.Text.Encoding.UTF8.GetBytes("TEXT 40,620,\"ARIAL.TTF\",0,12,12,\"utf8 test Wörter auf Deutsch\"");

            //TSCLIB_DLL.about();
            byte status = TSCLIB_DLL.usbportqueryprinter();     //0 = idle, 1 = head open, 16 = pause, following <ESC>!? command of TSPL manual

            TSCLIB_DLL.openport("TSC TE210");
            TSCLIB_DLL.sendcommand("SIZE 100 mm, 120 mm");
            TSCLIB_DLL.sendcommand("SPEED 4");
            TSCLIB_DLL.sendcommand("DENSITY 12");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("SET TEAR ON");
            TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
            TSCLIB_DLL.clearbuffer();
            //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            TSCLIB_DLL.windowsfont(40, 490, 48, 0, 0, 0, "Arial", "Windows Font Test");
            TSCLIB_DLL.windowsfontUnicode(40, 550, 48, 0, 0, 0, "Arial", result_unicode);
            //TSCLIB_DLL.sendcommand("PUTPCX 40,40,\"UL.PCX\"");
            TSCLIB_DLL.sendBinaryData(result_utf8, result_utf8.Length);
            TSCLIB_DLL.barcode("40", "300", "128", "80", "1", "0", "2", "2", B1);
            TSCLIB_DLL.printerfont("40", "250", "0", "0", "15", "15", WT1);
            TSCLIB_DLL.printlabel("1", "1");
            TSCLIB_DLL.closeport();
        }
示例#8
0
 private void button2_Click(object sender, EventArgs e)//LF
 {
     TSCLIB_DLL.openport("TSC TDP-245");
     //TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");
     //TSCLIB_DLL.clearbuffer();
     //TSCLIB_DLL.formfeed();
     TSCLIB_DLL.sendcommand("FEED 400");
     TSCLIB_DLL.closeport();
 }
示例#9
0
 private void btn_print_Click(object sender, EventArgs e)
 {
     TSCLIB_DLL.openport("TSC TDP-225");                                               //Open specified printer driver
     TSCLIB_DLL.setup("25", "220", "1", "8", "1", "6", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                         //Clear image buffer
     //TSCLIB_DLL.barcode("150", "600", "128", "100", "1", "270", "2", "2", "Barcode Test"); //Drawing barcode
     //TSCLIB_DLL.printerfont("100", "350", "3", "270", "1", "1", "Print Font Test");        //Drawing printer font
     //TSCLIB_DLL.windowsfont(100, 400, 24, 90, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("QRCODE 30,30,M,6,0,M2,\"BRADY123\"");                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                             //Print labels
     TSCLIB_DLL.closeport();                                                      //Close specified printer driver
 }
示例#10
0
        //---------- price
        private void price4515(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon)
        {
            try
            {
                string point_number_s = "";
                string price_with_cur = "";
                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price          = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price));
                price_with_cur = price + " " + price_cur;
                if (item_name.Length > 30)
                {
                    item_name = item_name.Substring(0, 30) + "...";
                }
                TSCLIB_DLL.clearbuffer();
                TSCLIB_DLL.windowsfont(16, 10, 50, 0, 2, 0, "Century Gothic", CenterString(price_with_cur, 19));
                TSCLIB_DLL.windowsfont(16, 55, 25, 0, 3, 0, "Century Gothic", CenterString(item_code, 37));
                TSCLIB_DLL.windowsfont(16, 80, 18, 0, 3, 0, "Century Gothic", CenterString(item_name, 50));

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>4515 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#11
0
 private void button1_Click(object sender, EventArgs e)
 {
     //TSCLIB_DLL.about();                                                                 //Show the DLL version
     TSCLIB_DLL.openport("TSC TTP-344M Plus");                                           //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
     TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");                                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
     TSCLIB_DLL.closeport();                                                             //Close specified printer driver
 }
示例#12
0
 private void btn_test_Click(object sender, EventArgs e)//测试按钮
 {
     //TSCLIB_DLL.about();                                                                //Show the DLL version
     TSCLIB_DLL.openport("TSC TDP-245");                                                 //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.about();
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "TSS24.BF2", "0", "1", "1", "Print Font 测试");  //Drawing printer font
     // TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "GBK", "测试"); //Draw windows font
     // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCXL.PC 100,400,\"UL.PCX\"");                           //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                   //Print labels
     TSCLIB_DLL.closeport();                                                            //Close specified printer driver
 }
示例#13
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Hello TSCLIB.DLL')", true);
     //TSCLIB_DLL.about();                                                                 //Show the DLL version
     TSCLIB_DLL.openport("TSC TTP-245C");                                                //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
     TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     //TSCLIB_DLL.downloadpcx("C:\\ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");                                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
     TSCLIB_DLL.closeport();
 }
        public void Print(PurchaseOrderDetail itm)
        {
            try
            {
                const int    VerticalSpace   = 150;
                const int    HorizontalSpace = 100;
                const string LabelFontSize   = "2.5";

                TSCLIB_DLL.openport(Settings.Default.TSCPrinter);                              //Open specified printer driver
                TSCLIB_DLL.setup("101", "150", "6", "8", "0", "5", "0");                       //Setup the media size and sensor type info
                TSCLIB_DLL.clearbuffer();                                                      //Clear image buffer
                TSCLIB_DLL.downloadpcx("box.pcx", "box.pcx");                                  //Download PCX file into printer



                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * .2).ToString(), "3", "0", "3", "3", PurchaseOrder.PODate.ToString("yyyy-MMM-dd"));     //Drawing printer font

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 1).ToString(), "3", "0", LabelFontSize, LabelFontSize, "Invoice#");
                TSCLIB_DLL.printerfont((HorizontalSpace * 4).ToString(), (VerticalSpace * 1).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.PurchaseOrderNo);

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 2).ToString(), "3", "0", LabelFontSize, LabelFontSize, "Item:");
                TSCLIB_DLL.printerfont((HorizontalSpace * 2.3).ToString(), (VerticalSpace * 2).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.ItemDescription);

                TSCLIB_DLL.barcode((HorizontalSpace * .5).ToString(), (VerticalSpace * 2.6).ToString(), "128", "125", "1", "0", "8", "8", itm.Barcode); //Drawing barcode


                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4).ToString(), "3", "0", LabelFontSize, LabelFontSize, "SORT");
                TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 4, HorizontalSpace * 8, VerticalSpace * 4 + 100));

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "GRADED");
                TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 5, HorizontalSpace * 8, VerticalSpace * 5 + 100));

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 6).ToString(), "3", "0", LabelFontSize, LabelFontSize, "WASH");
                TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 6, HorizontalSpace * 8, VerticalSpace * 6 + 100));

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 7).ToString(), "3", "0", LabelFontSize, LabelFontSize, "CHILLER#");
                TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 7, HorizontalSpace * 8, VerticalSpace * 7 + 100));


                TSCLIB_DLL.printlabel("1", itm.LabelQty.ToString());                                                //Print labels
                TSCLIB_DLL.closeport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#15
0
        private void btnBack_Click(object sender, EventArgs e)//退纸
        {
            TSCLIB_DLL.openport("TSC TDP-245");

            int data = Convert.ToInt32(nudBack.Value);

            if (cb_Back.Checked)
            {
                TSCLIB_DLL.sendcommand("BACKFEED " + data);
            }
            else
            {
                TSCLIB_DLL.sendcommand("BACKUP " + data);
            }


            TSCLIB_DLL.closeport();
        }
示例#16
0
        public bool PrintMUBLabel(string filePath)
        {
            try
            {
                // Open specified printer driver
                TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter);

                // Setup the media size and sensor type info
                // page size 100mm x 55mm
                TSCLIB_DLL.setup("55", "100", "4", "8", "0", "0", "0");

                //Clear image buffer
                TSCLIB_DLL.clearbuffer();

                // Download PCX file into printer
                // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
                // Drawing PCX graphic
                TSCLIB_DLL.downloadpcx(filePath, "mublabel.bmp");       //Download PCX file into printer

                TSCLIB_DLL.sendcommand("PUTBMP 1,1, \"mublabel.bmp\""); //Drawing PCX graphic

                //Print labels
                //TSCLIB_DLL.printlabel("1", "1");
                TSCLIB_DLL.sendcommand("PRINT 1");
                TSCLIB_DLL.closeport();

                // Delete temp file
                File.Delete(filePath);

                return(true);
            }
            catch (Exception ex)
            {
                LogManager.Debug(ex.Message);
                Debug.WriteLine("Print exception: " + ex.ToString());
                // Delete temp file
                File.Delete(filePath);
                return(false);
            }
        }
示例#17
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[] result = System.Text.Encoding.GetEncoding("utf-16").GetBytes("unicode test");

            //TSCLIB_DLL.about();
            TSCLIB_DLL.openport("TSC TA210");
            TSCLIB_DLL.sendcommand("SIZE 76 mm, 20 mm");
            TSCLIB_DLL.sendcommand("SPEED 4");
            TSCLIB_DLL.sendcommand("DENSITY 12");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("SET TEAR ON");
            TSCLIB_DLL.clearbuffer();
            TSCLIB_DLL.barcode("335", "30", "128", "100", "1", "0", "2", "2", "3410156300419176");
            TSCLIB_DLL.barcode("35", "30", "128", "100", "1", "0", "2", "2", "3410156300419176");
            //TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");
            //TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");
            //TSCLIB_DLL.windowsfontUnicode(100, 350, 24, 0, 0, 0, "ARIAL", result);
            TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
            TSCLIB_DLL.printlabel("4", "4");
            TSCLIB_DLL.closeport();
        }
示例#18
0
        private void price4515()
        {
            int select_count = dgv_malzeme.SelectedRows.Count;

            if (select_count > 0)
            {
                List <DataGridViewRow> rows =
                    (from DataGridViewRow row in dgv_malzeme.SelectedRows
                     where !row.IsNewRow
                     orderby row.Index
                     select row).ToList <DataGridViewRow>();
                string barcode;
                string ek_sutun;
                string item_code;
                string item_name;
                string printer_name = cmb_printer.Text;
                string label_count  = labelCount.Value.ToString();

                TSCLIB_DLL.openport(printer_name);
                TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm, 0 mm");
                if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
                // byte[] result_utf8 = System.Text.Encoding.UTF8.GetBytes("TEXT 40,620,\"ARIAL.TTF\",0,12,12,\"utf8 test Wörter auf Deutsch\"");
                for (int i = 0; i < select_count; i++)
                {
                    //float dev = float.Parse(rows[i].Cells[6].Value.ToString());
                    //if (dev>0)
                    //{
                    //    barcode = rows[i].Cells[7].Value.ToString();
                    //}
                    //else
                    //{

                    //    barcode = rows[i].Cells[3].Value.ToString();
                    //}
                    barcode   = rows[i].Cells[3].Value.ToString();
                    ek_sutun  = rows[i].Cells[4].Value.ToString();
                    item_name = rows[i].Cells[2].Value.ToString();
                    item_code = rows[i].Cells[1].Value.ToString();

                    TSCLIB_DLL.clearbuffer();
                    TSCLIB_DLL.windowsfont(16, 0, 26, 0, 2, 0, "Century Gothic", CenterString(item_code, 35));
                    if (item_name.Length > 30)
                    {
                        TSCLIB_DLL.windowsfont(16, 22, 15, 0, 2, 0, "Century Gothic", CenterString(item_name, 60));
                    }
                    else
                    {
                        TSCLIB_DLL.windowsfont(16, 22, 16, 0, 2, 0, "Century Gothic", CenterString(item_name, 70));
                    }

                    //BARCODE X,Y, "code type",height,human readable,rotation,narrow,wide,[alignment,] "content "
                    //TSCLIB_DLL.sendcommand("AZTEC 50, 45, 0, 4, 1, \"ABCDE\"");

                    if (barcode.Length <= 5)
                    {
                        TSCLIB_DLL.barcode("100", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 6)
                    {
                        TSCLIB_DLL.barcode("80", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 7)
                    {
                        TSCLIB_DLL.barcode("70", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 8)
                    {
                        TSCLIB_DLL.barcode("60", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 9)
                    {
                        TSCLIB_DLL.barcode("50", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 10)
                    {
                        TSCLIB_DLL.barcode("40", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length == 11)
                    {
                        TSCLIB_DLL.barcode("27", "42", "128", "40", "0", "0", "2", "1", barcode);
                    }
                    else if (barcode.Length < 15)
                    {
                        TSCLIB_DLL.barcode("90", "42", "128", "40", "0", "0", "1", "1", barcode);
                    }
                    else if (barcode.Length < 18)
                    {
                        TSCLIB_DLL.barcode("70", "42", "128", "40", "0", "0", "1", "1", barcode);
                    }
                    else if (barcode.Length >= 18)
                    {
                        TSCLIB_DLL.barcode("45", "42", "128", "40", "0", "0", "1", "1", barcode);
                    }

                    TSCLIB_DLL.windowsfont(20, 81, 20, 0, 2, 0, "Century Gothic", CenterString(barcode, 60));
                    TSCLIB_DLL.windowsfont(20, 95, 20, 0, 2, 0, "Century Gothic", CenterString(ek_sutun, 60));
                    TSCLIB_DLL.printlabel("1", label_count);
                }
                TSCLIB_DLL.closeport();
            }
        }
示例#19
0
        /// <summary>
        /// Not ready yet
        /// </summary>
        /// <param name="mubLabelInfo"></param>
        /// <returns></returns>
        public bool PrintMUBLabel(MUBLabelInfo mubLabelInfo)
        {
            lock (syncRoot)
            {
                try
                {
                    // validate
                    if (!mubLabelInfo.IsValid())
                    {
                        //LogManager.Debug("Model is not valid.");
                        return(false);
                    }

                    //Open specified printer driver
                    TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter);

                    #region rotation 90 degrees
                    //Setup the media size and sensor type info
                    // page size 55mm x 100mm
                    // template size 55mm x 100mm (actually 56mm x 82mm)
                    //TSCLIB_DLL.setup("55", "82.5", "4", "8", "0", "0", "0");
                    //Clear image buffer
                    //TSCLIB_DLL.clearbuffer();
                    // DPI = 203 => 8px = 1 mm
                    //Draw windows font
                    int    startX       = 280;
                    int    startY       = 142;
                    int    startY_Value = startY + 160;
                    string fontName     = "ARIAL";
                    int    fontStyle    = 0; // Normal
                    int    fontHeight   = 30;
                    int    lineSpacing  = 10;
                    int    maxChar      = 17; // max char of name at first name line
                    int    rotation     = 270;

                    // send FEED command
                    //TSCLIB_DLL.sendcommand("FEED 80");

                    TSCLIB_DLL.sendcommand("SIZE 40mm, 80mm");
                    TSCLIB_DLL.sendcommand("GAP 3mm, 0mm");
                    //TSCLIB_DLL.sendcommand("SIZE 42.5mm, 80mm");
                    //TSCLIB_DLL.sendcommand("GAP 1.3mm, 0mm");
                    TSCLIB_DLL.sendcommand("DIRECTION 0");
                    TSCLIB_DLL.sendcommand("CLS");
                    //TSCLIB_DLL.sendcommand("BOX 0,0,312,624,4");
                    TSCLIB_DLL.sendcommand("TEXT 280,312,\"ROMAN.TTF\",90,12,12,2,\"CENTRAL NARCOTICS BUREAU\"");
                    //TSCLIB_DLL.windowsfont(startX, startY, fontHeight, rotation, fontStyle, 0, fontName, "Name");
                    // Title line
                    //TSCLIB_DLL.windowsfont(startX, 48, fontHeight + 8, rotation, 2, 0, fontName, "CENTRAL NARCOTICS BUREAU");
                    //TSCLIB_DLL.windowsfont(startX-54, 0, fontHeight + 8, rotation, fontStyle, 0, fontName, "| Start");
                    //TSCLIB_DLL.windowsfont(startX-54, 600, fontHeight + 6, rotation, fontStyle, 0, fontName, "| End");


                    // Name line
                    TSCLIB_DLL.windowsfont(startX -= 64, startY, fontHeight, rotation, fontStyle, 0, fontName, "Name");
                    if (mubLabelInfo.Name.Length > maxChar)
                    {
                        TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.Name.Substring(0, maxChar));
                        // Addition line if name is too long. Need to improve (detech addition row by space char)
                        TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY_Value + 32, fontHeight, rotation, fontStyle, 0, fontName, mubLabelInfo.Name.Substring(maxChar, mubLabelInfo.Name.Length - maxChar));
                    }
                    else
                    {
                        TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.Name);
                        startX -= (fontHeight + lineSpacing);
                    }

                    // ID line
                    TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "ID No.");
                    TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.ID);

                    // Date line
                    TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "Date");
                    TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + DateTime.Now.ToString("dd/MM/yyyy"));

                    // Marking no
                    TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "Marking No.");
                    TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.MarkingNumber);

                    //Drawing barcode
                    //TSCLIB_DLL.sendcommand("DMATRIX 200,16,400,400,x3,r90, \"" + mubLabelInfo.QRCodeString + "\"");
                    TSCLIB_DLL.sendcommand("DMATRIX 100,40,400,400,x2, \"" + mubLabelInfo.QRCodeString + "\"");

                    //Print labels
                    TSCLIB_DLL.printlabel("1", "1");

                    // send FEED command
                    //TSCLIB_DLL.sendcommand("BACKFEED 80");
                    TSCLIB_DLL.closeport();
                    #endregion

                    #region rotation 270 degrees
                    //// Setup the media size and sensor type info
                    //// page size 55mm x 100mm
                    //// template size 55mm x 100mm (actually 56mm x 82mm)
                    //TSCLIB_DLL.setup("55", "82.5", "4", "8", "0", "0", "0");

                    ////Clear image buffer
                    //TSCLIB_DLL.clearbuffer();
                    //// DPI = 203 => 8px = 1 mm
                    ////Draw windows font
                    //int startX = 348;
                    //int startY = 134;
                    //int startY_Value = startY + 160;
                    //string fontName = "ARIAL";
                    //int fontStyle = 0; // Normal
                    //int fontHeight = 30;
                    //int lineSpacing = 10;
                    //int maxChar = 17;   // max char of name at first name line
                    //int rotation = 270;

                    //// Title line
                    //TSCLIB_DLL.windowsfont(startX, 48, fontHeight + 8, rotation, 2, 0, fontName, "CENTRAL NARCOTICS BUREAU");
                    ////TSCLIB_DLL.windowsfont(startX-54, 0, fontHeight + 8, rotation, fontStyle, 0, fontName, "| Start");
                    ////TSCLIB_DLL.windowsfont(startX-54, 600, fontHeight + 6, rotation, fontStyle, 0, fontName, "| End");


                    //// Name line
                    //TSCLIB_DLL.windowsfont(startX -= 64, startY, fontHeight, rotation, fontStyle, 0, fontName, "Name");
                    //if (mubLabelInfo.Name.Length > maxChar)
                    //{
                    //    TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.Name.Substring(0, maxChar));
                    //    // Addition line if name is too long. Need to improve (detech addition row by space char)
                    //    TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY_Value + 32, fontHeight, rotation, fontStyle, 0, fontName, "-" + mubLabelInfo.Name.Substring(maxChar, mubLabelInfo.Name.Length - maxChar));
                    //}
                    //else
                    //{
                    //    TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.Name);
                    //    startX -= (fontHeight + lineSpacing);
                    //}

                    //// ID line
                    //TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "ID No.");
                    //TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.ID);

                    //// Date line
                    //TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "Date");
                    //TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + DateTime.Now.ToString("dd/MM/yyyy"));

                    //// Marking no
                    //TSCLIB_DLL.windowsfont(startX -= (fontHeight + lineSpacing), startY, fontHeight, rotation, fontStyle, 0, fontName, "Marking No.");
                    //TSCLIB_DLL.windowsfont(startX, startY_Value, fontHeight, rotation, fontStyle, 0, fontName, " : " + mubLabelInfo.MarkingNumber);

                    ////Drawing barcode
                    ////TSCLIB_DLL.barcode(startX.ToString(), (startY += fontHeight + 8).ToString(), "39", "72", "0", "0", "1", "3", mubLabelInfo.QRCodeString);
                    //TSCLIB_DLL.sendcommand("DMATRIX 144,8,400,400,x3, \"" + mubLabelInfo.QRCodeString + "\"");

                    ////Download PCX file into printer
                    ////TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
                    ////Drawing PCX graphic
                    ////TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
                    ////Print labels
                    //TSCLIB_DLL.printlabel("1", "1");
                    //TSCLIB_DLL.closeport();
                    #endregion

                    return(true);
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine("Print exception: " + ex.ToString());
                    LogManager.Debug("Print exception: " + ex.ToString());
                    return(false);
                }
            }
        }
 public void PrintLogo(string zXPos, string zYPos, string zPCXName)
 {
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
     TSCLIB_DLL.sendcommand("PUTPCX 224,8,\"UL.PCX\"");
     TSCLIB_DLL.sendcommand("PUTPCX 576,8,\"UL.PCX\"");
 }
示例#21
0
        private void price8030()
        {
            try
            {
                int select_count = dgv_malzeme.SelectedRows.Count;
                if (select_count > 0)
                {
                    List <DataGridViewRow> rows =
                        (from DataGridViewRow row in dgv_malzeme.SelectedRows
                         where !row.IsNewRow
                         orderby row.Index
                         select row).ToList <DataGridViewRow>();
                    string price;
                    string price_cur;
                    string item_code;
                    string item_name;
                    string item_unit;
                    string printer_name = cmb_printer.Text;
                    string label_count  = labelCount.Value.ToString();
                    string price_with_cur;
                    int    point_number;
                    string point_number_s = "";

                    TSCLIB_DLL.openport(printer_name);
                    TSCLIB_DLL.sendcommand("SIZE 80 mm, 30 mm");
                    TSCLIB_DLL.sendcommand("SPEED 4");
                    TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                    if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON ON");
                    }
                    else
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                    }
                    TSCLIB_DLL.sendcommand("DENSITY 8");
                    TSCLIB_DLL.sendcommand("DIRECTION 1");
                    TSCLIB_DLL.sendcommand("SET TEAR ON");
                    TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                    for (int i = 0; i < select_count; i++)
                    {
                        price        = rows[i].Cells[3].Value.ToString();
                        price_cur    = rows[i].Cells[4].Value.ToString();
                        item_name    = rows[i].Cells[2].Value.ToString();
                        item_code    = rows[i].Cells[1].Value.ToString();
                        item_unit    = rows[i].Cells[5].Value.ToString();
                        point_number = Int32.Parse(rows[i].Cells[7].Value.ToString());
                        if (point_number > 0)
                        {
                            point_number_s = ".";
                            for (int j = 0; j < point_number; j++)
                            {
                                point_number_s += "0";
                            }
                        }
                        price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price)); //.ToString("### ### ### ###.##");
                                                                                                                //MessageBox.Show(price);

                        TSCLIB_DLL.clearbuffer();
                        switch (price.Length)
                        {
                        case 3:
                            TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(350, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 4:
                            TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(400, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 5:
                            TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(440, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 6:
                            TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 10));
                            TSCLIB_DLL.windowsfont(500, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 7:
                            TSCLIB_DLL.windowsfont(25, -10, 170, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 8:
                            TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 9:
                            TSCLIB_DLL.windowsfont(16, -10, 160, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 10:
                            TSCLIB_DLL.windowsfont(16, -10, 150, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        default:
                            TSCLIB_DLL.windowsfont(16, -10, 150, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                            break;
                        }

                        TSCLIB_DLL.windowsfont(16, 140, 38, 0, 2, 0, "Century Gothic", CenterString(item_code, 32));
                        if (item_name.Length > 40)
                        {
                            TSCLIB_DLL.windowsfont(24, 175, 22, 0, 2, 0, "Century Gothic", CenterString(item_name, 55));
                        }
                        else if (item_name.Length > 30)
                        {
                            TSCLIB_DLL.windowsfont(24, 175, 25, 0, 2, 0, "Century Gothic", CenterString(item_name, 45));
                        }
                        else
                        {
                            TSCLIB_DLL.windowsfont(14, 175, 28, 0, 2, 0, "Century Gothic", CenterString(item_name, 50));
                        }
                        TSCLIB_DLL.windowsfont(550, 200, 25, 0, 3, 0, "Century Gothic", item_unit);

                        TSCLIB_DLL.printlabel("1", label_count);
                    }
                    TSCLIB_DLL.closeport();
                }
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>8035 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#22
0
        private void price10338()
        {
            try
            {
                int select_count = dgv_malzeme.SelectedRows.Count;
                if (select_count > 0)
                {
                    List <DataGridViewRow> rows =
                        (from DataGridViewRow row in dgv_malzeme.SelectedRows
                         where !row.IsNewRow
                         orderby row.Index
                         select row).ToList <DataGridViewRow>();
                    string price;
                    string price_cur;
                    string item_code;
                    string item_name;
                    string item_unit;
                    string printer_name = cmb_printer.Text;
                    string label_count  = labelCount.Value.ToString();
                    string price_with_cur;
                    int    point_number;
                    string point_number_s = "";

                    TSCLIB_DLL.openport(printer_name);
                    TSCLIB_DLL.sendcommand("SIZE 103 mm, 38 mm");
                    TSCLIB_DLL.sendcommand("SPEED 4");
                    TSCLIB_DLL.sendcommand("GAP 0 mm, 0 mm");
                    if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON ON");
                    }
                    else
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                    }
                    TSCLIB_DLL.sendcommand("DENSITY 8");
                    TSCLIB_DLL.sendcommand("DIRECTION 1");
                    TSCLIB_DLL.sendcommand("SET TEAR ON");
                    TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                    for (int i = 0; i < select_count; i++)
                    {
                        price        = rows[i].Cells[3].Value.ToString();
                        price_cur    = rows[i].Cells[4].Value.ToString();
                        item_name    = rows[i].Cells[2].Value.ToString();
                        item_code    = rows[i].Cells[1].Value.ToString();
                        item_unit    = rows[i].Cells[5].Value.ToString();
                        point_number = Int32.Parse(rows[i].Cells[7].Value.ToString());
                        if (point_number > 0)
                        {
                            point_number_s = ".";
                            for (int j = 0; j < point_number; j++)
                            {
                                point_number_s += "0";
                            }
                        }
                        price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString()).Replace(",", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString())));

                        //MessageBox.Show(price);
                        // todo: orat suyshurmeli bolmasa page bellap bilenok
                        TSCLIB_DLL.clearbuffer();
                        switch (price.Length)

                        {
                        case 3:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 4:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 5:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(500, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 6:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 10));
                            TSCLIB_DLL.windowsfont(550, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 7:
                            TSCLIB_DLL.windowsfont(45, 15, 180, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(580, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 8:
                            TSCLIB_DLL.windowsfont(46, 15, 180, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(600, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 9:
                            TSCLIB_DLL.windowsfont(36, 15, 170, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 78, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 10:
                            TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        default:
                            TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;
                        }

                        TSCLIB_DLL.windowsfont(30, 170, 48, 0, 2, 0, "Century Gothic", CenterString(item_code, 32));
                        if (item_name.Length > 40)
                        {
                            TSCLIB_DLL.windowsfont(30, 230, 32, 0, 2, 0, "Century Gothic", CenterString(item_name, 55));
                        }
                        else if (item_name.Length > 30)
                        {
                            TSCLIB_DLL.windowsfont(30, 230, 35, 0, 2, 0, "Century Gothic", CenterString(item_name, 45));
                        }
                        else
                        {
                            TSCLIB_DLL.windowsfont(24, 230, 38, 0, 2, 0, "Century Gothic", CenterString(item_name, 50));
                        }
                        TSCLIB_DLL.windowsfont(650, 270, 35, 0, 3, 0, "Century Gothic", item_unit);

                        TSCLIB_DLL.printlabel("1", label_count);
                    }
                    TSCLIB_DLL.closeport();
                }
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>8035 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#23
0
        private void price3825()
        {
            try
            {
                int select_count = dgv_malzeme.SelectedRows.Count;
                if (select_count > 0)
                {
                    List <DataGridViewRow> rows =
                        (from DataGridViewRow row in dgv_malzeme.SelectedRows
                         where !row.IsNewRow
                         orderby row.Index
                         select row).ToList <DataGridViewRow>();
                    string price;
                    string price_cur;
                    string item_code;
                    string item_name;
                    string item_unit;
                    string printer_name = cmb_printer.Text;
                    string label_count  = labelCount.Value.ToString();
                    int    point_number;
                    string point_number_s = "";

                    TSCLIB_DLL.openport(printer_name);
                    TSCLIB_DLL.sendcommand("SIZE 38 mm, 25 mm");
                    TSCLIB_DLL.sendcommand("SPEED 4");
                    TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                    if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON ON");
                    }
                    else
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                    }
                    TSCLIB_DLL.sendcommand("DENSITY 8");
                    TSCLIB_DLL.sendcommand("DIRECTION 1");
                    TSCLIB_DLL.sendcommand("SET TEAR ON");
                    TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
                    for (int i = 0; i < select_count; i++)
                    {
                        price        = rows[i].Cells[3].Value.ToString();
                        price_cur    = rows[i].Cells[4].Value.ToString();
                        item_name    = rows[i].Cells[2].Value.ToString();
                        item_code    = rows[i].Cells[1].Value.ToString();
                        item_unit    = rows[i].Cells[5].Value.ToString();
                        point_number = Int32.Parse(rows[i].Cells[7].Value.ToString());
                        if (point_number > 0)
                        {
                            point_number_s = ".";
                            for (int j = 0; j < point_number; j++)
                            {
                                point_number_s += "0";
                            }
                        }
                        price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString()).Replace(",", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString())));
                        TSCLIB_DLL.clearbuffer();

                        TSCLIB_DLL.windowsfont(16, -5, 100, 0, 2, 0, "Agency FB", CenterString(price, 10));
                        TSCLIB_DLL.windowsfont(230, 75, 35, 0, 1, 0, "Century Gothic", price_cur);

                        TSCLIB_DLL.windowsfont(16, 115, 26, 0, 2, 0, "Century Gothic", CenterString(item_code, 30));
                        if (item_name.Length > 30)
                        {
                            TSCLIB_DLL.windowsfont(16, 140, 20, 0, 2, 0, "Century Gothic", item_name.Substring(0, 26) + "-");
                            TSCLIB_DLL.windowsfont(16, 155, 20, 0, 2, 0, "Century Gothic", item_name.Substring(26, item_name.Length - 26));
                        }
                        else
                        {
                            TSCLIB_DLL.windowsfont(14, 140, 20, 0, 2, 0, "Century Gothic", CenterString(item_name, 32));
                        }

                        TSCLIB_DLL.windowsfont(235, 168, 20, 0, 3, 0, "Century Gothic", item_unit);

                        TSCLIB_DLL.printlabel("1", label_count);
                    }
                    TSCLIB_DLL.closeport();
                }
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>3825 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#24
0
        private void price10338(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon, string item_unit)
        {
            try
            {
                string price_with_cur;
                string point_number_s = "";

                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 103 mm, 38 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 0 mm, 0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");


                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price)); //.ToString("### ### ### ###.##");

                //MessageBox.Show(price);
                // todo: orat suyshurmeli bolmasa page bellap bilenok
                TSCLIB_DLL.clearbuffer();
                switch (price.Length)
                {
                case 3:
                    TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 4:
                    TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 5:
                    TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(500, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 6:
                    TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 10));
                    TSCLIB_DLL.windowsfont(550, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 7:
                    TSCLIB_DLL.windowsfont(45, 15, 180, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(580, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 8:
                    TSCLIB_DLL.windowsfont(46, 15, 180, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(600, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 9:
                    TSCLIB_DLL.windowsfont(36, 15, 170, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(610, 78, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 10:
                    TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                default:
                    TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                    break;
                }

                TSCLIB_DLL.windowsfont(30, 170, 48, 0, 2, 0, "Century Gothic", CenterString(item_code, 32));
                if (item_name.Length > 40)
                {
                    TSCLIB_DLL.windowsfont(30, 230, 32, 0, 2, 0, "Century Gothic", CenterString(item_name, 55));
                }
                else if (item_name.Length > 30)
                {
                    TSCLIB_DLL.windowsfont(30, 230, 35, 0, 2, 0, "Century Gothic", CenterString(item_name, 45));
                }
                else
                {
                    TSCLIB_DLL.windowsfont(24, 230, 38, 0, 2, 0, "Century Gothic", CenterString(item_name, 50));
                }
                TSCLIB_DLL.windowsfont(650, 270, 35, 0, 3, 0, "Century Gothic", item_unit);

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>8035 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#25
0
        private void price8030(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon, string item_unit)
        {
            try
            {
                string point_number_s = "";
                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 80 mm, 30 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price)); //.ToString("### ### ### ###.##");
                TSCLIB_DLL.clearbuffer();
                switch (price.Length)
                {
                case 3:
                    TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(350, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 4:
                    TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(400, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 5:
                    TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 12));
                    TSCLIB_DLL.windowsfont(440, 65, 75, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 6:
                    TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", CenterString(price, 10));
                    TSCLIB_DLL.windowsfont(500, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 7:
                    TSCLIB_DLL.windowsfont(25, -10, 170, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 8:
                    TSCLIB_DLL.windowsfont(16, -10, 170, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 9:
                    TSCLIB_DLL.windowsfont(16, -10, 160, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                case 10:
                    TSCLIB_DLL.windowsfont(16, -10, 150, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;

                default:
                    TSCLIB_DLL.windowsfont(16, -10, 150, 0, 2, 0, "Agency FB", price);
                    TSCLIB_DLL.windowsfont(510, 78, 50, 0, 3, 0, "Century Gothic", price_cur);
                    break;
                }

                TSCLIB_DLL.windowsfont(16, 140, 38, 0, 2, 0, "Century Gothic", CenterString(item_code, 32));
                if (item_name.Length > 40)
                {
                    TSCLIB_DLL.windowsfont(24, 175, 22, 0, 2, 0, "Century Gothic", CenterString(item_name, 55));
                }
                else if (item_name.Length > 30)
                {
                    TSCLIB_DLL.windowsfont(24, 175, 25, 0, 2, 0, "Century Gothic", CenterString(item_name, 45));
                }
                else
                {
                    TSCLIB_DLL.windowsfont(14, 175, 28, 0, 2, 0, "Century Gothic", CenterString(item_name, 50));
                }
                TSCLIB_DLL.windowsfont(550, 200, 25, 0, 3, 0, "Century Gothic", item_unit);

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>8035 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#26
0
        /// <summary>
        /// print TTLabel
        /// </summary>
        /// <param name="ttLabelInfo">Id, Name, MarkingNumber must not be null</param>
        /// <returns>successful</returns>
        public bool PrintTTLabel_Direction_0(TTLabelInfo ttLabelInfo)
        {
            lock (syncRoot)
            {
                try
                {
                    //LogManager.Debug("PrintTTLabel ");
                    // validate
                    if (!ttLabelInfo.IsValid())
                    {
                        LogManager.Debug("!ttLabelInfo.IsValid");
                        return(false);
                    }

                    //Open specified printer driver
                    TSCLIB_DLL.openport(EnumDeviceNames.TTLabelPrinter);

                    //Setup the media size and sensor type info
                    // page size 55mm x 30mm
                    // template size 45mm x 30mm (actually 55mm x 32.5mm)
                    //TSCLIB_DLL.setup("55", "32.5", "4", "8", "0", "0", "0");
                    TSCLIB_DLL.setup("50", "30", "4", "8", "0", "0", "0");
                    TSCLIB_DLL.sendcommand("GAP 3mm, 0mm");
                    //TSCLIB_DLL.setup("52.5", "30", "4", "8", "0", "0", "0");
                    //TSCLIB_DLL.sendcommand("GAP 1.3mm, 0mm");
                    TSCLIB_DLL.sendcommand("DIRECTION 0");
                    TSCLIB_DLL.sendcommand("CLS");

                    //Clear image buffer
                    //TSCLIB_DLL.clearbuffer();

                    // DPI = 203 => 8px = 1 mm
                    //Draw windows font
                    //int startX = 54;
                    //int startY = 32;
                    int startX = 48;
                    int startY = 16;
                    //int startX = 40;
                    //int startY = 0;
                    string fontName   = "ARIAL";
                    int    fontStyle  = 2;  // Bold
                    int    fontHeight = 30;
                    int    maxChar    = 17; // max char of name at first name line

                    // Name line
                    TSCLIB_DLL.windowsfont(startX, startY, fontHeight, 0, fontStyle, 0, fontName, "Name");
                    if (ttLabelInfo.Name.Length > maxChar)
                    {
                        TSCLIB_DLL.windowsfont(startX + 70, startY, fontHeight, 0, fontStyle, 0, fontName, " : " + ttLabelInfo.Name.Substring(0, maxChar));
                        // Add name line if name is too long. Need to improve (split name by space char)
                        TSCLIB_DLL.windowsfont(startX + 100, startY += fontHeight, fontHeight, 0, fontStyle, 0, fontName, ttLabelInfo.Name.Substring(maxChar, ttLabelInfo.Name.Length - maxChar));
                    }
                    else
                    {
                        TSCLIB_DLL.windowsfont(startX + 70, startY, fontHeight, 0, fontStyle, 0, fontName, " : " + ttLabelInfo.Name);
                        startY += fontHeight;
                    }

                    // ID line
                    TSCLIB_DLL.windowsfont(startX, startY += fontHeight, fontHeight, 0, fontStyle, 0, fontName, "ID");
                    TSCLIB_DLL.windowsfont(startX + 70, startY, fontHeight, 0, fontStyle, 0, fontName, " : " + ttLabelInfo.ID);

                    //Drawing barcode
                    TSCLIB_DLL.barcode(startX.ToString(), (startY += fontHeight + 8).ToString(), "39", "72", "0", "0", "1", "3", ttLabelInfo.MarkingNumber);

                    // Drawing barcode buildin function do not let us set text size of readable line, so we need to draw a line to display MarkingNumber
                    TSCLIB_DLL.windowsfont(startX, startY += 80, fontHeight, 0, fontStyle, 0, fontName, ttLabelInfo.MarkingNumber);

                    //Print labels
                    TSCLIB_DLL.printlabel("1", "1");
                    TSCLIB_DLL.closeport();

                    //LogManager.Debug("Print OK");
                    return(true);
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine("Print exception: " + ex.ToString());
                    LogManager.Debug("Print exception: " + ex.ToString());
                    return(false);
                }
            }
        }
示例#27
0
        private void price3825()
        {
            int select_count = dgv_malzeme.SelectedRows.Count;

            if (select_count > 0)
            {
                List <DataGridViewRow> rows =
                    (from DataGridViewRow row in dgv_malzeme.SelectedRows
                     where !row.IsNewRow
                     orderby row.Index
                     select row).ToList <DataGridViewRow>();
                string barcode;
                string ek_sutun;
                string item_code;
                string item_name;
                string printer_name = cmb_printer.Text;
                string label_count  = labelCount.Value.ToString();

                TSCLIB_DLL.openport(printer_name);
                TSCLIB_DLL.sendcommand("SIZE 38 mm, 25 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm, 0 mm");
                if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
                // byte[] result_utf8 = System.Text.Encoding.UTF8.GetBytes("TEXT 40,620,\"ARIAL.TTF\",0,12,12,\"utf8 test Wörter auf Deutsch\"");
                for (int i = 0; i < select_count; i++)
                {
                    barcode   = rows[i].Cells[3].Value.ToString();
                    ek_sutun  = rows[i].Cells[4].Value.ToString();
                    item_name = rows[i].Cells[2].Value.ToString();
                    item_code = rows[i].Cells[1].Value.ToString();

                    TSCLIB_DLL.clearbuffer();
                    TSCLIB_DLL.windowsfont(16, 0, 24, 0, 2, 0, "Century Gothic", CenterString(item_code, 30));
                    if (item_name.Length > 35)
                    {
                        TSCLIB_DLL.windowsfont(16, 20, 16, 0, 2, 0, "Century Gothic", CenterString(item_name.Substring(0, 35) + "-", 50));
                        TSCLIB_DLL.windowsfont(16, 32, 16, 0, 2, 0, "Century Gothic", CenterString(item_name.Substring(35, item_name.Length - 35), 50));
                    }
                    else
                    {
                        TSCLIB_DLL.windowsfont(16, 26, 16, 0, 2, 0, "Century Gothic", CenterString(item_name, 60));
                    }
                    if (radioButton1.Checked)
                    {
                        if (barcode.Length <= 5)
                        {
                            TSCLIB_DLL.barcode("80", "58", "128", "65", "0", "0", "2", "1", barcode);
                        }
                        else if (barcode.Length == 6)
                        {
                            TSCLIB_DLL.barcode("60", "58", "128", "65", "0", "0", "2", "1", barcode);
                        }
                        else if (barcode.Length == 7)
                        {
                            TSCLIB_DLL.barcode("58", "58", "128", "65", "0", "0", "2", "1", barcode);
                        }
                        else if (barcode.Length == 8)
                        {
                            TSCLIB_DLL.barcode("55", "58", "128", "65", "0", "0", "2", "1", barcode);
                        }
                        else if (barcode.Length == 9)
                        {
                            TSCLIB_DLL.barcode("20", "58", "128", "65", "0", "0", "2", "1", barcode);
                        }
                        else if (barcode.Length < 15)
                        {
                            TSCLIB_DLL.barcode("70", "58", "128", "65", "0", "0", "1", "1", barcode);
                        }
                        else if (barcode.Length < 18)
                        {
                            TSCLIB_DLL.barcode("58", "58", "128", "65", "0", "0", "1", "1", barcode);
                        }
                        else if (barcode.Length >= 18)
                        {
                            TSCLIB_DLL.barcode("25", "58", "128", "65", "0", "0", "1", "1", barcode);
                        }
                        TSCLIB_DLL.windowsfont(20, 130, 22, 0, 2, 0, "Century Gothic", CenterString(barcode, 40));
                        TSCLIB_DLL.windowsfont(20, 150, 22, 0, 2, 0, "Century Gothic", CenterString(ek_sutun, 30));
                    }
                    else
                    {
                        //TSCLIB_DLL.sendcommand("AZTEC 110, 50, 0, 7, 1, \"" + barcode + "\"");
                        TSCLIB_DLL.sendcommand("QRCODE 110, 50, Q, 5, A, 0 , M2, \"" + barcode + "\"");

                        TSCLIB_DLL.windowsfont(20, 155, 22, 0, 2, 0, "Century Gothic", CenterString(barcode, 40));
                        TSCLIB_DLL.windowsfont(20, 170, 22, 0, 2, 0, "Century Gothic", CenterString(ek_sutun, 35));
                    }
                    //BARCODE X,Y, "code type",height,human readable,rotation,narrow,wide,[alignment,] "content "

                    TSCLIB_DLL.printlabel("1", label_count);
                }
                TSCLIB_DLL.closeport();
            }
        }
示例#28
0
        /*
         * barcode - Arassa barcode bermeli 240001, 2500001
         * item_code - haryt kody
         * item_name - haryt ady
         * birim_code - adet, packa
         * label_count - print count, yazdyryljak etiket sany
         * birim - 100 adet, 10.5 M
         * ek_sutun - goshamaca name maglumat bermeli bolsa,
         * unit_length - mukar beriljek wagty nace sany edip bermeli 55- lik bolsa 5, 46 bolsa 6
         * dev - 1000 lukmi yada 1 likmi
         * kapak - egerde kapak adyny cykarmaly bolsa kapak adynyn yazyp ugratmaly
         * galyndy - 1 bolsa yazgy gornushi uytgeyar, 0 bolsa galyndy dal digini anlatyar
         */

        private void birimBarcodePrint(string barcode, string item_code, string item_name, string birim_code, int label_count, float birim, string ek_sutun, int unit_length, int dev, string kapak, int galyndy, int ribon)
        {
            TSCLIB_DLL.openport(printer);
            TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
            TSCLIB_DLL.sendcommand("SPEED 4");
            TSCLIB_DLL.sendcommand("GAP 3 mm, 0 mm");
            if (ribon == 1)
            {
                TSCLIB_DLL.sendcommand("SET RIBBON ON");
            }
            else
            {
                TSCLIB_DLL.sendcommand("SET RIBBON OFF");
            }

            TSCLIB_DLL.sendcommand("DENSITY 8");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("SET TEAR ON");
            TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

            if (birim != 1)
            {
                string nollar = "";
                for (int j = 0; j < (int)unit_length; j++)
                {
                    nollar += "0";
                }
                barcode += ((int)dev * (float)birim).ToString(nollar);
                barcode  = makeControl(barcode);
            }

            TSCLIB_DLL.clearbuffer();
            if (kapak != "")
            {
                //TSCLIB_DLL.sendcommand("TEXT 300, 60,\"2\",0,1,1,2,\"" + kapak + "\"");
                //TSCLIB_DLL.sendcommand("BOX 260, 45, 340, 100, 2");
                TSCLIB_DLL.windowsfont(300, 10, 17, 0, 2, 0, "Century Gothic", kapak);
            }
            TSCLIB_DLL.sendcommand("BOX 40, 45, 120, 100, 2");

            /*
             * TSCLIB_DLL.windowsfont(30, 40, 28, 0, 2, 0, "Century Gothic", CenterString(birim.ToString(), 9));
             * TSCLIB_DLL.windowsfont(30, 60, 20, 0, 2, 0, "Century Gothic", CenterString(birim_code, 14));
             * TSCLIB_DLL.windowsfont(30, 75, 17, 0, 2, 0, "Century Gothic", "GALYNDY");*/
            TSCLIB_DLL.sendcommand("TEXT 80, 50,\"2\",0,1,1,2,\"" + birim.ToString() + "\"");
            TSCLIB_DLL.sendcommand("TEXT 80, 70,\"2\",0,1,1,2,\"" + birim_code + "\"");
            // TSCLIB_DLL.sendcommand("TEXT 30, 70,\"1\",90,1,1,2,\"" + DateTime.Now.ToString("yy.MM.dd") + "\"");
            if (galyndy == 1)
            {
                TSCLIB_DLL.windowsfont(20, 105, 17, 90, 2, 0, "Century Gothic", DateTime.Now.ToString("dd.MM.yy HH:mm"));
            }


            TSCLIB_DLL.windowsfont(42, 10, 20, 0, 2, 0, "Century Gothic", item_code);
            TSCLIB_DLL.windowsfont(42, 25, 16, 0, 2, 0, "Century Gothic", item_name);
            TSCLIB_DLL.barcode("130", "43", "128", "40", "0", "0", "1.4", "1", barcode);
            TSCLIB_DLL.windowsfont(130, 83, 14, 0, 2, 0, "Century Gothic", barcode);
            TSCLIB_DLL.windowsfont(130, 95, 16, 0, 2, 0, "Century Gothic", ek_sutun);
            TSCLIB_DLL.printlabel("1", label_count.ToString());

            TSCLIB_DLL.closeport();
        }
示例#29
0
        /// <summary>
        /// 条码布局在下方
        /// </summary>
        /// <param name="m"></param>
        /// <param name="layout"></param>
        private void MixCode_ABPrint(InstrumentModel m)
        {
            // 设置标签 宽度、高度 等信息.
            // 宽 94mm  高 25mm
            // 速度为4
            // 字体浓度为8
            // 使用垂直間距感測器(gap sensor)
            // 两个标签之间的  间距为 3.5mm
            //TSCLIB_DLL.setup("35", "35", "1", "8", "1", "3.5", "0");
            // 清除缓冲信息
            TSCLIB_DLL.clearbuffer();
            // 发送 TSPL 指令.
            // 设置 打印的方向.
            TSCLIB_DLL.sendcommand("DIRECTION 0");
            string strP = "QRCODE 530,140,H,6,A,0,M2,S1,\"" + m.BarCode + "\"";

            TSCLIB_DLL.sendcommand(strP);
            TSCLIB_DLL.barcode("280", "7", "128", "65", "1", "0", "2", "2", m.BarCode);
            // 打印文本信息.
            // 在 (176, 16) 的坐标上
            // 字体高度为34
            // 旋转的角度为 0 度
            // 2 表示 粗体.
            // 文字没有下划线.
            // 字体为 黑体.
            // 打印的内容为:title
            //TSCLIB_DLL.barcode("280", "7", "128", "65", "1", "0", "2", "2", m.BarCode);
            //TSCLIB_DLL.windowsfont(340, 120, 23, 0, 2, 0, "宋体", "名称:" + m.InstrumentName);
            //TSCLIB_DLL.windowsfont(340, 160, 23, 0, 2, 0, "宋体", "仪器型号:" + m.Specification);
            //TSCLIB_DLL.windowsfont(340, 200, 23, 0, 2, 0, "宋体", "资产编号:" + m.AssetsNo);
            //TSCLIB_DLL.windowsfont(340, 240, 23, 0, 2, 0, "宋体", "出厂编号:" + m.SerialNo);
            //TSCLIB_DLL.windowsfont(340, 280, 23, 0, 2, 0, "宋体", "管理编号:" + m.ManageNo);
            int    Y    = 0;
            string name = m.InstrumentName;

            if (m.InstrumentName.Length > 10)
            {
                Y    = 40;
                name = m.InstrumentName.Substring(0, 10);
            }
            TSCLIB_DLL.windowsfont(200, 110, 23, 0, 2, 0, "宋体", "名称:" + name);
            if (m.InstrumentName.Length > 10)
            {
                TSCLIB_DLL.windowsfont(200, 110 + Y, 23, 0, 2, 0, "宋体", m.InstrumentName.Substring(10, m.InstrumentName.Length - 10));
            }
            TSCLIB_DLL.windowsfont(200, 140 + Y, 23, 0, 2, 0, "宋体", "仪器型号:" + m.Specification);
            TSCLIB_DLL.windowsfont(200, 170 + Y, 23, 0, 2, 0, "宋体", "资产编号:" + m.AssetsNo);
            TSCLIB_DLL.windowsfont(200, 200 + Y, 23, 0, 2, 0, "宋体", "出厂编号:" + m.SerialNo);
            TSCLIB_DLL.windowsfont(200, 230 + Y, 23, 0, 2, 0, "宋体", "管理编号:" + m.ManageNo);
            // 打印条码.
            // 在 (176, 66) 的坐标上
            // 以 Code39 的条码方式
            // 条码高度 130
            // 打印条码的同时,还打印条码的文本信息.
            // 旋转的角度为 0 度
            // 条码 宽 窄 比例因子为 7:12
            // 条码内容为:barCode
            //TSCLIB_DLL.barcode("176", "66", "39", "130", "1", "0", "7", "12", barCode);
            // 打印.
            TSCLIB_DLL.printlabel("1", "1");
            // 关闭 打印机 端口
            TSCLIB_DLL.closeport();
        }
示例#30
0
        public bool BarCodePrinting(long TemplateNo)
        {
            try
            {
                long PrintType;
                dBarCodeSetting = ObjFunction.GetDataView("Select PrinterName,ScriptData,NoOfColumn From MBarcodeTemplate Where PKSRNo=" + TemplateNo + "").Table;
                string strScript = dBarCodeSetting.Rows[0].ItemArray[1].ToString();
                strScript = strScript.Replace("\r", "");
                string[] str = new string[1];
                str[0] = "\n";
                // str[1] = "\"";
                PrintType = Convert.ToInt64(ObjFunction.GetAppSettings(AppSettings.O_BarCodePrintType));
                string[]         strLine     = strScript.Split(str, StringSplitOptions.None);
                int              HeaderIndex = 0;
                StringCollection strcollect  = new StringCollection();
                for (int j = 0; j < strLine.Length; j++)
                {
                    if (PrintType == BarcodePrinterType.TSC)
                    {
                        if (strLine[j].IndexOf("CLS") >= 0)
                        {
                            HeaderIndex = j;
                            break;
                        }
                        strcollect.Add(strLine[j]);
                    }
                    //else if (PrintType == BarcodePrinterType.Godex)
                    //{
                    //    if (strLine[j].IndexOf("Th:m:s") >= 0)
                    //    {
                    //        HeaderIndex = j;
                    //        break;
                    //    }
                    //}
                    //else if (PrintType == BarcodePrinterType.Argox)
                    //{
                    //    if (strLine[j].IndexOf("Th:m:s") >= 0)
                    //    {
                    //        HeaderIndex = j;
                    //        break;
                    //    }
                    //}
                }

                for (int i = 0; i < barcodeprintcollection.Count; i++)
                {
                    for (int j = HeaderIndex; j < strLine.Length; j++)
                    {
                        string rdline = strLine[j];
                        int    pos    = rdline.IndexOf("Var");
                        if (pos != -1)
                        {
                            string varName = "";
                            if (PrintType == BarcodePrinterType.TSC)
                            {
                                varName = rdline.Substring(pos + 3, (rdline.Length - 1) - (pos + 3)).Replace("\\", "");
                            }
                            else if (PrintType == BarcodePrinterType.Godex)
                            {
                                varName = rdline.Substring(pos + 3, (rdline.Length - 1) - (pos + 2)).Replace("\\", "");
                            }
                            else if (PrintType == BarcodePrinterType.Argox)
                            {
                                varName = rdline.Substring(pos + 3, (rdline.Length - 1) - (pos + 3)).Replace("\\", "");
                            }

                            if (varName.ToLower().Equals("barcode"))
                            {
                                rdline = rdline.Replace("VarBarcode", barcodeprintcollection[i].VarBarCode);
                            }
                            else if (varName.ToLower().Equals("barcodeno"))
                            {
                                rdline = rdline.Replace("VarBarcodeno", barcodeprintcollection[i].VarBarCode);
                            }
                            else if (varName.ToLower().Equals("firmname"))
                            {
                                rdline = rdline.Replace("VarFirmName", barcodeprintcollection[i].VarFirmName);
                            }
                            else if (varName.ToLower().Equals("mrp"))
                            {
                                rdline = rdline.Replace("VarMRP", barcodeprintcollection[i].VarMRP);
                            }
                            else if (varName.ToLower().Equals("rate"))
                            {
                                rdline = rdline.Replace("VarRate", barcodeprintcollection[i].VarRate);
                            }
                            else if (varName.ToLower().Equals("weight"))
                            {
                                rdline = rdline.Replace("VarWeight", barcodeprintcollection[i].VarWeight);
                            }
                            else if (varName.ToLower().Equals("brand"))
                            {
                                rdline = rdline.Replace("VarBrand", barcodeprintcollection[i].VarBrand);
                            }
                            else if (varName.ToLower().Equals("shortdesc"))
                            {
                                rdline = rdline.Replace("VarShortDesc", barcodeprintcollection[i].VarBrand + " " + barcodeprintcollection[i].VarShortDesc);
                            }
                            else if (varName.ToLower().Equals("packeddate"))
                            {
                                rdline = rdline.Replace("VarPackedDate", barcodeprintcollection[i].VarPackedDate);
                            }
                            else if (varName.ToLower().Equals("bestbefore"))
                            {
                                rdline = rdline.Replace("VarBestBefore", barcodeprintcollection[i].VarBestBefore);
                            }
                            else if (varName.ToLower().Equals("freetext1"))
                            {
                                rdline = rdline.Replace("VarFreeText1", barcodeprintcollection[i].VarFreeText1);
                            }
                            else if (varName.ToLower().Equals("freetext2"))
                            {
                                rdline = rdline.Replace("VarFreeText2", barcodeprintcollection[i].VarFreeText2);
                            }
                            else if (varName.ToLower().Equals("freetext3"))
                            {
                                rdline = rdline.Replace("VarFreeText3", barcodeprintcollection[i].VarFreeText3);
                            }
                            else if (varName.ToLower().Equals("freetext4"))
                            {
                                rdline = rdline.Replace("VarFreeText4", barcodeprintcollection[i].VarFreeText4);
                            }
                            else if (varName.ToLower().Equals("code"))
                            {
                                rdline = rdline.Replace("VarCode", barcodeprintcollection[i].VarCode);
                            }
                            else if (rdline.ToLower().IndexOf("varprint") > -1)
                            {
                                double tmp = Math.Ceiling(Convert.ToDouble(Convert.ToDouble(barcodeprintcollection[i].VarQuantity) / Convert.ToInt64(dBarCodeSetting.Rows[0].ItemArray[2].ToString())));
                                //tmp = Math.Floor(tmp);
                                //rdline = rdline.Replace("varPrint", barcodeprintcollection[i].VarQuantity.ToString());
                                rdline = rdline.Replace("VarPrint", tmp.ToString());
                            }
                        }
                        strcollect.Add(rdline);
                    }
                }
                if (PrintType == BarcodePrinterType.TSC)
                {
                    strcollect.Add(strLine[strLine.Length - 1]);
                }
                string strTemp = "";
                if (PrintType == BarcodePrinterType.TSC)
                {
                    TSCLIB_DLL.openport(dBarCodeSetting.Rows[0].ItemArray[0].ToString());
                    for (int i = 0; i < strcollect.Count; i++)
                    {
                        strTemp += strcollect[i].ToString() + Environment.NewLine;
                        TSCLIB_DLL.sendcommand(strcollect[i].ToString());
                    }
                    TSCLIB_DLL.closeport();
                }
                else if (PrintType == BarcodePrinterType.Godex)
                {
                    Godex_DLL.openport(dBarCodeSetting.Rows[0].ItemArray[0].ToString());
                    Godex_DLL.beginjob(100, 12, 4, 0, 3, 0);
                    for (int i = 0; i < strcollect.Count; i++)
                    {
                        strTemp += strcollect[i].ToString() + Environment.NewLine;
                        Godex_DLL.sendcommand(strcollect[i].ToString());
                    }
                    Godex_DLL.endjob();
                    Godex_DLL.closeport();
                }
                else if (PrintType == BarcodePrinterType.Argox)
                {
                    int    nLen, ret = 0, sw;
                    byte[] pbuf = new byte[128];
                    IntPtr ver;
                    System.Text.Encoding encAscII   = System.Text.Encoding.ASCII;
                    System.Text.Encoding encUnicode = System.Text.Encoding.Unicode;
                    // dll version.
                    ver = ArgoxDLL.A_Get_DLL_Version(0);
                    // search port.
                    nLen = ArgoxDLL.A_GetUSBBufferLen() + 1;

                    if (nLen > 1)
                    {
                        byte[] buf1, buf2;
                        int    len1 = 128, len2 = 128;
                        buf1 = new byte[len1];
                        buf2 = new byte[len2];
                        ArgoxDLL.A_EnumUSB(pbuf);
                        ArgoxDLL.A_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2);
                        sw = 1;
                        if (1 == sw)
                        {
                            ret = ArgoxDLL.A_CreatePrn(12, encAscII.GetString(buf2, 0, len2));// open usb.
                        }
                        else
                        {
                            ret = ArgoxDLL.A_CreateUSBPort(1);// must call A_GetUSBBufferLen() function fisrt.
                        }
                        if (0 != ret)
                        {
                        }
                        else
                        {
                            if (2 == sw)
                            {
                                //get printer status.
                                pbuf[0] = 0x01;
                                pbuf[1] = 0x46;
                                pbuf[2] = 0x0D;
                                pbuf[3] = 0x0A;
                                ArgoxDLL.A_WriteData(1, pbuf, 4);
                                ret = ArgoxDLL.A_ReadData(pbuf, 2, 1000);
                            }
                        }
                    }

                    if (0 != ret)
                    {
                        return(false);
                    }


                    // sample setting.
                    ArgoxDLL.A_Set_DebugDialog(1);
                    ArgoxDLL.A_Set_Unit('n');
                    ArgoxDLL.A_Set_Syssetting(1, 0, 0, 0, 0);
                    ArgoxDLL.A_Set_Darkness(8);
                    ArgoxDLL.A_Del_Graphic(1, "*"); // delete all picture.
                    ArgoxDLL.A_Clear_Memory();      // clear memory.
                    strTemp = "";
                    for (int i = 0; i < strcollect.Count; i++)
                    {
                        strTemp += strcollect[i].ToString() + Environment.NewLine;
                    }
                    //ArgoxDLL.A_WriteData(0, encAscII.GetBytes(strcollect[i].ToString()), strcollect[i].ToString().Length);
                    ArgoxDLL.A_WriteData(0, encAscII.GetBytes(strTemp), strTemp.Length);
                    // output.
                    ArgoxDLL.A_Print_Out(1, 1, 1, 1);// copy 2.

                    // close port.
                    ArgoxDLL.A_ClosePrn();
                }
                return(true);
            }
            catch (Exception e)
            {
                OMMessageBox.Show(e.Message, CommonFunctions.ErrorTitle);
                return(false);
            }
        }