def validate_regions(self): ''' Validates a valid regions was received ''' #check for valid regions, and that error code 3 #was not returned in either LUT self.set_sign_off_allowed(True) valid = False error_code = 0 for region in self._valid_regions_lut: if region['errorCode'] == IN_PROGRESS_ANOTHER_FUNCTION: error_code = IN_PROGRESS_ANOTHER_FUNCTION if region['number'] >= 0: valid = True if valid and error_code == 0: for region in self._region_config_lut: if region['errorCode'] == IN_PROGRESS_ANOTHER_FUNCTION: error_code = IN_PROGRESS_ANOTHER_FUNCTION #check if valid or not if error_code == IN_PROGRESS_ANOTHER_FUNCTION: self.return_to(CORE_TASK_NAME, REQUEST_FUNCTIONS) elif not valid: self.next_state = '' prompt_only(itext('generic.regionNotAuth.prompt')) else: self._region_selected = True if self._valid_regions_lut[0][ 'errorCode'] == IN_PROGRESS_SPECIFIC_REGION: self._inprogress_work = True prompt_only(itext('selection.getting.in-progress.work')) else: is_auto_issaunce = self._region_config_lut[0][ 'autoAssign'] == '1' max_work_ids = self._region_config_lut[0]['maxNumberWordID']
def location_prompt(self): globalwords.words['sign off'].enabled = True op_entry = prompt_digits(itext('main.location.prompt',self._location), itext('main.location.help'), 3, 3, confirm=False) if int(self._chk_digit) != int(op_entry) : prompt_only(itext('main.wrong.check.digit', str(op_entry)), True) self.next_state = LOCATION_PROMPT
def _skip_slot(self): logging.debug('-- in skip slot' ) # from pprint import pprint logging.debug(list(vars(self._region))) logging.debug(dir(self._region)) logging.debug(self._region.__dict__) #check if region allows if not self._region['skipSlotAllowed']: prompt_only(itext('generic.skip.slot.notallowed')) return location_id = self._picks[0]['locationID'] allowed = False pass_status = 'N' skip_status = 'S' #if not pick by pick, then check if another slot and pass if not self._region['pickByPick']: for pick in self.callingTask._picks_lut: if (pick['status'] not in ['P', 'X'] and pick['locationID'] != location_id): allowed = True if pick['status'] == 'B': #must be in base item pass pass_status = 'B' skip_status = 'N' #Last slot, not allowed to skip if not allowed: prompt_only(itext('generic.skip.slot.last')) return #confirm skip slot if prompt_yes_no(itext('generic.skip.slot.confirm')): for pick in self.callingTask._picks_lut: if pick['status'] == pass_status: if pick['locationID'] == location_id: pick['status'] = skip_status #send update status update_status = VoiceLinkLutOdr('prTaskLUTUpdateStatus', 'prTaskODRUpdateStatus', self._region['useLuts']) while update_status.do_transmit(self._assignment_lut[0]['groupID'], self._picks[0]['locationID'], '0', skip_status) != 0: pass #End the pick prompt self.next_state = ''
def prompt_assignment_complete(self): # Successful LUT transmission, prompt for next assignment # FF _ don't say or ask anything, user cannot talk # result = prompt_ready(itext(self._assignment_complete_prompt_key), True, # {'change function' : False, # 'change region' : False}) self.next_state = GET_ASSIGNMENT # press pause time.sleep(1) prompt_only(itext('voice.chalenge.press.pause')) time.sleep(5)
def execute_function(self): ''' prompt for function and execute it ''' self.sign_off_allowed = True #if only 1 record returned then automatically select that function self.function = None if len(self._functions_lut) == 1: self.function = self._functions_lut[0]['number'] prompt_only(self._functions_lut[0]['description']) #else prompt user to select function else: self.function = prompt_list_lut_auth(self._functions_lut, 'number', 'description', itext('core.function.prompt'), itext('core.function.help')) self.function = str(self.function) #Execute selected function if self.function == '1': #PutAway self.launch(obj_factory.get(PutawayTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '2': #Replenishment self.launch(obj_factory.get(ReplenishmentTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function in ['3', '4', '6']: #Selection self.launch(obj_factory.get(SelectionTask, self.function, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '7': #Line Loading self.launch(obj_factory.get(LineLoadingTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '8': #Put to store self.launch(obj_factory.get(PutToStoreTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '9': #Cycle Counting self.launch(obj_factory.get(CycleCountingTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '10': #Loading self.launch(obj_factory.get(LoadingTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '11': #Back Stocking self.launch(obj_factory.get(BackstockingTask, self.taskRunner, self), EXECUTE_FUNCTIONS) elif self.function == '12': #Receiving self.launch(obj_factory.get(ReceivingTask, self.taskRunner, self), EXECUTE_FUNCTIONS) else: #Function specified not implemented prompt_ready(itext('core.function.notimplemented', str(self.function))) self.next_state = REQUEST_FUNCTIONS
def slot_verification(self): '''override for Single Prompts''' logging.debug('--Slot_verification in PickPromptSingleTask_Custom') #if pick prompt type is 1 prompt only slot assuming they are picking just 1pick prompt single additional_vocabulary={'short product' : False, 'ready' : False, 'skip slot' : False, 'partial' : False} if self._region['pickPromptType'] == '1' and self._expected_quantity == 1: prompt = itext("selection.pick.prompt.single.slot.only", self._picks[0]["slot"], self._uom, self._description, self._id_description, self._message) else: prompt = itext("selection.pick.prompt.single.pick.quantity", self._picks[0]["slot"], self._expected_quantity, self._uom, self._description, self._id_description, self._message) result, is_scanned = prompt_digits_required(prompt, itext("selection.pick.prompt.checkdigit.help"), [self._picks[0]["checkDigits"], self._pvid], [self._picks[0]["scannedProdID"]], additional_vocabulary, self._skip_prompt) self._skip_prompt = False if result == 'short product': logging.debug('short product') self.next_state = SLOT_VERIFICATION self._validate_short_product() prompt_only(itext('selection.pick.prompt.check.digit'), True) self._skip_prompt = True #don't repeat main prompt elif result == 'partial': logging.debug('partial product') self.next_state = SLOT_VERIFICATION self._validate_partial(self._expected_quantity) prompt_only(itext('selection.pick.prompt.check.digit'), True) self._skip_prompt = True #don't repeat main prompt elif result == 'skip slot': logging.debug('--skip slot single 1') self.next_state = SLOT_VERIFICATION self._skip_slot() else: self._verify_product_slot(result, is_scanned)
def _skip_aisle(self): ''' method to process the skip aisle command when spoken ''' logging.debug('--Pick Assignment skip isle') #check if region allows if not self._region['skipAisleAllowed']: prompt_only(itext('generic.skip.aisle.notallowed')) return #check if another aisle curr_pre_aisle = self._pickList[0]['preAisle'] curr_aisle = self._pickList[0]['aisle'] allowed = False pass_status = 'N' skip_status = 'S' if not self._region['pickByPick']: for pick in self._picks_lut: if (pick['status'] not in ['P', 'X'] and (pick['preAisle'] != curr_pre_aisle or pick['aisle'] != curr_aisle)): allowed = True if pick['status'] == 'B': #must be in base item pass pass_status = 'B' skip_status = 'N' #last aisle not allowed to skip if not allowed: prompt_only(itext('generic.skip.aisle.last')) self._aisle_direction = '' return #confirm skip aisle if prompt_yes_no(itext('generic.skip.aisle.confirm')): for pick in self._picks_lut: if pick['status'] == pass_status: if pick['preAisle'] == curr_pre_aisle and pick['aisle'] == curr_aisle: pick['status'] = skip_status #send update status self._update_status(self._pickList[0]['locationID'], '1', skip_status) self.next_state = PICK_ASSIGNMENT_CHECK_NEXT_PICK self._aisle_direction=''
def end_picking(self): ''' End Picking''' logging.debug('--Pick Assignment end_picking') #end picking if self.status == 'B': self.status = 'N' self.next_state = PICK_ASSIGNMENT_CHECK_NEXT_PICK self._update_status('', 2, 'N') elif self.status == 'N': if not self._region['pickByPick']: if self._picks_lut.has_picks(None, ['N', 'S']): for pick in self._picks_lut: if pick['status'] == 'S': pick['status'] = 'N' self.next_state = PICK_ASSIGNMENT_CHECK_NEXT_PICK self._update_status('', 2, 'N') else: prompt_only(itext('selection.pick.assignment.picking.complete')) else: self.dynamic_vocab.next_pick([])
def _verify_product_slot(self, result, is_scanned): '''Verifies product/slot depending on spoken check digit or spoken/scanned pvid or ready spoken''' #if ready is spoken and check digits is not blank prompt for check digit logging.debug('---verify_product_slot','result = ',result,',check digits = ',self._picks[0]["checkDigits"]) if result == 'ready' and self._picks[0]["checkDigits"] != '': logging.debug(' we want this one') prompt_only(itext('selection.pick.prompt.speak.check.digit'), True) self.next_state = SLOT_VERIFICATION #if pvid is scanned verify it matches the scanned product id elif is_scanned: if self._picks[0]["scannedProdID"] != result: prompt_only(itext('generic.wrongValue.prompt', result)) self.next_state = SLOT_VERIFICATION #if check digit is spoken and both pvid and check digits are same prompt for identical short product elif result == self._picks[0]["checkDigits"] and self._pvid == result: logging.debug('short1') if prompt_yes_no(itext('selection.pick.prompt.identical.product.short.product')): self._set_short_product(0) self.next_state = LOT_TRACKING #if ready or check digits is spoken and pvid is not blank prompt for short product elif result in [self._picks[0]["checkDigits"], 'ready'] and (self._pvid != '' or self._picks[0]["scannedProdID"] != ''): logging.debug('short2') if prompt_yes_no(itext("selection.pick.prompt.short.product")): logging.debug('short3') self._set_short_product(0) self.next_state = LOT_TRACKING else: logging.debug('short4') prompt_only(itext('selection.pick.prompt.wrong.pvid')) self.next_state = SLOT_VERIFICATION
def reprint_labels(self): ''' Reprint labels command is used by the operator''' logging.debug('--reprint_label') #is this chase assignment or container type is 0 if self.is_chase or self._region['containerType'] == 0: assignment_id = self._assignment['assignmentID'] if self._assignment.parent.has_multiple_assignments(): assignment_id = '' self._print_lut.do_transmit(self._assignment['groupID'], assignment_id, self.operation, '', self.task.printer_number, self._reprint_label) else: # is regions container type setting - pick to containers container, container_scanned = prompt_alpha_numeric(itext('selection.put.prompt.for.container'), itext('selection.new.container.prompt.for.container.help'), self._region['spokenContainerLen'], self._region['spokenContainerLen'], confirm=True,scan=True, additional_vocab={'all':False, 'no more':False}) #if all is spoken system container id null operation 1 if container == 'no more': self.next_state = '' elif container == 'all': logging.debug('--all selected by user') if prompt_yes_no(itext('selection.reprint.labels.all.correct')): self._print_lut.do_transmit(self._assignment['groupID'], '', self.operation, '', self.task.printer_number, self._reprint_label) else: self.next_state = REPRINT_LABELS else: valid_container = self._container_lut._get_container(container, container_scanned) logging.debug('--is valid container ? ') #Verify if the container is a valid container or is already closed if not valid_container: prompt_only(itext('selection.reprint.label.container.not.valid', container)) self.next_state = REPRINT_LABELS else: system_container_id = self._container_lut._get_container(container, container_scanned) #system container id operation 1 self._print_lut.do_transmit(self._assignment['groupID'], system_container_id['assignmentID'], self.operation, system_container_id['systemContainerID'], self.task.printer_number, self._reprint_label)
def confirm_new_container(self): logging.debug("--confirm new container") ''' confirm new container and close current container if multiple open''' if self._picks[0]['targetContainer'] > 0: prompt_only(itext('selection.new.container.not.allowed.target.containers')) self.next_state = '' else: logging.debug("--else") if prompt_yes_no(itext('selection.new.container.confirm')): if self._region['allowMultOpenCont']: #check to see if there are multiple open containers if not self._container_lut.multiple_open_containers(self._assignment['assignmentID']): if not prompt_yes_no(itext('selection.new.container.close.current.container')): self.next_state=OPEN_CONTAINER else: logging.debug("--confirm close prompt?") self.next_state=CLOSE_CONTAINER else: logging.debug("--multiple containers open?") self.next_state = OPEN_CONTAINER else: self.next_state = ''
def open_container(self): container = '' if self._position == '': prompt = itext('selection.new.container.prompt.for.container.id') if self._region['promptForContainer'] == 1: result = prompt_alpha_numeric( prompt, itext('selection.new.container.prompt.for.container.help'), confirm=True, scan=True) container = result[0] result = -1 if self._picks[0]['targetContainer'] == 0: target_container = '' else: target_container = self._picks[0]['targetContainer'] while result < 0: result = self._container_lut.do_transmit( self._assignment['groupID'], self._assignment['assignmentID'], target_container, '', container, 2, '') if result > 0: self.next_state = OPEN_CONTAINER_OPEN if result == 0: result = prompt_alpha_numeric(itext('voice.chalenge.badge'), itext('voice.chalenge.badge'), confirm=False, scan=True) prompt_only(itext('voice.chalenge.wait')) time.sleep(5) # delays for 10 seconds prompt_only(itext('voice.chalenge.mark')) time.sleep(3) prompt_only(itext('voice.chalenge.get.set')) time.sleep(3) prompt_only(itext('voice.chalenge.go'))
def _verify_product_slot(self, result, is_scanned): '''Verifies product/slot depending on spoken check digit or spoken/scanned pvid or ready spoken''' #if ready is spoken and check digits is not blank prompt for check digit if result == 'ready' and self._picks[0]["checkDigits"] != '': prompt_only(itext('selection.pick.prompt.speak.check.digit'), True) self.next_state = SLOT_VERIFICATION #if pvid is scanned verify it matches the scanned product id elif is_scanned: if self._picks[0]["scannedProdID"] != result: prompt_only(itext('generic.wrongValue.prompt', result)) self.next_state = SLOT_VERIFICATION #if check digit is spoken and both pvid and check digits are same prompt for identical short product elif result == self._picks[0]["checkDigits"] and self._pvid == result: if prompt_yes_no(itext('selection.pick.prompt.identical.product.short.product')): self._set_short_product(0) self.next_state = LOT_TRACKING #if ready or check digits is spoken and pvid is not blank prompt for short product elif result in [self._picks[0]["checkDigits"], 'ready'] and (self._pvid != '' or self._picks[0]["scannedProdID"] != ''): if prompt_yes_no(itext("selection.pick.prompt.short.product")): self._set_short_product(0) self.next_state = LOT_TRACKING else: prompt_only(itext('selection.pick.prompt.wrong.pvid')) self.next_state = SLOT_VERIFICATION
def sign_off(self): if prompt_yes_no(itext('global.sign.off.confirm')): prompt_only(itext('global.sign.off')) self.return_to(self.name, WELCOME_PROMPT) else: globalwords.words['sign off'].enabled = True
def quantity_prompt(self): prompt_only(itext('backstock.quantity', str(self._quantity)))