worker-automate-hub 0.4.425__py3-none-any.whl → 0.4.427__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/models/dto/rpa_processo_rdp_dto.py +15 -0
- worker_automate_hub/tasks/jobs/conexao_rdp.py +173 -268
- worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +20 -4
- {worker_automate_hub-0.4.425.dist-info → worker_automate_hub-0.4.427.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.4.425.dist-info → worker_automate_hub-0.4.427.dist-info}/RECORD +7 -6
- {worker_automate_hub-0.4.425.dist-info → worker_automate_hub-0.4.427.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.4.425.dist-info → worker_automate_hub-0.4.427.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
from typing import Dict, Optional
|
2
|
+
from pydantic import BaseModel
|
3
|
+
|
4
|
+
class ConfigEntrada(BaseModel):
|
5
|
+
ip: str
|
6
|
+
user: str
|
7
|
+
password: str
|
8
|
+
processo: str
|
9
|
+
uuid_robo: Optional[str]
|
10
|
+
|
11
|
+
def get(self, key, default=None):
|
12
|
+
return getattr(self, key, default)
|
13
|
+
|
14
|
+
class RpaProcessoRdpDTO(BaseModel):
|
15
|
+
configEntrada: ConfigEntrada
|
@@ -1,301 +1,206 @@
|
|
1
1
|
import asyncio
|
2
|
-
import
|
2
|
+
import platform
|
3
3
|
import subprocess
|
4
|
-
import
|
5
|
-
|
4
|
+
import socket
|
6
5
|
import pyautogui
|
7
|
-
import pygetwindow
|
8
|
-
from worker_automate_hub.models.dto.rpa_historico_request_dto import RpaHistoricoStatusEnum, RpaRetornoProcessoDTO
|
9
|
-
from worker_automate_hub.models.dto.rpa_processo_entrada_dto import RpaProcessoEntradaDTO
|
10
|
-
from pygetwindow._pygetwindow_win import Win32Window
|
6
|
+
import pygetwindow as gw
|
11
7
|
from rich.console import Console
|
12
|
-
|
8
|
+
import pygetwindow as gw
|
9
|
+
from pywinauto import Application
|
10
|
+
from worker_automate_hub.models.dto.rpa_historico_request_dto import RpaHistoricoStatusEnum, RpaRetornoProcessoDTO
|
11
|
+
from worker_automate_hub.models.dto.rpa_processo_rdp_dto import RpaProcessoRdpDTO
|
13
12
|
from worker_automate_hub.utils.logger import logger
|
14
13
|
|
15
14
|
console = Console()
|
16
15
|
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
try:
|
33
|
-
pyautogui.screenshot(caminho_screenshot)
|
34
|
-
console.print(f"Screenshot tirada: {caminho_screenshot}")
|
35
|
-
return caminho_screenshot
|
36
|
-
|
37
|
-
except Exception as e:
|
38
|
-
console.print(f"Erro ao tirar screenshot: {e}")
|
39
|
-
return None
|
40
|
-
|
41
|
-
|
42
|
-
def deletar_screenshots(caminhos_screenshots: str):
|
43
|
-
"""
|
44
|
-
Recebe uma lista de caminhos de arquivos de screenshots e deleta cada um deles.
|
45
|
-
|
46
|
-
:param caminhos_screenshots: lista de caminhos de arquivos de screenshots
|
47
|
-
:type caminhos_screenshots: list[str]
|
48
|
-
"""
|
49
|
-
if caminhos_screenshots is None:
|
50
|
-
raise ValueError("Lista de caminhos de screenshots não pode ser nula")
|
51
|
-
|
52
|
-
for caminho in caminhos_screenshots:
|
53
|
-
if caminho is None:
|
54
|
-
raise ValueError("Caminho de screenshot não pode ser nulo")
|
55
|
-
|
56
|
-
try:
|
57
|
-
os.remove(caminho)
|
58
|
-
console.print(f"Screenshot deletada: {caminho}")
|
59
|
-
except OSError as e:
|
60
|
-
console.print(f"Erro ao deletar screenshot {caminho}: {e}")
|
61
|
-
|
62
|
-
|
63
|
-
def fechar_janelas_rdp_sem_ip():
|
64
|
-
"""
|
65
|
-
Fecha as janelas de conex o RDP sem IP.
|
66
|
-
|
67
|
-
Caso não tenha nenhuma conexão RDP aberta, não fará nada.
|
68
|
-
"""
|
69
|
-
janelas_rdp = [
|
70
|
-
win
|
71
|
-
for win in gw.getAllTitles()
|
72
|
-
if "Conexão de Área de Trabalho Remota" in win
|
73
|
-
or "Remote Desktop Connection" in win
|
74
|
-
]
|
75
|
-
for titulo in janelas_rdp:
|
76
|
-
if not any(char.isdigit() for char in titulo):
|
77
|
-
console.print(f"Fechando pop-up de conexão sem IP: {titulo}")
|
78
|
-
janela: Win32Window = gw.getWindowsWithTitle(titulo)[0]
|
79
|
-
if janela is None:
|
80
|
-
raise RuntimeError(f"Janela {titulo} não existe")
|
81
|
-
try:
|
82
|
-
janela.close()
|
83
|
-
except Exception as e:
|
84
|
-
logger.error(f"Erro ao fechar janela {titulo}: {e}")
|
85
|
-
time.sleep(2)
|
86
|
-
|
87
|
-
|
88
|
-
def fechar_janela_existente(ip: str):
|
89
|
-
"""
|
90
|
-
Fecha a janela existente com o IP informado.
|
91
|
-
|
92
|
-
Args:
|
93
|
-
ip (str): IP da janela a ser fechada.
|
94
|
-
|
95
|
-
Raises:
|
96
|
-
Exception: Erro ao tentar fechar a janela.
|
97
|
-
"""
|
98
|
-
try:
|
99
|
-
janelas_encontradas = gw.getAllTitles()
|
100
|
-
for titulo in janelas_encontradas:
|
101
|
-
if ip in titulo:
|
102
|
-
janela: Win32Window = gw.getWindowsWithTitle(titulo)[0]
|
103
|
-
if janela is None:
|
104
|
-
raise RuntimeError(f"Janela {titulo} não existe")
|
105
|
-
console.print(f"Fechando janela existente: {titulo}")
|
106
|
-
janela.activate()
|
107
|
-
pyautogui.hotkey("alt", "f4")
|
108
|
-
time.sleep(1)
|
109
|
-
break
|
110
|
-
else:
|
111
|
-
console.print(f"Nenhuma janela encontrada com o IP: {ip}")
|
112
|
-
|
113
|
-
fechar_janelas_rdp_sem_ip()
|
114
|
-
|
115
|
-
except Exception as e:
|
116
|
-
console.print(f"Erro ao tentar fechar a janela: {e}", style="bold red")
|
117
|
-
|
118
|
-
|
119
|
-
def restaurar_janelas_rdp():
|
120
|
-
"""
|
121
|
-
Função para restaurar todas as janelas de Conexão de área de Trabalho Remota
|
122
|
-
que estão minimizadas e mover elas para uma posicão na tela.
|
123
|
-
"""
|
124
|
-
janelas_rdp = [
|
125
|
-
win
|
126
|
-
for win in gw.getAllTitles()
|
127
|
-
if "Conexão de Área de Trabalho Remota" in win
|
128
|
-
or "Remote Desktop Connection" in win
|
129
|
-
]
|
130
|
-
|
131
|
-
offset_x = 0
|
132
|
-
offset_y = 0
|
133
|
-
step_x = 30
|
134
|
-
step_y = 30
|
135
|
-
|
136
|
-
for titulo in janelas_rdp:
|
137
|
-
janela: Win32Window = gw.getWindowsWithTitle(titulo)[0]
|
138
|
-
if janela is None:
|
139
|
-
console.print(
|
140
|
-
f"Erro ao restaurar janela {titulo}: janela não existe",
|
141
|
-
style="bold red",
|
142
|
-
)
|
143
|
-
continue
|
144
|
-
|
145
|
-
console.print(f"Processando janela: {titulo}")
|
146
|
-
if janela.isMinimized:
|
147
|
-
try:
|
148
|
-
janela.restore()
|
149
|
-
except Exception as e:
|
150
|
-
console.print(
|
151
|
-
f"Erro ao restaurar janela {titulo}: {e}", style="bold red"
|
152
|
-
)
|
153
|
-
else:
|
154
|
-
console.print(f"Janela restaurada: {titulo}")
|
17
|
+
class RDPConnection:
|
18
|
+
def __init__(self, task: RpaProcessoRdpDTO):
|
19
|
+
self.task = task
|
20
|
+
self.ip = task.configEntrada.get("ip")
|
21
|
+
self.user = task.configEntrada.get("user")
|
22
|
+
self.password = task.configEntrada.get("password")
|
23
|
+
self.processo = task.configEntrada.get("processo")
|
24
|
+
self.uuid_robo = task.configEntrada.get("uuid_robo")
|
25
|
+
|
26
|
+
async def verificar_conexao(self) -> bool:
|
27
|
+
sistema_operacional = platform.system().lower()
|
28
|
+
logger.info(f"Sistema operacional detectado: {sistema_operacional}")
|
29
|
+
if sistema_operacional == "windows":
|
30
|
+
comando_ping = ["ping", "-n", "1", "-w", "1000", self.ip]
|
155
31
|
else:
|
156
|
-
|
157
|
-
|
32
|
+
comando_ping = ["ping", "-c", "1", "-W", "1", self.ip]
|
33
|
+
logger.info(f"Executando comando de ping: {' '.join(comando_ping)}")
|
158
34
|
try:
|
159
|
-
|
35
|
+
resposta_ping = subprocess.run(comando_ping, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
36
|
+
ping_alcancado = resposta_ping.returncode == 0
|
37
|
+
logger.info(f"Ping {'sucesso' if ping_alcancado else 'falhou'}")
|
160
38
|
except Exception as e:
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
39
|
+
logger.error(f"Erro ao executar ping: {e}")
|
40
|
+
ping_alcancado = False
|
41
|
+
|
42
|
+
porta_aberta = False
|
166
43
|
try:
|
167
|
-
|
44
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
45
|
+
sock.settimeout(5)
|
46
|
+
logger.info(f"Verificando porta 3389 em {self.ip}")
|
47
|
+
resposta_porta = sock.connect_ex((self.ip, 3389))
|
48
|
+
porta_aberta = resposta_porta == 0
|
49
|
+
logger.info(f"Porta 3389 {'aberta' if porta_aberta else 'fechada'}")
|
168
50
|
except Exception as e:
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
:param altura: Altura da janela em pixels
|
180
|
-
:type altura: int
|
181
|
-
"""
|
182
|
-
janelas_rdp = [
|
183
|
-
win
|
184
|
-
for win in gw.getAllTitles()
|
185
|
-
if "Conexão de Área de Trabalho Remota" in win
|
186
|
-
or "Remote Desktop Connection" in win
|
187
|
-
]
|
188
|
-
|
189
|
-
if janelas_rdp:
|
190
|
-
try:
|
191
|
-
janela_rdp: Win32Window = gw.getWindowsWithTitle(janelas_rdp[0])[0]
|
192
|
-
if janela_rdp is None:
|
193
|
-
raise RuntimeError("Janela RDP não existe")
|
194
|
-
janela_rdp.resizeTo(largura, altura)
|
195
|
-
janela_rdp.moveTo(20, 20)
|
196
|
-
console.print(f"Janela redimensionada para {largura}x{altura}.")
|
197
|
-
janela_rdp.activate()
|
198
|
-
janela_rdp.restore()
|
199
|
-
time.sleep(1)
|
200
|
-
except Exception as e:
|
201
|
-
console.print(f"Erro ao redimensionar janela RDP: {e}", style="bold red")
|
202
|
-
else:
|
203
|
-
console.print("Não foi possível encontrar a janela RDP para redimensionar.")
|
204
|
-
|
205
|
-
|
206
|
-
async def conexao_rdp(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
207
|
-
|
208
|
-
caminhos_screenshots = []
|
209
|
-
try:
|
210
|
-
if not task or not task.configEntrada:
|
211
|
-
raise ValueError("Task inválida ou sem configurações de entrada.")
|
212
|
-
|
213
|
-
ip = task.configEntrada.get("ip", "")
|
214
|
-
user = task.configEntrada.get("user", "")
|
215
|
-
password = task.configEntrada.get("password", "")
|
216
|
-
|
217
|
-
if not ip or not user or not password:
|
218
|
-
raise ValueError(
|
219
|
-
"Configurações de entrada inválidas. Verifique se o IP, Usuário e Senha estão preenchidos."
|
220
|
-
)
|
221
|
-
|
222
|
-
pyautogui.hotkey("win", "d")
|
223
|
-
console.print("1 - Minimizando todas as telas...")
|
224
|
-
await asyncio.sleep(2)
|
225
|
-
|
226
|
-
fechar_janela_existente(ip)
|
227
|
-
|
228
|
-
subprocess.Popen("mstsc")
|
229
|
-
console.print("2 - Abrindo conexão de trabalho remota...")
|
230
|
-
await asyncio.sleep(2)
|
231
|
-
|
232
|
-
redimensionar_janela_rdp(500, 500)
|
233
|
-
|
234
|
-
await asyncio.sleep(2)
|
235
|
-
|
51
|
+
logger.error(f"Erro ao verificar a porta RDP: {e}")
|
52
|
+
porta_aberta = False
|
53
|
+
|
54
|
+
return ping_alcancado and porta_aberta
|
55
|
+
|
56
|
+
async def clicar_no_titulo(self):
|
57
|
+
"""
|
58
|
+
Função para clicar no título das janelas de Conexão de Área de Trabalho Remota
|
59
|
+
com o botão direito do mouse e executar comandos.
|
60
|
+
"""
|
236
61
|
janelas_rdp = [
|
237
62
|
win
|
238
63
|
for win in gw.getAllTitles()
|
239
64
|
if "Conexão de Área de Trabalho Remota" in win
|
240
65
|
or "Remote Desktop Connection" in win
|
241
66
|
]
|
242
|
-
if not janelas_rdp:
|
243
|
-
raise RuntimeError("Nenhuma janela RDP foi encontrada.")
|
244
|
-
|
245
|
-
janela_rdp: Win32Window = gw.getWindowsWithTitle(janelas_rdp[0])[0]
|
246
|
-
if janela_rdp is None:
|
247
|
-
raise RuntimeError("Janela RDP não existe.")
|
248
|
-
|
249
|
-
janela_rdp.activate()
|
250
|
-
janela_rdp.restore()
|
251
|
-
await asyncio.sleep(1)
|
252
|
-
|
253
|
-
caminhos_screenshots.append(tirar_screenshot("antes_de_inserir_ip"))
|
254
|
-
console.print("3 - Inserindo o IP...")
|
255
|
-
pyautogui.write(ip)
|
256
|
-
await asyncio.sleep(10)
|
257
|
-
caminhos_screenshots.append(tirar_screenshot("depois_de_inserir_ip"))
|
258
|
-
pyautogui.press("enter")
|
259
|
-
await asyncio.sleep(5)
|
260
|
-
caminhos_screenshots.append(tirar_screenshot("depois_de_inserir_usuario"))
|
261
|
-
await asyncio.sleep(5)
|
262
67
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
68
|
+
for titulo in janelas_rdp:
|
69
|
+
janela = gw.getWindowsWithTitle(titulo)[0]
|
70
|
+
if not janela:
|
71
|
+
print(f"Erro ao localizar a janela: {titulo}")
|
72
|
+
continue
|
268
73
|
|
269
|
-
|
270
|
-
pyautogui.press("left")
|
271
|
-
await asyncio.sleep(2)
|
272
|
-
console.print("7 - Apertando Enter...")
|
273
|
-
pyautogui.press("enter")
|
274
|
-
await asyncio.sleep(20)
|
275
|
-
caminhos_screenshots.append(tirar_screenshot("depois_do_certificado"))
|
74
|
+
print(f"Processando janela: {titulo}")
|
276
75
|
|
277
|
-
|
278
|
-
|
279
|
-
await asyncio.sleep(2)
|
280
|
-
caminhos_screenshots.append(tirar_screenshot("depois_de_minimizar_todas"))
|
76
|
+
# Obtém as coordenadas da janela
|
77
|
+
x, y = janela.left, janela.top
|
281
78
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
79
|
+
try:
|
80
|
+
# Move o mouse para o título da janela e clica com o botão direito
|
81
|
+
pyautogui.moveTo(x + 10, y + 10) # Ajuste para alinhar ao título da janela
|
82
|
+
pyautogui.click(button="right")
|
83
|
+
|
84
|
+
await asyncio.sleep(2)
|
85
|
+
pyautogui.press("down", presses=7, interval=0.1)
|
86
|
+
await asyncio.sleep(2)
|
87
|
+
pyautogui.hotkey("enter")
|
88
|
+
await asyncio.sleep(2)
|
89
|
+
pyautogui.hotkey("enter")
|
286
90
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
)
|
91
|
+
except Exception as e:
|
92
|
+
print(f"Erro ao interagir com a janela {titulo}: {e}")
|
93
|
+
|
94
|
+
async def conectar(self):
|
95
|
+
logger.info(f"Iniciando cliente RDP para {self.ip}")
|
96
|
+
try:
|
97
|
+
pyautogui.hotkey("win", "d")
|
98
|
+
await asyncio.sleep(2) # Tempo para garantir que todas as janelas sejam minimizadas
|
99
|
+
logger.info("Todas as janelas minimizadas com sucesso.")
|
100
|
+
|
101
|
+
subprocess.Popen(["mstsc", f"/v:{self.ip}"], close_fds=True, start_new_session=True)
|
102
|
+
await asyncio.sleep(7) # Tempo aumentado para garantir abertura
|
103
|
+
|
104
|
+
logger.info("Procurando janela 'Conexão de Área de Trabalho Remota'")
|
105
|
+
windows = gw.getWindowsWithTitle("Conexão de Área de Trabalho Remota")
|
106
|
+
if not windows:
|
107
|
+
logger.warning("Tentando encontrar janela com título em inglês 'Remote Desktop Connection'")
|
108
|
+
windows = gw.getWindowsWithTitle("Remote Desktop Connection")
|
109
|
+
|
110
|
+
if not windows:
|
111
|
+
logger.error("Janela de RDP não encontrada.")
|
112
|
+
return False
|
113
|
+
|
114
|
+
rdp_window = windows[0]
|
115
|
+
logger.info(f"Janela '{rdp_window.title}' encontrada. Focando na janela.")
|
116
|
+
|
117
|
+
# Restaurar janela se estiver minimizada
|
118
|
+
if rdp_window.isMinimized:
|
119
|
+
rdp_window.restore()
|
120
|
+
await asyncio.sleep(2)
|
121
|
+
|
122
|
+
# Redimensionar para 50% da tela
|
123
|
+
screen_width, screen_height = pyautogui.size()
|
124
|
+
new_width = screen_width // 2
|
125
|
+
new_height = screen_height // 2
|
126
|
+
rdp_window.resizeTo(new_width, new_height)
|
127
|
+
rdp_window.moveTo(screen_width // 4, screen_height // 4)
|
128
|
+
logger.info(f"Janela redimensionada para {new_width}x{new_height}.")
|
129
|
+
|
130
|
+
rdp_window.activate()
|
131
|
+
await asyncio.sleep(2) # Tempo extra para garantir que a janela está ativa
|
132
|
+
|
133
|
+
# Clique para garantir o foco
|
134
|
+
pyautogui.click(rdp_window.left + 50, rdp_window.top + 50)
|
135
|
+
await asyncio.sleep(1)
|
136
|
+
|
137
|
+
# Inserir credenciais
|
138
|
+
|
139
|
+
try:
|
140
|
+
app = Application(backend="uia").connect(title="Segurança do Windows")
|
141
|
+
dialog = app.window(title="Segurança do Windows")
|
142
|
+
|
143
|
+
edit_field = dialog.child_window(auto_id="EditField_1", control_type="Edit")
|
144
|
+
|
145
|
+
if edit_field.exists():
|
146
|
+
logger.info("Inserindo usuário.")
|
147
|
+
pyautogui.write(self.user, interval=0.1)
|
148
|
+
pyautogui.press("tab")
|
149
|
+
await asyncio.sleep(5)
|
150
|
+
except:
|
151
|
+
pass
|
152
|
+
|
153
|
+
logger.info("Inserindo senha.")
|
154
|
+
pyautogui.write(self.password, interval=0.1)
|
155
|
+
pyautogui.press("enter")
|
156
|
+
await asyncio.sleep(1)
|
157
|
+
pyautogui.press("left")
|
158
|
+
await asyncio.sleep(1)
|
159
|
+
pyautogui.press("enter")
|
160
|
+
logger.info("Credenciais inseridas.")
|
161
|
+
await asyncio.sleep(5) # Tempo para conexão ser concluída
|
162
|
+
|
163
|
+
logger.info("Conexão RDP ativa. Mantendo o script em execução.")
|
164
|
+
return True
|
165
|
+
except Exception as e:
|
166
|
+
logger.error(f"Erro ao tentar conectar via RDP: {e}")
|
167
|
+
return False
|
292
168
|
|
169
|
+
async def conexao_rdp(task: RpaProcessoRdpDTO) -> RpaRetornoProcessoDTO:
|
170
|
+
try:
|
171
|
+
logger.info("Iniciando processo de conexão RDP.")
|
172
|
+
rdp = RDPConnection(task)
|
173
|
+
conectado = await rdp.verificar_conexao()
|
174
|
+
if not conectado:
|
175
|
+
logger.warning("Não foi possível estabelecer conexão RDP. Verifique o IP e a disponibilidade da porta.")
|
176
|
+
return RpaRetornoProcessoDTO(
|
177
|
+
sucesso=False,
|
178
|
+
retorno="Não foi possível estabelecer conexão RDP. Verifique o IP e a disponibilidade da porta.",
|
179
|
+
status=RpaHistoricoStatusEnum.Falha,
|
180
|
+
)
|
181
|
+
sucesso_conexao = await rdp.conectar()
|
182
|
+
if sucesso_conexao:
|
183
|
+
logger.info("Processo de conexão RDP executado com sucesso.")
|
184
|
+
|
185
|
+
await rdp.clicar_no_titulo()
|
186
|
+
|
187
|
+
# Mantém o script ativo para manter a conexão RDP aberta
|
188
|
+
return RpaRetornoProcessoDTO(
|
189
|
+
sucesso=True,
|
190
|
+
retorno="Conexão RDP estabelecida com sucesso.",
|
191
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
192
|
+
)
|
193
|
+
else:
|
194
|
+
logger.error("Falha ao tentar conectar via RDP.")
|
195
|
+
return RpaRetornoProcessoDTO(
|
196
|
+
sucesso=False,
|
197
|
+
retorno="Falha ao tentar conectar via RDP.",
|
198
|
+
status=RpaHistoricoStatusEnum.Falha,
|
199
|
+
)
|
293
200
|
except Exception as ex:
|
294
201
|
err_msg = f"Erro ao executar conexao_rdp: {ex}"
|
295
202
|
logger.error(err_msg)
|
296
203
|
console.print(err_msg, style="bold red")
|
297
|
-
caminhos_screenshots.append(tirar_screenshot("erro"))
|
298
|
-
deletar_screenshots(caminhos_screenshots)
|
299
204
|
return RpaRetornoProcessoDTO(
|
300
205
|
sucesso=False,
|
301
206
|
retorno=err_msg,
|
@@ -135,6 +135,26 @@ async def gerar_nosso_numero(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
|
|
135
135
|
|
136
136
|
# Clicando em na coluna da tabela para ordenar os titulos com nosso número
|
137
137
|
pyautogui.click(718,642, clicks=2, interval=1)
|
138
|
+
|
139
|
+
await worker_sleep(1)
|
140
|
+
|
141
|
+
# Indo para o ultimo titulo
|
142
|
+
with pyautogui.hold('ctrl'):
|
143
|
+
pyautogui.press('end')
|
144
|
+
|
145
|
+
await worker_sleep(2)
|
146
|
+
|
147
|
+
with pyautogui.hold('ctrl'):
|
148
|
+
pyautogui.press('c')
|
149
|
+
|
150
|
+
actual_line = pyperclip.paste()
|
151
|
+
print(actual_line)
|
152
|
+
if actual_line.split('\n')[1].split('\t')[2] != '':
|
153
|
+
log_msg = "Todos os nossos numeros estao preenchidos!"
|
154
|
+
console.print(log_msg, style="bold yellow")
|
155
|
+
return RpaRetornoProcessoDTO(
|
156
|
+
sucesso=False, retorno=log_msg, status=RpaHistoricoStatusEnum.Falha
|
157
|
+
)
|
138
158
|
|
139
159
|
# Indo para o primeiro titulo
|
140
160
|
with pyautogui.hold('ctrl'):
|
@@ -148,8 +168,6 @@ async def gerar_nosso_numero(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
|
|
148
168
|
|
149
169
|
#Se a Coluna "Nosso Numero" estiver populada desceleciona o dado
|
150
170
|
if actual_line.split('\n')[1].split('\t')[2] != '':
|
151
|
-
|
152
|
-
|
153
171
|
pyautogui.press('enter')
|
154
172
|
#Se a Coluna "Nosso Numero" estiver vazia quebra o loop
|
155
173
|
elif actual_line.split('\n')[1].split('\t')[2] == '':
|
@@ -228,5 +246,3 @@ async def gerar_nosso_numero(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
|
|
228
246
|
return RpaRetornoProcessoDTO(
|
229
247
|
sucesso=False, retorno=log_msg, status=RpaHistoricoStatusEnum.Falha
|
230
248
|
)
|
231
|
-
finally:
|
232
|
-
await kill_process("EMSys")
|
@@ -25,11 +25,12 @@ worker_automate_hub/models/dao/rpa_processo.py,sha256=AfOUhJKL-AAOyjON4g7f6B7Bxa
|
|
25
25
|
worker_automate_hub/models/dto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
worker_automate_hub/models/dto/rpa_historico_request_dto.py,sha256=tFTAfNUwHp9fuZQq4JTpyrOHFhm0PfVz3BrSyFxKwXQ,1371
|
27
27
|
worker_automate_hub/models/dto/rpa_processo_entrada_dto.py,sha256=NP2SNJ4Eq4xPQgwdw1CSwErB_g1RmBQR7pdQnOZipAE,678
|
28
|
+
worker_automate_hub/models/dto/rpa_processo_rdp_dto.py,sha256=2TKA9CzFGj_9tWXfN84gVzHWZtAMN22QrNMcmNGHZD8,356
|
28
29
|
worker_automate_hub/models/dto/rpa_sistema_dto.py,sha256=sLkmJei8x6sl-1-IXUKDmYQuKx0sotYQREPyhQqPmRg,161
|
29
30
|
worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
31
|
worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
32
|
worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=rf4fW-FaHUl1MS7b03z4cwI3zHfNw8FWxvjvNY3Xn20,28773
|
32
|
-
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=
|
33
|
+
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=kSdMptac1gCMfIfBtaUcSa1W9sMrqMSSu6v0WHHjgx4,8942
|
33
34
|
worker_automate_hub/tasks/jobs/descartes.py,sha256=RIjrZIzkW77NiKeXbxFN9k872cz3fl9cG1m5TJpjmmY,40134
|
34
35
|
worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=aPckQRlRozFS_OK3C9wNdMCmqO6AM4djwqY2uSSaPmo,20687
|
35
36
|
worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=FFpAdtZLO4uelWZooCVpm4JePv_iDt5nwVKrk1ipZJQ,1599
|
@@ -50,7 +51,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=jIml8gjXPdI6_x7S9V
|
|
50
51
|
worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=8XP9G3n0PUeshbRWkWKOMnyUGRWspIolPZVqQTR3SMI,14184
|
51
52
|
worker_automate_hub/tasks/jobs/entrada_de_notas_9.py,sha256=SF1IXzLV83MxHm0QA1VhOoOS-2RNnOLm5U7_pvMbqGU,49546
|
52
53
|
worker_automate_hub/tasks/jobs/exemplo_processo.py,sha256=3-zxbb-9YHPmSA_K1Qgxp_FwSqg2QDjGBRCLxDZ8QoQ,3451
|
53
|
-
worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=
|
54
|
+
worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=mZ6mCaz1lYmyFxwC8MVLXPsgynE1VkNKlEzYGsciDiY,10179
|
54
55
|
worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py,sha256=QBGm6eS5JghgNWNqZlk1g2a2iV8LnBLiOTBBL3Giet0,4181
|
55
56
|
worker_automate_hub/tasks/jobs/login_emsys.py,sha256=IoGCIvO4UwmuxOZEn3cvYJlKyhsWvtHvbFk8vwjTroQ,5620
|
56
57
|
worker_automate_hub/tasks/jobs/playground.py,sha256=bdnXv3C7WLQUxt4edGZDfAbRJJ2-q4zuIQaK3GLnaUc,1765
|
@@ -67,7 +68,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
67
68
|
worker_automate_hub/utils/util.py,sha256=JpRM3ltfGNkzui0RAjUK1FhWT3aWUjt3ljEyQez3Sbw,120156
|
68
69
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=7ju688sD52y30taGSm5rPMGdQyByUUwveLeKV4ImEiE,28401
|
69
70
|
worker_automate_hub/worker.py,sha256=KDBU3L2kVobndrnN5coRZFTwVmBLKmPJjRv20sCo5Hc,4697
|
70
|
-
worker_automate_hub-0.4.
|
71
|
-
worker_automate_hub-0.4.
|
72
|
-
worker_automate_hub-0.4.
|
73
|
-
worker_automate_hub-0.4.
|
71
|
+
worker_automate_hub-0.4.427.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
72
|
+
worker_automate_hub-0.4.427.dist-info/METADATA,sha256=cQago9TzxLknkeosyrWQkgAifW_x21Rx7FYb4VMQxIw,2895
|
73
|
+
worker_automate_hub-0.4.427.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
74
|
+
worker_automate_hub-0.4.427.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.4.425.dist-info → worker_automate_hub-0.4.427.dist-info}/entry_points.txt
RENAMED
File without changes
|