worker-automate-hub 0.4.367__py3-none-any.whl → 0.4.369__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 +1 -1
- worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +2 -1
- worker_automate_hub/tasks/jobs/sped_fiscal.py +26 -29
- worker_automate_hub/tasks/task_executor.py +3 -0
- {worker_automate_hub-0.4.367.dist-info → worker_automate_hub-0.4.369.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.4.367.dist-info → worker_automate_hub-0.4.369.dist-info}/RECORD +8 -8
- {worker_automate_hub-0.4.367.dist-info → worker_automate_hub-0.4.369.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.4.367.dist-info → worker_automate_hub-0.4.369.dist-info}/entry_points.txt +0 -0
@@ -492,7 +492,7 @@ async def get_status_nf_emsys(chave: int):
|
|
492
492
|
# Função para enviar arquivo de imagem a api
|
493
493
|
async def send_file(uuidRelacao: str, desArquivo: str, tipo: str, file: bytes, file_extension: str = "jpg") -> None:
|
494
494
|
"""
|
495
|
-
Função assíncrona para enviar um arquivo de imagem para uma API.
|
495
|
+
Função assíncrona para enviar um arquivo de imagem/text para uma API.
|
496
496
|
|
497
497
|
Args:
|
498
498
|
uuidRelacao (str): UUID da relação associada ao arquivo.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import List
|
2
|
+
from typing import List, Optional
|
3
3
|
|
4
4
|
from worker_automate_hub.models.dto.rpa_sistema_dto import RpaSistemaDTO
|
5
5
|
from pydantic import BaseModel, Field
|
@@ -12,6 +12,7 @@ class RpaProcessoEntradaDTO(BaseModel):
|
|
12
12
|
nomProcesso: str = Field(..., alias="nomProcesso")
|
13
13
|
uuidFila: str = Field(..., alias="uuidFila")
|
14
14
|
sistemas: List[RpaSistemaDTO] = Field(..., alias="sistemas")
|
15
|
+
historico_id: Optional[str] = None
|
15
16
|
|
16
17
|
class Config:
|
17
18
|
populate_by_name = True
|
@@ -54,6 +54,17 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
54
54
|
multiplicador_timeout = int(float(task.sistemas[0].timeout))
|
55
55
|
set_variable("timeout_multiplicador", multiplicador_timeout)
|
56
56
|
|
57
|
+
historico_id = task.historico_id
|
58
|
+
if historico_id:
|
59
|
+
console.print("Historico ID recuperado com sucesso...\n")
|
60
|
+
else:
|
61
|
+
console.print("Não foi possivel recuperar o histórico do ID, não sendo possivel enviar o arquivo SPED como retorno...\n")
|
62
|
+
return RpaRetornoProcessoDTO(
|
63
|
+
sucesso=False,
|
64
|
+
retorno="Não foi possivel recuperar o histórico do ID, não sendo possivel enviar o arquivo SPED como retorno",
|
65
|
+
status=RpaHistoricoStatusEnum.Falha,
|
66
|
+
)
|
67
|
+
|
57
68
|
# Fecha a instancia do emsys - caso esteja aberta
|
58
69
|
await kill_all_emsys()
|
59
70
|
|
@@ -399,36 +410,22 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
399
410
|
file_bytes = ""
|
400
411
|
with open(temp_path_to_txt, 'rb') as file:
|
401
412
|
file_bytes = file.read()
|
402
|
-
await worker_sleep(6)
|
403
413
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
result
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
status=RpaHistoricoStatusEnum.Sucesso,
|
420
|
-
)
|
421
|
-
except Exception as e:
|
422
|
-
result = f"Arquivo do SPED gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {temp_path_to_txt} !"
|
423
|
-
console.print(result, style="bold red")
|
424
|
-
|
425
|
-
return RpaRetornoProcessoDTO(
|
426
|
-
sucesso=False,
|
427
|
-
retorno=result,
|
428
|
-
status=RpaHistoricoStatusEnum.Falha,
|
429
|
-
)
|
430
|
-
else:
|
431
|
-
result = f"Arquivo do SPED gerado com sucesso, porém não foi possivel obter o id do historico para envio do arquivo, retorno {get_historico["retorno"]} - Arquivo ainda salvo na dispositivo utilizado no diretório {temp_path_to_txt}"
|
414
|
+
|
415
|
+
await worker_sleep(6)
|
416
|
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
417
|
+
desArquivo = f"ArquivoSped_{filial_cod}_{timestamp}.txt"
|
418
|
+
try:
|
419
|
+
await send_file(historico_id, desArquivo, "text", file_bytes, file_extension="txt")
|
420
|
+
result = "Arquivo do SPED gerado com sucesso e arquivo salvo no Backoffice !"
|
421
|
+
os.remove(temp_path_to_txt)
|
422
|
+
return RpaRetornoProcessoDTO(
|
423
|
+
sucesso=True,
|
424
|
+
retorno=result,
|
425
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
426
|
+
)
|
427
|
+
except Exception as e:
|
428
|
+
result = f"Arquivo do SPED gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {temp_path_to_txt} !"
|
432
429
|
console.print(result, style="bold red")
|
433
430
|
return RpaRetornoProcessoDTO(
|
434
431
|
sucesso=False,
|
@@ -54,6 +54,9 @@ async def perform_task(task: RpaProcessoEntradaDTO):
|
|
54
54
|
try:
|
55
55
|
if task_uuid in task_definitions:
|
56
56
|
# Executar a task
|
57
|
+
if task_uuid == "276d0c41-0b7c-4446-ae0b-dd5d782917cc":
|
58
|
+
task.historico_id = historico.uuidHistorico
|
59
|
+
|
57
60
|
result: RpaRetornoProcessoDTO = await task_definitions[task_uuid](task)
|
58
61
|
if registrar_historico:
|
59
62
|
await _update_historico(
|
@@ -1,7 +1,7 @@
|
|
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=en7cGzf4ElK01uxIPkwMi3Rj8fdIje_1TgM84N7qFJM,20687
|
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
7
|
worker_automate_hub/api/rpa_historico_service.py,sha256=WhTMVW-uNlJO3YZakhx63xlsw3_XDeWnSD-3MVEzzdk,4763
|
@@ -24,7 +24,7 @@ worker_automate_hub/models/dao/rpa_historico.py,sha256=zKo_Wz_qMdB-cmFkJY1ckFx63
|
|
24
24
|
worker_automate_hub/models/dao/rpa_processo.py,sha256=AfOUhJKL-AAOyjON4g7f6B7Bxa174FNC1Eh7oItK2kA,1233
|
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
|
-
worker_automate_hub/models/dto/rpa_processo_entrada_dto.py,sha256=
|
27
|
+
worker_automate_hub/models/dto/rpa_processo_entrada_dto.py,sha256=NP2SNJ4Eq4xPQgwdw1CSwErB_g1RmBQR7pdQnOZipAE,678
|
28
28
|
worker_automate_hub/models/dto/rpa_sistema_dto.py,sha256=sLkmJei8x6sl-1-IXUKDmYQuKx0sotYQREPyhQqPmRg,161
|
29
29
|
worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -54,10 +54,10 @@ worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=Y-mKYcgX1kwcy_s
|
|
54
54
|
worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py,sha256=QBGm6eS5JghgNWNqZlk1g2a2iV8LnBLiOTBBL3Giet0,4181
|
55
55
|
worker_automate_hub/tasks/jobs/login_emsys.py,sha256=IoGCIvO4UwmuxOZEn3cvYJlKyhsWvtHvbFk8vwjTroQ,5620
|
56
56
|
worker_automate_hub/tasks/jobs/playground.py,sha256=bdnXv3C7WLQUxt4edGZDfAbRJJ2-q4zuIQaK3GLnaUc,1765
|
57
|
-
worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=
|
57
|
+
worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=_Ahc5uXNNI8HXEjmygUSfgGlZy3wwIo5pxC689nTVF4,20039
|
58
58
|
worker_automate_hub/tasks/jobs/transferencias.py,sha256=keCUlvbPhLrTiZQ9Co_r6IqL5wjYqVGB_-mgvdDe9pM,36080
|
59
59
|
worker_automate_hub/tasks/task_definitions.py,sha256=2Jp1H4_qJZqqGyaP6MA87KLt4QNrtWBYWbXu-2gymFo,4459
|
60
|
-
worker_automate_hub/tasks/task_executor.py,sha256=
|
60
|
+
worker_automate_hub/tasks/task_executor.py,sha256=eXFgWbcM8aMPwENvNix8KyFv7BqvIwhXUDkBSI1ul7M,8873
|
61
61
|
worker_automate_hub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
worker_automate_hub/utils/env.py,sha256=TacQjGRO7PUNpttrhTAc5Gnegaiysl2Knsv1P8qfkfs,57
|
63
63
|
worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1wiaMoJAGZeSy0D37sYdU,2212
|
@@ -67,7 +67,7 @@ worker_automate_hub/utils/updater.py,sha256=0LR6Xpe3HZk-xu-trH7vKRhP5FXp0nhp1qxt
|
|
67
67
|
worker_automate_hub/utils/util.py,sha256=hUzQOnVYwvlrFzAv1p5Lt3s1dmW_77NZFuG77QQHKL4,119565
|
68
68
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=4--3HDyWddT8vw2mBNY_-9IscvAQYBygwPIMiKvAG-w,27583
|
69
69
|
worker_automate_hub/worker.py,sha256=vkl_x7gSo6nQlhSBLwRkGx6LEONnYptfBaGxOy1ZLsE,4634
|
70
|
-
worker_automate_hub-0.4.
|
71
|
-
worker_automate_hub-0.4.
|
72
|
-
worker_automate_hub-0.4.
|
73
|
-
worker_automate_hub-0.4.
|
70
|
+
worker_automate_hub-0.4.369.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
71
|
+
worker_automate_hub-0.4.369.dist-info/METADATA,sha256=oJ5Wor7u4LHKArITh4hFXBGL_GhsEYFaVWVty3ol09w,2895
|
72
|
+
worker_automate_hub-0.4.369.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
73
|
+
worker_automate_hub-0.4.369.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.4.367.dist-info → worker_automate_hub-0.4.369.dist-info}/entry_points.txt
RENAMED
File without changes
|