worker-automate-hub 0.5.19__py3-none-any.whl → 0.5.21__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/entrada_de_notas_9.py +1 -1
- worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +142 -0
- worker_automate_hub/tasks/task_definitions.py +2 -0
- {worker_automate_hub-0.5.19.dist-info → worker_automate_hub-0.5.21.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.19.dist-info → worker_automate_hub-0.5.21.dist-info}/RECORD +7 -6
- {worker_automate_hub-0.5.19.dist-info → worker_automate_hub-0.5.21.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.19.dist-info → worker_automate_hub-0.5.21.dist-info}/entry_points.txt +0 -0
@@ -578,7 +578,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
|
|
578
578
|
sucesso=False,
|
579
579
|
retorno=f"Não foi possivel obter o resultado da quantidade restante, texto extraido: {captured_text}",
|
580
580
|
status=RpaHistoricoStatusEnum.Falha,
|
581
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.
|
581
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
582
582
|
)
|
583
583
|
except Exception as e:
|
584
584
|
return RpaRetornoProcessoDTO(
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import asyncio
|
2
|
+
import warnings
|
3
|
+
|
4
|
+
import pyautogui
|
5
|
+
from rich.console import Console
|
6
|
+
|
7
|
+
from worker_automate_hub.models.dto.rpa_historico_request_dto import RpaHistoricoStatusEnum, RpaRetornoProcessoDTO
|
8
|
+
from worker_automate_hub.models.dto.rpa_processo_entrada_dto import RpaProcessoEntradaDTO
|
9
|
+
from worker_automate_hub.utils.logger import logger
|
10
|
+
from worker_automate_hub.utils.util import (
|
11
|
+
find_element_center,
|
12
|
+
find_target_position,
|
13
|
+
kill_process,
|
14
|
+
take_screenshot,
|
15
|
+
type_text_into_field,
|
16
|
+
wait_element_ready_win,
|
17
|
+
)
|
18
|
+
|
19
|
+
console = Console()
|
20
|
+
|
21
|
+
|
22
|
+
async def login_emsys_versao_especifica(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
23
|
+
from pywinauto.application import Application
|
24
|
+
|
25
|
+
warnings.filterwarnings(
|
26
|
+
"ignore",
|
27
|
+
category=UserWarning,
|
28
|
+
message="32-bit application should be automated using 32-bit Python",
|
29
|
+
)
|
30
|
+
|
31
|
+
try:
|
32
|
+
# Mata todos processos do emsys antes de abrir uma nova instancia
|
33
|
+
await kill_process("EMSys")
|
34
|
+
|
35
|
+
# Abre um novo emsys
|
36
|
+
app = Application().start("C:\\Rezende\\EMSys3\\EMSys3.977.exe")
|
37
|
+
console.print("\nEMSys iniciando...", style="bold green")
|
38
|
+
|
39
|
+
await asyncio.sleep(10)
|
40
|
+
# Testa se existe alguma mensagem no Emsys
|
41
|
+
window_message_login_emsys = await find_element_center(
|
42
|
+
"assets/emsys/window_message_login_emsys.png", (560, 487, 1121, 746), 10
|
43
|
+
)
|
44
|
+
|
45
|
+
# Obtém a resolução da tela
|
46
|
+
screen_width, screen_height = pyautogui.size()
|
47
|
+
|
48
|
+
pyautogui.click(screen_width / 2, screen_height / 2)
|
49
|
+
|
50
|
+
# Clica no "Não mostrar novamente" se existir
|
51
|
+
if window_message_login_emsys:
|
52
|
+
pyautogui.click(window_message_login_emsys.x, window_message_login_emsys.y)
|
53
|
+
pyautogui.click(
|
54
|
+
window_message_login_emsys.x + 383, window_message_login_emsys.y + 29
|
55
|
+
)
|
56
|
+
console.print("Mensagem de login encontrada e fechada.", style="bold green")
|
57
|
+
|
58
|
+
# Ve se o Emsys esta aberto no login
|
59
|
+
image_emsys_login = await find_element_center(
|
60
|
+
"assets/emsys/logo_emsys_login.png", (800, 200, 1400, 700), 600
|
61
|
+
)
|
62
|
+
# config_robot = await get_config_by_name("Login EmSys")
|
63
|
+
if image_emsys_login:
|
64
|
+
# await asyncio.sleep(10)
|
65
|
+
# type_text_into_field(
|
66
|
+
# config_robot["EmSys DB"], app["Login"]["ComboBox"], True, "50"
|
67
|
+
# )
|
68
|
+
# pyautogui.press("enter")
|
69
|
+
# await asyncio.sleep(2)
|
70
|
+
|
71
|
+
if await wait_element_ready_win(app["Login"]["Edit2"], 30):
|
72
|
+
disconect_database = await find_element_center(
|
73
|
+
"assets/emsys/disconect_database.png", (1123, 452, 1400, 578), 300
|
74
|
+
)
|
75
|
+
|
76
|
+
if disconect_database:
|
77
|
+
# Realiza login no Emsys
|
78
|
+
type_text_into_field(
|
79
|
+
task.configEntrada["user"], app["Login"]["Edit2"], True, "50"
|
80
|
+
)
|
81
|
+
pyautogui.press("tab")
|
82
|
+
type_text_into_field(
|
83
|
+
task.configEntrada["pass"],
|
84
|
+
app["Login"]["Edit1"],
|
85
|
+
True,
|
86
|
+
"50",
|
87
|
+
)
|
88
|
+
pyautogui.press("enter")
|
89
|
+
|
90
|
+
# Seleciona a filial do emsys
|
91
|
+
selecao_filial = await find_element_center(
|
92
|
+
"assets/emsys/selecao_filial.png", (480, 590, 820, 740), 15
|
93
|
+
)
|
94
|
+
|
95
|
+
if selecao_filial == None:
|
96
|
+
screenshot_path = take_screenshot()
|
97
|
+
selecao_filial = find_target_position(
|
98
|
+
screenshot_path, "Grupo", 0, -50, 15
|
99
|
+
)
|
100
|
+
|
101
|
+
if selecao_filial == None:
|
102
|
+
selecao_filial = (804, 640)
|
103
|
+
|
104
|
+
pyautogui.write(task.configEntrada["filial"])
|
105
|
+
pyautogui.press("enter")
|
106
|
+
|
107
|
+
else:
|
108
|
+
type_text_into_field(
|
109
|
+
task.configEntrada["filial"],
|
110
|
+
app["Seleção de Empresas"]["Edit"],
|
111
|
+
True,
|
112
|
+
"50",
|
113
|
+
)
|
114
|
+
pyautogui.press("enter")
|
115
|
+
|
116
|
+
button_logout = await find_element_center(
|
117
|
+
"assets/emsys/button_logout.png", (0, 0, 130, 150), 75
|
118
|
+
)
|
119
|
+
|
120
|
+
if button_logout:
|
121
|
+
console.print(
|
122
|
+
"Login realizado com sucesso.", style="bold green"
|
123
|
+
)
|
124
|
+
return RpaRetornoProcessoDTO(
|
125
|
+
sucesso=True,
|
126
|
+
retorno="Processo de login no EMSys executado com sucesso.",
|
127
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
128
|
+
)
|
129
|
+
|
130
|
+
else:
|
131
|
+
logger.info("login_emsys_win -> wait_element_ready_win [1]")
|
132
|
+
console.print("Elemento de login não está pronto.", style="bold red")
|
133
|
+
|
134
|
+
except Exception as ex:
|
135
|
+
logger.error("Erro em login_emsys: " + str(ex))
|
136
|
+
console.print(f"Erro em login_emsys: {str(ex)}", style="bold red")
|
137
|
+
return RpaRetornoProcessoDTO(
|
138
|
+
sucesso=False,
|
139
|
+
retorno=f"Erro em login_emsys: {str(ex)}",
|
140
|
+
status=RpaHistoricoStatusEnum.Falha,
|
141
|
+
)
|
142
|
+
|
@@ -52,6 +52,7 @@ from worker_automate_hub.tasks.jobs.entrada_de_notas_7139 import (
|
|
52
52
|
)
|
53
53
|
from worker_automate_hub.tasks.jobs.exemplo_processo import exemplo_processo
|
54
54
|
from worker_automate_hub.tasks.jobs.login_emsys import login_emsys
|
55
|
+
from worker_automate_hub.tasks.jobs.login_emsys_versao_especifica import login_emsys_versao_especifica
|
55
56
|
from worker_automate_hub.tasks.jobs.playground import playground
|
56
57
|
from worker_automate_hub.tasks.jobs.transferencias import transferencias
|
57
58
|
from worker_automate_hub.tasks.jobs.sped_fiscal import sped_fiscal
|
@@ -59,6 +60,7 @@ from worker_automate_hub.tasks.jobs.sped_fiscal import sped_fiscal
|
|
59
60
|
task_definitions = {
|
60
61
|
"5b295021-8df7-40a1-a45e-fe7109ae3902": exemplo_processo,
|
61
62
|
"a0788650-de48-454f-acbf-3537ead2d8ed": login_emsys,
|
63
|
+
"7d319f61-5e12-425c-86ed-678f0d9e14bd": login_emsys_versao_especifica,
|
62
64
|
"abcfa1ba-d580-465a-aefb-c15ac4514407": descartes,
|
63
65
|
"2c8ee738-7447-4517-aee7-ce2c9d25cea9": transferencias,
|
64
66
|
"855f9e0f-e972-4f52-bc1a-60d1fc244e79": conexao_rdp,
|
@@ -53,16 +53,17 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=_7KzUuife5eizfNH6hE
|
|
53
53
|
worker_automate_hub/tasks/jobs/entrada_de_notas_500.py,sha256=m8jau-sljkoezbu1KxLuaLmnF_wvjpM8yw6_yPrI5wc,33936
|
54
54
|
worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=ieROuyLMQ3bUrAuriuUYcFqsEJYn08_lesEhh-o3g3U,15160
|
55
55
|
worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=MEgy5XE7B9L3r7K44fGX4Eq8Xw0x9MKZM-1VRv-Nba0,15861
|
56
|
-
worker_automate_hub/tasks/jobs/entrada_de_notas_9.py,sha256=
|
56
|
+
worker_automate_hub/tasks/jobs/entrada_de_notas_9.py,sha256=6jI7iCmHqCiIV-2LviVRo_pJcp2Nys8dTZNMGMHXlnA,52823
|
57
57
|
worker_automate_hub/tasks/jobs/exemplo_processo.py,sha256=nV0iLoip2FH2-FhLmhX3nPqsfl_MPufZ3E5Q5krJvdc,3544
|
58
58
|
worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py,sha256=8GVImU7EnncCSxbbuEC4-EBE8oGTk6CJ-HFNqJ5OiMs,5564
|
59
59
|
worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=tUU5-xbwQtpp4HcEGYaYPW7i4y3raKC0IgjWpT0338c,10548
|
60
60
|
worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py,sha256=QBGm6eS5JghgNWNqZlk1g2a2iV8LnBLiOTBBL3Giet0,4181
|
61
61
|
worker_automate_hub/tasks/jobs/login_emsys.py,sha256=scdKsseFOL-7UQ5D743VaZZzWBKaEfq0XzYNmROUOgE,5703
|
62
|
+
worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py,sha256=cGj98H7g_1HpKsFAdrpVdFF14wd7Qp2PXgwd6ww-qSw,5642
|
62
63
|
worker_automate_hub/tasks/jobs/playground.py,sha256=7vWDg9DwToHwGJ6_XOa8TQ6LmfRV5Qz2TaOV3q3P9sA,1918
|
63
64
|
worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=zJjyvMUTeIGrjczdIDxckx5J-FGRt5L3hg_ErqM66d4,28208
|
64
65
|
worker_automate_hub/tasks/jobs/transferencias.py,sha256=i3fCanHZ_pSwPW03THpQPqlzrDjbV4QbKkXpUqV3dxM,39272
|
65
|
-
worker_automate_hub/tasks/task_definitions.py,sha256=
|
66
|
+
worker_automate_hub/tasks/task_definitions.py,sha256=TLJKIyi8IgZL_3EqVzER74kT3nfFdpSMbUwnnEkLpZk,4786
|
66
67
|
worker_automate_hub/tasks/task_executor.py,sha256=DUN2-Bi8Zxv0J_QUoV1vt7KgfbmYtixuA6i3Uzt67bA,5256
|
67
68
|
worker_automate_hub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
69
|
worker_automate_hub/utils/env.py,sha256=TacQjGRO7PUNpttrhTAc5Gnegaiysl2Knsv1P8qfkfs,57
|
@@ -73,7 +74,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
73
74
|
worker_automate_hub/utils/util.py,sha256=Eyy0mLLt_xd_zVXWoHAb-GK0PU1xZdWPvh-IndajxDk,128815
|
74
75
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=jWhLVwEovorHvQha9u6EQn5njsnz6sbMpPPreYhhIyw,29594
|
75
76
|
worker_automate_hub/worker.py,sha256=CT-poyP1ZYvubArYsnnNd9oJ53SPaDwgr6p6keS3nI4,6248
|
76
|
-
worker_automate_hub-0.5.
|
77
|
-
worker_automate_hub-0.5.
|
78
|
-
worker_automate_hub-0.5.
|
79
|
-
worker_automate_hub-0.5.
|
77
|
+
worker_automate_hub-0.5.21.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
78
|
+
worker_automate_hub-0.5.21.dist-info/METADATA,sha256=GVbyyIKX-VbFd3gXO_WQs4lEggGDFRUMwvmZPTM8Tv0,2894
|
79
|
+
worker_automate_hub-0.5.21.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
80
|
+
worker_automate_hub-0.5.21.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.19.dist-info → worker_automate_hub-0.5.21.dist-info}/entry_points.txt
RENAMED
File without changes
|