.net PrintNormal()问题“未初始化”

pbgvytdp  于 2022-11-26  发布在  .NET
关注(0)|答案(2)|浏览(146)

当前的C# POS.NET打印问题:
PrintNormal()引发异常= '未初始化'
CheckHealth =“未初始化”打印到Epson TM-T88 IV时出现“未初始化”异常
使用POS for .NET 1.12和Epson OPOS ADK for .NET(v1.11.9)服务对象成功打开、声明和设置PosPrinter的DeviceEnabled-true

问题在此PrintNormal()之后向打印机发送任何内容会导致抛出“未初始化”异常。Epson OPOS ADK附带的CheckHealth实用程序会导致完全相同的错误。使用PrintNormal(PrinterStation.Receipt时,异常为“未安装指定的工作站”。

打印机打印精细使用直接并行打印机本身打印
我们怎么能不抛出消息-“它没有初始化”的豁免?

void K8POSPrint()
{
    /// <summary>
    /// PosPrinter object
    /// </summary>
    PosPrinter m_Printer = null;
    try
    {
        //Use a Logical Device Name which has been set on the SetupPOS.
        string strLogicalName = "PosPrinter";
        try
        {
            //Create PosExplorer
            PosExplorer posExplorer = new PosExplorer();
            DeviceInfo deviceInfo = null;

            try
            {
                // Device Info is not null when the printer has the logical name
                deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
                m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
            }
            catch (Exception ExDevice)
            {
            }

            //Open the device
            m_Printer.Open();
            //Get the exclusive control right for the opened device. Then the device is disable from other application.
            m_Printer.Claim(1000);
            //Enable the device.
            m_Printer.DeviceEnabled = true;
            //    ////CheckHealth.
            //m_Printer.CheckHealth(Microsoft.PointOfService.HealthCheckLevel.Interactive);
            //    //As using the PrintNormal method, send strings to a printer, and print it [\n] is the standard code for starting a new line.
            /// Current Issue Next Line thows an exception - 'It is not initialized' 
            m_Printer.PrintNormal(PrinterStation.Receipt, "Hey Now OPOS for .NET\n");
            // the next line would throw the exception 'The specified station is not mounted.'
            // m_Printer.PrintNormal(PrinterStation.Slip,"Hey Now Slip OPOS.NET\n");
        }
        catch (PosControlException)
        {

        }
    }
    catch (Exception ex)
    {

    }
}

其他信息:尝试在pos打印机上打印时安装的程序包括:
1.已安装APD 4打印机驱动程序Epson TI 88 IV
APD_412EWM.exe
https://www.epsonexpert.com/ee/techRes/index.htm?ProductId=570
在控制面板打印机中进行此设置后,我可以选择打印机的属性并成功地将测试打印到打印机。
2.已安装Microsoft POS.NET 1.12
用于. NET的POS.msi http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eaae202a-0fcc-406a-8fde-35713d7841ca
3.已安装爱普生OPOS ADK v2.67
ADK267ER4.exe
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
4.已安装用于.NET的爱普生OPOS ADK 1.11.8
OPOSN 1 11 18.exe文件
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
5.已安装的OPOS公共控制对象1.13.001
OPOS_CCOs_1.13.001.msi
http://monroecs.com/oposccos_current.htm
6. SetupPOS -添加的设备和逻辑名称
7.检查运行状况仍抛出错误:未初始化OPOS_E_ILLEGAL 10007(0x 00002717)

rkue9o1l

rkue9o1l1#

问题可能不是软件,而是硬件。我看到了类似的问题(在http://social.msdn.microsoft.com/Forums/vstudio/en-US/446fd4cc-db6b-4822-b3c8-7d9a98bf7eb4/it-is-not-initialized-when-trying-to-printnormal?forum=posfordotnet),开发人员使用的是非并行的延长电缆。当他将并行电缆直接连接到打印机时(没有延长线),他的软件工作了。这是在他打电话给爱普生订购了一台较新的打印机之后,因为他们告诉他原来的打印机与.NET不兼容,所以这也可能是您的问题。

xmjla07d

xmjla07d2#

我在全新的Epson TM-T88 VI上遇到了同样的错误“It is not initialized”(未初始化)。打印机附带IDN卡,默认情况下以太网卡部分阻塞。您可以使用以太网卡连接到“Epson Net Config”,但当您尝试使用OPOS ADK for NET打印时,以太网卡不工作。解决方法是将IDN卡上的开关设置为:
| DS 1系统|DS 2系统|DS 3系统|DS 4系统|DS5系统|DS6系统|DS 7系统|
| - -|- -|- -|- -|- -|- -|- -|
| 关闭|关闭|关闭|关闭|开启|开启|开启|
更换开关时,确保关闭电源。

相关问题