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

marcussulic
Member Posts: 15
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
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:)

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.
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:)
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.
0
Comments
-
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/0 -
Sorry, I should have specified that it's not my error, buta similiar error found on the Internet.
Here's mine:
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:
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.0 -
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.0
-
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
0 -
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:
Change 'RunOnClient to 'Yes':
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions