ThingWorx Applications Setup > Core Function Configurations > Endpoints > Production Endpoint > Serial Number Import — Custom Service Creation
Serial Number Import — Custom Service Creation
To use the Serial Number Import, a custom service must be created that will provide serial numbers to the ThingWorx Applications.
The Serial Number Import works in two different modes; Work Order Based and Non-Work Order Based. For information on configuring this mode, see Serial Number Import — Connecting Application and Custom Service. The modes are differentiated by the external system having a predefined relationship between serial numbers and work orders.
Work Order Based—The external system has a predefined set of serial numbers attached to a work order. This set of serial numbers is the correct amount for the planned quantity of that work order. The set of serial numbers can be found using the name of the work order, which is common between ThingWorx Applications and the external system.
Non-Work Order Based—The external system does not have any predefined attachment between serial numbers and a work order. The external system generates unique values for serial numbers, but any serial number can be assigned to any work order.
Inputs
Listed below are available inputs that the ThingWorx Applications will provide to the custom service. The custom service’s inputs must have the same name and data type as seen in the bullet points.
WorkOrder (STRING)—This required input will contain the name of the work order that is requesting serial numbers. For a work order based system this work order name should be common to both the ThingWorx Applications system and the external system.
ProductName (STRING)—This optional input will contain the product associated with the work order that is requesting serial numbers. This input is an optional filter option that can be used by the custom interface or external system to better provide serial numbers. The product name provided will be the product as it is known in the ThingWorx Applications system.
Quantity (INTEGER)—This required input will contain the requested quantity of serial numbers for the work order making the request.
Work Order Based—This quantity is irrelevant, as the expectation is that the custom interface will return the full list of serial numbers that satisfy the work order’s planned quantity.
Non Work Order Based—This quantity must be matched by the number of serial numbers returned from the custom interface. The requested quantity will be calculated to ensure that the work order only receives a list of serial numbers that will satisfy the work order’s planned quantity.
Outputs
This custom service must return a JSON object called Result with the following contents:
SerialNumbers (ARRAY) - Contains the serial number values that satisfy the input requirements. The number of values in this array must meet the specifications required by the input Quantity and the type of external system.
WorkOrder (STRING) - For a work order based system this work order value must match the input WorkOrder value exactly. This is used as confirmation that, if a work order was necessary in the external system, it has been found and utilized.
ErrorCode (INTEGER) - The only value which indicates success is 0. Any other value or data type will result in an error and no serial numbers will be processed.
ErrorMessage (STRING) - This value will be logged in the ThingWorx ScriptLog on any response that cannot be processed, such as an ErrorCode not equal to 0.
Was this helpful?