爱普生TM-T88V打印机抽屉踢 [英] Epson TM-T88V printer drawer kick

查看:134
本文介绍了爱普生TM-T88V打印机抽屉踢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个现金抽屉的详细信息如下:



Hi,
I have a Cash Drawer details as below :

引用:

型号:D41SRB

SKU:D41SRB

电子现金抽屉黑色16,

Roller,24V爱普生STD RJ11,不锈钢正面

5比尔/ 5硬币

1毫米精钢表壳

表壳顶部有两个额外的支架,增加耐用性

Model: D41SRB
SKU: D41SRB
Electronic Cash Drawer Black 16",
Roller, 24V Epson STD RJ11, Stainless front
5 Bill/5 Coin
1mm steel case
Two extra brackets inside top of case for added durability





连接到



It is connected to

引用:

EPSON TM-T88V收据

EPSON TM-T88V Receipt

通过RJ11插入打印机。

如何在销售时从我的C#POS应用程序中打开此抽屉。我打印机从打印机首选项中检查抽屉打印后打开工作正常。



我尝试了什么:



我尝试编写代码这里它给了我错误端口关闭。所以我改为:

via RJ11 plugged into Printer.
How can I open this drawer from my C# POS application when sale is made. I checked drawer from Printer Preference to open after printing it works fine.

What I have tried:

I tried writing code as stated HERE It gave me error port is closed . So I changed it to :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
namespace cashdrawertest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private SerialPort serialPort1 = new SerialPort();

        public void OpenPort()
        {
            //serialPort1.PortName = "COM1";
            serialPort1.PortName = "ESDPRT001";
            serialPort1.Encoding = Encoding.ASCII;
            serialPort1.BaudRate = 38400;
            serialPort1.Parity = System.IO.Ports.Parity.None;
            serialPort1.DataBits = 8;
            serialPort1.StopBits = System.IO.Ports.StopBits.One;
            serialPort1.DtrEnable = true;
            try
            {
                serialPort1.Open();
            }
            catch (Exception ex)
            {
                serialPort1.Close();
                serialPort1.Open();
            }
//            serialPort1.Open();
        }

        public void InitializePrinter()
        {
            serialPort1.Write(Char.ConvertFromUtf32(27) + char.ConvertFromUtf32(64));
        }

        public void OpenDrawer()
        {
            serialPort1.Write(char.ConvertFromUtf32(27) +
               char.ConvertFromUtf32(112) +
               char.ConvertFromUtf32(0) +
               char.ConvertFromUtf32(5) +
               char.ConvertFromUtf32(5));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            OpenDrawer();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            serialPort1.PortName = "COM1";
            //serialPort1.PortName = "ESDPRT001";
            serialPort1.Encoding = Encoding.ASCII;
            serialPort1.BaudRate = 38400;
            serialPort1.Parity = System.IO.Ports.Parity.None;
            serialPort1.DataBits = 8;
            serialPort1.StopBits = System.IO.Ports.StopBits.One;
            serialPort1.DtrEnable = true;
            try
            {
                serialPort1.Open();
            }
            catch (Exception ex)
            {
                serialPort1.Close();
                serialPort1.Open();
            }
        }
    }
}





我在打印机属性下检查了端口有ESDPRT001用于



I checked Port under printer properties it has ESDPRT001 for

引用:

EPSON TM-T88V收据

EPSON TM-T88V Receipt





同样,它说同样的东西是封闭的。所以请帮忙。谢谢



Again it says same thing Port is Closed. So please help. Thanks

推荐答案

OpenDrawer 方法的第一行放置一个断点,然后在调试器中运行你的应用程序。断点被击中时检查SerialPort对象的状况。



但是......两件事:

1)复制代码时从互联网上随机选择,考虑你在做什么是个好主意 - 你没有这样做,或者你不会在加载中重复相同的代码事件处理程序和您从未调用的 OpenPort 方法。

2)当您从Internet复制代码时,您可能希望将其全部复制 - 并在某个时候调用 InitializePrinter 方法。

3)当你从互联网上复制代码时,考虑它并考虑它是一个非常好的主意。检查您尝试使用的COM端口实际上是否适合您的打印机 - COM1可能不是正确的端口。在开始编写代码之前,始终使用终端程序(如HyperTerminal)证明通信,以确保在添加另一层混淆之前一切正常。



该代码是......呃......很穷我知道,我知道 - 你没有写。但如果它无法打开,只需再试一次是一种做任何事情的糟糕方式......
Put a breakpoint on the first line in your OpenDrawer method, and run your app in the debugger. Check the condition of the SerialPort object when the breakpoint gets hit.

But ... two things:
1) When you copy code at random from the internet, it's a good idea to think about what you are doing - you aren't doing that or you wouldn't have the same code repeated in your Load event handler and your OpenPort method that you never call.
2) When you copy code from the internet, you might want to copy it all - and call the InitializePrinter method at some point.
3) When you copy code from the internet, it's a very good idea to think about it and check that the COM port you are trying to use is in fact the right one for your printer - COM1 may not be the right port. Always prove communications using a terminal program such as HyperTerminal before you even start to write code to make sure that everything is working before adding another layer of confusion.

That code is ... um ... poor. I know, I know - you didn't write it. But "if it fails to open, just try again" is a poor way to do anything ...


这篇关于爱普生TM-T88V打印机抽屉踢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆