system.mes.trace.recordOperation

Sepasoft MES Module Suite

system.mes.trace.recordOperation

This function records an operation (a movement or transformation of materials) for the purpose of traceability.  Data captured is reflected in inventory as well as genealogy records for the materials referenced.  This function takes the place of the earlier approach to Track and Trace use, wherein ISA-95 Operation model objects would by created and interacted with at runtime.  recordOperation() vastly reduces the training and scripting required by the earlier method, as a single call can capture runtime information.

For use cases where additional information must be updated (e.g. recordOperation() is called at the beginning of an operation, and additional information is gathered and must be recorded at the end of the operation) the system.mes.trace.modifyOperation() function is recommended.  By using recordOperation() and modifyOperation(), initial and final conditions of the operation and it's resources can be recorded accurately and quickly with very little scripting.

For Batch Procedure and Track & Trace integration, see Material Resource Tracking and Traceability | Batch Procedure

Warning

Scripting Function added in MES 3.81.6 RC 3 and later.

Note As of 3.81.10 SP6 and later: When run with 'autoCreateLot, .recordOperation attaches any MaterialLot it create to the Response Segment it creates.

Syntax

system.mes.trace.recordOperation(userId, name, beginDateTime, endDateTime, equipmentPath, materialIn, materialOut, workOrder, personnel, supplementalEquipment, operationCustomProps)

Success When using Enterprise Sync in an MES enterprise network and duplicate operation userId's and names , make sure to add a server identifier to those parameters, e.g., site1_userId, site2_userId. Doing this avoids sync errors.

userId string: A user-provided unique id that can be used to later modify or retrieve the details after they have initially been recorded. E.g. "Line1_Packaging_[Timestamp]"

name string: The name to use for the operation. This appears in the Trace Graph and other components.  E.g. "Palletizing" or "Soldering"

beginDateTime date: The date and time to record for the start of the operation.

endDateTime date: The date and time to record for the end of the operation.

equipmentPath string: The equipment path where the operation occurs. Must be the same equipment path as the target equipment (where that lot is coming from), e.g., To consume a lot named 'test lot', make sure to write your recordOperation call with the equipmentPath that holds the 'test lot'.

workOrder string: An optional work order name to associate the operation with. 

Note: The Work Order must exist prior to referencing it within this function call.

Also note: The quantity from the material out gets added to the work order.  If you don't want this behavior but still want the work order associated, use should use a custom property.

material_In Python Array: An array defining the materials that feed into the operation. Either a material in or a material out is required.

Lot Array Entry: {‘userid’:’’, ‘Name’:’’, ‘LotNo’:’’, ‘MaterialName’:’’, ‘Quantity’:, ‘UOM’:’’, ‘Status’:’’, ‘BeginDateTime’: , ‘EndDateTime’: , ‘EquipmentPath’:’’, ‘ManifestName’:’’,‘SupplementalEquipment’:’’,‘AutoCreateManifest’:’’,‘AutoCreateSupplementalEquipment’:’’,‘AutoCreateLot’:’’,‘LotCustomProperties’:’’} 

material_Out Python Array: An array defining the materials that were generated by the operation. Either a material in or a material out is required.

BeginDateTime’ and ‘EndDateTime’ are optional and are set to the dates passed in for the operation. 

AutoCreateManifest Boolean - defaults to False

AutoCreateSupplementalEquipment Boolean - defaults to False. 

AutoCreateLot Boolean - defaults to True.

personnel: An optional array defining the personnel that were used to perform the operation: {‘userid’:’’, ‘Name’:’’, ‘Person’:’’, ‘Quantity’: , ‘UOM’:’’, ‘BeginDateTime’: , ‘EndDateTime’:}

supplementalEquipment: An optional array defining the supplemental equipment that was used to perform the operation.  In this position, Supplemental Equipment indicates tooling.  E.g. "Die Set 31A".

{‘userid’:’’, ‘Name’:’’, ‘EquipmentName:’’, ‘Quantity’: , ‘UOM’:’’, ‘BeginDateTime’: , ‘EndDateTime’:}

operationCustomProps: An optional array of python dictionaries defining the custom properties associated with the operation.

[{‘Name’:’mypropertyname’, ‘Value’:15.0}]

  • Returns

None

  • Scope

All

system.mes.trace.recordOperation

Track and trace scripting function reference, see system.mes.trace

Supported Sepasoft Module Versions:

Warning

Release Candidate: 3.81.6 RC3 and later

Script Example

In this script example, recordOperation() will be called, capturing the material, equipment, personnel, and tooling (supplemental equipment) information relevant to the transformation or movement of materials in the production of finished goods.  Note how recordOperation() takes in some top level information (dates, user defined ID, etc.) then arrays of dictionaries for materials, personnel, and tooling.  This structure allows for flexible addition and subtraction of resources.

Python
##Define required information like material lot info and equipment path.
inLot = '7-26-ID1'
id = '7-26-ID2'
eqPath = 'New Enterprise\\New Site\\New Area\\New Line'
material = 'Material 1'
suppl = 'Box'
person = 'Supervisor, Sam'

##Use a helper function to build the input material dictionary required by the Record Operation function
matInDict = system.mes.trace.configureMaterial(userid = inLot, name = inLot, lotNo = inLot, materialName = material, quantity = 100, 
			equipmentPath = eqPath)

##Use a helper function to build the output material dictionary required by the Record Operation function
matOutDict = system.mes.trace.configureMaterial(userid = id, name = id, lotNo = id, materialName = material, quantity = 100,
			equipmentPath = eqPath, autoCreateLot = True)

##Use a helper function to build the supplemental equipment dictionary required by the Record Operation function
supplementalEqDict = system.mes.trace.configureSupplementalEquipment(userid = id, name = id, equipmentName = suppl) 

##Use a helper function to build the personnel dictionary required by the Record Operation function
personnelDict = system.mes.trace.configurePersonnel(userid = id, name = id, person = person)

##Call record operation, passing in necessary data
system.mes.trace.recordOperation(
	userid = id, 
	name = 'Anodize Part', 
	beginDateTime = system.date.now(), 
	endDateTime = system.date.now(), 
	equipmentPath = eqPath, 
	materialIn = [matInDict],
	materialOut = [matOutDict],
	supplementalEquipment = [supplementalEqDict],
	personnel = [personnelDict]
	)






Sepasoft MES Module Suite