worker-automate-hub 0.4.439__py3-none-any.whl → 0.4.441__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/api/client.py +0 -48
- worker_automate_hub/api/rpa_fila_service.py +58 -0
- worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +12 -0
- worker_automate_hub/utils/util.py +4 -3
- worker_automate_hub/worker.py +4 -3
- {worker_automate_hub-0.4.439.dist-info → worker_automate_hub-0.4.441.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.4.439.dist-info → worker_automate_hub-0.4.441.dist-info}/RECORD +9 -8
- {worker_automate_hub-0.4.439.dist-info → worker_automate_hub-0.4.441.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.4.439.dist-info → worker_automate_hub-0.4.441.dist-info}/entry_points.txt +0 -0
@@ -45,33 +45,6 @@ async def get_new_task(stop_event: threading.Event) -> RpaProcessoEntradaDTO:
|
|
45
45
|
)
|
46
46
|
return None
|
47
47
|
|
48
|
-
async def burnQueue(id_fila: str):
|
49
|
-
env_config, _ = load_env_config()
|
50
|
-
try:
|
51
|
-
|
52
|
-
headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
|
53
|
-
|
54
|
-
|
55
|
-
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
56
|
-
async with session.delete(
|
57
|
-
f"{env_config["API_BASE_URL"]}/fila/burn-queue/{id_fila}",
|
58
|
-
headers=headers_basic,
|
59
|
-
) as response:
|
60
|
-
if response.status == 200:
|
61
|
-
logger.info("Fila excluida com sucesso.")
|
62
|
-
console.print("\nFila excluida com sucesso.\n", style="bold green")
|
63
|
-
else:
|
64
|
-
logger.error(f"Erro ao excluir a fila: {response.content}")
|
65
|
-
console.print(f"Erro ao excluir a fila: {response.content}", style="bold red")
|
66
|
-
|
67
|
-
except Exception as e:
|
68
|
-
err_msg = f"Erro remover registro da fila: {e}"
|
69
|
-
logger.error(err_msg)
|
70
|
-
console.print(
|
71
|
-
f"{err_msg}\n",
|
72
|
-
style="bold red",
|
73
|
-
)
|
74
|
-
return None
|
75
48
|
|
76
49
|
async def notify_is_alive(stop_event: threading.Event):
|
77
50
|
env_config, _ = load_env_config()
|
@@ -348,28 +321,7 @@ async def send_gchat_message(message: str) -> None:
|
|
348
321
|
style="bold red",
|
349
322
|
)
|
350
323
|
return None
|
351
|
-
|
352
|
-
async def unlock_queue(id: str):
|
353
|
-
env_config, _ = load_env_config()
|
354
|
-
try:
|
355
|
-
headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
|
356
|
-
|
357
324
|
|
358
|
-
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
359
|
-
async with session.get(
|
360
|
-
f"{env_config["API_BASE_URL"]}/fila/unlock-queue/{id}",
|
361
|
-
headers=headers_basic,
|
362
|
-
) as response:
|
363
|
-
return await response.text()
|
364
|
-
|
365
|
-
except Exception as e:
|
366
|
-
err_msg = f"Erro ao desbloquear a fila: {e}"
|
367
|
-
logger.error(err_msg)
|
368
|
-
console.print(
|
369
|
-
f"{err_msg}\n",
|
370
|
-
style="bold red",
|
371
|
-
)
|
372
|
-
return None
|
373
325
|
|
374
326
|
|
375
327
|
def read_secret(path: str, vault_token: str):
|
@@ -0,0 +1,58 @@
|
|
1
|
+
from worker_automate_hub.config.settings import load_env_config
|
2
|
+
from worker_automate_hub.utils.logger import logger
|
3
|
+
from rich.console import Console
|
4
|
+
|
5
|
+
import aiohttp
|
6
|
+
|
7
|
+
console = Console()
|
8
|
+
|
9
|
+
|
10
|
+
async def burn_queue(id_fila: str):
|
11
|
+
env_config, _ = load_env_config()
|
12
|
+
try:
|
13
|
+
|
14
|
+
headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
|
15
|
+
|
16
|
+
|
17
|
+
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
18
|
+
async with session.delete(
|
19
|
+
f"{env_config["API_BASE_URL"]}/fila/burn-queue/{id_fila}",
|
20
|
+
headers=headers_basic,
|
21
|
+
) as response:
|
22
|
+
if response.status == 200:
|
23
|
+
logger.info("Fila excluida com sucesso.")
|
24
|
+
console.print("\nFila excluida com sucesso.\n", style="bold green")
|
25
|
+
else:
|
26
|
+
logger.error(f"Erro ao excluir a fila: {response.content}")
|
27
|
+
console.print(f"Erro ao excluir a fila: {response.content}", style="bold red")
|
28
|
+
|
29
|
+
except Exception as e:
|
30
|
+
err_msg = f"Erro remover registro da fila: {e}"
|
31
|
+
logger.error(err_msg)
|
32
|
+
console.print(
|
33
|
+
f"{err_msg}\n",
|
34
|
+
style="bold red",
|
35
|
+
)
|
36
|
+
return None
|
37
|
+
|
38
|
+
async def unlock_queue(id: str):
|
39
|
+
env_config, _ = load_env_config()
|
40
|
+
try:
|
41
|
+
headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
|
42
|
+
|
43
|
+
|
44
|
+
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
45
|
+
async with session.get(
|
46
|
+
f"{env_config["API_BASE_URL"]}/fila/unlock-queue/{id}",
|
47
|
+
headers=headers_basic,
|
48
|
+
) as response:
|
49
|
+
return await response.text()
|
50
|
+
|
51
|
+
except Exception as e:
|
52
|
+
err_msg = f"Erro ao desbloquear a fila: {e}"
|
53
|
+
logger.error(err_msg)
|
54
|
+
console.print(
|
55
|
+
f"{err_msg}\n",
|
56
|
+
style="bold red",
|
57
|
+
)
|
58
|
+
return None
|
@@ -38,6 +38,7 @@ from worker_automate_hub.utils.util import (
|
|
38
38
|
warnings_after_xml_imported,
|
39
39
|
worker_sleep,
|
40
40
|
check_nota_importada,
|
41
|
+
carregamento_import_xml,
|
41
42
|
)
|
42
43
|
|
43
44
|
pyautogui.PAUSE = 0.5
|
@@ -263,6 +264,17 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
|
|
263
264
|
"sucesso": False,
|
264
265
|
"retorno": f"Número máximo de tentativas atingido, Não foi possivel finalizar os trabalhos na tela de Informações para importação da Nota Fiscal Eletrônica",
|
265
266
|
}
|
267
|
+
|
268
|
+
await worker_sleep(2)
|
269
|
+
waiting_for_delay = await carregamento_import_xml()
|
270
|
+
if waiting_for_delay.sucesso:
|
271
|
+
console.print(waiting_for_delay.retorno)
|
272
|
+
else:
|
273
|
+
return RpaRetornoProcessoDTO(
|
274
|
+
sucesso=False,
|
275
|
+
retorno=waiting_for_delay.retorno,
|
276
|
+
status=RpaHistoricoStatusEnum.Falha,
|
277
|
+
)
|
266
278
|
|
267
279
|
console.print(
|
268
280
|
"Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
|
@@ -2214,7 +2214,7 @@ async def select_documento_type(document_type: str) -> RpaRetornoProcessoDTO:
|
|
2214
2214
|
set_combobox("||List", document_type)
|
2215
2215
|
except Exception as e:
|
2216
2216
|
console.log("Não foi possivel selecionar o tipo de documento via set combobox, realizando a alteração utilizando pyautogui write")
|
2217
|
-
pyautogui.write("
|
2217
|
+
pyautogui.write("document_type")
|
2218
2218
|
await worker_sleep(2)
|
2219
2219
|
pyautogui.hotkey("enter")
|
2220
2220
|
await worker_sleep(2)
|
@@ -2237,7 +2237,7 @@ async def select_documento_type(document_type: str) -> RpaRetornoProcessoDTO:
|
|
2237
2237
|
else:
|
2238
2238
|
return RpaRetornoProcessoDTO(
|
2239
2239
|
sucesso=False,
|
2240
|
-
retorno=f"Não foi possivel selecionar o tipo do documento
|
2240
|
+
retorno=f"Não foi possivel selecionar o tipo do documento",
|
2241
2241
|
status=RpaHistoricoStatusEnum.Falha,
|
2242
2242
|
)
|
2243
2243
|
|
@@ -2548,7 +2548,8 @@ async def itens_not_found_supplier(xml: str):
|
|
2548
2548
|
)
|
2549
2549
|
await worker_sleep(5)
|
2550
2550
|
i += 1
|
2551
|
-
|
2551
|
+
|
2552
|
+
await worker_sleep(5)
|
2552
2553
|
logs_erro = await is_window_open_by_class("TFrmExibeLogErroImportacaoNfe","TFrmExibeLogErroImportacaoNfe")
|
2553
2554
|
if logs_erro["IsOpened"] == True:
|
2554
2555
|
app = Application().connect(class_name="TFrmExibeLogErroImportacaoNfe")
|
worker_automate_hub/worker.py
CHANGED
@@ -3,11 +3,11 @@ import os
|
|
3
3
|
import threading
|
4
4
|
from pathlib import Path
|
5
5
|
|
6
|
+
from worker_automate_hub.api.rpa_fila_service import burn_queue, unlock_queue
|
6
7
|
import pyfiglet
|
7
8
|
from rich.console import Console
|
8
9
|
|
9
10
|
from worker_automate_hub.api.client import (
|
10
|
-
burnQueue,
|
11
11
|
get_new_task,
|
12
12
|
notify_is_alive,
|
13
13
|
send_gchat_message,
|
@@ -41,11 +41,12 @@ async def check_and_execute_tasks(stop_event: threading.Event):
|
|
41
41
|
if task is not None:
|
42
42
|
processo_existe = await is_uuid_in_tasks(task.uuidProcesso)
|
43
43
|
if processo_existe:
|
44
|
-
await
|
44
|
+
await burn_queue(task.uuidFila)
|
45
45
|
logger.info(f"Executando a task: {task.nomProcesso}")
|
46
46
|
await perform_task(task)
|
47
47
|
else:
|
48
|
-
|
48
|
+
await unlock_queue(task.uuidFila)
|
49
|
+
log_message = f"O processo [{task.nomProcesso}] não existe no Worker [{worker_config['NOME_ROBO']}] e foi devolvido para a fila."
|
49
50
|
console.print(f"\n{log_message}\n", style="yellow")
|
50
51
|
logger.error(log_message)
|
51
52
|
await send_gchat_message(log_message)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
worker_automate_hub/__init__.py,sha256=LV28uQvBfpPIqudGIMJmVB8E941MjXHcu8DMoX5n8AM,25
|
2
2
|
worker_automate_hub/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
worker_automate_hub/api/ahead_service.py,sha256=0tX-i1ACRg3_yOI-_AfFEZ6FNU3L8Zb316n3QUkSwL0,2027
|
4
|
-
worker_automate_hub/api/client.py,sha256=
|
4
|
+
worker_automate_hub/api/client.py,sha256=qsnyd_B26q199i5fCNWvwLKdQu9bVcS5NjU4L_0xjUw,18791
|
5
5
|
worker_automate_hub/api/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
worker_automate_hub/api/helpers/api_helpers.py,sha256=SkheO2fXexeh-a4shr8Qzsz_kZhuSG0DJ7kbODctRbM,3696
|
7
|
+
worker_automate_hub/api/rpa_fila_service.py,sha256=DxBEghdoF2DZQDnkThEEQDkoak4yVRM9kooV1fm0syg,2102
|
7
8
|
worker_automate_hub/api/rpa_historico_service.py,sha256=WhTMVW-uNlJO3YZakhx63xlsw3_XDeWnSD-3MVEzzdk,4763
|
8
9
|
worker_automate_hub/cli.py,sha256=JB45pjPJ8_E-4xw0OjqDMcAw-tpDV0mjmvwJRTnTzY0,6862
|
9
10
|
worker_automate_hub/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -48,7 +49,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_36.py,sha256=vFkDcgJ9uxrMMLYdeON
|
|
48
49
|
worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=Kv1Ttgq477Xtp17QDymcOgWtuozFAexUqhcThPV9GTI,32767
|
49
50
|
worker_automate_hub/tasks/jobs/entrada_de_notas_500.py,sha256=MYPaYAP2iwdBYDZUf39f7yGibTME9uObEash_QTCmFA,32231
|
50
51
|
worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=jIml8gjXPdI6_x7S9VVV8IrKZRF7_PTNOMnhNmYMDTU,14490
|
51
|
-
worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=
|
52
|
+
worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=SZzsdjZGMFObZB_25EwvfNdKUlA_e3tbSrUPCYONltM,14620
|
52
53
|
worker_automate_hub/tasks/jobs/entrada_de_notas_9.py,sha256=Urt_7dZNuyUkSyG9fYb2ArBXzEONXlrqWIesoXeL1EI,50984
|
53
54
|
worker_automate_hub/tasks/jobs/exemplo_processo.py,sha256=3-zxbb-9YHPmSA_K1Qgxp_FwSqg2QDjGBRCLxDZ8QoQ,3451
|
54
55
|
worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=mZ6mCaz1lYmyFxwC8MVLXPsgynE1VkNKlEzYGsciDiY,10179
|
@@ -65,10 +66,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
|
|
65
66
|
worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
|
66
67
|
worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
|
67
68
|
worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
|
68
|
-
worker_automate_hub/utils/util.py,sha256=
|
69
|
+
worker_automate_hub/utils/util.py,sha256=6GFMSMk8DOE_6Y_xmYQBczyN7bxcGRrH2q634Lb2Um0,121847
|
69
70
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=7ju688sD52y30taGSm5rPMGdQyByUUwveLeKV4ImEiE,28401
|
70
|
-
worker_automate_hub/worker.py,sha256=
|
71
|
-
worker_automate_hub-0.4.
|
72
|
-
worker_automate_hub-0.4.
|
73
|
-
worker_automate_hub-0.4.
|
74
|
-
worker_automate_hub-0.4.
|
71
|
+
worker_automate_hub/worker.py,sha256=tftQpX8liC-_0_bOUf1YYzXSCvloMQBvjmQ6lzfEE-c,4816
|
72
|
+
worker_automate_hub-0.4.441.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
73
|
+
worker_automate_hub-0.4.441.dist-info/METADATA,sha256=JoFlzM-mvuNIzVdNUlYazv4UaY7o0ilv65qEFxcrgAo,2895
|
74
|
+
worker_automate_hub-0.4.441.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
75
|
+
worker_automate_hub-0.4.441.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.4.439.dist-info → worker_automate_hub-0.4.441.dist-info}/entry_points.txt
RENAMED
File without changes
|