worker-automate-hub 0.5.16__py3-none-any.whl → 0.5.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- worker_automate_hub/tasks/jobs/coleta_dje_process.py +12 -0
 - worker_automate_hub/tasks/jobs/conexao_rdp.py +4 -4
 - worker_automate_hub/tasks/jobs/descartes.py +21 -18
 - worker_automate_hub/tasks/jobs/ecac_estadual_go.py +8 -6
 - worker_automate_hub/tasks/jobs/ecac_estadual_main.py +4 -2
 - worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +8 -6
 - worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +5 -3
 - worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +9 -7
 - worker_automate_hub/tasks/jobs/ecac_federal.py +11 -8
 - worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +14 -12
 - worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +19 -11
 - worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +23 -11
 - worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +63 -32
 - worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +56 -28
 - worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +54 -38
 - worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +35 -21
 - worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +53 -28
 - worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +40 -14
 - worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +28 -14
 - worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +18 -12
 - worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +40 -13
 - worker_automate_hub/tasks/jobs/exemplo_processo.py +3 -0
 - worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +3 -3
 - worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +9 -7
 - worker_automate_hub/tasks/jobs/login_emsys.py +2 -1
 - worker_automate_hub/tasks/jobs/playground.py +4 -0
 - worker_automate_hub/tasks/jobs/sped_fiscal.py +24 -0
 - worker_automate_hub/tasks/jobs/transferencias.py +28 -26
 - worker_automate_hub/tasks/task_executor.py +3 -0
 - worker_automate_hub/utils/util.py +148 -141
 - worker_automate_hub/utils/utils_nfe_entrada.py +10 -0
 - {worker_automate_hub-0.5.16.dist-info → worker_automate_hub-0.5.18.dist-info}/METADATA +1 -1
 - {worker_automate_hub-0.5.16.dist-info → worker_automate_hub-0.5.18.dist-info}/RECORD +35 -35
 - {worker_automate_hub-0.5.16.dist-info → worker_automate_hub-0.5.18.dist-info}/WHEEL +0 -0
 - {worker_automate_hub-0.5.16.dist-info → worker_automate_hub-0.5.18.dist-info}/entry_points.txt +0 -0
 
| 
         @@ -21,6 +21,8 @@ from worker_automate_hub.config.settings import load_env_config 
     | 
|
| 
       21 
21 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_historico_request_dto import (
         
     | 
| 
       22 
22 
     | 
    
         
             
                RpaHistoricoStatusEnum,
         
     | 
| 
       23 
23 
     | 
    
         
             
                RpaRetornoProcessoDTO,
         
     | 
| 
      
 24 
     | 
    
         
            +
                RpaTagDTO,
         
     | 
| 
      
 25 
     | 
    
         
            +
                RpaTagEnum,
         
     | 
| 
       24 
26 
     | 
    
         
             
            )
         
     | 
| 
       25 
27 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
         
     | 
| 
       26 
28 
     | 
    
         
             
                RpaProcessoEntradaDTO,
         
     | 
| 
         @@ -155,6 +157,7 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       155 
157 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       156 
158 
     | 
    
         
             
                            retorno=imported_nfe.retorno,
         
     | 
| 
       157 
159 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 160 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       158 
161 
     | 
    
         
             
                        )
         
     | 
| 
       159 
162 
     | 
    
         | 
| 
       160 
163 
     | 
    
         
             
                    await worker_sleep(10)
         
     | 
| 
         @@ -182,6 +185,7 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       182 
185 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       183 
186 
     | 
    
         
             
                                retorno=warning_work.retorno,
         
     | 
| 
       184 
187 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 188 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       185 
189 
     | 
    
         
             
                            )
         
     | 
| 
       186 
190 
     | 
    
         | 
| 
       187 
191 
     | 
    
         
             
                    # VERIFICANDO A EXISTENCIA DE ERRO
         
     | 
| 
         @@ -242,25 +246,21 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       242 
246 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
       243 
247 
     | 
    
         | 
| 
       244 
248 
     | 
    
         
             
                    try:
         
     | 
| 
       245 
     | 
    
         
            -
                        console.print(
         
     | 
| 
       246 
     | 
    
         
            -
                            "Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
         
     | 
| 
       247 
     | 
    
         
            -
                        )
         
     | 
| 
      
 249 
     | 
    
         
            +
                        console.print("Verificando itens não localizados ou NCM...\n")
         
     | 
| 
       248 
250 
     | 
    
         
             
                        itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
       249 
252 
     | 
    
         
             
                        if itens_by_supplier["IsOpened"] == True:
         
     | 
| 
       250 
253 
     | 
    
         
             
                            itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
         
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
                                    sucesso=False,
         
     | 
| 
       256 
     | 
    
         
            -
                                    retorno=itens_by_supplier_work.get("retorno"),
         
     | 
| 
       257 
     | 
    
         
            -
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
       258 
     | 
    
         
            -
                                )
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                            if not itens_by_supplier_work.sucesso:
         
     | 
| 
      
 256 
     | 
    
         
            +
                                return itens_by_supplier_work
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
       259 
258 
     | 
    
         
             
                    except Exception as error:
         
     | 
| 
       260 
259 
     | 
    
         
             
                        return RpaRetornoProcessoDTO(
         
     | 
| 
       261 
260 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       262 
261 
     | 
    
         
             
                            retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
         
     | 
| 
       263 
262 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 263 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       264 
264 
     | 
    
         
             
                        )
         
     | 
| 
       265 
265 
     | 
    
         | 
| 
       266 
266 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
         @@ -360,6 +360,7 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       360 
360 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       361 
361 
     | 
    
         
             
                                retorno=observacao,
         
     | 
| 
       362 
362 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 363 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       363 
364 
     | 
    
         
             
                            )
         
     | 
| 
       364 
365 
     | 
    
         | 
| 
       365 
366 
     | 
    
         
             
                    max_attempts = 60
         
     | 
| 
         @@ -382,7 +383,7 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       382 
383 
     | 
    
         
             
                        return RpaRetornoProcessoDTO(
         
     | 
| 
       383 
384 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       384 
385 
     | 
    
         
             
                            retorno=f"Erro ao lançar nota",
         
     | 
| 
       385 
     | 
    
         
            -
                            status=RpaHistoricoStatusEnum. 
     | 
| 
      
 386 
     | 
    
         
            +
                            status=RpaHistoricoStatusEnum.Descartado,
         
     | 
| 
       386 
387 
     | 
    
         
             
                        )
         
     | 
| 
       387 
388 
     | 
    
         
             
                    else:
         
     | 
| 
       388 
389 
     | 
    
         
             
                        return RpaRetornoProcessoDTO(
         
     | 
| 
         @@ -401,4 +402,5 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       401 
402 
     | 
    
         
             
                        sucesso=False,
         
     | 
| 
       402 
403 
     | 
    
         
             
                        retorno=observacao,
         
     | 
| 
       403 
404 
     | 
    
         
             
                        status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 405 
     | 
    
         
            +
                        tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       404 
406 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -21,6 +21,8 @@ from worker_automate_hub.config.settings import load_env_config 
     | 
|
| 
       21 
21 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_historico_request_dto import (
         
     | 
| 
       22 
22 
     | 
    
         
             
                RpaHistoricoStatusEnum,
         
     | 
| 
       23 
23 
     | 
    
         
             
                RpaRetornoProcessoDTO,
         
     | 
| 
      
 24 
     | 
    
         
            +
                RpaTagDTO,
         
     | 
| 
      
 25 
     | 
    
         
            +
                RpaTagEnum,
         
     | 
| 
       24 
26 
     | 
    
         
             
            )
         
     | 
| 
       25 
27 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
         
     | 
| 
       26 
28 
     | 
    
         
             
                RpaProcessoEntradaDTO,
         
     | 
| 
         @@ -45,6 +47,7 @@ from worker_automate_hub.utils.util import ( 
     | 
|
| 
       45 
47 
     | 
    
         
             
            from worker_automate_hub.utils.utils_nfe_entrada import EMSys
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
       47 
49 
     | 
    
         
             
            pyautogui.PAUSE = 0.5
         
     | 
| 
      
 50 
     | 
    
         
            +
            pyautogui.FAILSAFE = False
         
     | 
| 
       48 
51 
     | 
    
         
             
            console = Console()
         
     | 
| 
       49 
52 
     | 
    
         | 
| 
       50 
53 
     | 
    
         
             
            emsys = EMSys()
         
     | 
| 
         @@ -109,6 +112,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       109 
112 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       110 
113 
     | 
    
         
             
                            retorno=document_type.retorno,
         
     | 
| 
       111 
114 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 115 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       112 
116 
     | 
    
         
             
                        )
         
     | 
| 
       113 
117 
     | 
    
         | 
| 
       114 
118 
     | 
    
         
             
                    await worker_sleep(4)
         
     | 
| 
         @@ -122,6 +126,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       122 
126 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       123 
127 
     | 
    
         
             
                            retorno=imported_nfe.retorno,
         
     | 
| 
       124 
128 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 129 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       125 
130 
     | 
    
         
             
                        )
         
     | 
| 
       126 
131 
     | 
    
         | 
| 
       127 
132 
     | 
    
         
             
                    await worker_sleep(10)
         
     | 
| 
         @@ -149,6 +154,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       149 
154 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       150 
155 
     | 
    
         
             
                                retorno=warning_work.retorno,
         
     | 
| 
       151 
156 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 157 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       152 
158 
     | 
    
         
             
                            )
         
     | 
| 
       153 
159 
     | 
    
         | 
| 
       154 
160 
     | 
    
         
             
                    # VERIFICANDO A EXISTENCIA DE ERRO
         
     | 
| 
         @@ -230,6 +236,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       230 
236 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       231 
237 
     | 
    
         
             
                            retorno=f"Erro ao iterar itens de almoxarifado: {e}",
         
     | 
| 
       232 
238 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 239 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       233 
240 
     | 
    
         
             
                        )
         
     | 
| 
       234 
241 
     | 
    
         | 
| 
       235 
242 
     | 
    
         
             
                    checkbox = window.child_window(
         
     | 
| 
         @@ -289,30 +296,27 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       289 
296 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       290 
297 
     | 
    
         
             
                            retorno=f"Número máximo de tentativas atingido, Não foi possivel finalizar os trabalhos na tela de Informações para importação da Nota Fiscal Eletrônica",
         
     | 
| 
       291 
298 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 299 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       292 
300 
     | 
    
         
             
                        )
         
     | 
| 
       293 
301 
     | 
    
         | 
| 
       294 
302 
     | 
    
         
             
                    await worker_sleep(15)
         
     | 
| 
       295 
303 
     | 
    
         | 
| 
       296 
304 
     | 
    
         
             
                    try:
         
     | 
| 
       297 
     | 
    
         
            -
                        console.print(
         
     | 
| 
       298 
     | 
    
         
            -
                            "Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
         
     | 
| 
       299 
     | 
    
         
            -
                        )
         
     | 
| 
      
 305 
     | 
    
         
            +
                        console.print("Verificando itens não localizados ou NCM...\n")
         
     | 
| 
       300 
306 
     | 
    
         
             
                        itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
       301 
308 
     | 
    
         
             
                        if itens_by_supplier["IsOpened"] == True:
         
     | 
| 
       302 
309 
     | 
    
         
             
                            itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
         
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
                                    sucesso=False,
         
     | 
| 
       308 
     | 
    
         
            -
                                    retorno=itens_by_supplier_work.get("retorno"),
         
     | 
| 
       309 
     | 
    
         
            -
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
       310 
     | 
    
         
            -
                                )
         
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
                            if not itens_by_supplier_work.sucesso:
         
     | 
| 
      
 312 
     | 
    
         
            +
                                return itens_by_supplier_work
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
       311 
314 
     | 
    
         
             
                    except Exception as error:
         
     | 
| 
       312 
315 
     | 
    
         
             
                        return RpaRetornoProcessoDTO(
         
     | 
| 
       313 
316 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       314 
317 
     | 
    
         
             
                            retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
         
     | 
| 
       315 
318 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 319 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       316 
320 
     | 
    
         
             
                        )
         
     | 
| 
       317 
321 
     | 
    
         | 
| 
       318 
322 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
         @@ -403,6 +407,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       403 
407 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       404 
408 
     | 
    
         
             
                                retorno=observacao,
         
     | 
| 
       405 
409 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 410 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       406 
411 
     | 
    
         
             
                            )
         
     | 
| 
       407 
412 
     | 
    
         
             
                    try:
         
     | 
| 
       408 
413 
     | 
    
         | 
| 
         @@ -476,6 +481,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       476 
481 
     | 
    
         
             
                                        sucesso=False,
         
     | 
| 
       477 
482 
     | 
    
         
             
                                        retorno=f"Pop_up Informantion não mapeado para andamento do robô, mensagem {captured_text}",
         
     | 
| 
       478 
483 
     | 
    
         
             
                                        status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 484 
     | 
    
         
            +
                                        tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       479 
485 
     | 
    
         
             
                                    )
         
     | 
| 
       480 
486 
     | 
    
         
             
                            else:
         
     | 
| 
       481 
487 
     | 
    
         
             
                                console.print(f"Aba Information não encontrada")
         
     | 
| 
         @@ -487,6 +493,7 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       487 
493 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       488 
494 
     | 
    
         
             
                            retorno=f"Erro em obter o retorno, Nota inserida com sucesso, erro {e}",
         
     | 
| 
       489 
495 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 496 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       490 
497 
     | 
    
         
             
                        )
         
     | 
| 
       491 
498 
     | 
    
         | 
| 
       492 
499 
     | 
    
         
             
                    if retorno:
         
     | 
| 
         @@ -506,4 +513,5 @@ async def entrada_de_notas_16(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       506 
513 
     | 
    
         
             
                        sucesso=False,
         
     | 
| 
       507 
514 
     | 
    
         
             
                        retorno=observacao,
         
     | 
| 
       508 
515 
     | 
    
         
             
                        status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 516 
     | 
    
         
            +
                        tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       509 
517 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -17,6 +17,8 @@ from worker_automate_hub.api.client import ( 
     | 
|
| 
       17 
17 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_historico_request_dto import (
         
     | 
| 
       18 
18 
     | 
    
         
             
                RpaHistoricoStatusEnum,
         
     | 
| 
       19 
19 
     | 
    
         
             
                RpaRetornoProcessoDTO,
         
     | 
| 
      
 20 
     | 
    
         
            +
                RpaTagDTO,
         
     | 
| 
      
 21 
     | 
    
         
            +
                RpaTagEnum,
         
     | 
| 
       20 
22 
     | 
    
         
             
            )
         
     | 
| 
       21 
23 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
         
     | 
| 
       22 
24 
     | 
    
         
             
                RpaProcessoEntradaDTO,
         
     | 
| 
         @@ -109,6 +111,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       109 
111 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       110 
112 
     | 
    
         
             
                            retorno=document_type.retorno,
         
     | 
| 
       111 
113 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 114 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       112 
115 
     | 
    
         
             
                        )
         
     | 
| 
       113 
116 
     | 
    
         | 
| 
       114 
117 
     | 
    
         
             
                    await worker_sleep(4)
         
     | 
| 
         @@ -122,6 +125,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       122 
125 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       123 
126 
     | 
    
         
             
                            retorno=imported_nfe.retorno,
         
     | 
| 
       124 
127 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 128 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       125 
129 
     | 
    
         
             
                        )
         
     | 
| 
       126 
130 
     | 
    
         | 
| 
       127 
131 
     | 
    
         
             
                    await worker_sleep(5)
         
     | 
| 
         @@ -140,6 +144,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       140 
144 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       141 
145 
     | 
    
         
             
                                retorno=warning_work.retorno,
         
     | 
| 
       142 
146 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 147 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       143 
148 
     | 
    
         
             
                            )
         
     | 
| 
       144 
149 
     | 
    
         | 
| 
       145 
150 
     | 
    
         
             
                    # VERIFICANDO A EXISTENCIA DE ERRO
         
     | 
| 
         @@ -178,6 +183,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       178 
183 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       179 
184 
     | 
    
         
             
                            retorno="Erro mapeado, CFOP diferente de 5655 ou 56, necessario ação manual ou ajuste no robo",
         
     | 
| 
       180 
185 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 186 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       181 
187 
     | 
    
         
             
                        )
         
     | 
| 
       182 
188 
     | 
    
         | 
| 
       183 
189 
     | 
    
         
             
                    # INTERAGINDO COM O CAMPO ALMOXARIFADO
         
     | 
| 
         @@ -204,6 +210,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       204 
210 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       205 
211 
     | 
    
         
             
                            retorno=f"Erro ao iterar itens de almoxarifado: {e}",
         
     | 
| 
       206 
212 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 213 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       207 
214 
     | 
    
         
             
                        )
         
     | 
| 
       208 
215 
     | 
    
         | 
| 
       209 
216 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
         @@ -272,30 +279,27 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       272 
279 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       273 
280 
     | 
    
         
             
                            retorno=f"Número máximo de tentativas atingido, Não foi possivel finalizar os trabalhos na tela de Informações para importação da Nota Fiscal Eletrônica",
         
     | 
| 
       274 
281 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 282 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       275 
283 
     | 
    
         
             
                        )
         
     | 
| 
       276 
284 
     | 
    
         | 
| 
       277 
285 
     | 
    
         
             
                    await worker_sleep(6)
         
     | 
| 
       278 
286 
     | 
    
         | 
| 
       279 
287 
     | 
    
         
             
                    try:
         
     | 
| 
       280 
     | 
    
         
            -
                        console.print(
         
     | 
| 
       281 
     | 
    
         
            -
                            "Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
         
     | 
| 
       282 
     | 
    
         
            -
                        )
         
     | 
| 
      
 288 
     | 
    
         
            +
                        console.print("Verificando itens não localizados ou NCM...\n")
         
     | 
| 
       283 
289 
     | 
    
         
             
                        itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
       284 
291 
     | 
    
         
             
                        if itens_by_supplier["IsOpened"] == True:
         
     | 
| 
       285 
292 
     | 
    
         
             
                            itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
         
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
             
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
                                    sucesso=False,
         
     | 
| 
       291 
     | 
    
         
            -
                                    retorno=itens_by_supplier_work.get("retorno"),
         
     | 
| 
       292 
     | 
    
         
            -
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
       293 
     | 
    
         
            -
                                )
         
     | 
| 
      
 293 
     | 
    
         
            +
             
     | 
| 
      
 294 
     | 
    
         
            +
                            if not itens_by_supplier_work.sucesso:
         
     | 
| 
      
 295 
     | 
    
         
            +
                                return itens_by_supplier_work
         
     | 
| 
      
 296 
     | 
    
         
            +
             
     | 
| 
       294 
297 
     | 
    
         
             
                    except Exception as error:
         
     | 
| 
       295 
298 
     | 
    
         
             
                        return RpaRetornoProcessoDTO(
         
     | 
| 
       296 
299 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       297 
300 
     | 
    
         
             
                            retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
         
     | 
| 
       298 
301 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 302 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       299 
303 
     | 
    
         
             
                        )
         
     | 
| 
       300 
304 
     | 
    
         | 
| 
       301 
305 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
         @@ -324,6 +328,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       324 
328 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       325 
329 
     | 
    
         
             
                            retorno="Não foi possivel acessar a aba de 'Itens da nota'",
         
     | 
| 
       326 
330 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 331 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       327 
332 
     | 
    
         
             
                        )
         
     | 
| 
       328 
333 
     | 
    
         | 
| 
       329 
334 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
         @@ -350,6 +355,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       350 
355 
     | 
    
         
             
                                    sucesso=False,
         
     | 
| 
       351 
356 
     | 
    
         
             
                                    retorno=f"Não foi possivel acessar a extrair a quantidade/Unidade de medidade do XML, item: {item}",
         
     | 
| 
       352 
357 
     | 
    
         
             
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 358 
     | 
    
         
            +
                                    tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       353 
359 
     | 
    
         
             
                                )
         
     | 
| 
       354 
360 
     | 
    
         
             
                            pos_x = formato.find("X")
         
     | 
| 
       355 
361 
     | 
    
         
             
                            cod_split = str(formato[0:pos_x])
         
     | 
| 
         @@ -424,6 +430,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       424 
430 
     | 
    
         
             
                                            sucesso=False,
         
     | 
| 
       425 
431 
     | 
    
         
             
                                            retorno=f"Erro ao selecionar o IPI de unidade nos itens, IPI: {ipi_value}",
         
     | 
| 
       426 
432 
     | 
    
         
             
                                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 433 
     | 
    
         
            +
                                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       427 
434 
     | 
    
         
             
                                        )
         
     | 
| 
       428 
435 
     | 
    
         | 
| 
       429 
436 
     | 
    
         
             
                                    await worker_sleep(4)
         
     | 
| 
         @@ -480,6 +487,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       480 
487 
     | 
    
         
             
                                                sucesso=False,
         
     | 
| 
       481 
488 
     | 
    
         
             
                                                retorno=f"Erro ao selecionar o tipo de unidade nos itens, item: {n_item} {descricao}, não possui UN-{cod_split} - F OU CAIXA C/{cod_split} ",
         
     | 
| 
       482 
489 
     | 
    
         
             
                                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 490 
     | 
    
         
            +
                                                tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       483 
491 
     | 
    
         
             
                                            )
         
     | 
| 
       484 
492 
     | 
    
         | 
| 
       485 
493 
     | 
    
         
             
                                        else:
         
     | 
| 
         @@ -492,6 +500,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       492 
500 
     | 
    
         
             
                                        sucesso=False,
         
     | 
| 
       493 
501 
     | 
    
         
             
                                        retorno=f"Erro ao selecionar o tipo de unidade nos itens: {e}",
         
     | 
| 
       494 
502 
     | 
    
         
             
                                        status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 503 
     | 
    
         
            +
                                        tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       495 
504 
     | 
    
         
             
                                    )
         
     | 
| 
       496 
505 
     | 
    
         | 
| 
       497 
506 
     | 
    
         
             
                                console.print(
         
     | 
| 
         @@ -512,6 +521,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       512 
521 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       513 
522 
     | 
    
         
             
                            retorno=f"Erro ao trabalhar nas alterações dos itens: {e}",
         
     | 
| 
       514 
523 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 524 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       515 
525 
     | 
    
         
             
                        )
         
     | 
| 
       516 
526 
     | 
    
         | 
| 
       517 
527 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
         @@ -564,6 +574,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       564 
574 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       565 
575 
     | 
    
         
             
                                retorno=f"Pop-up nota incluida encontrada, porém nota não encontrada no EMSys - Reprocessar",
         
     | 
| 
       566 
576 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 577 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       567 
578 
     | 
    
         
             
                            )
         
     | 
| 
       568 
579 
     | 
    
         
             
                    else:
         
     | 
| 
       569 
580 
     | 
    
         
             
                        console.print("Erro ao lançar nota", style="bold red")
         
     | 
| 
         @@ -571,6 +582,7 @@ async def entrada_de_notas_207(task: RpaProcessoEntradaDTO) -> RpaRetornoProcess 
     | 
|
| 
       571 
582 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       572 
583 
     | 
    
         
             
                            retorno=f"Erro ao lançar nota, erro: {nf_imported.retorno}",
         
     | 
| 
       573 
584 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 585 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       574 
586 
     | 
    
         
             
                        )
         
     | 
| 
       575 
587 
     | 
    
         | 
| 
       576 
588 
     | 
    
         
             
                except Exception as ex:
         
     | 
| 
         @@ -25,6 +25,8 @@ from worker_automate_hub.config.settings import load_env_config 
     | 
|
| 
       25 
25 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_historico_request_dto import (
         
     | 
| 
       26 
26 
     | 
    
         
             
                RpaHistoricoStatusEnum,
         
     | 
| 
       27 
27 
     | 
    
         
             
                RpaRetornoProcessoDTO,
         
     | 
| 
      
 28 
     | 
    
         
            +
                RpaTagDTO,
         
     | 
| 
      
 29 
     | 
    
         
            +
                RpaTagEnum,
         
     | 
| 
       28 
30 
     | 
    
         
             
            )
         
     | 
| 
       29 
31 
     | 
    
         
             
            from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
         
     | 
| 
       30 
32 
     | 
    
         
             
                RpaProcessoEntradaDTO,
         
     | 
| 
         @@ -121,6 +123,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       121 
123 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       122 
124 
     | 
    
         
             
                            retorno=document_type.retorno,
         
     | 
| 
       123 
125 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 126 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       124 
127 
     | 
    
         
             
                        )
         
     | 
| 
       125 
128 
     | 
    
         | 
| 
       126 
129 
     | 
    
         
             
                    await worker_sleep(4)
         
     | 
| 
         @@ -134,6 +137,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       134 
137 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       135 
138 
     | 
    
         
             
                            retorno=imported_nfe.retorno,
         
     | 
| 
       136 
139 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 140 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       137 
141 
     | 
    
         
             
                        )
         
     | 
| 
       138 
142 
     | 
    
         | 
| 
       139 
143 
     | 
    
         
             
                    await worker_sleep(5)
         
     | 
| 
         @@ -152,6 +156,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       152 
156 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       153 
157 
     | 
    
         
             
                                retorno=warning_work.retorno,
         
     | 
| 
       154 
158 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 159 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       155 
160 
     | 
    
         
             
                            )
         
     | 
| 
       156 
161 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
       157 
162 
     | 
    
         
             
                    # VERIFICANDO A EXISTENCIA DE ERRO
         
     | 
| 
         @@ -192,6 +197,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       192 
197 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       193 
198 
     | 
    
         
             
                            retorno=f"Erro mapeado, CFOP diferente de inicio com 540 ou 510, necessario ação manual ou ajuste no robo.",
         
     | 
| 
       194 
199 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 200 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       195 
201 
     | 
    
         
             
                        )
         
     | 
| 
       196 
202 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
       197 
203 
     | 
    
         | 
| 
         @@ -218,6 +224,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       218 
224 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       219 
225 
     | 
    
         
             
                            retorno=f"Erro ao iterar itens de almoxarifado: {e}",
         
     | 
| 
       220 
226 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 227 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       221 
228 
     | 
    
         
             
                        )
         
     | 
| 
       222 
229 
     | 
    
         | 
| 
       223 
230 
     | 
    
         
             
                    await worker_sleep(1)
         
     | 
| 
         @@ -233,6 +240,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       233 
240 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       234 
241 
     | 
    
         
             
                            retorno=f"Fornecedor não mapeado para andamento no processo, forneceodr: {fornecedor}",
         
     | 
| 
       235 
242 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 243 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       236 
244 
     | 
    
         
             
                        )
         
     | 
| 
       237 
245 
     | 
    
         | 
| 
       238 
246 
     | 
    
         
             
                    tipo_despesa_work = await tipo_despesa(despesa)
         
     | 
| 
         @@ -243,6 +251,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       243 
251 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       244 
252 
     | 
    
         
             
                            retorno=tipo_despesa_work.retorno,
         
     | 
| 
       245 
253 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 254 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       246 
255 
     | 
    
         
             
                        )
         
     | 
| 
       247 
256 
     | 
    
         | 
| 
       248 
257 
     | 
    
         
             
                    # INTERAGINDO COM O CHECKBOX ZERAR ICMS
         
     | 
| 
         @@ -254,6 +263,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       254 
263 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       255 
264 
     | 
    
         
             
                            retorno=checkbox_zerar_icms.retorno,
         
     | 
| 
       256 
265 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 266 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       257 
267 
     | 
    
         
             
                        )
         
     | 
| 
       258 
268 
     | 
    
         | 
| 
       259 
269 
     | 
    
         
             
                    # INTERAGINDO COM O CAMPO DE CODIGO DO ICMS
         
     | 
| 
         @@ -265,6 +275,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       265 
275 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       266 
276 
     | 
    
         
             
                            retorno=cod_icms_work.retorno,
         
     | 
| 
       267 
277 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 278 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       268 
279 
     | 
    
         
             
                        )
         
     | 
| 
       269 
280 
     | 
    
         | 
| 
       270 
281 
     | 
    
         
             
                    # INTERAGINDO COM O CAMPO Manter Natureza de Operação selecionada
         
     | 
| 
         @@ -325,6 +336,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       325 
336 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       326 
337 
     | 
    
         
             
                            retorno="Número máximo de tentativas atingido, Não foi possivel finalizar os trabalhos na tela de Informações para importação da Nota Fiscal Eletrônica",
         
     | 
| 
       327 
338 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 339 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       328 
340 
     | 
    
         
             
                        )
         
     | 
| 
       329 
341 
     | 
    
         | 
| 
       330 
342 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
         @@ -337,22 +349,26 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       337 
349 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       338 
350 
     | 
    
         
             
                            retorno=waiting_for_delay.retorno,
         
     | 
| 
       339 
351 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 352 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       340 
353 
     | 
    
         
             
                        )
         
     | 
| 
       341 
354 
     | 
    
         | 
| 
       342 
     | 
    
         
            -
                     
     | 
| 
       343 
     | 
    
         
            -
                        "Verificando  
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
             
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
             
     | 
| 
       349 
     | 
    
         
            -
                             
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
             
     | 
| 
       355 
     | 
    
         
            -
                             
     | 
| 
      
 355 
     | 
    
         
            +
                    try:
         
     | 
| 
      
 356 
     | 
    
         
            +
                        console.print("Verificando itens não localizados ou NCM...\n")
         
     | 
| 
      
 357 
     | 
    
         
            +
                        itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
         
     | 
| 
      
 358 
     | 
    
         
            +
             
     | 
| 
      
 359 
     | 
    
         
            +
                        if itens_by_supplier["IsOpened"] == True:
         
     | 
| 
      
 360 
     | 
    
         
            +
                            itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
         
     | 
| 
      
 361 
     | 
    
         
            +
             
     | 
| 
      
 362 
     | 
    
         
            +
                            if not itens_by_supplier_work.sucesso:
         
     | 
| 
      
 363 
     | 
    
         
            +
                                return itens_by_supplier_work
         
     | 
| 
      
 364 
     | 
    
         
            +
             
     | 
| 
      
 365 
     | 
    
         
            +
                    except Exception as error:
         
     | 
| 
      
 366 
     | 
    
         
            +
                        return RpaRetornoProcessoDTO(
         
     | 
| 
      
 367 
     | 
    
         
            +
                            sucesso=False,
         
     | 
| 
      
 368 
     | 
    
         
            +
                            retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
         
     | 
| 
      
 369 
     | 
    
         
            +
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 370 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
      
 371 
     | 
    
         
            +
                        )
         
     | 
| 
       356 
372 
     | 
    
         | 
| 
       357 
373 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
       358 
374 
     | 
    
         
             
                    console.print(f"Trabalhando com itens com multiplas referencias.\n")
         
     | 
| 
         @@ -447,6 +463,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       447 
463 
     | 
    
         
             
                                    sucesso=False,
         
     | 
| 
       448 
464 
     | 
    
         
             
                                    retorno="Quantidade de tentativa atingida (3), não foi possivel capturar o item da nota com multiplas referencias para andamento no processo",
         
     | 
| 
       449 
465 
     | 
    
         
             
                                    status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 466 
     | 
    
         
            +
                                    tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       450 
467 
     | 
    
         
             
                                )
         
     | 
| 
       451 
468 
     | 
    
         | 
| 
       452 
469 
     | 
    
         
             
                            console.print(
         
     | 
| 
         @@ -542,6 +559,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       542 
559 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       543 
560 
     | 
    
         
             
                            retorno=f"Não foi possivel encontrar o item mais proximo ao item da nota com multiplas referencias {itens_nao_semelhantes}",
         
     | 
| 
       544 
561 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 562 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       545 
563 
     | 
    
         
             
                        )
         
     | 
| 
       546 
564 
     | 
    
         | 
| 
       547 
565 
     | 
    
         
             
                    # VERIFICANDO A EXISTENCIA DE ERRO
         
     | 
| 
         @@ -552,22 +570,26 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       552 
570 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       553 
571 
     | 
    
         
             
                            retorno=error_work.retorno,
         
     | 
| 
       554 
572 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 573 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       555 
574 
     | 
    
         
             
                        )
         
     | 
| 
       556 
575 
     | 
    
         | 
| 
       557 
     | 
    
         
            -
                     
     | 
| 
       558 
     | 
    
         
            -
                        "Verificando  
     | 
| 
       559 
     | 
    
         
            -
             
     | 
| 
       560 
     | 
    
         
            -
             
     | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
       562 
     | 
    
         
            -
             
     | 
| 
       563 
     | 
    
         
            -
             
     | 
| 
       564 
     | 
    
         
            -
                             
     | 
| 
       565 
     | 
    
         
            -
             
     | 
| 
       566 
     | 
    
         
            -
             
     | 
| 
       567 
     | 
    
         
            -
             
     | 
| 
       568 
     | 
    
         
            -
             
     | 
| 
       569 
     | 
    
         
            -
             
     | 
| 
       570 
     | 
    
         
            -
                             
     | 
| 
      
 576 
     | 
    
         
            +
                    try:
         
     | 
| 
      
 577 
     | 
    
         
            +
                        console.print("Verificando itens não localizados ou NCM...\n")
         
     | 
| 
      
 578 
     | 
    
         
            +
                        itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
         
     | 
| 
      
 579 
     | 
    
         
            +
             
     | 
| 
      
 580 
     | 
    
         
            +
                        if itens_by_supplier["IsOpened"] == True:
         
     | 
| 
      
 581 
     | 
    
         
            +
                            itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
         
     | 
| 
      
 582 
     | 
    
         
            +
             
     | 
| 
      
 583 
     | 
    
         
            +
                            if not itens_by_supplier_work.sucesso:
         
     | 
| 
      
 584 
     | 
    
         
            +
                                return itens_by_supplier_work
         
     | 
| 
      
 585 
     | 
    
         
            +
             
     | 
| 
      
 586 
     | 
    
         
            +
                    except Exception as error:
         
     | 
| 
      
 587 
     | 
    
         
            +
                        return RpaRetornoProcessoDTO(
         
     | 
| 
      
 588 
     | 
    
         
            +
                            sucesso=False,
         
     | 
| 
      
 589 
     | 
    
         
            +
                            retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
         
     | 
| 
      
 590 
     | 
    
         
            +
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 591 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
      
 592 
     | 
    
         
            +
                        )
         
     | 
| 
       571 
593 
     | 
    
         | 
| 
       572 
594 
     | 
    
         
             
                    await worker_sleep(2)
         
     | 
| 
       573 
595 
     | 
    
         
             
                    console.print("Navegando pela Janela de Nota Fiscal de Entrada...\n")
         
     | 
| 
         @@ -644,6 +666,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       644 
666 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       645 
667 
     | 
    
         
             
                            retorno=f"A soma dos pagamentos não bate com o valor da nota.",
         
     | 
| 
       646 
668 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 669 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       647 
670 
     | 
    
         
             
                        )
         
     | 
| 
       648 
671 
     | 
    
         
             
                    else:
         
     | 
| 
       649 
672 
     | 
    
         
             
                        console.print(
         
     | 
| 
         @@ -677,6 +700,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       677 
700 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       678 
701 
     | 
    
         
             
                            retorno=f"Número máximo de tentativas atingido. A tela para Rateio da Despesa não foi encontrada.",
         
     | 
| 
       679 
702 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 703 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       680 
704 
     | 
    
         
             
                        )
         
     | 
| 
       681 
705 
     | 
    
         | 
| 
       682 
706 
     | 
    
         
             
                    despesa_rateio_work = await rateio_despesa(filialEmpresaOrigem)
         
     | 
| 
         @@ -687,6 +711,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       687 
711 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       688 
712 
     | 
    
         
             
                            retorno=despesa_rateio_work.retorno,
         
     | 
| 
       689 
713 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 714 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       690 
715 
     | 
    
         
             
                        )
         
     | 
| 
       691 
716 
     | 
    
         | 
| 
       692 
717 
     | 
    
         
             
                    # Verifica se a info 'Nota fiscal incluida' está na tela
         
     | 
| 
         @@ -734,12 +759,14 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       734 
759 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       735 
760 
     | 
    
         
             
                            retorno=f"Filial: {filialEmpresaOrigem} está com o livro fechado ou encerrado, verificar com o setor fiscal",
         
     | 
| 
       736 
761 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 762 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
         
     | 
| 
       737 
763 
     | 
    
         
             
                            )
         
     | 
| 
       738 
764 
     | 
    
         
             
                        else:
         
     | 
| 
       739 
765 
     | 
    
         
             
                            return RpaRetornoProcessoDTO(
         
     | 
| 
       740 
766 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       741 
767 
     | 
    
         
             
                            retorno=f"Warning não mapeado para seguimento do robo, mensagem: {captured_text}",
         
     | 
| 
       742 
768 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 769 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       743 
770 
     | 
    
         
             
                            )
         
     | 
| 
       744 
771 
     | 
    
         | 
| 
       745 
772 
     | 
    
         
             
                    await worker_sleep(3)
         
     | 
| 
         @@ -762,6 +789,7 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       762 
789 
     | 
    
         
             
                                sucesso=False,
         
     | 
| 
       763 
790 
     | 
    
         
             
                                retorno=f"Pop-up nota incluida encontrada, porém nota não encontrada no EMSys - Reprocessar",
         
     | 
| 
       764 
791 
     | 
    
         
             
                                status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 792 
     | 
    
         
            +
                                tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       765 
793 
     | 
    
         
             
                            )
         
     | 
| 
       766 
794 
     | 
    
         
             
                    else:
         
     | 
| 
       767 
795 
     | 
    
         
             
                        console.print("Erro ao lançar nota", style="bold red")
         
     | 
| 
         @@ -769,13 +797,16 @@ async def entrada_de_notas_32(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso 
     | 
|
| 
       769 
797 
     | 
    
         
             
                            sucesso=False,
         
     | 
| 
       770 
798 
     | 
    
         
             
                            retorno=f"Erro ao lançar nota, erro: {nf_imported.retorno}",
         
     | 
| 
       771 
799 
     | 
    
         
             
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 800 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
       772 
801 
     | 
    
         
             
                        )
         
     | 
| 
       773 
802 
     | 
    
         | 
| 
       774 
803 
     | 
    
         
             
                except Exception as ex:
         
     | 
| 
       775 
     | 
    
         
            -
                     
     | 
| 
       776 
     | 
    
         
            -
             
     | 
| 
       777 
     | 
    
         
            -
             
     | 
| 
       778 
     | 
    
         
            -
             
     | 
| 
      
 804 
     | 
    
         
            +
                    return RpaRetornoProcessoDTO(
         
     | 
| 
      
 805 
     | 
    
         
            +
                            sucesso=False,
         
     | 
| 
      
 806 
     | 
    
         
            +
                            retorno=f"Erro ao lançar nota, erro: {ex}",
         
     | 
| 
      
 807 
     | 
    
         
            +
                            status=RpaHistoricoStatusEnum.Falha,
         
     | 
| 
      
 808 
     | 
    
         
            +
                            tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
         
     | 
| 
      
 809 
     | 
    
         
            +
                        )
         
     | 
| 
       779 
810 
     | 
    
         | 
| 
       780 
811 
     | 
    
         
             
                finally:
         
     | 
| 
       781 
812 
     | 
    
         
             
                    # Deleta o xml
         
     |