Starting Next Scheduled OEE Operation via Script 3.0

This example demonstrates how to begin the next scheduled entry for a given Line.


Similar to the Right-click - Begin OEE Run action on the MES Schedule Selector:


Schedule Begin

Code
#specify equipment path
eqPath = 'Enterprise\\El Dorado Hills\\Packaging Area\\Packaging Line 1'

#check if there are active operations first
ops = system.mes.oee.getOEEAllActiveSegments(eqPath)
if ops.size() == 0:

	#specify the start and end dates to retrieve schedules
	begin = system.date.now()
	end = system.date.addDays(system.date.now(), 5)
	   
	#specify the category
	category = 'Active'
	   
	#get schedule entries
	list = system.mes.getEquipmentScheduleEntries(eqPath, begin, end, category, False)
	print list
	for item in list:
	    print item.getScheduledStartDate()
	    if item.hasMESOperationsScheduleLink():
	        print item.getMESOperationsScheduleLink()
	        print item.getMESOperationsRequestLink(), '; Operations Request'
	          
	        if item.hasMESOperationsResponseLink():
	            print item.getMESOperationsResponseLink(), '; Operations Response'
	      
	        else:
	        	#begin OEE Run
	            system.mes.oee.beginOEERun(item.getMESOperationsRequestLink()) 
	          
	    break