Cash drawer opening

Asked

Viewed 2,703 times

1

I’m trying to send a command to open my cash drawer automatically by my application, but no success so far. I contacted the manufacturer of the drawer and printer (Non fiscal) to Bematech and they indicated me a download with a dll that I have to use and an info file where I have some information that follow below...


Parameters: Command: STRING with the command you want to execute. Command Size: INTEGER with the size of the command that will be sent.

Example: Example in Visual Basic Command to Trigger Cash Drawer sComando = Chr( 27 ) + Chr( 118 ) + Chr( 140 ) iRetorno = Commandtx( sComando, Len( sComando )

// Example in Delphi // Command to Trigger Cash Drawer

Like := #27 + #118 + #140; iReturn := Commandtx( sComando, Length( sComando );

The return of this function is given through an integer value, where if the return is: 1 (a): Success. The function was executed smoothly.

0 (zero): Communication error.

But now I’m having trouble understanding the logic of how to send this command to the printer for it to open the drawer. I can send similar as I send the receipt print?

Example of how I print...

insira o código aqui
                //--------------------------------Impressão do recibo ---------------------------//
                // popular relatório
                var report = from p in _objListProduct
                             select p;

                var rpDepartament = new crSaleDepartament();
                rpDepartament.SetDataSource(report);


                rpDepartament.SetParameterValue("NameUser", _nameUser);
                rpDepartament.SetParameterValue("NameDepartament", 

                //impressão direta do .rpt sem conversão
                rpDepartament.PrintToPrinter(1, false, 0, 0);

1 answer

4


I got...

Class

[DllImport("MP2032.dll")]
public static extern int ComandoTX(String comando, int tComando);

Chamei no botão              

const int charCode = 27;
const int charCode2 = 118;
const int charCode3 = 140;
var specialChar = Convert.ToChar(charCode);
var specialChar2 = Convert.ToChar(charCode2);
var specialChar3 = Convert.ToChar(charCode3);
string cmdText = "" + specialChar + specialChar2 + specialChar3;
iRetorno = MP2032.ComandoTX(cmdText, cmdText.Length);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.