Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
# userMenuItemClicked code
if event.getMenuItemName() == 'Add CP Facility':

    woObj = event.getWorkOrder()
    #Add Facility to be used for this Work Order as a custom property
    parentPath = 'Facility'
    dataType = 'String'
    description = 'Facility Desc'
    units = ''
    productionVisible = True
    required = False
     
    #Add Facility custom property directly to the MES object
    #woObjwoObj.addCustomProperty(parentPath, dataType, 'Facility Used', '', productionVisible, required)
     
    name = 'Facility X'
    value = system.gui.inputBox('Enter a Value for Facility X:')    
    woObj.addCustomProperty(parentPath, name, dataType, description, units, productionVisible, required, value)
    print "added : name [%s] : value [%s]"% (name, value)  
  
    system.mes.saveMESObject(woObj)
    system.mes.invalidateCache()
    #print woObj.getCustomPropertiesFull()
    
elif event.getMenuItemName() == 'Add CP Work Center':

	woObj = event.getWorkOrder()
	#Add Work Center to be used for this Work Order as a custom property
	parentPath = 'Work Center'
	dataType = 'String'
	description = 'Work Center Desc'
	units = ''
	productionVisible = True
	required = False
	
	#Add Facility custom property directly to the MES object
	#woObjwoObj.addCustomProperty(parentPath, dataType, 'Work Center Used', '', productionVisible, required)
	
	name = 'Work Center'
	value = system.gui.inputBox('Enter a Value for Work Center:')    
	woObj.addCustomProperty(parentPath, name, dataType, description, units, productionVisible, required, value)
	print "added : name [%s] : value [%s]"% (name, value)  
	
	system.mes.saveMESObject(woObj)
	system.mes.invalidateCache()
	#print woObj.getCustomPropertiesFull()
	
elif event.getMenuItemName() == 'Get Custom Properties ?':

    woObj = event.getWorkOrder()
  	
    print woObj.getCustomPropertiesFull()

...