worker-automate-hub 0.5.808__py3-none-any.whl → 0.5.810__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/abertura_livros_fiscais.py +3 -5
- worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +81 -57
- {worker_automate_hub-0.5.808.dist-info → worker_automate_hub-0.5.810.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.808.dist-info → worker_automate_hub-0.5.810.dist-info}/RECORD +6 -6
- {worker_automate_hub-0.5.808.dist-info → worker_automate_hub-0.5.810.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.808.dist-info → worker_automate_hub-0.5.810.dist-info}/entry_points.txt +0 -0
@@ -331,8 +331,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
331
331
|
console.print("Aguardar o término de carregar")
|
332
332
|
# imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livros_incluidos.png"
|
333
333
|
imagem = "assets\\abertura_livros\\livros_incluidos.png"
|
334
|
-
|
335
|
-
tempo_limite = 1200 # 20 minutos
|
334
|
+
tempo_limite = 3600 # 1h
|
336
335
|
intervalo = 2 # segundos entre as verificações
|
337
336
|
|
338
337
|
inicio = time.time()
|
@@ -375,7 +374,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
375
374
|
# img_dialog = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\notas_rejeitadas.png"
|
376
375
|
img_dialog = "assets\\abertura_livros\\notas_rejeitadas.png"
|
377
376
|
if os.path.exists(img_dialog):
|
378
|
-
caixa = pyautogui.locateOnScreen(img_dialog, confidence=0.
|
377
|
+
caixa = pyautogui.locateOnScreen(img_dialog, confidence=0.9, grayscale=True)
|
379
378
|
if caixa:
|
380
379
|
print("Janela 'notas rejeitadas' detectada por imagem.")
|
381
380
|
region = (caixa.left, caixa.top, caixa.width, caixa.height)
|
@@ -394,7 +393,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
394
393
|
# img_dialog = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\gerar_rel_notas_rejeitadas.png"
|
395
394
|
img_dialog = "assets\\abertura_livros\\gerar_rel_notas_rejeitadas.png"
|
396
395
|
if os.path.exists(img_dialog):
|
397
|
-
caixa = pyautogui.locateOnScreen(img_dialog, confidence=0.
|
396
|
+
caixa = pyautogui.locateOnScreen(img_dialog, confidence=0.9, grayscale=True)
|
398
397
|
if caixa:
|
399
398
|
print("Janela 'notas rejeitadas' detectada por imagem.")
|
400
399
|
region = (caixa.left, caixa.top, caixa.width, caixa.height)
|
@@ -632,4 +631,3 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
632
631
|
status=RpaHistoricoStatusEnum.Falha,
|
633
632
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
634
633
|
)
|
635
|
-
|
@@ -202,7 +202,7 @@ async def integracao_contabil_generica(
|
|
202
202
|
|
203
203
|
# console.print("Selecionando item do campo origem...")
|
204
204
|
uuid_processo = task.uuidProcesso
|
205
|
-
caminho_imagem = f"
|
205
|
+
caminho_imagem = os.path.join(ASSETS_PATH_BASE, "integracao_contabil", f"{uuid_processo}.png")
|
206
206
|
|
207
207
|
await metodo_selecao_origem_especial()
|
208
208
|
await localizar_e_clicar(caminho_imagem) # main_window.set_focus()
|
@@ -258,7 +258,7 @@ async def integracao_contabil_generica(
|
|
258
258
|
console.print("Verificar se existem lotes")
|
259
259
|
try:
|
260
260
|
# Verifica mensagem sem lote pra integrar
|
261
|
-
imagem_alvo = "
|
261
|
+
imagem_alvo = os.path.join(ASSETS_PATH_BASE, "integracao_contabil", "sem_lote.png")
|
262
262
|
|
263
263
|
localizacao = pyautogui.locateOnScreen(imagem_alvo, confidence=0.9)
|
264
264
|
|
@@ -297,7 +297,7 @@ async def integracao_contabil_generica(
|
|
297
297
|
await worker_sleep(5)
|
298
298
|
|
299
299
|
try:
|
300
|
-
imagem_finalizada = "
|
300
|
+
imagem_finalizada = os.path.join(ASSETS_PATH_BASE, "integracao_contabil", "pesquisa_finalizada.png")
|
301
301
|
|
302
302
|
if not os.path.exists(imagem_finalizada):
|
303
303
|
raise FileNotFoundError(
|
@@ -399,9 +399,9 @@ async def integracao_contabil_generica(
|
|
399
399
|
total_debito = numeros[1].window_text()
|
400
400
|
total_credito = numeros[2].window_text()
|
401
401
|
|
402
|
-
print("Diferença:", diferenca)
|
403
|
-
print("Total Débito:", total_debito)
|
404
|
-
print("Total Crédito:", total_credito)
|
402
|
+
console.print("Diferença:", diferenca)
|
403
|
+
console.print("Total Débito:", total_debito)
|
404
|
+
console.print("Total Crédito:", total_credito)
|
405
405
|
|
406
406
|
if diferenca > "0,00":
|
407
407
|
clicou = True
|
@@ -433,19 +433,16 @@ async def integracao_contabil_generica(
|
|
433
433
|
|
434
434
|
await worker_sleep(5)
|
435
435
|
|
436
|
-
|
436
|
+
# --- AJUSTE: retorno de SUCESSO quando detectar integracao_sucesso.png
|
437
|
+
assets_int_cont = os.path.join(ASSETS_PATH_BASE, "integracao_contabil")
|
437
438
|
err_dict = {
|
438
|
-
assets_int_cont
|
439
|
-
|
440
|
-
assets_int_cont
|
441
|
-
|
442
|
-
assets_int_cont
|
443
|
-
+ "lote_sem_complemento_error.png": "Integração não realizada. Lote encontrado sem complemento obrigatório.",
|
444
|
-
assets_int_cont
|
445
|
-
+ "diferenca_cred_deb.png": "Integração não realizada. Existem diferença em lotes consistentes, por favor verificar.",
|
446
|
-
assets_int_cont
|
447
|
-
+ "integracao_sucesso.png": "Integração Finalizada com Sucesso.",
|
439
|
+
os.path.join(assets_int_cont, "erro_duplicidade.png"): "Integração não realizada. Erro de Duplicidade localizado enquanto finalizava a integração, contate o suporte do Emsys.",
|
440
|
+
os.path.join(assets_int_cont, "conta_indefinida_error.png"): "Integração não realizada. Conta contábil indefinida no sistema.",
|
441
|
+
os.path.join(assets_int_cont, "lote_sem_complemento_error.png"): "Integração não realizada. Lote encontrado sem complemento obrigatório.",
|
442
|
+
os.path.join(assets_int_cont, "diferenca_cred_deb.png"): "Integração não realizada. Existem diferença em lotes consistentes, por favor verificar.",
|
443
|
+
os.path.join(assets_int_cont, "integracao_sucesso.png"): "Integração Finalizada com Sucesso.",
|
448
444
|
}
|
445
|
+
|
449
446
|
# Aguardar finalizar
|
450
447
|
while True:
|
451
448
|
try:
|
@@ -454,23 +451,56 @@ async def integracao_contabil_generica(
|
|
454
451
|
)
|
455
452
|
msg_box = app["TMsgBox"]
|
456
453
|
|
457
|
-
#
|
454
|
+
# Verifica por imagens de SUCESSO/ERRO
|
458
455
|
for img_path, mensagem in err_dict.items():
|
459
456
|
try:
|
460
|
-
|
461
|
-
except:
|
462
|
-
|
457
|
+
found = pyautogui.locateOnScreen(img_path, confidence=0.90)
|
458
|
+
except Exception:
|
459
|
+
found = None
|
463
460
|
|
464
|
-
if
|
465
|
-
|
461
|
+
if found:
|
462
|
+
# Caso SUCESSO
|
463
|
+
if img_path.endswith("integracao_sucesso.png"):
|
466
464
|
console.print(f"[green]{mensagem}[/green]")
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
465
|
+
# fecha a TMsgBox se estiver aberta (best-effort)
|
466
|
+
try:
|
467
|
+
msg_box.child_window(class_name="TBitBtn", found_index=0).click_input()
|
468
|
+
except:
|
469
|
+
pass
|
470
|
+
|
471
|
+
# Se integrou com 'Lotes Consistentes' marcados, é FALHA
|
472
|
+
if lotesMarcados:
|
473
|
+
try:
|
474
|
+
# busca novamente o checkbox para garantir escopo
|
475
|
+
cb = dlg.child_window(title="Lotes Consistentes", class_name="TCheckBox")
|
476
|
+
if cb.exists() and cb.is_enabled() and cb.is_visible():
|
477
|
+
cb.click_input()
|
478
|
+
print("Checkbox 'Lotes Consistentes' desmarcado com sucesso.")
|
479
|
+
except Exception as e:
|
480
|
+
print(f"Não foi possível desmarcar checkbox: {e}")
|
481
|
+
|
482
|
+
time.sleep(5)
|
483
|
+
return RpaRetornoProcessoDTO(
|
484
|
+
sucesso=False,
|
485
|
+
retorno="Integração realizada, porém, existem LOTES INCONSISTENTES.",
|
486
|
+
status=RpaHistoricoStatusEnum.Falha,
|
487
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
488
|
+
)
|
489
|
+
|
490
|
+
# Se não estava marcado, aí sim é sucesso
|
491
|
+
return RpaRetornoProcessoDTO(
|
492
|
+
sucesso=True,
|
493
|
+
retorno=mensagem,
|
494
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
495
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
496
|
+
)
|
497
|
+
|
498
|
+
# Demais imagens tratadas como ERRO
|
472
499
|
console.print(f"[red]Erro encontrado:[/red] {mensagem}")
|
473
|
-
|
500
|
+
try:
|
501
|
+
msg_box.child_window(class_name="TBitBtn", found_index=0).click_input()
|
502
|
+
except:
|
503
|
+
pass
|
474
504
|
return RpaRetornoProcessoDTO(
|
475
505
|
sucesso=False,
|
476
506
|
retorno=mensagem,
|
@@ -480,19 +510,16 @@ async def integracao_contabil_generica(
|
|
480
510
|
|
481
511
|
await worker_sleep(1)
|
482
512
|
|
513
|
+
# Se nenhuma imagem foi encontrada, tenta só fechar a TMsgBox (se existir) e sai
|
483
514
|
try:
|
484
515
|
app = Application(backend="win32").connect(
|
485
516
|
class_name="TMsgBox", found_index=0
|
486
517
|
)
|
487
518
|
main_window = app["TMsgBox"]
|
488
|
-
main_window.child_window(
|
489
|
-
class_name="TBitBtn", found_index=0
|
490
|
-
).click_input()
|
519
|
+
main_window.child_window(class_name="TBitBtn", found_index=0).click_input()
|
491
520
|
break
|
492
521
|
except ElementNotFoundError:
|
493
|
-
console.print(
|
494
|
-
"[yellow]Janela TMsgBox ainda não visível.[/yellow]"
|
495
|
-
)
|
522
|
+
console.print("[yellow]Janela TMsgBox ainda não visível.[/yellow]")
|
496
523
|
break
|
497
524
|
|
498
525
|
except ElementNotFoundError:
|
@@ -503,6 +530,23 @@ async def integracao_contabil_generica(
|
|
503
530
|
|
504
531
|
await worker_sleep(1)
|
505
532
|
|
533
|
+
try:
|
534
|
+
app = Application(backend="win32").connect(
|
535
|
+
class_name="TMsgBox", found_index=0
|
536
|
+
)
|
537
|
+
main_window = app["TMsgBox"]
|
538
|
+
main_window.child_window(class_name="TBitBtn", found_index=0).click_input()
|
539
|
+
time.sleep(5)
|
540
|
+
break
|
541
|
+
except ElementNotFoundError:
|
542
|
+
console.print("[yellow]Janela TMsgBox ainda não visível.[/yellow]")
|
543
|
+
|
544
|
+
except Exception as e:
|
545
|
+
print(f"Erro inesperado ao verificar janela de confirmação: {e}")
|
546
|
+
break
|
547
|
+
|
548
|
+
await worker_sleep(1)
|
549
|
+
|
506
550
|
try:
|
507
551
|
app = Application(backend="win32").connect(
|
508
552
|
class_name="TMsgBox", found_index=0
|
@@ -516,28 +560,7 @@ async def integracao_contabil_generica(
|
|
516
560
|
except ElementNotFoundError:
|
517
561
|
console.print("[yellow]Janela TMsgBox ainda não visível.[/yellow]")
|
518
562
|
|
519
|
-
|
520
|
-
if (
|
521
|
-
checkbox.exists()
|
522
|
-
and checkbox.is_enabled()
|
523
|
-
and checkbox.is_visible()
|
524
|
-
):
|
525
|
-
checkbox.click_input()
|
526
|
-
print("Checkbox 'Lotes Consistentes' desmarcado com sucesso.")
|
527
|
-
time.sleep(5)
|
528
|
-
return RpaRetornoProcessoDTO(
|
529
|
-
sucesso=False,
|
530
|
-
retorno=f"Integração realizada, porém, existem LOTES INCONSISTENTES.",
|
531
|
-
status=RpaHistoricoStatusEnum.Falha,
|
532
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
533
|
-
)
|
534
|
-
else:
|
535
|
-
return RpaRetornoProcessoDTO(
|
536
|
-
sucesso=True,
|
537
|
-
retorno=f"Sucesso ao executar processo de integracao contabil",
|
538
|
-
status=RpaHistoricoStatusEnum.Sucesso,
|
539
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
540
|
-
)
|
563
|
+
|
541
564
|
except Exception as erro:
|
542
565
|
return RpaRetornoProcessoDTO(
|
543
566
|
sucesso=False,
|
@@ -553,3 +576,4 @@ async def integracao_contabil_generica(
|
|
553
576
|
status=RpaHistoricoStatusEnum.Falha,
|
554
577
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
555
578
|
)
|
579
|
+
|
@@ -36,7 +36,7 @@ worker_automate_hub/models/dto/rpa_sap_dto.py,sha256=eovdvKCtVIhRct3PL98KjsdlngL
|
|
36
36
|
worker_automate_hub/models/dto/rpa_sistema_dto.py,sha256=sLkmJei8x6sl-1-IXUKDmYQuKx0sotYQREPyhQqPmRg,161
|
37
37
|
worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=
|
39
|
+
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=4IOJCIGXQ-7Fq9hzC3RrzljtBGRd7IY-2XlXoJQ4ZCc,25189
|
40
40
|
worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=UkLWTC5Ub2qBb0yY-8IZ0DLLOVJOfNTq_z9krx_t25Q,29476
|
41
41
|
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=S6QC4xhuo0pB5FjaUJZNMm1LIgEjpjifReCTBDqxH-U,11719
|
42
42
|
worker_automate_hub/tasks/jobs/cte_manual.py,sha256=JucHpRMjMiy-QEJ0wtFnytLpN53tKXgCDI05nGLGclU,603
|
@@ -82,7 +82,7 @@ worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py,sha256=mmBW7KetUeRjiZkjn
|
|
82
82
|
worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py,sha256=QzK2aG5d9pmFbb8cTaNm3LWf5NMkmCvBkgo70gcLu0c,14781
|
83
83
|
worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py,sha256=4Rtm2uCfA6tZ-KW6aunKug7reTqbBX69CCBZCBnwbYc,21856
|
84
84
|
worker_automate_hub/tasks/jobs/integracao_contabil.py,sha256=psoIU0tjtTJq2W8aGXjXrfkAOYlIpUtHZyNolI7dp-0,16263
|
85
|
-
worker_automate_hub/tasks/jobs/integracao_contabil_generica.py,sha256=
|
85
|
+
worker_automate_hub/tasks/jobs/integracao_contabil_generica.py,sha256=aAMdB8a-BjHf5zoCvbiec8-CAs3ZR7ChBT8kPIEQQk0,24122
|
86
86
|
worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py,sha256=0mlu-oPwRd9qCocB-6tWsEI0-wd48mkBJn5juYqOAX8,40788
|
87
87
|
worker_automate_hub/tasks/jobs/lancamento_rateio.py,sha256=0cvbpuJiHl5mca5gpZudX7uQY5Rqe5xzwt6juQcMhjo,15875
|
88
88
|
worker_automate_hub/tasks/jobs/login_emsys.py,sha256=dO9S027qRTtjOfytF6IWO-m6hDld8kZqOVAsn91l1YA,5684
|
@@ -103,7 +103,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
103
103
|
worker_automate_hub/utils/util.py,sha256=HXXGEEeGQd-gD_u8W0_aPYVDiMB9bKF-rJBl-m6RiRM,210781
|
104
104
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=F7jk95LpDwl5WfaQXahCA5yDdnySnWdctDqczHXwGqE,38195
|
105
105
|
worker_automate_hub/worker.py,sha256=zEnYUrm5kY2cHbbee15QJkwkx4euD2SB2zRvUIbjS90,6850
|
106
|
-
worker_automate_hub-0.5.
|
107
|
-
worker_automate_hub-0.5.
|
108
|
-
worker_automate_hub-0.5.
|
109
|
-
worker_automate_hub-0.5.
|
106
|
+
worker_automate_hub-0.5.810.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
107
|
+
worker_automate_hub-0.5.810.dist-info/METADATA,sha256=pxBRPfxFbWsQ32RJdkCuLYm-4tWza5yO396pTxgIhQw,3100
|
108
|
+
worker_automate_hub-0.5.810.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
109
|
+
worker_automate_hub-0.5.810.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.808.dist-info → worker_automate_hub-0.5.810.dist-info}/entry_points.txt
RENAMED
File without changes
|