def worker_wip(machine_code): ### This needs to be updated to reflect the fact that the worker_id task will now deal with the issue ### of machines being manned (operator present) or unmanned (operator absent or otherwise not there). """ Function to create individual machine WIP dict """ console.clear() print('For machine {} please enter thee following information: \n'.format( machine_code)) # Machine wip dictionary # The attendance no longer necessary once the ID number routine complete machine_dict = {'Attendance': 'Absent', 'Style': 'null', 'WIP': 'null'} # Determine absence user_choice = get_user_choice( '{} : Is the operator present?'.format(machine_code), 'Please select an option', ( 'Present', 'Absent', )) # If operator not present if user_choice != 'Present': print wip_validation_fmt.format( machine_code, **machine_dict) # print data back to user time.sleep(2) #check user satisfaction user_satisfied = get_user_choice( 'Are you satisfied with data entered?', 'Select one', ('Yes', 'No')) if user_satisfied == 'No': return worker_wip(machine_code) # re-enter worker wip data return machine_dict # return the worker wip dict # If operator present machine_dict['Attendance'] = 'Present' prompt = 'Please enter current style name/number as per work order: ' machine_dict['Style'] = get_user_input(prompt).strip().lower() prompt = 'Please enter the amount of WIP at time of checking: ' machine_dict['WIP'] = get_user_special_float(prompt) print wip_validation_fmt.format(machine_code, **machine_dict) # print data back to user time.sleep(4) user_satisfied = get_user_choice('Are you satisfied with data entered?', 'Select one', ('Yes', 'No')) if user_satisfied == 'No': return worker_wip(machine_code) #re-enter worker wip data return machine_dict #return the worker wip dict
def worker_id(machine_code): """ Function prompts user for informaiton about the machine and the id of the operator working the machine (if any). Returns dict of that information""" # This generates the worker routine for an individual operator. Rather than thinking about # present/absent the user will simply state is the machine is manned or unmanned. If it is # manned they will be prompted to enter the worker id of the person working on the machine. # The fact that manned/unmanned status will be dealt with here means that the Attendance #component of the wip task is now defunct (although the user may wish to change the # manned/unmanned status during the task if for example the worker was absent when the id # routine is run, but present once the wip task is undertaken. console.clear() print('For machine {} please enter thee following information: \n'.format( machine_code)) worker_id_dict = {'mc_status': 'Unmanned', 'worker_id': 'null'} title = '{} : Please state is machine is manned or unmanned?'.format( machine_code) user_choice = get_user_choice(title, 'Please select an option', ('Manned', 'Unmanned')) # If machine unmanned if user_choice != 'Manned': print ID_validation_fmt.format( machine_code, **worker_id_dict) # print data back to user time.sleep(2) #check user satisfaction user_satisfied = get_user_choice( 'Are you satisfied with data entered?', 'Select one', ('Yes', 'No')) if user_satisfied == 'No': return worker_id(machine_code) # re-enter the machine dict data return worker_id_dict # return the machine dict worker_id_dict['mc_status'] = 'Manned' prompt = 'Please enter the id number of the worker on this machine as is appears on their ID card: ' worker_id_dict['worker_id'] = get_user_input(prompt).strip().lower() print ID_validation_fmt.format(machine_code, **worker_id_dict) # print data back to user time.sleep(4) user_satisfied = get_user_choice('Are you satisfied with data entered?', 'Select one', ('Yes', 'No')) if user_satisfied == 'No': return worker_id(machine_code) #re-enter worker wip data return worker_id_dict #return the worker id dict
def worker_wip(machine_code): ### This needs to be updated to reflect the fact that the worker_id task will now deal with the issue ### of machines being manned (operator present) or unmanned (operator absent or otherwise not there). """ Function to create individual machine WIP dict """ console.clear() print ("For machine {} please enter thee following information: \n".format(machine_code)) # Machine wip dictionary # The attendance no longer necessary once the ID number routine complete machine_dict = {"Attendance": "Absent", "Style": "null", "WIP": "null"} # Determine absence user_choice = get_user_choice( "{} : Is the operator present?".format(machine_code), "Please select an option", ("Present", "Absent") ) # If operator not present if user_choice != "Present": print wip_validation_fmt.format(machine_code, **machine_dict) # print data back to user time.sleep(2) # check user satisfaction user_satisfied = get_user_choice("Are you satisfied with data entered?", "Select one", ("Yes", "No")) if user_satisfied == "No": return worker_wip(machine_code) # re-enter worker wip data return machine_dict # return the worker wip dict # If operator present machine_dict["Attendance"] = "Present" prompt = "Please enter current style name/number as per work order: " machine_dict["Style"] = get_user_input(prompt).strip().lower() prompt = "Please enter the amount of WIP at time of checking: " machine_dict["WIP"] = get_user_special_float(prompt) print wip_validation_fmt.format(machine_code, **machine_dict) # print data back to user time.sleep(4) user_satisfied = get_user_choice("Are you satisfied with data entered?", "Select one", ("Yes", "No")) if user_satisfied == "No": return worker_wip(machine_code) # re-enter worker wip data return machine_dict # return the worker wip dict
def worker_id(machine_code): """ Function prompts user for informaiton about the machine and the id of the operator working the machine (if any). Returns dict of that information""" # This generates the worker routine for an individual operator. Rather than thinking about # present/absent the user will simply state is the machine is manned or unmanned. If it is # manned they will be prompted to enter the worker id of the person working on the machine. # The fact that manned/unmanned status will be dealt with here means that the Attendance # component of the wip task is now defunct (although the user may wish to change the # manned/unmanned status during the task if for example the worker was absent when the id # routine is run, but present once the wip task is undertaken. console.clear() print ("For machine {} please enter thee following information: \n".format(machine_code)) worker_id_dict = {"mc_status": "Unmanned", "worker_id": "null"} title = "{} : Please state is machine is manned or unmanned?".format(machine_code) user_choice = get_user_choice(title, "Please select an option", ("Manned", "Unmanned")) # If machine unmanned if user_choice != "Manned": print ID_validation_fmt.format(machine_code, **worker_id_dict) # print data back to user time.sleep(2) # check user satisfaction user_satisfied = get_user_choice("Are you satisfied with data entered?", "Select one", ("Yes", "No")) if user_satisfied == "No": return worker_id(machine_code) # re-enter the machine dict data return worker_id_dict # return the machine dict worker_id_dict["mc_status"] = "Manned" prompt = "Please enter the id number of the worker on this machine as is appears on their ID card: " worker_id_dict["worker_id"] = get_user_input(prompt).strip().lower() print ID_validation_fmt.format(machine_code, **worker_id_dict) # print data back to user time.sleep(4) user_satisfied = get_user_choice("Are you satisfied with data entered?", "Select one", ("Yes", "No")) if user_satisfied == "No": return worker_id(machine_code) # re-enter worker wip data return worker_id_dict # return the worker id dict