Exemplo n.º 1
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()
Exemplo n.º 2
0
def get_lot_info(attempt=0):
    keyboard.command(('shift', 'f10'))
    if attempt > 4:
        return False
    print(f"attemtpt {attempt}")
    screen = window.get_window()
    lot_data = {}
    for reference in lot_reference:
        lot_data[reference['data_point']] = find_text_end(screen, reference)

    if not lot_data['assortment_code']:
        return get_lot_info(attempt + 1)
    lot_data['catgeory'] = get_category_name(lot_data['category_num'])
    print(lot_data['catgeory'])
    lot_data['name'] = get_article_name(lot_data['catgeory'])
    try:
        lot_data['purchase_date'] = dates.lot_date(lot_data['purchase_date'])
    except:
        return get_lot_info(attempt + 1)
    lot_data['landed_price'] = get_landed(lot_data['landed_price'])
    if not lot_data['landed_price']:
        lot_data['landed_price'] = '0.01'

    if check_complete(lot_data):
        return lot_data
    return get_lot_info(attempt + 1)
Exemplo n.º 3
0
def process_scene(uscreen):
    for j in range(10):
        try:
            return uscreen.split('\r\n')
        except:
            uscreen = window.get_window()
    return None
Exemplo n.º 4
0
def tries(strings):
    print('start tries')
    screen = window.get_window()
    for s in strings:
        if not screen or s not in screen:
            return False
    return True
Exemplo n.º 5
0
def pricing_screen():
    text = 'Alle Tariefgroepen'
    for i in range(20):
        if text in window.get_window():
            return True
        else:
            time.sleep(.05)
    return False
Exemplo n.º 6
0
def verify(points):

    time.sleep(1)
    screen = parse.process_scene(window.get_window())
    for p in points:
        if not p[0] in screen[p[1]][p[2]:]:
            return False
    return True
Exemplo n.º 7
0
def close_pricing():
    for i in range(10):
        screen = window.get_window()
        if not 'Val╦═Perc.' in screen:
            return True
        time.sleep(.02)
    keyboard.f12()
    close_pricing()
Exemplo n.º 8
0
def get_recommended_price(attempt=0):
    for i in range(20):
        screen = window.get_window()
        text = '1N║Flowers C&C'
        if text in screen:
            start = screen.index(text) + 37
            end = start + 6
            return screen[start:end].replace(',', '.').strip()
        time.sleep(.1)
    return False
Exemplo n.º 9
0
def verify_lot(lot_number):
    keyboard.command(('shift', 'f10'))
    text = f'Intern partijnummer  : {lot_number}'
    for i in range(20):
        if text in window.get_window():
            keyboard.f12()
            return True
        else:
            time.sleep(.05)
    keyboard.f12()
    return False
Exemplo n.º 10
0
 def tries(points):
     #print(points)
     screen = parse.process_scene(window.get_window())
     for p in points:
         try:
             if not p['target'] in screen[p['location']
                                          [0]][p['location'][1]:]:
                 return False
         except:
             return False
     return True
Exemplo n.º 11
0
def count_items_in_category(count=0, oldcreen=''):
    points = VERIFICATION['pricing']['in_group-pricing']
    if f2.verify(points, attempts=10):
        if f2.is_new_screen(oldcreen):
            uscreen = window.get_window()
            count += parse.count_category(uscreen)
            keyboard.pgdn()
            time.sleep(.1)
            return count_items_in_category(count, uscreen)
        return count
    return None
Exemplo n.º 12
0
def get_stock_lots():
    uscreen = window.get_window()
    screen = process_scene(uscreen)
    data = {}
    for s in screen[6:-4]:
        row = s.split('║')
        if row[1].strip():
            lot = row[1].strip()[:-1]
            rdata = {'lot': lot, 'price': row[11].replace(',', '.').strip()}
            data[lot] = (rdata)
    return data
Exemplo n.º 13
0
def get_stock_locations():
    uscreen = window.get_window()
    match_str = '║[a-zA-Z][a-z]   ║'
    a = re.findall(match_str, uscreen)
    match_str = '║[a-zA-Z][a-z][a-z]  ║'
    a.extend(re.findall(match_str, uscreen))
    match_str = '║[a-zA-Z][a-z][a-z][a-z] ║'
    a.extend(re.findall(match_str, uscreen))
    for index in range(len(a)):
        a[index] = a[index].strip('║')
        a[index] = a[index].strip()
    return a
Exemplo n.º 14
0
def is_new_screen(old_screen, attempts=0):
    if old_screen == '':
        return True

    if attempts > 50:
        return False

    old_screen = parse.process_scene(old_screen)[6:-4]
    new_screen = parse.process_scene(window.get_window())[6:-4]

    if old_screen == new_screen:
        return is_new_screen(old_screen, attempts + 1)
    return True
Exemplo n.º 15
0
def get_window_info(targets):
    total = []
    w = parse.process_scene(window.get_window())

    for target in (targets):
        i = 0
        for line in w:
            if target in line:
                total.append({
                    'target': target,
                    'location': (i, line.index(target))
                })
            i += 1

    #print(total)
    return total
Exemplo n.º 16
0
def get_lot_info_assortment(attempt=0):
    keyboard.command(('shift', 'f10'))
    if attempt > 20:

        return False
    #print(f"attemtpt {attempt}")
    screen = window.get_window()
    lot_data = {}
    for reference in lot_reference:
        try:
            lot_data[reference['data_point']] = find_text_end(
                screen, reference)
        except:
            pass
    if not lot_data['assortment_code']:
        return get_lot_info_assortment(attempt + 1)
    lot_data['catgeory'] = get_category_name(lot_data['category_num'])
    lot_data['name'] = get_article_name(lot_data['catgeory'])
    return lot_data
Exemplo n.º 17
0
def get_input_purchase_lots(system, purchase_date):
    time.sleep(.1)
    uscreen = window.get_window()
    screen = process_scene(uscreen)
    data = {}
    for s in screen[6:-4]:
        row = s.split('║')
        lot = row[1].strip()

        rdata = {
            'system': system,
            'purchase_date': purchase_date,
            'lot': lot,
            'landed_price': row[6].replace(',', '.').strip(),
            'supplier_code': row[8].strip()
        }
        if rdata['lot'].isdigit():
            data[lot] = (rdata)
    return data
Exemplo n.º 18
0
def verify_per_location_price_level(location, level, attempt=0):

    if attempt > 50:
        return False
    level = str(level)
    if level == '0':
        row = parse.process_scene(window.get_window())[4][55:-5].strip()
        print('row', row)
        if row == '' or row == 'Pricegroup :    0':
            print("TRUE")
            return True
        else:
            return verify_per_location_price_level(location, level,
                                                   attempt + 1)

    keyword = "stock_per_location-flowers-location-price_level"
    window_data = VERIFICATION['screens'][keyword]
    swaps = {
        '{level}': level,
    }
    for w in window_data:
        w['target'] = swap_values(swaps, w['target'])
    return verify_per_location(location) and f2.verify(window_data, 50)
Exemplo n.º 19
0
def get_lot_info_purchase(lot_number, purchase_date, supplier_code, attempt=0):
    keyboard.command(('shift', 'f10'))
    if attempt > 4:
        return False
    screen = window.get_window()
    lot_data = {}

    for reference in lot_reference:
        lot_data[reference['data_point']] = find_text_end(screen, reference)
    if not lot_data['assortment_code']:
        return get_lot_info_purchase(purchase_date, lot_number, supplier_code,
                                     attempt + 1)
    lot_data['catgeory'] = get_category_name(lot_data['category_num'])

    lot_data['name'] = get_article_name(lot_data['catgeory'])
    lot_data['landed_price'] = get_landed(lot_data['landed_price'])
    lot_data['purchase_date'] = purchase_date
    lot_data['supplier_code'] = supplier_code
    if not lot_data['lot_number']:
        lot_data['lot_number'] = lot_number
    if check_complete(lot_data):
        return lot_data
    return get_lot_info_purchase(lot_number, purchase_date, supplier_code,
                                 attempt + 1)
Exemplo n.º 20
0
def get_parsed_screen_body():
    return process_scene(window.get_window())[6:-4]
Exemplo n.º 21
0
def underline_item(date_str, b):
    w = window.get_window()
    if (date_str in w) == b:
        keyboard.write_text(' ')
    keyboard.command('down')
    return w
Exemplo n.º 22
0
def top_of_list():
    uscreen = window.get_window()
    keyboard.home(2)
    if f2.is_new_screen(uscreen):
        return top_of_list()
    return True
Exemplo n.º 23
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)
Exemplo n.º 24
0
def get_parsed_screen():
    return process_scene(window.get_window())
Exemplo n.º 25
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)


if __name__ == '__main__':
    system = 'f2_canada_real'
    # data = get_lot_data(['574399', dates.menu_date('03/01/19')], system)
    # update_data.update_purchases_assortment(system, data['lot_number'], data['assortment_code'])
    # update_purchases(system, dates.menu_date('31/01/20'))

    # update_purchases(system, '19/12/19')
    #update_data.update_purchase_orders_mark_entered(11, False)
    window.get_window()
    print(get_virtual_purchase_todo())
    enter_virtual_purchase(259)
    #window.get_window()

    #enter_purchase_normal('tecligpi+r', '.43', '.43', '5', '100', 'CASPFL')