Batch Procedure | Electronic Batch Record EBR

Sepasoft MES Module Suite

Get EBR Formatted

Python
def getSublogic(subLogic,depth):
		logicType = subLogic['LogicType']
		name = subLogic['Name']
		
		dashes='-'*(depth*4)
		spaces=' '*(depth*4+2)
										
		print dashes+'LogicType/Name: '+logicType+'/'+name+' -- Parameters START----'
		params = subLogic['Parameters']
		for param in params:
			name = str(param['Name'])
			value = str(param['Value'])
			try:
				ts = str(param['TimeStamp'])
			except:
				ts = ''
			print spaces+name.ljust(22)+' = '+value.ljust(30)+' @ '+ts
		print dashes+'LogicType/Name: '+logicType+'/'+name+' -- Parameters END----'
		print ''
	
		getSteps(subLogic['Steps'],depth+1)
		
def getSteps(steps,depth):
	for step in steps:
		phaseName = step['Phase']
		stepName = step['Step']
		status = step['Status']
		
		dashes='-'*(depth*4)
		spaces=' '*(depth*4+2)
	
		print dashes+'Step/Phase/Status: '+stepName+'/'+phaseName+'/'+status+' -- Parameters START----'
		params = step['Parameters']
		for param in params:
			name = str(param['Name'])
			value = str(param['Value'])
			try:
				ts = str(param['TimeStamp'])
			except:
				ts = ''
			print spaces+name.ljust(22)+' = '+value.ljust(30)+' @ '+ts
		print dashes+'Step/Phase/Status: '+stepName+'/'+phaseName+'/'+status+' -- Parameters END----'
		print ''
		
		try:
			getSublogic(step['Sublogic'],depth+1)
		except:
			pass
		
def getEBRNice(BatchId):# Show the Recipe Level parameters
	ebr = system.mes.batch.queue.getBatchEBR(BatchId,True)
	print '--Batch Level -- Parameters START--'
	params = ebr['Parameters']
	for param in params:
		name = str(param['Name'])
		value = str(param['Value'])
		ts = str(param['TimeStamp'])
		print '   '+name.ljust(22)+' = '+value.ljust(30)+' @ '+ts
		print '--Batch Level -- Parameters END--'
	print ''
	
	
	#getSteps(ebr['Steps'],1)
	
getEBRNice('R5')











Sepasoft MES Module Suite