【问题标题】:Printer error (EX_TIMEOUT) Epson TM-T88V-I with epson.ePOSBuilder打印机错误 (EX_TIMEOUT) Epson TM-T88V-I 与 epson.ePOSBuilder
【发布时间】:2014-02-27 17:39:42
【问题描述】:
  • 爱普生型号 TM-T88V-i。
  • 已连接到 LAN。
  • Ping 响应正常。
  • 打印状态表正常。
  • 我可以访问打印机配置页面。

    http://192.168.x.x/PrinterConfigurationPage/

  • 在配置页面 - 部分设备在打印机“local_printer”的测试打印按钮中引发错误,错误:“EX_TIMEOUT A time-out occurred”。

参考(ePOS-Print API/XML):
https://download.epson-biz.com/modules/community/index.php?content_subject=ePOS-Print%20API/XML

简单的测试网站:

打印.html

<script type="text/javascript" src="js/epos-print-3.0.0.js"></script>

代码

function printTest() {
    // open print dialog
    $('#print').dialog('open');

    //
    // build print data
    //

    // create print data builder object
    var builder = new epson.ePOSBuilder();

    builder.addText('Test Print\n');
    builder.addFeedLine(1);

    // append paper cutting
    builder.addCut();

    //
    // send print data
    //

    // create print object
    var url = 'http://192.168.x.x/cgi-bin/epos/service.cgi?devid=local_printer&timeout=6000';
    var epos = new epson.ePOSPrint(url);

    // register callback function
    epos.onreceive = function (res) {
        // close print dialog
        $('#print').dialog('close');
        // print failure
        if (!res.success) {
            // show error message
            $('#receive').dialog('open');
        }
    }

    // register callback function
    epos.onerror = function (err) {
        // close print dialog
        $('#print').dialog('close');
        // show error message
        $('#error').dialog('open');
    }

    // send
    epos.send(builder.toString());

}

对 service.cgi 的请求:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">
            <text>Test Print!!&#10;</text>
            <feed line="1"/>
            <cut/>
        </epos-print>
    </s:Body>
</s:Envelope>

响应:epson api 手册(状态:0x00000001 = TM 打印机没有响应)

<?xml version="1.0" encoding="UTF-8" ?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <response success="false" code="EX_TIMEOUT" status="1" xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print" /> 
    </soapenv:Body>
</soapenv:Envelope>

当我将服务 url 更改为其他设备时

var url = 'http://192.168.x.x/cgi-bin/epos/service.cgi?devid=other_printer&timeout=6000';

要求正确

Sucess="False" code="DeviceNotFound" status="0"

Windows 应用程序示例相同的响应:

Public Class Form1

    ' URL of ePOS-Print supported TM printer
    Private address As String = "http://192.168.x.x/cgi-bin/epos/service.cgi?devid=local_printer&timeout=10000"

    ' XML namespace
    Private soap As XNamespace = "http://schemas.xmlsoap.org/soap/envelope/"
    Private epos As XNamespace = "http://www.epson-pos.com/schemas/2011/03/epos-print"

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ' Create print document
        Dim req As XElement = _
            <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
                <s:Body>
                    <epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">
                        <text lang="en" smooth="true">Intelligent Printer&#10;</text>
                        <cut/>
                    </epos-print>
                </s:Body>
            </s:Envelope>

        ' Send print document
        Dim client As WebClient = New WebClient()
        client.Headers.Set("Content-Type", "text/xml; charset=utf-8")
        AddHandler client.UploadStringCompleted, AddressOf UploadStringCompletedEventHandler
        client.UploadStringAsync(New Uri(address, UriKind.Absolute), req.ToString())

    End Sub

    ' Receive response document
    Private Sub UploadStringCompletedEventHandler(sender As Object, e As UploadStringCompletedEventArgs)

        If (e.Error IsNot Nothing) Then
            MessageBox.Show(e.Error.Message)
        Else
            'Parse response document
            Dim res As XElement = XElement.Parse(e.Result)
            Dim c = From el In res.Descendants(epos + "response") Select el.Attribute("success")
            MessageBox.Show(c.First().Value)
        End If

    End Sub

End Class

【问题讨论】:

    标签: printing point-of-sale thermal-printer network-printers


    【解决方案1】:

    两种可能:

    您的打印机的设备 ID 不同于 local_printer - 检查配置页。

    或者ePOSPrint()函数不允许直接发送url。我在第一个测试页面上的内容(我现在正在为同一台打印机构建一个应用程序)看起来与你的不同:

    var epos = new epson.ePOSPrint();
    epos.address = 'http://192.168.0.1/cgi-bin/epos/services.cgi?devid=local_printer&timeout=6000';
    

    注意空的() 以及初始化后url是如何传递的。


    检查后,看起来我的其他一些测试代码确实像你一样将 url 作为参数提交给函数,所以我唯一的猜测是设备 id local_printer 不正确。

    【讨论】:

    • 但是我们如何获取设备 ID,因为在配置页面中没有类似 DeviceId 的东西?
    • 我无法再访问打印机,但我相信“local_printer”可能是打印机的原始名称(=设备 ID),所以我会从它开始。跨度>
    • #semmelbroesel 。我在上面发现了一些东西 某些打印机配置页不同。我有 TM82-I 有很多选择然后 TM-U220-B 和 TM-88V-i 。在配置页面我可以设置设备ID。 TM-82-I。
    猜你喜欢
    • 2018-12-25
    • 2018-10-11
    • 2012-07-31
    • 2012-05-16
    • 2015-01-30
    • 2016-07-23
    • 1970-01-01
    • 2018-04-23
    • 2014-08-21
    相关资源
    最近更新 更多