This class is used in all our applications as a common interface to deal with serials, and the modal window is named "Serials: Extended Information"
Allows you to deal with a batch of serials for incoming, outgoing processes or just displays information in read-only mode, applying the necessary rules in each case.

To include this library in your app, just add this code to your app source code in Beas, between the "_header()" and "_footer()":
<script src="assets21/js/class_serials.js"></script>
Class members
Method Summary
|
|
constructor
|
constructor( mode, batches )
Initialize the class
|
set
|
set( serials, options={} )
Set the serials and options before to display this window
|
get
|
get()
Get the serials list with all modifications made by the user to the serials
|
display
|
display(onclose=null)
Open the modal window
|
Method Detail
|
|
constructor
constructor( mode, batches )
|
Initialize the class
Parameters:
{string} mode
The mode to deal with the entries (see "set")
|
{array of json objects} serials
Returns:
{class_serials object}
Example
var serialsAdvancedEditor = new itemSerialInfo( 'out', [] );
|
|
set
set( batches, options={} )
|
Set the batches and options before to display this window
Parameters:
{array of json objects} serials
The batches to fill the modal window, is an Array, and each component is an object with these fields:
[ {...}, ...., {...} ]
Property
|
Data Type
|
Description
|
serial
|
{string}
|
The serial number
|
serial_exists
|
{boolean}
|
If the serial number exists then true else false
|
version
|
{string}
|
Serial version (rules depending of mode are applied)
|
version_description
|
{string}
|
Version description
|
quantity
|
{number}
|
Quantity selected for this serial number = 1
Is allowed to set > 1 if the serial number is empty and the options allow this
|
attr1
|
{string}
|
Attribute 1
|
attr2
|
{string}
|
Attribute 2
|
dateOfPermssion
|
{date}
|
Date of Permission
|
manufacturingDate
|
{date}
|
Manufacturing Date
|
shelfLife
|
{date}
|
Shelf Life
|
expirationDate
|
{date}
|
Expiration Date
|
guaranteeStart
|
{date}
|
Warranty start date
|
guaranteeEnd
|
{date}
|
Warranty end date
|
details
|
{string}
|
Details
|
status
|
{number}
|
Status, and the valid one are:
•2 = Locked
•1 = Not Accessible
•0 = Released |
has_error
|
{boolean}
|
If any field don't match the rules, this record is tagged as it has an error (true)
|
|
{json object} options
All the options to apply when the modal window is opened
Property
|
Data Type
|
Description
|
mode
|
{string}
|
The mode in which this editor is going to work, each mode has own rules about how an entry is valid, the warehouses, and quantities
•in
•out
•in-wo
•info |
multiLine
|
{boolean}
|
Control where the extended editor can hold more than one serial at time and the tab "Lines" is active or not
default: true
|
automaticNumber
|
{boolean}
|
If true, the serial can be empty
default: false
|
itemCode
|
{string}
|
The item code to search if a serial is valid/exists/warehouses available
|
whsCode
|
{string}
|
The whsCode for this group of batches
|
whsLocated
|
{string}
|
Flag to indicate if the warehouse is bin located
default: false
|
whsLocation
|
{string}
|
Bin Location code for bin located warehouses
|
version
|
{string}
|
Serial version number or null if the item is not version controlled
default: null (no version)
|
uom
|
{string}
|
Unit of Measure
|
uom_dec
|
{number}
|
Number of decimals for the selected uom
default: 6
|
|
Returns:
{void}
Example
serialsAdvancedEditor.set(
[{serial:'S1'}, {serial:'S2'}],
{mode:'in',itemCode:'RM_S', version:null, whsCode:'01', uom:'Kgs',uom_dec:3 }
);
|
|
get
get()
|
Get the serials list with all modifications made by the user to the batches
Parameters: none
Returns:
{array of json objects} serials
|
display
display(onclose=null)
|
Open the modal window
Parameters:
function callback
When the user close the modal window, this function is called
|
Returns:
{void}
Example
serialsAdvancedEditor.display(function() { batches = serialsAdvancedEditor.get(); /* do something here */ } );
|
|
x