2010-10-22 12 views
7

corrente C# POS.NET stampa Problema:PrintNormal() Edizione 'Non è inizializzata'

PrintNormal() genera un'eccezione = 'Non è inizializzato'
CheckHealth = 'Non è inizializzato' 'Non è inizializzato eccezione', quando la stampa di Epson TM-T88IV

Utilizzando POS for .NET 1.12 e l'EPSON OPOS ADK for .NET (v1.11.9) servizio-oggetti successo in grado di aprire, rivendicazione e impostare il DeviceEnabled-vero per PosPrinter

Numero invio di qualsiasi cosa alla stampante dopo questo PrintNormal() genera un'eccezione 'Non è inizializzato' generata. L'utility CheckHealth fornita con Epson OPOS ADK genera esattamente lo stesso errore. Quando si utilizza PrintNormal (PrinterStation.Receipt l'eccezione è 'La stazione specificata non è montato "

stampante stampa benissimo using diretta stampante parallela si stamperà

Come non buttare l'esenzione con il messaggio -. 'E ' non è inizializzata '

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) 
    { 

    } 
} 

Informazioni aggiuntive:? programmi installati durante il tentativo di stampare sulla stampante POS sono:
1. installata APD4 driver della stampante Epson TI88IV
APD_412EWM.exe
https://www.epsonexpert.com/ee/techRes/index.htm?ProductId=570
Dopo questo set in Pannello di controllo Stampanti posso selezionare le proprietà della stampante & stampa un test per la stampante con successo.
2. installato Microsoft POS.NET 1.12
POSfor.NET.msi http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eaae202a-0fcc-406a-8fde-35713d7841ca
3. Installato Epson OPOS ADK V2.67
ADK267ER4.exe
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
4. Installato EPSON OPOS ADK per. NET 1.11.8
OPOSN 1 11 18.exe
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
5. installato OPOS Common Control Oggetti 1.13.001
OPOS_CCOs_1.13.001.msi
http://monroecs.com/oposccos_current.htm
6. SetupPOS - dispositivo & nome logico aggiunti
7. stato di salute getta ancora gli errori Non è inizializzato OPOS_E_ILLEGAL 10007 (0x00002717)

+1

Penso che il tuo tentativo di annidamento sia il problema, qui non trovi il vero problema. Prova a rimuovere alcuni dei codici di cattura Try e ne lasci solo uno. Quindi vedrai qual è il vero problema. – Rumplin

+0

Avete una stampante OPOS denominata PosPrinter? È possibile controllare il registro sotto HKEY_LOCAL_MACHINE \ SOFTWARE \ OLEforRetail \ ServiceOPOS \ PosPrinter', dovrebbe essere presente una sottochiave denominata 'PosPrinter'. La configurazione della stampante in Windows in Stampanti e Dispositivi, se si tenta di rimuovere? Da quello che ricordo se la stampante è installata in Windows, non funzionerà sempre in OPOS. – Re0sless

risposta

0

Il problema potrebbe non essere software, ma hardware. Ho visto una domanda simile (http://social.msdn.microsoft.com/Forums/vstudio/en-US/446fd4cc-db6b-4822-b3c8-7d9a98bf7eb4/it-is-not-initialized-when-trying-to-printnormal?forum=posfordotnet), in cui lo sviluppatore utilizzava un cavo di estensione che non era parallelo. Non appena ha collegato il cavo parallelo direttamente alla stampante (senza il cavo di prolunga), il suo software ha funzionato. Questo è stato dopo che ha chiamato Epson e ha ordinato una stampante più recente, perché gli hanno detto che la sua stampante originale non era compatibile con .NET, quindi potrebbe anche essere il tuo problema.

Problemi correlati