Overview
The Track and Trace Module has built in Work-In-Process (WIP) functionality that can prevent material from being selected when the quantity for it has been used up. In cases where the quantities are not exact maybe due to flow meter inaccuracies, this functionality can be overridden.
Applies To and Version Info
This feature applies to Track and Trace module and is available in all versions.
Lot Quantity
Because multiple operation segments can add to and also pull from the quantity of a lot in a storage location, the actual lot quantity is not stored in the MESMaterialLot object. In order to determine the actual lot quantity, the total quantity of all segments that pulled from the lot is subtracted from the total quantity of all segments that added to the lot.
Lot Availability
When a segment is ended or updated, the lot availability is evaluated. If the net quantity for the lot is equal to or less than zero, then the availability will be changed from 'Available' to 'Used'. This prevents the lot from being selected for another segment because the quantity has been used up.
Info
|
Zero Lot Threshold settings change the threshold that the quantity must be before the lot is set to 'Used'”. |
The default handling of the Lot Availability Status will always be evaluated and updated when segments begin, end, are updated or lot references are changed. Overriding the Lot Availability Status should occur when there is not an active segment referencing the lot. This prevents the segment from changing the overridden value.
Scripting
To override the default handling of the lot availability, scripting must be used. The following is an overview of the script functions that are used to control and ignore the lot availability.
Get the Lot Availability
Code |
path = '[global]\Enterprise\Site\Receiving\Steel\QC Holding'
#Load the lot
lot = system.mes.loadMaterialLot('SSS004', None, path, False)
#Read the Lot Availability Status
print lot.getPropertyValue('LotAvailabilityStatus') |
The following script can be used to change the lot availability from “Used” to “Available” or from “Available” to “Used”.
Change Availability of a Lot
Code |
path = '[global]\Enterprise\Site\Receiving\Steel\QC Holding'
#Load the lot
lot = system.mes.loadMaterialLot('SSS004', None, path, False)
#Set the availability to 'Available'. Please note that this is case sensitive and the two valid options are 'Available' and 'Used'
lot.setPropertyValue('LotAvailabilityStatus', 'Available')
#Save the lot
system.mes.saveMESObject(lot) |
Once the script is executed, the default value of the lot availability status will be changed making it available for using in a segment.
Begin Segment Example
Code |
segPath = '[global]\Enterprise\Site\Receiving\Steel\QC Holding'
matOutPath = '[global]\Enterprise\Site\Receiving\Steel\Inventory'
#Create a new segment
seg = system.mes.createSegment('Inspect Steel', segPath, True)
#Set the lot for the segment's Steel In material reference bypassing inventory checks.
#Note that the Lot Availability Status must be set to "Available" at this point
seg.setMaterialBypassChecks('Steel In', 'SSS005', 100.0)
#Set the segment's Steel Out material reference
seg.setMaterial('Steel Out', '84032', matOutPath, 100.0)
#Begin the segment and bypass inventory checks
seg.begin() |
Update Segment
Code |
segPath = '[global]\Enterprise\Site\Receiving\Steel\QC Holding'
matOutPath = '[global]\Enterprise\Site\Receiving\Steel\Inventory'
#Get the currently active segment
seg = system.mes.getActiveSegment(segPath , 'Inspect Steel')
#Change the lot for the segment's Steel In material reference bypassing inventory checks.
#Note that the Lot Availability Status must be set to "Available" at this point
seg.setMaterialBypassChecks('Steel In', 'SSS004', 100.0)
#Update the segment
seg.update() |
The Lot Summary binding function can also be used to display the net quantity.
Get Net Quantity
Code |
path = '[global]\Enterprise\Site\Receiving\Steel\QC Holding'
#Get the link to the lot
lotLink = system.mes.loadMaterialLotLink('SSS004', None, path, False)
#Get the summary for the lot - This function returns a Materiallot object
inv = system.mes.getLotInventoryByLot(lotLink.getMESObjectUUID(), '')
#Print the net quantity which can be negative
print inv.getNetQuantity()
|