Batch Procedure | Creating Phases By Script

Sepasoft MES Module Suite

Create Phases By Script

This script:

  • Adds a Document Phase inside a Phase Class. Keep in mind that you can add user-defined phases with user-defined parameters.
  • Adds a user-defined parameter
  • Creates an MES Artifact on the BatchPhase object using an inherited AbstractMESObject method to add HTML5 content to a phase based on the Document phase-type.

Scripting Reference

Batch Script Functions
system.mes.batch.phase.getPhaseLink(name)
system.mes.batch.phase.savePhase(phase)
system.mes.batch.phase.getClassLink(name)
system.mes.batch.phase.createPhase(name, inheritedFromLink, parentLink)
Objects
BatchPhase
MESObjectLink

For Phase Parameter Properties, see Properties Common to All Phase Parameters.

Python
phaseName = 'myDocument'

defaultPhaseLink = system.mes.batch.phase.getPhaseLink('Document')

phaseClassName = 'Custom Phases'
phaseClassLink = system.mes.batch.phase.getClassLink(phaseClassName)

phase = system.mes.batch.phase.createPhase(phaseName, defaultPhaseLink, phaseClassLink)

#Add a parameter on the phase. See link to Properties Common to All Phase Properties above.
param = phase.addParameter('aStringParam')
param.setParamKindName('User Phase')
param.setParamDataTypeName('String')		
param.setParamValueSourceName('Recipe and Execution')
param.setParamRecordingTypeName('All to Object and History')
param.setParamValue('testvalue')

#for document phases there is an artifact
phase.createArtifact('documenttext','<html>Hello World!</html>')

system.mes.batch.phase.savePhase(phase)

Sepasoft MES Module Suite