我正在尝试编写一个概念验证应用程序(以便我理解代码),演示如何打印到收据打印机并打开现金抽屉。
打印机可以很好地从软件中获得打印任务,但是我在现金抽屉中没有运气。所以我打印了一个设备列表:
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft Msr Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft Keylock Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft Scanner Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft CashDrawer Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft CheckScanner Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft LineDisplay Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft PinPad Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft PosPrinter Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Microsoft PosKeyboard Simulator
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : Example Scanner
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
-Logical Names
Service Object Name : ExampleMsr
Service Object Version : 1.14.1.0
-Device
+Device
Device Hardware Id :
Device Hardware Description :
Device Hardware Path :
+Logical Names
rp-600 printer
-Logical Names
Service Object Name : RP-600_USB
Service Object Version : 0.0
-Device
大多数是。net模拟器之类的POS,但RP-600_USB
设备是我的打印机。我的现金抽屉根本没有出现在清单上。
现金抽屉通过RJ11连接器连接到打印机。打印机通过USB连接到pc -那么现金抽屉在哪里,为什么没有出现在任何地方?
通过RJ11连接器连接到打印机的现金抽屉不会像打印机或扫描仪那样显示为"设备"。
在你的代码中,对现金抽屉的引用可能是一个独立于打印机的USB现金抽屉。
您将向打印机发送打印作业,说明"打开现金抽屉"。根据打印机的型号和接口将决定您需要什么代码。
打开抽屉代码列表
有一个列表,但最好的情况是找到打印机的手册,告诉你使用了哪些代码。
当现金抽屉关闭时,它就被锁上了,准备打开。它只是在等待打印机的脉冲来释放控制"账单托盘"和弹簧的杠杆。
每个现金抽屉的电缆可以不同,但一般使用4根电线。24v,抽屉打开,开/关信号,接地。如果你用的是12V的抽屉,24V也可以是12V的。如果您使用的是标准热敏打印机(例如爱普生TM88),则这些打印机使用24V电源,并且只能打开24V抽屉。12V抽屉通常连接到POS(销售点)站,该站由12V供电,而不是24V。
我现在在前面的POS程序,使用这个代码发送给打印机打开抽屉。
27112, 0, 50200256256256256256
许多热敏打印机使用爱普生接口。明星,Citizen打印机确实使用自己的接口,但大多数打印机都有将其更改为爱普生接口的设置。我以前用过RP-600,非常确信它们是默认的爱普生接口。
不是所有的爱普生代码都可以在打印机上工作,但通常是基本的命令:切纸打印条码打开抽屉…
这样的事情会起作用。
TLDR;
要打开现金抽屉,向打印机发送打印作业。打印机将该作业视为"打开现金抽屉"作业,并向现金抽屉发送信号。
希望对你有帮助。
如果您使用合作伙伴技术提供的OPOS实用程序设置在这里,您可以设置您的OPOS打印机和现金抽屉,并给它一个逻辑设备名称。然后你可以使用微软POS库做一些简单的事情,如
DeviceInfo myDevice;
CashDrawer _myCashDrawer;
PosExplorer posExplorer = new PosExplorer();
myDevice = posExplorer.GetDevice("CashDrawer", "Drawer Logical Name Given");
_myCashDrawer = (CashDrawer)posExplorer.CreateInstance(myDevice);
_myCashDrawer.Open();
_myCashDrawer.Claim(1000);
_myCashDrawer.DeviceEnabled = true;
_myCashDrawer.OpenDrawer();
_myCashDrawer.DeviceEnabled = false;
_myCashDrawer.Release();
_myCashDrawer.Close();
,因此您跳过了使用特定代码来打开抽屉并为其添加额外代码的需要。每个制造商都有自己的OPOS实用程序设置,其过程完全相同。不幸的是,我还没有找到一个"通用"的实用程序,因为每个程序只识别自己品牌的打印机。