Class SerialNumberHandler
Interface to handle serialnumbers from WATS MES. Written by Ragnar Engnes, Virinco as - 2016
Inheritance
Inherited Members
Namespace: Virinco.WATS.Interface.MES.Production
Assembly: Virinco.WATS.Interface.MES.dll
Syntax
public class SerialNumberHandler
Constructors
SerialNumberHandler(String)
Constructor, creates an object reference
Declaration
public SerialNumberHandler(string serialNumberTypeName)
Parameters
Type | Name | Description |
---|---|---|
System. |
serialNumberTypeName | Type of serial number, e.g. MACAddress |
Methods
CancelReservations(Guid)
Cancels any reservations that is not taken from the local store on the server.
Declaration
public void CancelReservations(Guid token)
Parameters
Type | Name | Description |
---|---|---|
System. |
token | Special Guid needed to perform this function, contact support@virinco.com |
FormatAsMAC(Int64, Char)
Converts from Int to MAC string
Declaration
public string FormatAsMAC(long i, char separator)
Parameters
Type | Name | Description |
---|---|---|
System. |
i | |
System. |
separator |
Returns
Type | Description |
---|---|
System. |
GenerateAndUploadSerialNumbers(String, String, Int64, Int64, Char, out Int32, out Int32, Guid)
Generates and uploads serialnumbers to server.MACTo
Declaration
public List<string> GenerateAndUploadSerialNumbers(string tokenID, string serviceUrl, long fromSN, long toSN, char separator, out int uploaded, out int rejected, Guid token)
Parameters
Type | Name | Description |
---|---|---|
System. |
tokenID | |
System. |
serviceUrl | |
System. |
fromSN | |
System. |
toSN | |
System. |
separator | Use to format mac string |
System. |
uploaded | Successfully uploaded |
System. |
rejected | Already exists |
System. |
token | Secret token support@virinco.com |
Returns
Type | Description |
---|---|
System. |
A list of serialnumbers that already existed |
GetFreeLocalSerialNumbers()
Returns the number of local serial numbers that are not taken.
Declaration
public int GetFreeLocalSerialNumbers()
Returns
Type | Description |
---|---|
System. |
Free local serialnumbers |
GetPoolInfo(out Boolean, out Int32, out Int32, out String, out String)
Returns information about the current pool when type is Reserve
Declaration
public void GetPoolInfo(out bool onlyInSequence, out int batchSize, out int fetchWhenLessThan, out string startFromSerialNumber, out string siteName)
Parameters
Type | Name | Description |
---|---|---|
System. |
onlyInSequence | |
System. |
batchSize | |
System. |
fetchWhenLessThan | |
System. |
startFromSerialNumber | |
System. |
siteName |
GetSerialNumber(String, String)
Returns one serial number, see also Get
Declaration
public string GetSerialNumber(string serialnumberRef, string partnumberRef)
Parameters
Type | Name | Description |
---|---|---|
System. |
serialnumberRef | Associate this serial number to this serialnumber |
System. |
partnumberRef | Associate this serial number to this partnumber |
Returns
Type | Description |
---|---|
System. |
Serial number as string |
GetSerialNumbers(Int32, String, String)
Retrieves serialnumber from local store or server
Declaration
public string[] GetSerialNumbers(int numToGet, string serialnumberRef, string partnumberRef)
Parameters
Type | Name | Description |
---|---|---|
System. |
numToGet | Number of serialnumbers wanted |
System. |
serialnumberRef | Reference to a serial number |
System. |
partnumberRef | Reference to a part number |
Returns
Type | Description |
---|---|
System. |
String array with serial numbers |
GetStatus()
Returns the status of a SerialnumberType
Declaration
public SerialNumberHandler.Status GetStatus()
Returns
Type | Description |
---|---|
Serial |
Ready/NotInitialized |
Initialize(String, String, SerialNumberHandler.RequestType, Boolean, Int32, Int32, String, String, Guid)
Initialize a client and make it ready for serial number retrieval.
Declaration
public void Initialize(string tokenID, string serviceUrl, SerialNumberHandler.RequestType requestType, bool onlyInSequence, int batchSize, int fetchWhenLessThan, string startFromSerialNumber, string siteName, Guid token)
Parameters
Type | Name | Description |
---|---|---|
System. |
tokenID | Authentication token generated on the WATS server according to this procedure: https://virinco.zendesk.com/hc/en-us/articles/207424253-Authentication /// |
System. |
serviceUrl | The service address, e.g.: http://localhost/SerialnumberAdmin/api/SerialNumber/ |
Serial |
requestType | Legal Values Serial Take: Client must be online and requested number of serialnumbers will be marked as Taken in the SN database
Reserve: Client download a The downloaded serial numbers are stored and maintained in an XML file on the client (C:\ProgramData\Virinco\WATS\AddressStore)
When there are
|
System. |
onlyInSequence | If set to true, requested serialnumbers will be contiguous (NB: Only MAC addresses) |
System. |
batchSize | How many serialnumbers that are reserved on the server (When requestType=Resvere) |
System. |
fetchWhenLessThan | Number of remaining offline serialnumbers before server is polled for a new batch |
System. |
startFromSerialNumber | If specified, will restrict serial numbers retrieved to be greater or equal this value |
System. |
siteName | Serial numbers will be registered to a site with this name (NB: Must be defined on the server, can be null) |
System. |
token | Special Guid needed to perform this function, contact support@virinco.com |
MACToInt(String)
Converts MAC string to int
Declaration
public long MACToInt(string mac)
Parameters
Type | Name | Description |
---|---|---|
System. |
mac | MAC String, supported separators are -,:,blank |
Returns
Type | Description |
---|---|
System. |
Int64 |
SetReuseOnDuplicateRequest(Boolean)
Change the behaviour of the serialnumber handler to re-use serialnumbers if referencedSN and referencedPN and number requested has been requested earlier (in the same call)
Declaration
public void SetReuseOnDuplicateRequest(bool on)
Parameters
Type | Name | Description |
---|---|---|
System. |
on | Turns on this functionality (default is off) |
UploadSerialNumbersFromFile(String, String, String, out Int32, out Int32, Guid)
Uploads a text file with serialnumbers to the server, one sn per line - separated by CR/LF
Declaration
public List<string> UploadSerialNumbersFromFile(string tokenID, string serviceUrl, string fileName, out int uploaded, out int rejected, Guid token)
Parameters
Type | Name | Description |
---|---|---|
System. |
tokenID | |
System. |
serviceUrl | |
System. |
fileName | |
System. |
uploaded | |
System. |
rejected | |
System. |
token |
Returns
Type | Description |
---|---|
System. |