This article describes how to configure the Serial Number handler at the WATS Client dynamically using the API.
First, download and install the WATS client (download.wats.com).
See Also:
Configure Serial Number handler at the WATS Client
Get Serial number or MAC address using the WATS Client
NOTE: The parameters tokenID, serviceUrl, and token should be left blank as the WATS Client will retrieve these from the client setup automatically. The parameters continue to exist for backwards comparability reasons.
NOTE: The only valid serialNumberTypeName in new WATS installations is "MAC address" (different from "MACAddress", the old default) and RunningSN. New custom handler(s) may be applied (specific rules for SN generation etc.), please contact support@virinco.com.
The WATS Client API can be referenced using the NuGet package Virinco.WATS.ClientAPI, or if the WATS Client is installed it can be referenced directly from C:\Program Files\Virinco\WATS\DesignSupport\Virinco.WATS.ClientAPI.dll
Create an instance of the Virinco.WATS.Interface.MES.Production.SerialNumberHandler class with your serialNumberTypeName.
The GetStatus method returns if the serial number type is already initialized and ready to be used. If NotInitialized, the application needs to call the Initialize method to prepare the client for serial number retrieval:
public void Initialize(
string tokenID,
string serviceUrl,
SerialNumberHandler.RequestType requestType,
bool onlyInSequence,
int batchSize,
int fetchWhenLessThan,
string siteName,
Guid token = new Guid())
This is the meaning of the parameters:
-
tokenID: Leave BLANK (API will use the existing WATS Client token)
serviceUrl: Leave BLANK (API will use the existing WATS Client connection) -
requestType: The WATS Client can operate in two different modes:
- Take: WATS Client must be online and the requested number of serial numbers will immediately be marked as Taken in WATS when fetched.
- Reserve: WATS Client downloads a batchSize number of serial numbers and makes a reservation in WATS. The downloaded serial numbers are stored and maintained in an local store on the WATS Client (C:\ProgramData\Virinco\WATS\AddressStore) and can be used even while the WATS Client does not have a connection to WATS. When there are fetchWhenLessThan serial numbers left in the local store, new serial numbers are downloaded from WATS automatically.
- onlyInSequence: If set to true, requested serial numbers will be contiguous (NB: Only MAC addresses)
- batchSize: How many serial numbers that are reserved on the server (When requestType=Reserve)
- fetchWhenLessThan: Number of remaining local serial numbers before server is polled for a new batch
- siteName: Serial numbers will be registered to a site with this name (NB: Must be defined on the server, can be null)
- token: Do not specify, not in use anymore.
Initialize can be called again to change the settings used for this serial number type.
After Initalizing, the client is ready to retrieve serial numbers by calling the GetSerialNumber or GetSerialNumbers methods.
Comments
0 comments
Please sign in to leave a comment.