예제 #1
0
def traverse_menu(
    previous_menu,
    menu_str,
    system,
    attempt=0,
):
    if not f2.is_system_open(tries=25):
        login.sign_in_toronto(login.username, login.password, system)

    window_data = VERIFICATION['system'][system]

    if not f2.verify(window_data, attempts=50):
        login.sign_in_toronto(login.username, login.password, system)

    if attempt > 2:
        return False
    if previous_menu(system):
        window_data = VERIFICATION['screens'][menu_str]
        cmd = VERIFICATION['navigation'][menu_str]
        print(cmd)
        if '{' in cmd:
            keyboard.write_mix(cmd)
        else:
            keyboard.write_text(cmd)
        keyboard.enter(1)
        if not f2.verify(window_data, 50):
            return traverse_menu(previous_menu,
                                 menu_str,
                                 system,
                                 attempt=attempt + 1)
        return True
    return False
예제 #2
0
def main_menu_stock_stock_per_location_edit_stock_date_flowers(
        system, from_date, to_date, attempt=0, virtual=False):
    if attempt > 10:
        return False

    if type(from_date) == datetime.datetime:
        from_date = dates.get_menu_date(from_date)

    if type(to_date) == datetime.datetime:
        to_date = dates.get_menu_date(to_date)

    if main_menu_stock_stock_per_location_edit_stock_date(system,
                                                          from_date,
                                                          to_date,
                                                          attempt=0,
                                                          virtual=virtual):
        keyword = "main_menu-stock-stock_per_location-edit_stock-date-flowers"
        window_data = VERIFICATION['screens'][keyword]
        cmd = VERIFICATION['navigation'][keyword]
        keyboard.write_mix(cmd)
        keyboard.enter(1)
        if not f2.verify(window_data, 50):
            return main_menu_stock_stock_per_location_edit_stock_date_flowers(
                system, from_date, to_date, attempt + 1)
        else:
            return True
    return False
예제 #3
0
def stock_per_location_location(system,
                                from_date,
                                to_date,
                                location,
                                attempt=0,
                                virtual=False):
    if attempt > 10:
        return False
    if location in get_actual_stock_locations(system,
                                              from_date,
                                              to_date,
                                              virtual=virtual):
        keyword = 'stock_per_location-flowers-location'
        keyboard.write_text(location)
        keyboard.enter(2)
        window_data = copy.deepcopy(VERIFICATION['screens'][keyword])
        swaps = {
            '{location}': location,
        }
        for w in window_data:
            w['target'] = swap_values(swaps, w['target'])
        print(f"location is {location}: {window_data}")
        if not f2.verify(window_data, 100):
            return stock_per_location_location(system,
                                               from_date,
                                               to_date,
                                               location,
                                               attempt + 1,
                                               virtual=virtual)
        return True
    return False
예제 #4
0
def main_menu_purchase_default_purchase_distribute_flowers_purchase(
        system, purchase_date, attempts=0):
    if type(purchase_date) == datetime.datetime:
        purchase_date = dates.get_menu_date(purchase_date)

    if main_menu_purchase_default_purchase_distribute_flowers(system):
        keyboard.write_text(purchase_date)
        keyboard.enter()
        keyboard.f11()
예제 #5
0
def price_item(price):
    points = VERIFICATION['pricing']['f8-pricing']
    if True or f2.verify(points, attempts=10):
        keyboard.home()
        keyboard.enter()
        keyboard.paste_write(pricing.make_price_str(price))
        keyboard.f11()
        keyboard.f12()
    else:
        return False
예제 #6
0
def main_menu_purchase_default_input_purchases_flowers_date(
        system, purchase_date, attempts=0):
    if type(purchase_date) in (datetime.datetime, datetime.date):
        purchase_date = dates.get_menu_date(purchase_date)

    if main_menu_purchase_default_input_purchases_flowers(system):
        keyboard.write_text(purchase_date)
        keyboard.enter()
        keyboard.shift_f11()
        keyboard.home(3)
        return True
예제 #7
0
def main_menu_maintainance_data(system, attempt=0):
    if attempt > 10:
        return False
    if main_menu(system):
        window_data = VERIFICATION['screens']['main_menu-maintenance_data']
        cmd = VERIFICATION['navigation']['main_menu-maintenance_data']
        keyboard.write_text(cmd)
        keyboard.enter(1)
        if not f2.verify(window_data, 50):
            return main_menu_maintainance_data(attempt + 1)
        return True
    return False
예제 #8
0
def go_to_lot(system, location, lot, attempt=0):
    if f2_page.verify_per_location(location) and f2.verify_system(system):
        time.sleep(attempt * .05)
        keyboard.command('F7')
        keyboard.write_text(lot)
        keyboard.enter(2)
        keyboard.command(('shift', 'F10'))
        found = f2_page.verify_lot_info(lot)
        keyboard.command('f12')
        if not found and attempt < 5:
            found = go_to_lot(system, location, lot, attempt=attempt + 1)
        return found
예제 #9
0
def close_window(open_window):
    handle = open_window['handle']
    for i in range(8):
        try:
            window.maximize_window(handle)
            win32gui.SetForegroundWindow(handle)
            time.sleep(1)
            keyboard.f12(7)
            keyboard.enter()
        except:
            return True

    win32gui.PostMessage(open_window['handle'], win32con.WM_CLOSE, 0, 0)
예제 #10
0
def enter_purchase_normal(code, fob, landed, quantity, packing, supplier):
    keyboard.command('f10')
    keyboard.write_text(code)
    keyboard.enter()
    keyboard.write_text(fob)
    keyboard.enter()
    keyboard.write_text(landed)
    keyboard.enter()
    keyboard.write_text(quantity)
    keyboard.enter()
    keyboard.write_text(packing)
    keyboard.enter()
    keyboard.write_text(supplier)
    keyboard.f11(2)
예제 #11
0
def go_to_pricing():
    screen = window.get_window()
    if not screen:
        time.sleep(.1)
        screen = window.get_window()
    if 'Pricegroup:' in screen:
        keyboard.command('f1')
        keyboard.write_text('0')
        keyboard.enter()

    keyboard.command('f2')
    keyboard.shift_f11()
    keyboard.home(3)
    return lot_verify.pricing_screen()
예제 #12
0
def main_menu_maintainance_data_pricelists_edit_pricelist_flowers_select(
        price_list, date, system, attempt=0):
    menu_str = 'main_menu-maintenance_data-pricelists-edit_pricelist-flowers'
    f = main_menu_maintainance_data_pricelists_edit_pricelist
    if traverse_menu(f, menu_str, system, attempt=0):

        if date:
            keyboard.command(('shift', '3'))
            keyboard.write_text(date)
            keyboard.enter()
        keyboard.write_text(price_list)
        price_list_name = VERIFICATION['price_list'][price_list]['name']
        window_data = VERIFICATION['screens'][
            'main_menu-maintenance_data-pricelists-edit_pricelist-flowers-select']
        window_data[1]['target'] = price_list_name
        if not f2.verify(window_data, 50):
            return False
        else:
            return True
    return False
예제 #13
0
def main_menu_stock_stock_per_location_edit_stock_date(system,
                                                       from_date,
                                                       to_date,
                                                       attempt=0,
                                                       virtual=False):
    if attempt > 10:
        return False

    if type(from_date) == datetime.datetime:
        from_date = dates.get_menu_date(from_date)

    if type(to_date) == datetime.datetime:
        to_date = dates.get_menu_date(to_date)

    if virtual:
        menu = main_menu_stock_virtual_stock_location_edit_stock
    else:
        menu = main_menu_stock_stock_per_location_edit_stock

    if menu(system, attempt=0):
        keyboard.write_text(from_date)
        keyboard.enter()
        keyboard.write_text(to_date)
        keyboard.enter()
        window_data = copy.deepcopy(
            VERIFICATION['screens']
            ['main_menu-stock-stock_per_location-edit_stock-date'])
        swaps = {
            '{from_date}': from_date,
            '{to_date}': to_date,
        }
        for w in window_data:
            w['target'] = swap_values(swaps, w['target'])
        # print(window_data)
        if not f2.verify(window_data, 50):
            return main_menu_stock_stock_per_location_edit_stock_date(
                system, from_date, to_date, attempt + 1)
        else:
            return True
    return False
예제 #14
0
def login(username, password):
    closef2.close()
    paths = [{
        'dir': r'c:/Program Files (x86)/Connect Internet/',
        'filename': 'Connect.exe'
    }, {
        'dir': r'c:/Program Files (x86)/Connect2000_Internet/',
        'filename': 'Connect2000.exe'
    }]
    for path in paths:
        try:
            os.chdir(path['dir'])
            os.system(path['filename'])
            break
        except:
            print("not found")
            print(path)
    while not is_login_dialogue_open():
        time.sleep(.1)
    keyboard.write_text(password)
    pyautogui.hotkey('shift', 'tab')
    keyboard.write_text(username)
    keyboard.enter()
예제 #15
0
def get_lot_data(lot, system):
    lot_number = lot[0]
    purchase_date = lot[1]
    window.drag_window()
    keyboard.command("f7")
    keyboard.write_text(lot_number)
    keyboard.enter()
    for i in range(5):
        try:
            lot_main = parse.get_input_purchase_lots(system, purchase_date)
            break
        except:
            lot_main = False
            time.sleep(.1)
    if not lot_main or lot_number not in lot_main:
        return False
    lot_main = lot_main[lot_number]
    supplier_code = lot_main['supplier_code']
    if not supplier_code or supplier_code[0] in (
            'M', '1') and 'f2_canada' in system:
        return False
    data = lots.get_lot_info_purchase(lot_number, purchase_date, supplier_code)
    keyboard.f12()
    return data
예제 #16
0
def go_to_lot(lot_number):
    window.get_window()
    keyboard.command('f7')
    keyboard.write_text(lot_number)
    keyboard.enter(n=2)
    return lot_verify.verify_lot(lot_number)
예제 #17
0
def main_menu_purchase_default_insert_virtual_purchase_flowers_date(
        system, purchase_date, attempts=0):
    if main_menu_purchase_default_insert_virtual_purchase_flowers(system):
        keyboard.write_text(purchase_date)
        keyboard.enter()
예제 #18
0
def change_price_level(system, location, price_level):
    if f2_page.verify_per_location(location) and f2.verify_system(system):
        keyboard.command('F1')
        keyboard.write_text(str(price_level))
        keyboard.enter()
        return f2_page.verify_per_location_price_level(location, price_level)