I am struggling to start the production in midnight shift on OEE screen. Please see below scripting for the start production button for midnight shift. When we pressed the start production button it is not starting the production and also it is not giving me any error message. Please find below the scripting. Any help would be appreciated.
target = system.date.now()
date1 = windows.rootContainer.getComponent('DateDropdown').selectedLabel
#elif event.source.parent.getComponent('ShiftDropdown').selectedLabel == "MIDNIGHT":
production_status = "Production"
params = {"Production_Marker":production_status, "Hour_Record": 23, "DateSelected":event.source.parent.getComponent('DateDropdown').selectedLabel}
system.db.runNamedQuery("Bread/ProdMarker", params)
nhour = " 23:03"
time = system.date.parse(date1 + nhour , "dd/M/yyyy HH:mm")
diff1 = target.getTime() - time.getTime()
diffmin = (diff1/(60000))
if diffmin >= 485:
params = {"HourRecord":23, "DateSelected":date1}
productionstatus = system.db.runNamedQuery("Bread/Grab_ProdMarker_and_tstamp", params)
timestamp =system.date.format(productionstatus.getValueAt(0, 1),"yyyy-MM-dd HH:mm")
Production_day = 1
params2 = {"Production_Day":Production_day,"t_stamp":timestamp}
system.db.runNamedQuery("Bread/Production_Day", params2)