Honeywell 智能脱机打印(SmartSystem Printer)

news/2025/2/12 7:42:42/

条码打印机智能脱机打印

  • 使用BCC中国定制条码打印机
    • 打印机指令
    • 打印机底层是运行在Unix系统上的
    • 操作步骤
    • 图片
    • 代码Demo

使用BCC中国定制条码打印机

BCC打印机 PM42 PM43打印机

打印机指令

打印机指令罗列一下:

  1. Honeywell 打印机 ,FP,DP,DPL指令;
  2. ZEBRA打印机 ZPL||,EPL,CPCL指令;
  3. ESPON打印机 ESC-POS指令 ;
  4. TSC打印机 TSPL指令 ;

各厂家打印机指令各有千秋。

打印机底层是运行在Unix系统上的

操作步骤

  1. 环境搭建
    Windows开启程序功能—>Telnet Client 功能

  2. 打开DOS系统 Win+R输入命令cmd
    telnet 192.168.0.120 网线连接打印机 打印机IP地址192.168.0.120
    login输入:user
    $ 输入:busybox
    再次输入:Mono apps/HelloWorld.exe

  3. 在VS2017中生成事件—后期生成事件命令行(C:\SmartPrinting\Utils\FtpPut.exe ( T a r g e t F i l e N a m e ) f t p : / / 192.168.1.10 / a p p s / (TargetFileName) ftp://192.168.1.10/apps/ (TargetFileName)ftp://192.168.1.10/apps/(TargetFileName) user pass)。

    1. FileZilla ftp文件软件可以查看打印机的系统文件 字体Font C#程序apps等等。

图片

WINDOWS开启Telnet客户端

连接打印机的图片:
连接打印机
VS2017生成事件的图片
在这里插入图片描述:

代码Demo

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.IO;
using System.Xml.Serialization;
using Intermec.Printer;

namespace HoneywellPrinterDemo
{
class Program
{
static UI.Canvas canvas;
static UI.Canvas.Timer timer;
static UI.Keypad keypad;
static Communication.Autohunt autohunt;

    static string ReadData = "";static int num = 0;static Color white = new Color(255, 255, 255, 255);static Color black = new Color(0, 0, 0, 255);static UI.Canvas.Text varTextL1;    //UI 第一行static UI.Canvas.Text varTextL2;    //UI 第二行static UI.Canvas.Text varTextL3;    //UI 第三行static void Main(string[] args){Console.WriteLine("HelloWorld Application is running V1.1.4!");     //Telnet 上显示canvas = new UI.Canvas();canvas.Clear();UI.Canvas.Rectangle bg = new UI.Canvas.Rectangle(0, 0, canvas.Width,canvas.Height, black);    //画背景图canvas += bg;UI.Canvas.Text titleText = new UI.Canvas.Text(5, 0, "Honeywell 中国", "MHeiGB18030C-Medium", 30, white);//UI第一行标题canvas += titleText;varTextL1 = new UI.Canvas.Text(5, 40, "请扫描条码!", "MHeiGB18030C-Medium", 26, white);//UI 第一行文字canvas += varTextL1;varTextL2 = new UI.Canvas.Text(5, 70, "", "MHeiGB18030C-Medium", 26, white);//UI 第二行文字canvas += varTextL2;varTextL3 = new UI.Canvas.Text(5, 100, "", "MHeiGB18030C-Medium", 26, white);//UI 第三行文字canvas += varTextL3;//140UI.Canvas.Text varTextFeed = new UI.Canvas.Text(5, 170, "按确认键测试认纸", "MHeiGB18030C-Medium", 26, white);canvas += varTextFeed;//170UI.Canvas.Text varTextExit = new UI.Canvas.Text(5, 200, "按返回键退出智能打印程序", "MHeiGB18030C-Medium", 26, white);canvas += varTextExit;//Autohunt  自动绑定USB和串口autohunt = new Communication.Autohunt();string[] usbPortNames = Communication.USBHost.GetPortNames();foreach (string usbPortName in usbPortNames){Communication.USBHost usbHost =new Communication.USBHost(usbPortName);usbHost.Open();if (usbHost.IsOpen){autohunt.AddStream(usbHost.GetStream());Console.WriteLine("Added: " + usbPortName);}}// Add Serial ports to autohuntstring[] serialPortNames = Communication.SerialPort.GetPortNames();foreach (string serialPortName in serialPortNames){Communication.SerialPort serialPort =new Communication.SerialPort(serialPortName);serialPort.Open();serialPort.BaudRate = 115200;           //串口参数,可以调整serialPort.Encoding = System.Text.Encoding.UTF8;serialPort.Parity = System.IO.Ports.Parity.None;serialPort.StopBits = System.IO.Ports.StopBits.One;serialPort.DataBits = 8;serialPort.Handshake = System.IO.Ports.Handshake.None;autohunt.AddStream(serialPort.BaseStream);Console.WriteLine("Added: " + serialPortName);   //Telnet上显示}keypad = new UI.Keypad();       //键盘事件keypad.KeyUp += new UI.Keypad.KeyEventHandler(KeyHandlerUp);    //键盘事件timer = new UI.Canvas.Timer();      //定时器timer.Interval = 500;               //刷新间隔500mstimer.Tick += new UI.Canvas.TimerEventHandler(GetData);timer.Start();canvas.Run();timer.Enabled = false;keypad.Dispose();autohunt.Dispose();canvas.Refresh();canvas.Exit();canvas.Dispose();}public static void KeyHandlerUp(Object o, UI.Keypad.KeyEventArgs eventArgs)  //按键事件{int keycode;keycode = eventArgs.KeyChar;// Output on consoleConsole.WriteLine("Key code: " + keycode.ToString());if (keycode == 9)    //返回键{timer.Enabled = false;timer.Stop();varTextL1.Data = "程序正在退出";  //更新UI第一行varTextL2.Data = "请耐心等待!";  //更新UI第二行varTextL3.Data = "";                //更新UI第三行canvas.Exit();canvas.Dispose();}if (keycode == 11)  //走纸{Feed(1);}if (keycode == 10){Feed(2);}}public static void GetData(Object obj, UI.Canvas.TimerEventArgs eventArgs)  //获取USB/串口数据{timer.Stop();string tempL1, tempL2, tempL3, tempL4;int i;Byte[] bytes = new Byte[256];if ((i = autohunt.Read(bytes, 0, bytes.Length)) > 0){string data = System.Text.Encoding.UTF8.GetString(bytes, 0, i);// Console.WriteLine("ReadData Value : {0}", data);Console.WriteLine("Begin read {0} bytes: {1}", data.Length, data);//data.IndexOf("\n") > 0  || data.IndexOf("\r") > 0 ||if (data.IndexOf("\n") > 0 || data.IndexOf("\r") > 0){data = ReadData + data;        //将USB串口数据存储为data//  data = data.Replace("\n", "");//删除回车//data =data.Replace("\r", "");//删除换行 chinaautoid.comReadData = "";Console.WriteLine("read {0} bytes: {1}", data.Length, data);varTextL1.Data = "扫描到数据:";  //更新UI第一行if (data.Length > 20)              //如果扫描数据> 20{varTextL2.Data = data.Substring(0, 20);      //分2行显示,截取前20位varTextL3.Data = data.Substring(20, data.Length - 20);}else{                               //如果扫描数据< 20varTextL2.Data = data;varTextL3.Data = "";}Console.WriteLine("Print Function!");if (data.Length == 14){PrintLabelType1(data);          //打印第一种标签}else{PrintLabelType2();}canvas.Refresh();           //刷新UI}else{Console.WriteLine("NOCR read {0} bytes: {1}", data.Length, data);ReadData += data;}}timer.Start();}private static void Feed(int FeedType){PrintControl printControl = new PrintControl();State state = State.NoError;if (FeedType == 1){state = printControl.FormFeed();}if (FeedType == 2){state = printControl.TestFeed();}if (state == State.NoError){Console.WriteLine("Feed 1 label");}printControl.Dispose();}private static void PrintLabelType1(string data){Console.WriteLine("In Print 1 Function");PrintControl printControl = new PrintControl();Drawing drawing = new Drawing();drawing.Clear();//清空画图Console.WriteLine(data);// Status status = new Status();// State state = status.GetState();State state = State.NoError;num++;Drawing.Text text = new Drawing.Text();text.CharacterEncoding = CharacterEncoding.UTF8;text.Point = new Point(100, 150);        //打印文字的X,Ytext.Data = "脱机打印SmartSystem"+num.ToString();                   //文字内容text.Height = 12;                       //文字高度text.FontName = "MHeiGB18030C-Medium"; //字体高度drawing += text;Drawing.Barcode barc = new Drawing.Barcode(120, 50, "CODE128", data);    //Code128,X,Y位置,条码内容barc.Height = 40;       //条码高度barc.Text.Enabled = true;   //人眼可识别文字开启barc.Text.FontName = "Univers";     //字体名barc.BarWidthWide = 3;barc.BarWidthNarrow = 1;barc.WidthMagnification = 1;drawing += barc;state = printControl.PrintFeed(drawing, 1); //打印一张if (state != State.NoError){Console.WriteLine("PrintFeed failed: {0}", state.ToString());}Console.WriteLine("Exit");printControl.Dispose();drawing.Dispose();}private static void PrintLabelType2(){Console.WriteLine("In Print 1 Function");PrintControl printControl = new PrintControl();Drawing drawing = new Drawing();drawing.Clear();//清空画图// Status status = new Status();// State state = status.GetState();State state = State.NoError;Drawing.Text text = new Drawing.Text();text.CharacterEncoding = CharacterEncoding.UTF8;text.Point = new Point(100, 150);        //打印文字的X,Ytext.Data = "Error";                   //文字内容text.Height = 12;                       //文字高度text.FontName = "MHeiGB18030C-Medium"; //字体高度drawing += text;Drawing.Text text1 = new Drawing.Text();text1.CharacterEncoding = CharacterEncoding.UTF8;text1.Point = new Point(100, 170);        //打印文字的X,Ytext1.Data = "Honeyewll";                   //文字内容text1.Height = 12;                       //文字高度text1.FontName = "MHeiGB18030C-Medium"; //字体高度drawing += text1;state = printControl.PrintFeed(drawing, 1); //打印一张if (state != State.NoError){Console.WriteLine("PrintFeed failed: {0}", state.ToString());}Console.WriteLine("Exit");printControl.Dispose();drawing.Dispose();}private static void PrintLabelType3(string data){Console.WriteLine("In Print 2 Function");PrintControl printControl = new PrintControl();Drawing drawing = new Drawing();drawing.Clear();//清空画图//Status status = new Status();// State state = status.GetState();State state = State.NoError;//Console.WriteLine("Printer State: {0}", state.ToString());Drawing.Text text = new Drawing.Text();text.Point = new Point(150, 30);        //打印文字的X,Ytext.Data = data;                      //文字内容text.Height = 12;                       //文字高度text.FontName = "MHeiGB18030C-Medium"; //字体高度drawing += text;state = printControl.PrintFeed(drawing, 1);if (state != State.NoError){Console.WriteLine("PrintFeed failed: {0}", state.ToString());}Console.WriteLine("Exit");printControl.Dispose();drawing.Dispose();}
}

}


http://www.ppmy.cn/news/539379.html

相关文章

Honeywell EPKS R5XX 系统装机及配置手册

Document Name Honeywell EPKS R5XX系统装机及配置手册 Version 01 Date April 30, 2022 Reference Standard Operating Procedure 1 介绍 本文档根据 Honeywell 标准手册的内容进行整理、精简…

Linux入侵检测病毒清理流程

Linux入侵检测病毒清理流程 1.前言&#xff1a; 根据阿里云快讯病毒公布&#xff1a; Redis RCE导致h2Miner蠕虫病毒&#xff0c;其利用Redis未授权或弱口令作为入口&#xff0c;使用主从同步的方式从恶意服务器上同步恶意module&#xff0c;之后在目标机器上加载此恶意modul…

java和c制作游戏软件,游戏软件制作,游戏软件制作入门教程

游戏软件制作&#xff0c;游戏软件制作入门教程 来源&#xff1a;互联网/编辑&#xff1a;佚名/时间&#xff1a;2020-08-29 在手机上看 扫一扫进入手机端 如何制作单机游戏软件 制作单机游戏软件&#xff1f;这个就多了&#xff0c;绘图软件、3D制作软件、动画制作软件、数据库…

计算机制作游戏,怎么制作游戏?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 游戏从诞生起就受到了人们的喜爱&#xff0c;从单机游戏到网络游戏&#xff0c;从PC游戏到移动游戏&#xff0c;游戏陪人们度过了一个又一个难熬的碎片时间&#xff0c;成为人们生活中不可或缺的一部分。而如何制作一个游戏&#…

游戏策划的软件与工具

游戏策划的软件与工具 UXplayer https://www.jianshu.com/p/ceddde705933 gongjutitle.png 本文修改自前公司的一份交接文档&#xff0c;分享了工作中一些常用的软件。 Axure 界面示意图/流程图制作软件 大前提&#xff1a;Windows系统、无法直连外网 Mac系统的话&#xff0c;…

你想制作一款属于自己的游戏吗?

&#x1f482; 个人网站:【海拥】【摸鱼游戏】【神级源码资源网站】&#x1f91f; 前端学习课程&#xff1a;&#x1f449;【28个案例趣学前端】【400个JS面试题】&#x1f485; 想寻找共同学习交流、摸鱼划水的小伙伴&#xff0c;请点击【摸鱼学习交流群】&#x1f4ac; 免费且…

如何开发一款游戏:游戏开发流程及所需工具

本文来自作者 goto先生 在 GitChat 上分享 「如何开发一款游戏&#xff1a;游戏开发流程及所需工具」 编辑 | 哈比 游戏作为娱乐生活的一个方面&#xff0c;参与其中的人越来越多&#xff0c;而大部分参与其中的人都是以玩家的身份。 他们热爱一款游戏&#xff0c;或是被游戏的…

游戏制作

在软件开发中&#xff0c;游戏开发这个方向看起来目标很明确&#xff0c;但其实是个领域很广的方向&#xff0c;入门的时候如果得不到指点一二&#xff0c;很容易误入歧途&#xff0c;相反&#xff0c;如果走这条路之前能得到前人的一些指路&#xff0c;是可以事半功倍的。 平…