worker-automate-hub 0.5.672__tar.gz → 0.5.673__tar.gz
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.
Potentially problematic release.
This version of worker-automate-hub might be problematic. Click here for more details.
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/PKG-INFO +1 -1
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/pyproject.toml +1 -1
- worker_automate_hub-0.5.673/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +495 -0
- worker_automate_hub-0.5.672/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +0 -298
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/README.md +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/ahead_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/client.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/datalake_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/helpers/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/rdp_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/rpa_fila_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/rpa_historico_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/webhook_service.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/cli.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/config/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/config/settings.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/config.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/core/so_manipulation.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/deprecation.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/rate_limit.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/repeat.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/retry.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/singleton.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/timeit.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/rpa_fila.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dao/rpa_robo.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/rpa_sap_dto.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/cte_manual.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/cte_xml.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/devolucao_ctf.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/devolucao_ctf_35.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_cte_1353.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_cte_333.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_503.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/entrada_de_notas_9000.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/extracao_fechamento_contabil.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/extracao_fechamento_emsys.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/fidc_exportacao_docs_portal_b2b.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/integracao_contabil.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/lancamento_rateio.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/playground.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/task_definitions.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/task_executor.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/__init__.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/env.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/logger.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/toast.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/updater.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/util.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
- {worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/worker.py +0 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import pyautogui
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
from pywinauto.keyboard import send_keys
|
|
9
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
from worker_automate_hub.utils.logger import logger
|
|
13
|
+
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
|
14
|
+
RpaHistoricoStatusEnum,
|
|
15
|
+
RpaRetornoProcessoDTO,
|
|
16
|
+
RpaTagDTO,
|
|
17
|
+
RpaTagEnum,
|
|
18
|
+
)
|
|
19
|
+
from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
|
|
20
|
+
RpaProcessoEntradaDTO,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
from worker_automate_hub.api.client import get_config_by_name
|
|
24
|
+
from pywinauto import Application
|
|
25
|
+
from rich.console import Console
|
|
26
|
+
from worker_automate_hub.utils.util import (
|
|
27
|
+
is_window_open_by_class,
|
|
28
|
+
kill_all_emsys,
|
|
29
|
+
login_emsys_fiscal,
|
|
30
|
+
type_text_into_field,
|
|
31
|
+
worker_sleep,
|
|
32
|
+
)
|
|
33
|
+
from worker_automate_hub.utils.utils_nfe_entrada import EMSys
|
|
34
|
+
import pyperclip
|
|
35
|
+
import warnings
|
|
36
|
+
import asyncio
|
|
37
|
+
from worker_automate_hub.decorators.repeat import repeat
|
|
38
|
+
from pytesseract import image_to_string
|
|
39
|
+
from pywinauto import Desktop
|
|
40
|
+
|
|
41
|
+
pyautogui.PAUSE = 0.5
|
|
42
|
+
pyautogui.FAILSAFE = False
|
|
43
|
+
|
|
44
|
+
console = Console()
|
|
45
|
+
|
|
46
|
+
emsys = EMSys()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@repeat(times=10, delay=5)
|
|
50
|
+
async def wait_aguarde_window_closed(app, timeout=60):
|
|
51
|
+
console.print("Verificando existencia de aguarde...")
|
|
52
|
+
start_time = time.time()
|
|
53
|
+
|
|
54
|
+
while time.time() - start_time < timeout:
|
|
55
|
+
janela_topo = app.top_window()
|
|
56
|
+
titulo = janela_topo.window_text()
|
|
57
|
+
console.print(f"Titulo da janela top: ${titulo}")
|
|
58
|
+
await emsys.verify_warning_and_error("Aviso", "&Ok")
|
|
59
|
+
await worker_sleep(2)
|
|
60
|
+
|
|
61
|
+
if "Gerar Registros" in titulo or "Movimento de Livro Fiscal" in titulo:
|
|
62
|
+
console.log("Fim de aguardando...")
|
|
63
|
+
return
|
|
64
|
+
else:
|
|
65
|
+
console.log("Aguardando...")
|
|
66
|
+
|
|
67
|
+
console.log("Timeout esperando a janela Aguarde...")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def click_desconfirmar():
|
|
71
|
+
cords = (675, 748)
|
|
72
|
+
pyautogui.click(x=cords[0], y=cords[1])
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def ctrl_c():
|
|
76
|
+
pyautogui.press("tab", presses=12) # verificar
|
|
77
|
+
pyautogui.hotkey("ctrl", "c")
|
|
78
|
+
return pyperclip.paste()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
82
|
+
try:
|
|
83
|
+
config = await get_config_by_name("login_emsys_fiscal")
|
|
84
|
+
|
|
85
|
+
# Fecha a instancia do emsys - caso esteja aberta
|
|
86
|
+
await kill_all_emsys()
|
|
87
|
+
|
|
88
|
+
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal.exe")
|
|
89
|
+
warnings.filterwarnings(
|
|
90
|
+
"ignore",
|
|
91
|
+
category=UserWarning,
|
|
92
|
+
message="32-bit application should be automated using 32-bit Python",
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
await worker_sleep(4)
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
app = Application(backend="win32").connect(
|
|
99
|
+
class_name="TFrmLoginModulo", timeout=50
|
|
100
|
+
)
|
|
101
|
+
except:
|
|
102
|
+
return RpaRetornoProcessoDTO(
|
|
103
|
+
sucesso=False,
|
|
104
|
+
retorno="Erro ao abrir o EMSys Fiscal, tela de login não encontrada",
|
|
105
|
+
status=RpaHistoricoStatusEnum.Falha,
|
|
106
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
107
|
+
)
|
|
108
|
+
return_login = await login_emsys_fiscal(config.conConfiguracao, app, task)
|
|
109
|
+
if return_login.sucesso:
|
|
110
|
+
try:
|
|
111
|
+
##### Janela Confirm #####
|
|
112
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
113
|
+
main_window = app["TMessageForm"]
|
|
114
|
+
main_window.set_focus()
|
|
115
|
+
|
|
116
|
+
# Clicar em Não
|
|
117
|
+
console.print("Navegando nos elementos...\n")
|
|
118
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
119
|
+
await worker_sleep(2)
|
|
120
|
+
except:
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
##### Janela Principal ####
|
|
124
|
+
console.print("Navegando para Livros Fiscais")
|
|
125
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
126
|
+
main_window = app["TFrmPrincipalFiscal"]
|
|
127
|
+
main_window.set_focus()
|
|
128
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0)
|
|
129
|
+
type_text_into_field(
|
|
130
|
+
"Livros Fiscais", input_livros, True, "50"
|
|
131
|
+
)
|
|
132
|
+
await worker_sleep(5)
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
##### Janela Confirm #####
|
|
136
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
137
|
+
main_window = app["TMessageForm"]
|
|
138
|
+
main_window.set_focus()
|
|
139
|
+
|
|
140
|
+
# Clicar em Não
|
|
141
|
+
console.print("Navegando nos elementos...\n")
|
|
142
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
143
|
+
await worker_sleep(2)
|
|
144
|
+
except:
|
|
145
|
+
pass
|
|
146
|
+
|
|
147
|
+
# Clicar no input inicial
|
|
148
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0).click_input()
|
|
149
|
+
pyautogui.press("enter")
|
|
150
|
+
await worker_sleep(2)
|
|
151
|
+
pyautogui.press("down")
|
|
152
|
+
await worker_sleep(2)
|
|
153
|
+
pyautogui.press("enter")
|
|
154
|
+
console.print(
|
|
155
|
+
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
|
156
|
+
style="bold green",
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
await worker_sleep(10)
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
##### Janela Confirm #####
|
|
163
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
164
|
+
main_window = app["TMessageForm"]
|
|
165
|
+
main_window.set_focus()
|
|
166
|
+
|
|
167
|
+
# Clicar em Não
|
|
168
|
+
console.print("Navegando nos elementos...\n")
|
|
169
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
170
|
+
await worker_sleep(2)
|
|
171
|
+
except:
|
|
172
|
+
pass
|
|
173
|
+
|
|
174
|
+
await worker_sleep(2)
|
|
175
|
+
|
|
176
|
+
##### Janela Principal ####
|
|
177
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
178
|
+
main_window = app["TFrmPrincipalFiscal"]
|
|
179
|
+
main_window.set_focus()
|
|
180
|
+
|
|
181
|
+
# Clicar no input inicial
|
|
182
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0).click_input()
|
|
183
|
+
pyautogui.press("enter")
|
|
184
|
+
await worker_sleep(2)
|
|
185
|
+
pyautogui.press("down")
|
|
186
|
+
await worker_sleep(2)
|
|
187
|
+
pyautogui.press("enter")
|
|
188
|
+
console.print(
|
|
189
|
+
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
|
190
|
+
style="bold green",
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
await worker_sleep(10)
|
|
194
|
+
|
|
195
|
+
##### janela Movimento de Livro Fiscal #####
|
|
196
|
+
app = Application().connect(class_name="TFrmMovtoLivroFiscal", timeout=20)
|
|
197
|
+
main_window = app["TFrmMovtoLivroFiscal"]
|
|
198
|
+
main_window.set_focus()
|
|
199
|
+
data_input = main_window.child_window(class_name="TDBIEditDate", found_index=0)
|
|
200
|
+
competencia = task.configEntrada.get("periodo")
|
|
201
|
+
type_text_into_field(
|
|
202
|
+
competencia, data_input, True, "50"
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# Preenchendo campo competencia
|
|
206
|
+
console.print("Preenchendo campo competencia...")
|
|
207
|
+
pyautogui.press("tab")
|
|
208
|
+
competencia = task.configEntrada.get("periodo")
|
|
209
|
+
pyautogui.write(competencia)
|
|
210
|
+
await worker_sleep(3)
|
|
211
|
+
|
|
212
|
+
# Marcando caixa Entrada
|
|
213
|
+
console.print("Marcando caixa entrada")
|
|
214
|
+
entrada = main_window.child_window(class_name="TcxCheckBox", found_index=9).click_input()
|
|
215
|
+
|
|
216
|
+
# Marcando caixa Saida
|
|
217
|
+
console.print("Marcando caixa saida")
|
|
218
|
+
saida = main_window.child_window(class_name="TcxCheckBox", found_index=8).click_input()
|
|
219
|
+
|
|
220
|
+
await worker_sleep(2)
|
|
221
|
+
|
|
222
|
+
# Clicando em incluir livro
|
|
223
|
+
try:
|
|
224
|
+
console.print("Clicando em incluir livro")
|
|
225
|
+
cords = (695, 729)
|
|
226
|
+
pyautogui.click(x=cords[0], y=cords[1])
|
|
227
|
+
await worker_sleep(5)
|
|
228
|
+
except:
|
|
229
|
+
return RpaRetornoProcessoDTO(
|
|
230
|
+
sucesso=False,
|
|
231
|
+
retorno=f"Erro ao clicar em botão de incluir livro.",
|
|
232
|
+
status=RpaHistoricoStatusEnum.Falha,
|
|
233
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
##### Janela Pergunta das Geração dos Livros Fiscais #####
|
|
237
|
+
await worker_sleep(5)
|
|
238
|
+
app = Application().connect(class_name="TPerguntasLivrosFiscaisForm", timeout=20)
|
|
239
|
+
main_window = app["TPerguntasLivrosFiscaisForm"]
|
|
240
|
+
main_window.set_focus()
|
|
241
|
+
console.print("Clicando sim em janela somar os valores de IPI Frete")
|
|
242
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=0).click_input()
|
|
243
|
+
|
|
244
|
+
await worker_sleep(1)
|
|
245
|
+
send_keys("Sim{ENTER}")
|
|
246
|
+
await worker_sleep(2)
|
|
247
|
+
|
|
248
|
+
console.print("Clicando sim em janela gerar Numero de Serie do SAT")
|
|
249
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=4).click_input()
|
|
250
|
+
|
|
251
|
+
await worker_sleep(1)
|
|
252
|
+
send_keys("Sim{ENTER}")
|
|
253
|
+
await worker_sleep(2)
|
|
254
|
+
|
|
255
|
+
console.print("Clicando sim em janela gerar Numero de Serie a partir da chave do documento")
|
|
256
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=1).click_input()
|
|
257
|
+
|
|
258
|
+
await worker_sleep(1)
|
|
259
|
+
send_keys("Sim{ENTER}")
|
|
260
|
+
await worker_sleep(2)
|
|
261
|
+
|
|
262
|
+
console.print("Clicando sim em janela gerar livro com observação da nota fiscal")
|
|
263
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=3).click_input()
|
|
264
|
+
|
|
265
|
+
await worker_sleep(1)
|
|
266
|
+
send_keys("Sim{ENTER}")
|
|
267
|
+
await worker_sleep(2)
|
|
268
|
+
|
|
269
|
+
console.print("Clicando sim em janela somar valores de ICMS...")
|
|
270
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=2).click_input()
|
|
271
|
+
|
|
272
|
+
await worker_sleep(1)
|
|
273
|
+
send_keys("Sim{ENTER}")
|
|
274
|
+
|
|
275
|
+
await worker_sleep(2)
|
|
276
|
+
|
|
277
|
+
# Clicar em confirmar
|
|
278
|
+
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
|
279
|
+
|
|
280
|
+
await worker_sleep(5)
|
|
281
|
+
##### Janela Gerar Registro ####
|
|
282
|
+
console.print("Confirmar Registro")
|
|
283
|
+
app = Application().connect(title="Gerar Registros", timeout=60)
|
|
284
|
+
main_window = app["Gerar Registros"]
|
|
285
|
+
main_window.set_focus()
|
|
286
|
+
|
|
287
|
+
# Clicar em Sim
|
|
288
|
+
main_window.child_window(class_name="Button", found_index=0).click_input()
|
|
289
|
+
|
|
290
|
+
# try:
|
|
291
|
+
# # Esperando janela aguarde
|
|
292
|
+
# console.print("Aguardando tela de aguarde ser finalizada")
|
|
293
|
+
# await wait_aguarde_window_closed(app)
|
|
294
|
+
# await worker_sleep(5)
|
|
295
|
+
# except:
|
|
296
|
+
# pass
|
|
297
|
+
|
|
298
|
+
await worker_sleep(5)
|
|
299
|
+
|
|
300
|
+
##### Janela Pré-visualizando Relatório #####
|
|
301
|
+
console.print("Fechar Janela Pré-visualizando Relatório ")
|
|
302
|
+
app = Application().connect(class_name="TFrmPreviewRelatorio", timeout=60)
|
|
303
|
+
main_window = app["TFrmPreviewRelatorio"]
|
|
304
|
+
main_window.set_focus()
|
|
305
|
+
|
|
306
|
+
# Clicar em fechar
|
|
307
|
+
main_window.close()
|
|
308
|
+
|
|
309
|
+
await worker_sleep(3)
|
|
310
|
+
|
|
311
|
+
##### Janela Principal ####
|
|
312
|
+
console.print("Navegando para Livro de Apuração ICMS... ")
|
|
313
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
314
|
+
input_principal = main_window = app["TFrmPrincipalFiscal"]
|
|
315
|
+
input_principal.set_focus()
|
|
316
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0)
|
|
317
|
+
type_text_into_field(
|
|
318
|
+
"Livro de Apuração ICMS", input_livros, True, "50"
|
|
319
|
+
)
|
|
320
|
+
await worker_sleep(5)
|
|
321
|
+
|
|
322
|
+
try:
|
|
323
|
+
##### Janela Confirm #####
|
|
324
|
+
app = Application().connect(class_name="TMessageForm", timeout=60)
|
|
325
|
+
main_window = app["TMessageForm"]
|
|
326
|
+
main_window.set_focus()
|
|
327
|
+
main_window.child_window(class_name="TButton", found_index=0).click_input()
|
|
328
|
+
except:
|
|
329
|
+
pass
|
|
330
|
+
console.print("Selecionar Livro de Apuração")
|
|
331
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0).click_input()
|
|
332
|
+
pyautogui.press("enter")
|
|
333
|
+
await worker_sleep(1)
|
|
334
|
+
pyautogui.press("enter")
|
|
335
|
+
|
|
336
|
+
await worker_sleep(5)
|
|
337
|
+
|
|
338
|
+
##### Janela Movimentação de Apuração ICMS #####
|
|
339
|
+
app = Application().connect(class_name="TFrmMovtoApuraIcmsNew", timeout=60)
|
|
340
|
+
main_window = app["TFrmMovtoApuraIcmsNew"]
|
|
341
|
+
main_window.set_focus()
|
|
342
|
+
|
|
343
|
+
console.print("Clicando no último livro, primeira linha")
|
|
344
|
+
pyautogui.click(599,410)
|
|
345
|
+
|
|
346
|
+
await worker_sleep(1)
|
|
347
|
+
|
|
348
|
+
console.print("Clicando em Estornar Livro")
|
|
349
|
+
pyautogui.click(667,742)
|
|
350
|
+
|
|
351
|
+
await worker_sleep(3)
|
|
352
|
+
|
|
353
|
+
main_window.close()
|
|
354
|
+
|
|
355
|
+
await worker_sleep(2)
|
|
356
|
+
|
|
357
|
+
console.print("Selecionar Livro Saída aberto")
|
|
358
|
+
|
|
359
|
+
# Selecionar linha livro de saída aberto
|
|
360
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livro_saida_aberto.png"
|
|
361
|
+
|
|
362
|
+
# Tenta localizar a imagem na tela
|
|
363
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9)
|
|
364
|
+
|
|
365
|
+
if localizacao:
|
|
366
|
+
print(f"Imagem livro de saída aberto encontrado em: {localizacao}")
|
|
367
|
+
pyautogui.moveTo(localizacao)
|
|
368
|
+
pyautogui.click()
|
|
369
|
+
else:
|
|
370
|
+
console.print("Imagem livro de saída aberto não encontrado na tela.")
|
|
371
|
+
|
|
372
|
+
# Clicar em alterar livro
|
|
373
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\alterar_livro.png"
|
|
374
|
+
|
|
375
|
+
# Tenta localizar a imagem na tela
|
|
376
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
377
|
+
|
|
378
|
+
if localizacao:
|
|
379
|
+
print(f"Imagem alterar livro encontrado em: {localizacao}")
|
|
380
|
+
pyautogui.moveTo(localizacao)
|
|
381
|
+
pyautogui.click()
|
|
382
|
+
else:
|
|
383
|
+
console.print("Imagem alterar livro não encontrada na tela.")
|
|
384
|
+
|
|
385
|
+
await worker_sleep(4)
|
|
386
|
+
|
|
387
|
+
# Clicar em Livro fiscal
|
|
388
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livro_fiscal.png"
|
|
389
|
+
|
|
390
|
+
# Tenta localizar a imagem na tela
|
|
391
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
392
|
+
|
|
393
|
+
if localizacao:
|
|
394
|
+
print(f"Imagem Livro fiscal encontrado em: {localizacao}")
|
|
395
|
+
pyautogui.moveTo(localizacao)
|
|
396
|
+
pyautogui.click()
|
|
397
|
+
else:
|
|
398
|
+
console.print("Imagem Livro fiscal não encontrada na tela.")
|
|
399
|
+
|
|
400
|
+
await worker_sleep(4)
|
|
401
|
+
|
|
402
|
+
# Clicar em Gerar Relatório
|
|
403
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\gerar_registros.png"
|
|
404
|
+
|
|
405
|
+
# Tenta localizar a imagem na tela
|
|
406
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
407
|
+
|
|
408
|
+
if localizacao:
|
|
409
|
+
print(f"Imagem gerar relatório encontrado em: {localizacao}")
|
|
410
|
+
pyautogui.moveTo(localizacao)
|
|
411
|
+
pyautogui.click()
|
|
412
|
+
else:
|
|
413
|
+
console.print("Imagem gerar relatório não encontrada na tela.")
|
|
414
|
+
|
|
415
|
+
##### Janela Gerar Registro ####
|
|
416
|
+
console.print("Confirmar Registro")
|
|
417
|
+
app = Application().connect(class_name="TMsgBox", timeout=60)
|
|
418
|
+
main_window = app["TMsgBox"]
|
|
419
|
+
main_window.set_focus()
|
|
420
|
+
|
|
421
|
+
# Clicar em Sim
|
|
422
|
+
main_window.child_window(class_name="TBitBtn", found_index=1).click_input()
|
|
423
|
+
|
|
424
|
+
await worker_sleep(4)
|
|
425
|
+
|
|
426
|
+
console.print("Clicar em confirmar")
|
|
427
|
+
app = Application().connect(class_name="TPerguntasLivrosFiscaisForm", timeout=60)
|
|
428
|
+
main_window = app["TPerguntasLivrosFiscaisForm"]
|
|
429
|
+
main_window.set_focus()
|
|
430
|
+
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
|
431
|
+
|
|
432
|
+
# Caminho da imagem que deve desaparecer
|
|
433
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\janela_carregada.png"
|
|
434
|
+
|
|
435
|
+
# Tempo máximo de espera (em segundos)
|
|
436
|
+
tempo_limite = 600 # 10 minutos
|
|
437
|
+
intervalo = 2 # segundos entre as verificações
|
|
438
|
+
|
|
439
|
+
inicio = time.time()
|
|
440
|
+
|
|
441
|
+
while True:
|
|
442
|
+
localizacao = pyautogui.locateOnScreen(imagem, confidence=0.9)
|
|
443
|
+
|
|
444
|
+
if not localizacao:
|
|
445
|
+
print("Imagem desapareceu da tela.")
|
|
446
|
+
break # A imagem sumiu, podemos seguir
|
|
447
|
+
|
|
448
|
+
if time.time() - inicio > tempo_limite:
|
|
449
|
+
print("Tempo esgotado. A imagem não desapareceu.")
|
|
450
|
+
break
|
|
451
|
+
|
|
452
|
+
print("Imagem ainda presente... aguardando")
|
|
453
|
+
time.sleep(intervalo)
|
|
454
|
+
|
|
455
|
+
##### Janela Principal ####
|
|
456
|
+
console.print("Navegando para Livro de Apuração ICMS... ")
|
|
457
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
458
|
+
input_principal = main_window = app["TFrmPrincipalFiscal"]
|
|
459
|
+
input_principal.set_focus()
|
|
460
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0)
|
|
461
|
+
type_text_into_field(
|
|
462
|
+
"Livro de Apuração ICMS", input_livros, True, "50"
|
|
463
|
+
)
|
|
464
|
+
await worker_sleep(5)
|
|
465
|
+
|
|
466
|
+
app = Application().connect(class_name="TFrmMovtoApuraIcmsNew", timeout=60)
|
|
467
|
+
main_window = app["TFrmMovtoApuraIcmsNew"]
|
|
468
|
+
main_window.set_focus()
|
|
469
|
+
data_input = main_window.child_window(class_name="TDBIEditDate", found_index=0)
|
|
470
|
+
competencia = competencia #task.configEntrada.get("periodo")
|
|
471
|
+
type_text_into_field(
|
|
472
|
+
competencia, data_input, True, "50"
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
# Clicar em incluir apuração
|
|
476
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\btn_incluir_apuracao.png"
|
|
477
|
+
|
|
478
|
+
# Tenta localizar a imagem na tela
|
|
479
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
480
|
+
|
|
481
|
+
if localizacao:
|
|
482
|
+
print(f"Imagem incluir apuração encontrado em: {localizacao}")
|
|
483
|
+
pyautogui.moveTo(localizacao)
|
|
484
|
+
pyautogui.click()
|
|
485
|
+
else:
|
|
486
|
+
console.print("Imagem incluir apuração não encontrada na tela.")
|
|
487
|
+
|
|
488
|
+
except Exception as erro:
|
|
489
|
+
console.print(f"Erro ao executar abertura de livros fiscais, erro : {erro}")
|
|
490
|
+
return RpaRetornoProcessoDTO(
|
|
491
|
+
sucesso=False,
|
|
492
|
+
retorno=f"Erro na Abertura de Livro Fiscal : {erro}",
|
|
493
|
+
status=RpaHistoricoStatusEnum.Falha,
|
|
494
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
495
|
+
)
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import pyautogui
|
|
3
|
-
|
|
4
|
-
from worker_automate_hub.utils.logger import logger
|
|
5
|
-
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
|
6
|
-
RpaHistoricoStatusEnum,
|
|
7
|
-
RpaRetornoProcessoDTO,
|
|
8
|
-
RpaTagDTO,
|
|
9
|
-
RpaTagEnum,
|
|
10
|
-
)
|
|
11
|
-
from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
|
|
12
|
-
RpaProcessoEntradaDTO,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from worker_automate_hub.api.client import get_config_by_name
|
|
16
|
-
from pywinauto import Application
|
|
17
|
-
from rich.console import Console
|
|
18
|
-
from worker_automate_hub.utils.util import (
|
|
19
|
-
is_window_open_by_class,
|
|
20
|
-
kill_all_emsys,
|
|
21
|
-
login_emsys_fiscal,
|
|
22
|
-
type_text_into_field,
|
|
23
|
-
worker_sleep,
|
|
24
|
-
)
|
|
25
|
-
from worker_automate_hub.utils.utils_nfe_entrada import EMSys
|
|
26
|
-
import pyperclip
|
|
27
|
-
import warnings
|
|
28
|
-
import asyncio
|
|
29
|
-
from worker_automate_hub.decorators.repeat import repeat
|
|
30
|
-
from pytesseract import image_to_string
|
|
31
|
-
from pywinauto import Desktop
|
|
32
|
-
|
|
33
|
-
pyautogui.PAUSE = 0.5
|
|
34
|
-
pyautogui.FAILSAFE = False
|
|
35
|
-
|
|
36
|
-
console = Console()
|
|
37
|
-
|
|
38
|
-
emsys = EMSys()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@repeat(times=10, delay=5)
|
|
42
|
-
async def wait_aguarde_window_closed(app, timeout=60):
|
|
43
|
-
console.print("Verificando existencia de aguarde...")
|
|
44
|
-
start_time = time.time()
|
|
45
|
-
|
|
46
|
-
while time.time() - start_time < timeout:
|
|
47
|
-
janela_topo = app.top_window()
|
|
48
|
-
titulo = janela_topo.window_text()
|
|
49
|
-
console.print(f"Titulo da janela top: ${titulo}")
|
|
50
|
-
await emsys.verify_warning_and_error("Aviso", "&Ok")
|
|
51
|
-
await worker_sleep(2)
|
|
52
|
-
|
|
53
|
-
if "Gerar Registros" in titulo or "Movimento de Livro Fiscal" in titulo:
|
|
54
|
-
console.log("Fim de aguardando...")
|
|
55
|
-
return
|
|
56
|
-
else:
|
|
57
|
-
console.log("Aguardando...")
|
|
58
|
-
|
|
59
|
-
console.log("Timeout esperando a janela Aguarde...")
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def click_desconfirmar():
|
|
63
|
-
cords = (675, 748)
|
|
64
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def ctrl_c():
|
|
68
|
-
pyautogui.press("tab", presses=12) # verificar
|
|
69
|
-
pyautogui.hotkey("ctrl", "c")
|
|
70
|
-
return pyperclip.paste()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
74
|
-
try:
|
|
75
|
-
config = await get_config_by_name("login_emsys_fiscal")
|
|
76
|
-
|
|
77
|
-
# Fecha a instancia do emsys - caso esteja aberta
|
|
78
|
-
await kill_all_emsys()
|
|
79
|
-
|
|
80
|
-
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal.exe")
|
|
81
|
-
warnings.filterwarnings(
|
|
82
|
-
"ignore",
|
|
83
|
-
category=UserWarning,
|
|
84
|
-
message="32-bit application should be automated using 32-bit Python",
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
await worker_sleep(4)
|
|
88
|
-
|
|
89
|
-
try:
|
|
90
|
-
app = Application(backend="win32").connect(
|
|
91
|
-
class_name="TFrmLoginModulo", timeout=50
|
|
92
|
-
)
|
|
93
|
-
except:
|
|
94
|
-
return RpaRetornoProcessoDTO(
|
|
95
|
-
sucesso=False,
|
|
96
|
-
retorno="Erro ao abrir o EMSys Fiscal, tela de login não encontrada",
|
|
97
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
98
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
99
|
-
)
|
|
100
|
-
return_login = await login_emsys_fiscal(config.conConfiguracao, app, task)
|
|
101
|
-
if return_login.sucesso:
|
|
102
|
-
await worker_sleep(2)
|
|
103
|
-
type_text_into_field(
|
|
104
|
-
"Livros Fiscais", app["TFrmMenuPrincipal"]["Edit"], True, "50"
|
|
105
|
-
)
|
|
106
|
-
pyautogui.press("enter")
|
|
107
|
-
await worker_sleep(2)
|
|
108
|
-
pyautogui.press("down")
|
|
109
|
-
await worker_sleep(2)
|
|
110
|
-
pyautogui.press("enter")
|
|
111
|
-
console.print(
|
|
112
|
-
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
|
113
|
-
style="bold green",
|
|
114
|
-
)
|
|
115
|
-
await worker_sleep(10)
|
|
116
|
-
livros_fiscais_window = app.top_window()
|
|
117
|
-
# Preenchendo campo competencia
|
|
118
|
-
console.print("Preenchendo campo competencia...")
|
|
119
|
-
pyautogui.press("tab")
|
|
120
|
-
competencia = task.configEntrada.get("periodo")
|
|
121
|
-
pyautogui.write(competencia)
|
|
122
|
-
await worker_sleep(3)
|
|
123
|
-
|
|
124
|
-
# Resetando tabs
|
|
125
|
-
console.print("Levando cursor para campo competencia")
|
|
126
|
-
pyautogui.click(729, 321)
|
|
127
|
-
await worker_sleep(2)
|
|
128
|
-
|
|
129
|
-
# Marcando caixa Entrada
|
|
130
|
-
console.print("Marcando caixa entrada")
|
|
131
|
-
pyautogui.press("tab")
|
|
132
|
-
pyautogui.press("space")
|
|
133
|
-
await worker_sleep(2)
|
|
134
|
-
|
|
135
|
-
# Marcando caixa Saida
|
|
136
|
-
console.print("Marcando caixa saida")
|
|
137
|
-
pyautogui.press("tab")
|
|
138
|
-
pyautogui.press("space")
|
|
139
|
-
await worker_sleep(2)
|
|
140
|
-
|
|
141
|
-
# Clicando em incluir livro
|
|
142
|
-
try:
|
|
143
|
-
console.print("Clicando em incluir livro")
|
|
144
|
-
cords = (676, 716)
|
|
145
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
146
|
-
await worker_sleep(5)
|
|
147
|
-
except:
|
|
148
|
-
return RpaRetornoProcessoDTO(
|
|
149
|
-
sucesso=False,
|
|
150
|
-
retorno=f"Erro ao clicar em botão de incluir livro.",
|
|
151
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
152
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
# Clicando em sim na janela de gerar registros após incluir
|
|
156
|
-
console.print("Clicando em sim na janela de gerar registros após incluir")
|
|
157
|
-
cords = (942, 603)
|
|
158
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
159
|
-
await worker_sleep(5)
|
|
160
|
-
|
|
161
|
-
# Clicando nao na tela de somar icms outros
|
|
162
|
-
console.print("Clicando em nao na janela de calcular icms Outros.")
|
|
163
|
-
cords = (1000, 570)
|
|
164
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
165
|
-
await worker_sleep(5)
|
|
166
|
-
|
|
167
|
-
# Clicando sim em janela de confirmar observacao
|
|
168
|
-
console.print("Clicando sim em janela de confirmar observacao")
|
|
169
|
-
cords = (920, 560)
|
|
170
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
171
|
-
await worker_sleep(5)
|
|
172
|
-
|
|
173
|
-
# Esperando janela aguarde
|
|
174
|
-
console.print("Aguardando tela de aguarde ser finalizada")
|
|
175
|
-
await wait_aguarde_window_closed(app)
|
|
176
|
-
await worker_sleep(5)
|
|
177
|
-
|
|
178
|
-
# Clicando sim em janela gerar Num Serie
|
|
179
|
-
console.print("Clicando sim em janela gerar Numero de Serie")
|
|
180
|
-
cords = (920, 560)
|
|
181
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
182
|
-
await worker_sleep(5)
|
|
183
|
-
|
|
184
|
-
# Clicando sim em janela somar os valores de IPI, Frete..
|
|
185
|
-
console.print("Clicando sim em janela somar os valores de IPI Frete")
|
|
186
|
-
cords = (920, 560)
|
|
187
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
188
|
-
await worker_sleep(5)
|
|
189
|
-
|
|
190
|
-
# Esperando janela aguarde
|
|
191
|
-
console.print("Aguardando tela de aguarde ser finalizada")
|
|
192
|
-
await wait_aguarde_window_closed(app)
|
|
193
|
-
await worker_sleep(5)
|
|
194
|
-
|
|
195
|
-
app.top_window().set_focus()
|
|
196
|
-
await worker_sleep(5)
|
|
197
|
-
|
|
198
|
-
# Clicando OK em janela de livro incluido
|
|
199
|
-
console.print("Clicando em OK em janela de livro incluido")
|
|
200
|
-
await emsys.verify_warning_and_error("Informação", "OK")
|
|
201
|
-
await worker_sleep(5)
|
|
202
|
-
|
|
203
|
-
console.print("Selecionando primeira linha da tabela")
|
|
204
|
-
# Selecionando primeira linha da tabela
|
|
205
|
-
pyautogui.click(604, 485)
|
|
206
|
-
# Iterando apenas as 2 primeiras linhas da tabela para procurar entrada/saida
|
|
207
|
-
for _ in range(2):
|
|
208
|
-
conteudo = ctrl_c().lower()
|
|
209
|
-
if (
|
|
210
|
-
"entrada" in conteudo
|
|
211
|
-
and "confirmado" in conteudo
|
|
212
|
-
and competencia in conteudo
|
|
213
|
-
):
|
|
214
|
-
console.print(f"Clicando em desconfirmar entrada na tabela...")
|
|
215
|
-
click_desconfirmar()
|
|
216
|
-
await worker_sleep(2)
|
|
217
|
-
if (
|
|
218
|
-
"saida" in conteudo
|
|
219
|
-
and "confirmado" in conteudo
|
|
220
|
-
and competencia in conteudo
|
|
221
|
-
):
|
|
222
|
-
console.print(f"Clicando em desconfirmar saida na tabela...")
|
|
223
|
-
click_desconfirmar()
|
|
224
|
-
await worker_sleep(2)
|
|
225
|
-
pyautogui.press("down")
|
|
226
|
-
await worker_sleep(5)
|
|
227
|
-
|
|
228
|
-
# Fechando janela de livro fiscal
|
|
229
|
-
console.print("Fechando janela de livro fiscal")
|
|
230
|
-
livros_fiscais_window.close()
|
|
231
|
-
await worker_sleep(5)
|
|
232
|
-
|
|
233
|
-
# Abrindo janela de apuracao de ICMS
|
|
234
|
-
console.print("Abrindo janela de apuracao de ICMS")
|
|
235
|
-
type_text_into_field(
|
|
236
|
-
"Livro de Apuração ICMS", app["TFrmMenuPrincipal"]["Edit"], True, "50"
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
await worker_sleep(5)
|
|
240
|
-
|
|
241
|
-
pyautogui.press("enter", presses=2)
|
|
242
|
-
|
|
243
|
-
await worker_sleep(5)
|
|
244
|
-
titulo_atual = app.top_window().window_text().lower()
|
|
245
|
-
if "apuração icms" not in titulo_atual:
|
|
246
|
-
return RpaRetornoProcessoDTO(
|
|
247
|
-
sucesso=False,
|
|
248
|
-
retorno=f"Erro, ocorreu um problema ao tentar interagir com a janela de apuração.",
|
|
249
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
250
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
pyautogui.click(x=601, y=406)
|
|
254
|
-
primeira_entrada = ctrl_c().lower()
|
|
255
|
-
if "encerrado" in primeira_entrada:
|
|
256
|
-
# Clicando em estornar livro
|
|
257
|
-
console.print("Clicando em estornar livro")
|
|
258
|
-
cords = (662, 739)
|
|
259
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
260
|
-
await worker_sleep(4)
|
|
261
|
-
|
|
262
|
-
# Clicando no campo competencia antes de preencher
|
|
263
|
-
cords = (670, 329)
|
|
264
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
265
|
-
await worker_sleep(4)
|
|
266
|
-
|
|
267
|
-
# Preenchendo campo competencia
|
|
268
|
-
console.print("Preenchendo campo competencia")
|
|
269
|
-
pyautogui.write(competencia)
|
|
270
|
-
|
|
271
|
-
# Clicando em incluir apuracao
|
|
272
|
-
console.print("Clicando em incluir apuracao")
|
|
273
|
-
cords = (659, 688)
|
|
274
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
275
|
-
await worker_sleep(4)
|
|
276
|
-
|
|
277
|
-
console.print("Operacao finalizada com sucesso")
|
|
278
|
-
return RpaRetornoProcessoDTO(
|
|
279
|
-
sucesso=True,
|
|
280
|
-
retorno="Abertura de livro fiscal concluida com sucesso",
|
|
281
|
-
status=RpaHistoricoStatusEnum.Sucesso,
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
else:
|
|
285
|
-
logger.info(f"\nError Message: {return_login.retorno}")
|
|
286
|
-
console.print(
|
|
287
|
-
"\nError Messsage: {return_login.retorno}", style="bold green"
|
|
288
|
-
)
|
|
289
|
-
return return_login
|
|
290
|
-
|
|
291
|
-
except Exception as erro:
|
|
292
|
-
console.print(f"Erro ao executar abertura de livros fiscais, erro : {erro}")
|
|
293
|
-
return RpaRetornoProcessoDTO(
|
|
294
|
-
sucesso=False,
|
|
295
|
-
retorno=f"Erro na Abertura de Livro Fiscal : {erro}",
|
|
296
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
297
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
298
|
-
)
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/__init__.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/ahead_service.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/api/rdp_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/config/__init__.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/config/settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/repeat.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/retry.py
RENAMED
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/decorators/timeit.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/tasks/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/__init__.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/env.py
RENAMED
|
File without changes
|
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/logger.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/toast.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/updater.py
RENAMED
|
File without changes
|
{worker_automate_hub-0.5.672 → worker_automate_hub-0.5.673}/worker_automate_hub/utils/util.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|