[POS] Attempting to automatically open a cashdrawer - .net variable has not been instantianed

marcussulicmarcussulic Member Posts: 15
edited 2016-07-26 in NAV Three Tier
Hello Dynamics community!

My first steps into Nav 2016 and I'm getting an error.
I'm connecting a PC
HP RP7800 Retail System
with a cashdrawer
HP Standard Duty Cash Drawer (QT457AA)

I'm connecting the cashdrawer directly (without a receipt printer) and use a "RJ45 from drawer to RJ12 to the PC" cable.

POS Drivers from here and POS for .NET from here installed.

In the both packs there are test tools with which I succeed at opening the cashdrawer automatically.
The tools look somewhat like this on the 8 site from this PDF from the OPOS drivers pack
https://drive.google.com/open?id=0B5eop_-6tY07UGgzNG5RVXRtS2c

I have referenced a few DLLs from the .NET for POS Pack and activated the RunOnClient property on them.
My code in NAV
//PosDevice := PosExplorer.PosExplorer;
//PosCommon.
 //CashDrawer.
//PosCommon.Open();
// PosDevice.
// PosDrawer.OpenDrawer();
// PoSDrawer := PoSDrawer.OpenDrawer();
//PosExplorer. OpenDrawer();

 KassenFunktionen := KassenKlasse.OPOSCashDrawerClass;
 KassenFunktionen.Open('HP_CashDrawerPort-1');
 KassenFunktionen.DeviceEnabled := TRUE;
 KassenFunktionen.ClaimDevice(1000);
 KassenFunktionen.OpenDrawer;

PosDeviceCollection := PosExplorer.GetDevices('CashDrawer');
MESSAGE(PosDeviceCollection.ToString);
PosDeviceInfo := PosDeviceCollection.Item(1);
MESSAGE(PosDeviceInfo.ToString);

 PosDeviceInfo := PosExplorer.GetDevice('CashDrawer','HP_CashDrawerPort-1');
  check := PosDeviceInfo.IsDefault;
  MESSAGE(FORMAT(check));

 PosCommon := PosExplorer.CreateInstance(PosDeviceInfo);
 PosCommon.Open;
 MESSAGE(PosDevice.ToString);

 PoSDrawer.Open;
 PoSDrawer.Claim(10000);
 PoSDrawer.DeviceEnabled := TRUE;
 PoSDrawer.OpenDrawer;
 PoSDrawer.DeviceEnabled := FALSE;
 PoSDrawer.Release;
 PoSDrawer.Close 

//CashDrawer.Open;
//CashDrawer.Claim(10000);
//CashDrawer.DeviceEnabled := TRUE;
//CashDrawer.OpenDrawer;  
//CashDrawer.DeviceEnabled := FALSE;
//CashDrawer.Release;
//CashDrawer.Close;
// 
//

I just need a piece of code that opens the cashdrawer, the info checks etc arent essential.
Sorry, that there are too many comments. I copied the code as fast as I could and replicated some of it from memory. Didn't want to delete the wrong ones because I'm a newbie. No matter what I tried to change with the code it showed me errors.

The error looks like this:)
7043.Test01.JPG
I really have no idea
This doesnt help

I will try to answer everything as soon as I get to the code again.
Thanks in advance for the time wasted on me.

Comments

  • archer89archer89 Member Posts: 337
    TextToSpeech is not part of your code. did you miss something?
    KassenFunktionen := KassenKlasse.OPOSCashDrawerClass; seems not to be a ..net class, maybe an automation call.
    i such cases, i always develope the .net part of the code in visual studio (express), to test the part if it works in general.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • marcussulicmarcussulic Member Posts: 15
    edited 2016-07-26
    Sorry, I should have specified that it's not my error, buta similiar error found on the Internet.
    Here's mine:
    x1rgjathynvx.jpg
    It says "an instance of the following .NET variable could not be created, so I assumed it's the same as the error posted before, despite different wording.

    These are my locals from the drivers that I've installed:
    190mlrsn2fkq.jpg

    Sorry I don't really understand the concept it being an Automation call and not a class. I'll try to find some info on that.
    Meanwhile I'm quickly posting these screenshots to clear out some things.
    Using Win10 by the way.

    Thanks for the fast respond.
  • lhlDKlhlDK Member Posts: 11
    edited 2016-07-26
    My guess is that you only have copied your .net class into the client-addins and have declared the variable to run on the server.
  • marcussulicmarcussulic Member Posts: 15
    By copying, do you mean setting local variables or manually copying. The only thing I did was setting the Locals using DLLs that were installed with POS for .NET 1.14. They were put into GAC not by me but by the installer. Im just referencing them in NAV. Or at least I hope.
    Isn't it enough? I don't quite understand the distinction of Client and Server yet so sorry

  • lhlDKlhlDK Member Posts: 11
    edited 2016-07-27
    EDIT: I just read further up in the thread that you already did this so this is not helping then :-(
    Ok.
    If the .net dll's is gac'ed then i think you have to define the locals to run on the client:
    (Example using my own stuff)
    Click on the variable and show properties:
    ztc9ju2bmod8.png

    Change 'RunOnClient to 'Yes':
    9wztctl17wvx.png

Sign In or Register to comment.