Beispiel #1
0
    def inserir_inspecao_veicular(sap_session, numero_transporte,
                                  numero_inspecao_veicular):
        SAPTransaction.call(sap_session, 'vt02n')
        SAPGuiElements.set_text(sap_session, ELEMENTO_NUMERO_TRANSPORTE,
                                numero_transporte)
        SAPGuiElements.press_keyboard_keys(sap_session, "Enter")

        SAPGuiElements.select_element(sap_session, ELEMENTO_ABA_IDENTIFICACAO)
        SAPGuiElements.set_text(sap_session, ELEMENTO_NUMERO_INSPECAO_VEICULAR,
                                numero_inspecao_veicular)
        SAPGuiElements.press_button(sap_session, SAVE_BUTTON)

        tipo_mensagem = SAPGuiElements.get_sbar_message_type(sap_session)
        if tipo_mensagem and tipo_mensagem == 'S':
            return True, ""
        return False, "Erro ao inserir inspecao {} no transporte {}".format(
            numero_inspecao_veicular, numero_transporte)
Beispiel #2
0
    def __abrir_transacao(sap_session, numero_inspecao_veicular):
        SAPTransaction.call(sap_session, 'qe01')
        SAPGuiElements.set_text(sap_session, ELEMENTO_LOTE_CONTROLE,
                                numero_inspecao_veicular)
        SAPGuiElements.set_text(sap_session, ELEMENTO_OPERACAO, "0010")
        SAPGuiElements.set_text(sap_session, ELEMENTO_CENTRO, "1014")
        sap_session.findById(ELEMENTO_FILTRO_CARACTERISTICAS).key = 1
        SAPGuiElements.press_keyboard_keys(sap_session, "Enter")

        existe_proxima_operacao = True
        while existe_proxima_operacao:
            '''
            row = 0
            while row < sap_session.findById(ELEMENTO_TABELA_RESULTADOS).RowCount:
                # print(row)
                # print(SAPGuiElements.get_text(sap_session, ELEMENTO_COLUNA_S.format(row)))
                # session.findById(ELEMENTO_TABELA_RESULTADOS).selectedRows = row
                row += 1
            '''
            QE01.__inserir_s(sap_session)
            SAPGuiElements.press_button(sap_session,
                                        ELEMENTO_BOTAO_SELECIONAR_TODOS)
            SAPGuiElements.press_button(sap_session, ELEMENTO_BOTAO_AVALIAR)
            # TODO verificar essa lógica
            SAPGuiElements.press_button(sap_session,
                                        ELEMENTO_BOTAO_PROXIMA_OPERACAO)
            existe_proxima_operacao = SAPGuiElements.is_enable(
                sap_session, ELEMENTO_BOTAO_PROXIMA_OPERACAO)

            try:
                SAPGuiElements.press_button(sap_session,
                                            ELEMENTO_BOTAO_GRAVAR_PRIMEIRO)
            except AttributeError:
                pass
        SAPGuiElements.press_button(sap_session, SAVE_BUTTON)
        tipo_mensagem = SAPGuiElements.get_sbar_message_type(sap_session)
        message = SAPGuiElements.get_text(sap_session, MESSAGE_ELEMENT)
        if tipo_mensagem and tipo_mensagem == 'S':
            return True, message
        else:
            return False, message