worker-automate-hub 0.5.753__tar.gz → 0.5.754__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.
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/PKG-INFO +1 -1
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/pyproject.toml +1 -1
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/extracao_saldo_estoque.py +1 -4
- worker_automate_hub-0.5.754/worker_automate_hub/tasks/jobs/extracao_saldo_estoque_fiscal.py +376 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/task_definitions.py +3 -1
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/util.py +3 -1
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/README.md +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/ahead_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/client.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/datalake_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/helpers/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/rdp_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/rpa_fila_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/rpa_historico_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/webhook_service.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/cli.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/config/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/config/settings.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/config.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/core/so_manipulation.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/deprecation.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/rate_limit.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/repeat.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/retry.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/singleton.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/timeit.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/rpa_fila.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dao/rpa_robo.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/rpa_sap_dto.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/cte_manual.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/cte_xml.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/devolucao_ctf.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/devolucao_ctf_35.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_cte_1353.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_cte_333.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_503.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/entrada_de_notas_9000.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/extracao_fechamento_contabil.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/extracao_fechamento_emsys.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/fidc_exportacao_docs_portal_b2b.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/integracao_contabil.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/lancamento_rateio.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/opex_capex.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/playground.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/tasks/task_executor.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/__init__.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/env.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/logger.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/toast.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/updater.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
- {worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/worker.py +0 -0
@@ -4,10 +4,7 @@ from datetime import datetime
|
|
4
4
|
from pywinauto import Application, timings, findwindows
|
5
5
|
import sys
|
6
6
|
import io
|
7
|
-
|
8
|
-
sys.path.append(
|
9
|
-
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
10
|
-
)
|
7
|
+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
11
8
|
|
12
9
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
13
10
|
RpaHistoricoStatusEnum,
|
@@ -0,0 +1,376 @@
|
|
1
|
+
import asyncio
|
2
|
+
import os
|
3
|
+
from datetime import datetime
|
4
|
+
from pywinauto import Application, timings, findwindows, keyboard
|
5
|
+
import sys
|
6
|
+
import io
|
7
|
+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
8
|
+
|
9
|
+
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
10
|
+
RpaHistoricoStatusEnum,
|
11
|
+
RpaRetornoProcessoDTO,
|
12
|
+
RpaTagDTO,
|
13
|
+
RpaTagEnum,
|
14
|
+
)
|
15
|
+
from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
|
16
|
+
RpaProcessoEntradaDTO,
|
17
|
+
)
|
18
|
+
from rich.console import Console
|
19
|
+
import re
|
20
|
+
from pywinauto.keyboard import send_keys
|
21
|
+
import warnings
|
22
|
+
from pywinauto.application import Application
|
23
|
+
from worker_automate_hub.api.client import get_config_by_name, send_file
|
24
|
+
from worker_automate_hub.utils.util import (
|
25
|
+
kill_all_emsys,
|
26
|
+
login_emsys_fiscal,
|
27
|
+
set_variable,
|
28
|
+
type_text_into_field,
|
29
|
+
worker_sleep,
|
30
|
+
)
|
31
|
+
from pywinauto_recorder.player import set_combobox
|
32
|
+
|
33
|
+
from datetime import timedelta
|
34
|
+
import pyautogui
|
35
|
+
from worker_automate_hub.utils.logger import logger
|
36
|
+
from worker_automate_hub.utils.utils_nfe_entrada import EMSys
|
37
|
+
|
38
|
+
emsys = EMSys()
|
39
|
+
|
40
|
+
console = Console()
|
41
|
+
pyautogui.PAUSE = 0.5
|
42
|
+
pyautogui.FAILSAFE = False
|
43
|
+
|
44
|
+
|
45
|
+
async def extracao_saldo_estoque_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
46
|
+
try:
|
47
|
+
config = await get_config_by_name("login_emsys_fiscal")
|
48
|
+
periodo = task.configEntrada['periodo']
|
49
|
+
periodo_format = periodo.replace("/","")
|
50
|
+
filial = task.configEntrada['filialEmpresaOrigem']
|
51
|
+
historico_id = task.historico_id
|
52
|
+
await kill_all_emsys()
|
53
|
+
|
54
|
+
config = await get_config_by_name("login_emsys_fiscal")
|
55
|
+
|
56
|
+
# Fecha a instancia do emsys - caso esteja aberta
|
57
|
+
await kill_all_emsys()
|
58
|
+
|
59
|
+
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal_39.exe")
|
60
|
+
warnings.filterwarnings(
|
61
|
+
"ignore",
|
62
|
+
category=UserWarning,
|
63
|
+
message="32-bit application should be automated using 32-bit Python",
|
64
|
+
)
|
65
|
+
|
66
|
+
await worker_sleep(5)
|
67
|
+
|
68
|
+
try:
|
69
|
+
app = Application(backend="win32").connect(
|
70
|
+
class_name="TFrmLoginModulo", timeout=100
|
71
|
+
)
|
72
|
+
except:
|
73
|
+
return RpaRetornoProcessoDTO(
|
74
|
+
sucesso=False,
|
75
|
+
retorno="Erro ao abrir o EMSys Fiscal, tela de login não encontrada",
|
76
|
+
status=RpaHistoricoStatusEnum.Falha,
|
77
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
78
|
+
)
|
79
|
+
return_login = await login_emsys_fiscal(config.conConfiguracao, app, task)
|
80
|
+
if return_login.sucesso:
|
81
|
+
await worker_sleep(2)
|
82
|
+
type_text_into_field(
|
83
|
+
"Livros Fiscais", app["TFrmMenuPrincipal"]["Edit"], True, "50"
|
84
|
+
)
|
85
|
+
pyautogui.press("enter")
|
86
|
+
await worker_sleep(2)
|
87
|
+
pyautogui.press("down")
|
88
|
+
await worker_sleep(2)
|
89
|
+
pyautogui.press("enter")
|
90
|
+
console.print(
|
91
|
+
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
92
|
+
style="bold green",
|
93
|
+
)
|
94
|
+
|
95
|
+
else:
|
96
|
+
logger.info(f"\nError Message: {return_login.retorno}")
|
97
|
+
console.print(f"\nError Message: {return_login.retorno}", style="bold red")
|
98
|
+
return return_login
|
99
|
+
|
100
|
+
await worker_sleep(7)
|
101
|
+
|
102
|
+
##### Janela Movimento Livros Fiscais #####
|
103
|
+
# Conecta na janela principal
|
104
|
+
app = Application().connect(class_name="TFrmMovtoLivroFiscal")
|
105
|
+
main_window = app.window(class_name="TFrmMovtoLivroFiscal")
|
106
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
107
|
+
|
108
|
+
# Pegar o wrapper do campo
|
109
|
+
campo_data = main_window.child_window(class_name="TDBIEditDate")
|
110
|
+
campo_data.wait("exists enabled visible ready", timeout=10)
|
111
|
+
campo_data = campo_data.wrapper_object() # agora é o controle de fato
|
112
|
+
|
113
|
+
# Foco e clique
|
114
|
+
campo_data.set_focus()
|
115
|
+
campo_data.click_input()
|
116
|
+
|
117
|
+
# Limpa e digita
|
118
|
+
keyboard.send_keys("^a{BACKSPACE}07/2025")
|
119
|
+
|
120
|
+
# Seleciona inventário
|
121
|
+
chk_inventario = main_window.child_window(
|
122
|
+
class_name="TcxCheckBox", found_index=6
|
123
|
+
).click_input()
|
124
|
+
|
125
|
+
await worker_sleep(2)
|
126
|
+
|
127
|
+
# Caminho da imagem do botão
|
128
|
+
imagem_botao = r"\\assets\\extracao_relatorios\\btn_incluir_livro.png"
|
129
|
+
|
130
|
+
if os.path.exists(imagem_botao):
|
131
|
+
try:
|
132
|
+
# Localiza a imagem na tela
|
133
|
+
botao = pyautogui.locateCenterOnScreen(imagem_botao, confidence=0.9) # confidence precisa do opencv instalado
|
134
|
+
if botao:
|
135
|
+
pyautogui.click(botao)
|
136
|
+
print("Botão clicado com sucesso!")
|
137
|
+
else:
|
138
|
+
print("Não encontrou o botão na tela.")
|
139
|
+
except Exception as e:
|
140
|
+
print(f"Erro ao localizar/clicar na imagem: {e}")
|
141
|
+
else:
|
142
|
+
print("Caminho da imagem não existe.")
|
143
|
+
|
144
|
+
##### Janela Perguntas da Geração Livros Fiscais #####
|
145
|
+
app = Application().connect(class_name="TPerguntasLivrosFiscaisForm")
|
146
|
+
main_window = app.window(class_name="TPerguntasLivrosFiscaisForm")
|
147
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
148
|
+
|
149
|
+
respostas = ["Não", "Sim", "Não", "Não"]
|
150
|
+
|
151
|
+
for i, resposta in enumerate(respostas):
|
152
|
+
combo = main_window.child_window(class_name="TDBIComboBoxValues", found_index=i).wrapper_object()
|
153
|
+
combo.set_focus()
|
154
|
+
combo.click_input()
|
155
|
+
await worker_sleep(0.1)
|
156
|
+
keyboard.send_keys(resposta + "{ENTER}")
|
157
|
+
await worker_sleep(0.2)
|
158
|
+
# Clicar em confirmar
|
159
|
+
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
160
|
+
|
161
|
+
await worker_sleep(2)
|
162
|
+
|
163
|
+
##### Janela Gerar Registros #####
|
164
|
+
app = Application(backend="win32").connect(title="Gerar Registros")
|
165
|
+
main_window = app.window(title="Gerar Registros")
|
166
|
+
# Clicar em Sim
|
167
|
+
btn_sim = main_window.child_window(class_name="Button", found_index=1).click_input()
|
168
|
+
|
169
|
+
await worker_sleep(2)
|
170
|
+
|
171
|
+
##### Janela Informa Motivo do Inventario #####
|
172
|
+
app = Application().connect(class_name="TFrmMotvoMotivoInventario")
|
173
|
+
main_window = app.window(class_name="TFrmMotvoMotivoInventario")
|
174
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
175
|
+
slc_01 = main_window.child_window(class_name="TDBIComboBoxValues", found_index=0).click_input()
|
176
|
+
await worker_sleep(0.1)
|
177
|
+
keyboard.send_keys("01" + "{ENTER}")
|
178
|
+
await worker_sleep(0.2)
|
179
|
+
|
180
|
+
# Clicar em confirmar
|
181
|
+
main_window.child_window(class_name="TBitBtn", found_index=0).click_input()
|
182
|
+
|
183
|
+
await worker_sleep(5)
|
184
|
+
|
185
|
+
##### Conecta à janela Preview Relatorio #####
|
186
|
+
app = Application(backend="win32").connect(class_name="TFrmPreviewRelatorio")
|
187
|
+
|
188
|
+
# Espera até a janela aparecer e estar pronta
|
189
|
+
main_window = app.window(class_name="TFrmPreviewRelatorio")
|
190
|
+
main_window.wait("exists enabled visible ready", timeout=180)
|
191
|
+
|
192
|
+
# Dá o foco na janela
|
193
|
+
main_window.set_focus()
|
194
|
+
|
195
|
+
await worker_sleep(2)
|
196
|
+
|
197
|
+
main_window.close()
|
198
|
+
|
199
|
+
await worker_sleep(2)
|
200
|
+
|
201
|
+
##### Janela Movimento Livro Fiscal #####
|
202
|
+
# Selecionar primeira linha inventario
|
203
|
+
pyautogui.click(928, 475)
|
204
|
+
|
205
|
+
await worker_sleep(2)
|
206
|
+
|
207
|
+
# Clicar em visualizar livro
|
208
|
+
caminho = r"assets\\extracao_relatorios\\btn_visu_livros.png"
|
209
|
+
# Verifica se o arquivo existe
|
210
|
+
if os.path.isfile(caminho):
|
211
|
+
print("A imagem existe:", caminho)
|
212
|
+
|
213
|
+
# Procura a imagem na tela
|
214
|
+
pos = pyautogui.locateCenterOnScreen(caminho, confidence=0.9) # ajuste o confidence se necessário
|
215
|
+
if pos:
|
216
|
+
pyautogui.click(pos) # clica no centro da imagem
|
217
|
+
print("Clique realizado na imagem.")
|
218
|
+
else:
|
219
|
+
print("Imagem encontrada no disco, mas não está visível na tela.")
|
220
|
+
else:
|
221
|
+
print("A imagem NÃO existe:", caminho)
|
222
|
+
|
223
|
+
await worker_sleep(5)
|
224
|
+
|
225
|
+
##### Janela Movimento Livro Fiscal - Livro - Inventario para Competencia #####
|
226
|
+
app = Application().connect(class_name="TFrmMovtoLivroFiscal")
|
227
|
+
main_window = app.window(class_name="TFrmMovtoLivroFiscal")
|
228
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
229
|
+
input_7 = main_window.child_window(class_name="TDBIEditCode", found_index=0).click_input()
|
230
|
+
await worker_sleep(0.1)
|
231
|
+
keyboard.send_keys("7" + "{TAB}")
|
232
|
+
await worker_sleep(0.2)
|
233
|
+
# Clicar em imprimir
|
234
|
+
btn_imprimir = main_window.child_window(class_name="TBitBtn", found_index=0).click_input()
|
235
|
+
|
236
|
+
await worker_sleep(2)
|
237
|
+
|
238
|
+
##### Janela Selecion o Template Desejado #####
|
239
|
+
app = Application().connect(class_name="TFrmFRVisualizaTemplateMenuNew")
|
240
|
+
main_window = app.window(class_name="TFrmFRVisualizaTemplateMenuNew")
|
241
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
242
|
+
btn_gerar_rel = main_window.child_window(class_name="TBitBtn", found_index=1).click_input()
|
243
|
+
|
244
|
+
await worker_sleep(2)
|
245
|
+
|
246
|
+
##### Janela Parametros #####
|
247
|
+
app = Application().connect(class_name="TFrmFRParametroRelatorio")
|
248
|
+
main_window = app.window(class_name="TFrmFRParametroRelatorio")
|
249
|
+
main_window.wait("exists enabled visible ready", timeout=20)
|
250
|
+
slc_nao = main_window.child_window(class_name="TComboBox", found_index=0).click_input()
|
251
|
+
await worker_sleep(0.1)
|
252
|
+
keyboard.send_keys("NAO" + "{ENTER}")
|
253
|
+
await worker_sleep(0.2)
|
254
|
+
|
255
|
+
# Clicar BOTAO OK
|
256
|
+
slc_nao = main_window.child_window(class_name="TBitBtn", found_index=1).click_input()
|
257
|
+
|
258
|
+
await worker_sleep(2)
|
259
|
+
|
260
|
+
# Clicar em salvar
|
261
|
+
caminho = r"assets\\extracao_relatorios\\btn_salvar.png"
|
262
|
+
# Verifica se o arquivo existe
|
263
|
+
if os.path.isfile(caminho):
|
264
|
+
print("A imagem existe:", caminho)
|
265
|
+
|
266
|
+
# Procura a imagem na tela
|
267
|
+
pos = pyautogui.locateCenterOnScreen(caminho, confidence=0.9) # ajuste o confidence se necessário
|
268
|
+
if pos:
|
269
|
+
pyautogui.click(pos) # clica no centro da imagem
|
270
|
+
print("Clique realizado na imagem.")
|
271
|
+
else:
|
272
|
+
print("Imagem encontrada no disco, mas não está visível na tela.")
|
273
|
+
else:
|
274
|
+
print("A imagem NÃO existe:", caminho)
|
275
|
+
|
276
|
+
await worker_sleep(2)
|
277
|
+
|
278
|
+
# Conecta na janela Configuração para Salvar Arquivo
|
279
|
+
app = Application().connect(class_name="TFrmRelatorioFormato", found_index=0)
|
280
|
+
main_window = app["TFrmRelatorioFormato"]
|
281
|
+
main_window.set_focus()
|
282
|
+
# Acessa o ComboBox pelo identificador conhecido
|
283
|
+
combo = main_window.ComboBox
|
284
|
+
|
285
|
+
# Garante que existe "Excel" na lista
|
286
|
+
itens = combo.texts()
|
287
|
+
print("Itens do ComboBox:", itens)
|
288
|
+
|
289
|
+
# Seleciona o Excel correto (o segundo da lista, índice 8)
|
290
|
+
combo.select(8)
|
291
|
+
|
292
|
+
await worker_sleep(2)
|
293
|
+
|
294
|
+
# Clicar em Salvar
|
295
|
+
btn_salvar = main_window.child_window(
|
296
|
+
class_name="TBitBtn", found_index=1
|
297
|
+
).click_input()
|
298
|
+
|
299
|
+
await worker_sleep(5)
|
300
|
+
|
301
|
+
# Conecta na janela "Salvar para arquivo"
|
302
|
+
app = Application().connect(title_re="Salvar para arquivo", timeout=30)
|
303
|
+
main_window = app.window(title_re="Salvar para arquivo")
|
304
|
+
|
305
|
+
# Campo Nome (Edit) - use set_edit_text para evitar problemas de escape
|
306
|
+
campo_nome = main_window.child_window(class_name="Edit", control_id=1148).wrapper_object()
|
307
|
+
caminho_arquivo = rf"C:\Users\automatehub\Downloads\saldo_estoque_fiscal_{periodo_format}_{filial}.xlsx"
|
308
|
+
campo_nome.set_focus()
|
309
|
+
campo_nome.set_edit_text(caminho_arquivo)
|
310
|
+
|
311
|
+
print("✅ Texto inserido no campo Nome")
|
312
|
+
|
313
|
+
await worker_sleep(3)
|
314
|
+
|
315
|
+
# Clicar em ok para salvar
|
316
|
+
keyboard.send_keys("{TAB}{TAB}{ENTER}", pause=0.3)
|
317
|
+
|
318
|
+
await worker_sleep(5)
|
319
|
+
|
320
|
+
caminho_img = r"assets\\extracao_realtorios\\janela_printing.png"
|
321
|
+
|
322
|
+
# Aguarda até a janela com título "Printing" (ou "Salvando...") fechar
|
323
|
+
try:
|
324
|
+
app = Application().connect(title_re="Printing") # conecta se existir
|
325
|
+
janela = app.window(title_re="Printing")
|
326
|
+
|
327
|
+
print("Aguardando a janela 'Printing' sumir...")
|
328
|
+
janela.wait_not("visible", timeout=60) # espera até 60 segundos
|
329
|
+
print("Janela 'Printing' fechada.")
|
330
|
+
|
331
|
+
except findwindows.ElementNotFoundError:
|
332
|
+
print("Janela 'Printing' não estava aberta.")
|
333
|
+
|
334
|
+
nome_com_extensao = f'saldo_estoque_fiscal_{periodo_format}_{filial}.xlsx'
|
335
|
+
# lê o arquivo
|
336
|
+
with open(f"{caminho_arquivo}", "rb") as file:
|
337
|
+
file_bytes = io.BytesIO(file.read())
|
338
|
+
|
339
|
+
console.print("Enviar Excel para o BOF")
|
340
|
+
try:
|
341
|
+
await send_file(
|
342
|
+
historico_id,
|
343
|
+
nome_com_extensao,
|
344
|
+
"xlsx",
|
345
|
+
file_bytes,
|
346
|
+
file_extension="xlsx",
|
347
|
+
)
|
348
|
+
console.print("Removendo arquivo XLS da pasta downloads")
|
349
|
+
os.remove(f"{caminho_arquivo}")
|
350
|
+
return RpaRetornoProcessoDTO(
|
351
|
+
sucesso=True,
|
352
|
+
retorno="Relatório enviado com sucesso",
|
353
|
+
status=RpaHistoricoStatusEnum.Sucesso
|
354
|
+
)
|
355
|
+
|
356
|
+
except Exception as e:
|
357
|
+
console.print(f"Erro ao enviar o arquivo: {e}", style="bold red")
|
358
|
+
return RpaRetornoProcessoDTO(
|
359
|
+
sucesso=False,
|
360
|
+
retorno=f"Erro ao enviar o arquivo: {e}",
|
361
|
+
status=RpaHistoricoStatusEnum.Falha,
|
362
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
363
|
+
)
|
364
|
+
|
365
|
+
print("")
|
366
|
+
|
367
|
+
except Exception as ex:
|
368
|
+
retorno = f"Erro Processo Saldo Estoque Fiscal: {str(ex)}"
|
369
|
+
logger.error(retorno)
|
370
|
+
console.print(retorno, style="bold red")
|
371
|
+
return RpaRetornoProcessoDTO(
|
372
|
+
sucesso=False,
|
373
|
+
retorno=retorno,
|
374
|
+
status=RpaHistoricoStatusEnum.Falha,
|
375
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
376
|
+
)
|
@@ -32,6 +32,7 @@ from worker_automate_hub.tasks.jobs.entrada_de_notas_7139 import entrada_de_nota
|
|
32
32
|
from worker_automate_hub.tasks.jobs.entrada_de_notas_36 import entrada_de_notas_36
|
33
33
|
from worker_automate_hub.tasks.jobs.entrada_de_notas_503 import entrada_de_notas_503
|
34
34
|
from worker_automate_hub.tasks.jobs.extracao_saldo_estoque import extracao_saldo_estoque
|
35
|
+
from worker_automate_hub.tasks.jobs.extracao_saldo_estoque import extracao_saldo_estoque_fiscal
|
35
36
|
from worker_automate_hub.tasks.jobs.fidc_remessa_cobranca_cnab240 import (
|
36
37
|
remessa_cobranca_cnab240,
|
37
38
|
)
|
@@ -199,7 +200,8 @@ task_definitions = {
|
|
199
200
|
"58de6a65-68cd-4e68-ab28-31b543b6de02": transferencias, # Logistica reverse
|
200
201
|
"ca7ac373-e8e7-4ac2-aa7e-298070e0d9a0": extracao_fechamento_contabil,
|
201
202
|
"8c28726d-458d-4119-afa0-202695b79a8f": extracao_fechamento_emsys,
|
202
|
-
"16debe45-3520-4f63-acfe-ef0e8784fcab": extracao_saldo_estoque
|
203
|
+
"16debe45-3520-4f63-acfe-ef0e8784fcab": extracao_saldo_estoque,
|
204
|
+
"9cbc6016-7c0e-4a3a-8ee9-fb9dc4b35e33": extracao_saldo_estoque_fiscal
|
203
205
|
}
|
204
206
|
|
205
207
|
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/util.py
RENAMED
@@ -338,8 +338,10 @@ async def login_emsys_fiscal(
|
|
338
338
|
category=UserWarning,
|
339
339
|
message="32-bit application should be automated using 32-bit Python",
|
340
340
|
)
|
341
|
-
|
341
|
+
await worker_sleep(2)
|
342
342
|
filial_cod = task.configEntrada.get("empresa")
|
343
|
+
if filial_cod == None:
|
344
|
+
filial_cod = task.configEntrada.get("filialEmpresaOrigem")
|
343
345
|
console.print(f"Empresa a ser processada: {filial_cod}")
|
344
346
|
|
345
347
|
try:
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/ahead_service.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/api/client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/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.753 → worker_automate_hub-0.5.754}/worker_automate_hub/config/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/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.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/repeat.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/retry.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/decorators/timeit.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/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.753 → worker_automate_hub-0.5.754}/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
|
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/env.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/logger.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/toast.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.753 → worker_automate_hub-0.5.754}/worker_automate_hub/utils/updater.py
RENAMED
File without changes
|
File without changes
|
File without changes
|