def get_cart_for_shipping(): cursor = create_hana_connection() cursor.execute( f"select ID from sapecp.YECH_SHIP_CART where STATUS='' and ROUTE='' and SHIPMENT_ID= '' " ) cart_list = [ cart[0] for cart in cursor.fetchall() if cart[0].startswith("M") ] return cart_list
def get_cons_position(type_of_cons): cursor = create_hana_connection() cursor.execute( f'select EXC_BARCODE from "SAPECP"."/S2IM/001_EXCPOS" where EXC_TYPE = \'1\' and EXC_LOADING_TYPE = \'{type_of_cons}\' and VBELN = \'\'' ) empty_cons_positions = [ position[0] for position in cursor.fetchall() if not position[0].endswith("9999") ] return empty_cons_positions
def make_session(system): session, connection, application, sap_gui_auto = initialization() db_connection = create_hana_connection(system) cursor = db_connection.cursor() data = { "session": session, "connection": connection, "application": application, "sap_gui_auto": sap_gui_auto, "cursor": cursor, "user": os.environ.get("SAP_USER"), "system": system, "db_connection": db_connection } return data
def inbound(indls): driver = get_driver() login(driver, user, password) navigate_in(driver, indls) cursor = create_hana_connection() item_list = get_indls_data_from_lips(cursor, indls) pallets = [] for item in item_list: matnr, quantity, charge = item matnr = matnr.lstrip("0") quantity = str(quantity) pallets.append(input_pallet(driver, create_pallet(cursor))) input_material(driver, matnr) input_quantity(driver, quantity) if charge == "X": input_charge_date(driver, cursor, matnr) close_pallet(driver) navigate_out(driver) print(f"PALLETS = {pallets}") return pallets
driver.find_element(By.CSS_SELECTOR, "input[name*='answer_no']").click() def exit_control(driver): back_menu = driver.find_element_by_id("butback") back_menu.click() back_menu = driver.find_element_by_id("butback") back_menu.click() def control(driver, cursor, deliveries): position_and_boxes_dict, type_consolidation_dict = get_data_for_control(cursor, deliveries) empty_hu_list = get_empty_hu(cursor) storage_types = "02", "03", "04" for storage_type in storage_types: control_over_type(driver, position_and_boxes_dict, type_consolidation_dict, empty_hu_list, storage_type) change_workstation(driver, "all") return driver if __name__ == '__main__': wd = get_driver() login(wd) cursora = create_hana_connection() deliveris = ['2000003236', ] control(wd, cursora, deliveris) # print(get_data_for_control(cursora, deliveris))
session.FindById('wnd[0]/tbar[1]/btn[7]').Press() route = get_route_hana(delivery[0]) session.FindById("wnd[0]/tbar[0]/btn[3]").Press() session.FindById("wnd[0]/tbar[1]/btn[8]").Press() zmon_main_grid = session.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell") main_len_row = zmon_main_grid.RowCount - 1 for zmon_row in range(main_len_row)[1:]: if zmon_main_grid.GetCellValue(zmon_row, "ROUTE") == route: # zmon_main_grid.selectedRows = zmon_row zmon_main_grid.setCurrentCell(zmon_row, "ROUTE") break session.FindById("wnd[0]/tbar[1]/btn[20]").Press() session.FindById("wnd[1]/usr/ctxtYECH_POS_TERM-TERM_ID").text = "TEST" session.FindById("wnd[1]/tbar[0]/btn[8]").Press() print(f"DLV {delivery} - ROUTE {route}") if __name__ == '__main__': sess = initialization() cursor = create_hana_connection("k4d") dlv = [ '2000003236', ] zmonex(sess, cursor, dlv, terminal="TEST")
def get_su_from_hana(storage_unit): cursor = create_hana_connection() cursor.execute(f"select lenum from sapecp.lein where LENUM = '{storage_unit:0>20}'") return cursor.fetchone()[0].lstrip("0")
def get_to_from_dlv(dlv): cursor = create_hana_connection() cursor.execute(f"select VBELN from SAPECP.VBFA where VBELV='{dlv}' ") return cursor.fetchone()[0].lstrip("0")
def get_tst_data(): cursor = create_hana_connection() cursor.execute( f'select POSNR, MATNR from SAPECP.VBAP where VBELN=5510001340 ') return [print(_) for _ in cursor.fetchall()]
def get_courier_positions(): cursor = create_hana_connection() cursor.execute( f'select EXC_BARCODE from "SAPECP"."/S2IM/001_EXCPOS" where EXC_TYPE=2 and VBELN=\'\' and EXC_LOADING_TYPE=02' ) return [x[0] for x in cursor.fetchall()]
def get_cons_positions(): cursor = create_hana_connection() cursor.execute(f'select * from "SAPECP"."/S2IM/001_EXCPOS"') return cursor.fetchone()