worker-automate-hub 0.5.800__py3-none-any.whl → 0.5.801__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/abertura_livros_fiscais.py +24 -15
- {worker_automate_hub-0.5.800.dist-info → worker_automate_hub-0.5.801.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.800.dist-info → worker_automate_hub-0.5.801.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.800.dist-info → worker_automate_hub-0.5.801.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.800.dist-info → worker_automate_hub-0.5.801.dist-info}/entry_points.txt +0 -0
@@ -7,6 +7,7 @@ import sys
|
|
7
7
|
import os
|
8
8
|
from pywinauto.findwindows import ElementNotFoundError
|
9
9
|
from pywinauto.keyboard import send_keys
|
10
|
+
|
10
11
|
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
11
12
|
from worker_automate_hub.utils.logger import logger
|
12
13
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
@@ -84,7 +85,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
84
85
|
# Fecha a instancia do emsys - caso esteja aberta
|
85
86
|
await kill_all_emsys()
|
86
87
|
|
87
|
-
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\
|
88
|
+
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal.exe")
|
88
89
|
warnings.filterwarnings(
|
89
90
|
"ignore",
|
90
91
|
category=UserWarning,
|
@@ -564,10 +565,8 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
564
565
|
imagem = "assets\\abertura_livros\\btn_incluir_apuracao.png"
|
565
566
|
|
566
567
|
# Tenta localizar a imagem na tela
|
567
|
-
localizacao = pyautogui.locateCenterOnScreen(
|
568
|
-
|
569
|
-
)
|
570
|
-
|
568
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9)
|
569
|
+
|
571
570
|
if localizacao:
|
572
571
|
console.print(f"Imagem incluir apuração encontrado em: {localizacao}")
|
573
572
|
pyautogui.moveTo(localizacao)
|
@@ -582,7 +581,9 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
582
581
|
while time.time() < t_end:
|
583
582
|
try:
|
584
583
|
# variações: Aviso | Atenção | Erro
|
585
|
-
wins = desk.windows(
|
584
|
+
wins = desk.windows(
|
585
|
+
title_re=".*(Aviso|Aten[cç][aã]o|Erro).*", visible_only=True
|
586
|
+
)
|
586
587
|
if wins:
|
587
588
|
dlg = wins[0]
|
588
589
|
break
|
@@ -591,7 +592,9 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
591
592
|
time.sleep(0.25)
|
592
593
|
|
593
594
|
if dlg:
|
594
|
-
console.print(
|
595
|
+
console.print(
|
596
|
+
"Janela 'Aviso' detectada. Capturando texto e screenshot..."
|
597
|
+
)
|
595
598
|
|
596
599
|
# === 2) Captura de screenshot da janela ===
|
597
600
|
try:
|
@@ -619,21 +622,27 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
619
622
|
partes.append(t.strip())
|
620
623
|
except Exception:
|
621
624
|
pass
|
622
|
-
texto_aviso = " ".join(
|
625
|
+
texto_aviso = " ".join(
|
626
|
+
dict.fromkeys(partes)
|
627
|
+
) # remove duplicados mantendo ordem
|
623
628
|
console.print(f"Texto do Aviso: {texto_aviso}")
|
624
629
|
except Exception as e:
|
625
630
|
console.print(f"Falha ao coletar texto do 'Aviso': {e}")
|
626
631
|
|
627
632
|
# === 4) Validação do conteúdo (edite/adicione frases-chave conforme seu caso) ===
|
628
633
|
FRASES_ERRO = [
|
629
|
-
"O período para apuração informado",
|
630
|
-
"situação diferente de confirmado",
|
634
|
+
"O período para apuração informado",
|
635
|
+
"situação diferente de confirmado",
|
631
636
|
]
|
632
637
|
|
633
|
-
contem_msg_erro = any(
|
638
|
+
contem_msg_erro = any(
|
639
|
+
frase.lower() in texto_aviso.lower() for frase in FRASES_ERRO
|
640
|
+
)
|
634
641
|
|
635
642
|
if contem_msg_erro:
|
636
|
-
console.print(
|
643
|
+
console.print(
|
644
|
+
"Confirmação de erro pelo texto da janela 'Aviso'. Retornando falha."
|
645
|
+
)
|
637
646
|
retorno_msg = "Erro ao Incluir apuração."
|
638
647
|
if texto_aviso:
|
639
648
|
retorno_msg += f" Detalhe: {texto_aviso}"
|
@@ -647,7 +656,9 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
647
656
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
648
657
|
)
|
649
658
|
else:
|
650
|
-
console.print(
|
659
|
+
console.print(
|
660
|
+
"Janela 'Aviso' não contém mensagem de erro mapeada. Seguindo fluxo."
|
661
|
+
)
|
651
662
|
# (Opcional) você pode clicar no 'OK' e continuar:
|
652
663
|
try:
|
653
664
|
# tenta clicar em botão OK se existir
|
@@ -677,7 +688,6 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
677
688
|
status=RpaHistoricoStatusEnum.Sucesso,
|
678
689
|
)
|
679
690
|
|
680
|
-
|
681
691
|
except Exception as erro:
|
682
692
|
|
683
693
|
console.print(f"Erro ao executar abertura de livros fiscais, erro : {erro}")
|
@@ -687,4 +697,3 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
687
697
|
status=RpaHistoricoStatusEnum.Falha,
|
688
698
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
689
699
|
)
|
690
|
-
|
@@ -36,7 +36,7 @@ worker_automate_hub/models/dto/rpa_sap_dto.py,sha256=eovdvKCtVIhRct3PL98KjsdlngL
|
|
36
36
|
worker_automate_hub/models/dto/rpa_sistema_dto.py,sha256=sLkmJei8x6sl-1-IXUKDmYQuKx0sotYQREPyhQqPmRg,161
|
37
37
|
worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=
|
39
|
+
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=Ldh1IuxrdDizkTvQRj91IC-I3ubhJ7dDNaTaAso0q8Y,27800
|
40
40
|
worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=UkLWTC5Ub2qBb0yY-8IZ0DLLOVJOfNTq_z9krx_t25Q,29476
|
41
41
|
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=S6QC4xhuo0pB5FjaUJZNMm1LIgEjpjifReCTBDqxH-U,11719
|
42
42
|
worker_automate_hub/tasks/jobs/cte_manual.py,sha256=JucHpRMjMiy-QEJ0wtFnytLpN53tKXgCDI05nGLGclU,603
|
@@ -103,7 +103,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
103
103
|
worker_automate_hub/utils/util.py,sha256=noQRUSAjRnoDb1c4iMZ5eoyrNp59a8T9K78MHhalASw,210255
|
104
104
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=F7jk95LpDwl5WfaQXahCA5yDdnySnWdctDqczHXwGqE,38195
|
105
105
|
worker_automate_hub/worker.py,sha256=zEnYUrm5kY2cHbbee15QJkwkx4euD2SB2zRvUIbjS90,6850
|
106
|
-
worker_automate_hub-0.5.
|
107
|
-
worker_automate_hub-0.5.
|
108
|
-
worker_automate_hub-0.5.
|
109
|
-
worker_automate_hub-0.5.
|
106
|
+
worker_automate_hub-0.5.801.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
107
|
+
worker_automate_hub-0.5.801.dist-info/METADATA,sha256=eEB2-yI8bOkLhHqeeDvla_2kq0gPKjv7xaAsfUhbKDs,3100
|
108
|
+
worker_automate_hub-0.5.801.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
109
|
+
worker_automate_hub-0.5.801.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.800.dist-info → worker_automate_hub-0.5.801.dist-info}/entry_points.txt
RENAMED
File without changes
|