worker-automate-hub 0.5.321__py3-none-any.whl → 0.5.323__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/devolucao_prazo_a_faturar.py +10 -6
- worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +2504 -0
- worker_automate_hub/utils/util.py +47 -133
- {worker_automate_hub-0.5.321.dist-info → worker_automate_hub-0.5.323.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.321.dist-info → worker_automate_hub-0.5.323.dist-info}/RECORD +7 -7
- {worker_automate_hub-0.5.321.dist-info → worker_automate_hub-0.5.323.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.321.dist-info → worker_automate_hub-0.5.323.dist-info}/entry_points.txt +0 -0
@@ -13,6 +13,7 @@ import xml.etree.ElementTree as ET
|
|
13
13
|
from datetime import datetime, timedelta
|
14
14
|
from pathlib import Path
|
15
15
|
from typing import Dict, TypedDict
|
16
|
+
import time
|
16
17
|
|
17
18
|
import aiohttp
|
18
19
|
import cv2
|
@@ -2535,139 +2536,75 @@ async def error_before_persist_record() -> RpaRetornoProcessoDTO:
|
|
2535
2536
|
except:
|
2536
2537
|
console.print("Erro ao capturar mensagem de erro")
|
2537
2538
|
|
2539
|
+
async def wait_for_window(app, window_name: str, timeout: int, interval: float = 1.0):
|
2540
|
+
start = time.time()
|
2541
|
+
while time.time() - start < timeout:
|
2542
|
+
try:
|
2543
|
+
window = app[window_name]
|
2544
|
+
if window.exists():
|
2545
|
+
return window
|
2546
|
+
except Exception:
|
2547
|
+
pass
|
2548
|
+
await worker_sleep(interval)
|
2549
|
+
return None
|
2550
|
+
|
2551
|
+
async def wait_for_window_open_by_class(class_name: str, window_name: str, timeout: int, interval: float = 1.0):
|
2552
|
+
start = time.time()
|
2553
|
+
while time.time() - start < timeout:
|
2554
|
+
result = await is_window_open_by_class(class_name, window_name)
|
2555
|
+
if result["IsOpened"]:
|
2556
|
+
return True
|
2557
|
+
await worker_sleep(interval)
|
2558
|
+
return False
|
2538
2559
|
|
2539
2560
|
async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
2540
2561
|
try:
|
2541
2562
|
username = getpass.getuser()
|
2542
2563
|
console.print("Verificando se existe tela de multiplas referencias.\n")
|
2543
2564
|
await worker_sleep(10)
|
2544
|
-
|
2545
|
-
itens_fornecedor
|
2546
|
-
"TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor"
|
2547
|
-
)
|
2548
|
-
|
2549
|
-
if itens_fornecedor["IsOpened"] == True:
|
2565
|
+
itens_fornecedor = await is_window_open_by_class("TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor")
|
2566
|
+
if itens_fornecedor["IsOpened"]:
|
2550
2567
|
console.print("Tela de multiplas referencias existe.\n")
|
2551
2568
|
return RpaRetornoProcessoDTO(
|
2552
2569
|
sucesso=False,
|
2553
2570
|
retorno="Tela de Itens fornecedor - Multiplas referencias",
|
2554
2571
|
status=RpaHistoricoStatusEnum.Falha,
|
2555
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
2572
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
2556
2573
|
)
|
2557
|
-
|
2558
2574
|
console.print("Iteragindo com a tela de itens não localizados // NCM ...\n")
|
2559
|
-
|
2560
2575
|
app = Application().connect(class_name="TFrmAguarde", timeout=60)
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
except Exception as e:
|
2571
|
-
console.print(f"Erro ao tentar acessar TMessageForm: {e}")
|
2572
|
-
janela_aguarde = await is_window_open_by_class(
|
2573
|
-
"TFrmAguarde", "TFrmAguarde"
|
2574
|
-
)
|
2575
|
-
if janela_aguarde["IsOpened"] == True:
|
2576
|
-
console.print(
|
2577
|
-
"Aguardando tela de aguarde desaparecer ou conectar...\n"
|
2578
|
-
)
|
2579
|
-
else:
|
2580
|
-
try:
|
2581
|
-
main_window = app["TMessageForm"]
|
2582
|
-
if main_window.exists():
|
2583
|
-
console.print("Janela 'TMessageForm' encontrada!")
|
2584
|
-
break
|
2585
|
-
except:
|
2586
|
-
return RpaRetornoProcessoDTO(
|
2587
|
-
sucesso=True,
|
2588
|
-
retorno="Tela de aguardar carregada - Seguindo com andamento do processo (NCM).",
|
2589
|
-
status=RpaHistoricoStatusEnum.Sucesso,
|
2590
|
-
)
|
2591
|
-
|
2592
|
-
await worker_sleep(3)
|
2593
|
-
i += 1
|
2594
|
-
|
2576
|
+
aguarde_window = app.window(class_name="TFrmAguarde")
|
2577
|
+
aguarde_window.wait_not("exists visible")
|
2578
|
+
main_window = await wait_for_window(app, "TMessageForm", timeout=180, interval=3)
|
2579
|
+
if not main_window:
|
2580
|
+
return RpaRetornoProcessoDTO(
|
2581
|
+
sucesso=True,
|
2582
|
+
retorno="Tela de aguardar carregada - Seguindo com andamento do processo (NCM).",
|
2583
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
2584
|
+
)
|
2595
2585
|
window_title = main_window.window_text()
|
2596
|
-
|
2597
2586
|
if "Confirm" in window_title or "Seleciona Itens Fornecedor" in window_title:
|
2598
2587
|
console.print("Itens nao localizados para o fornecedor...\n")
|
2599
2588
|
if main_window.exists():
|
2600
2589
|
main_window.type_keys("%n")
|
2601
2590
|
await worker_sleep(10)
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
)
|
2606
|
-
itens_fornecedor = await is_window_open_by_class(
|
2607
|
-
"TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor"
|
2608
|
-
)
|
2609
|
-
|
2610
|
-
if itens_fornecedor["IsOpened"] == True:
|
2591
|
+
console.print("Verificando a existencia de tela de selecionar Itens...\n")
|
2592
|
+
itens_fornecedor = await is_window_open_by_class("TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor")
|
2593
|
+
if itens_fornecedor["IsOpened"]:
|
2611
2594
|
return RpaRetornoProcessoDTO(
|
2612
2595
|
sucesso=True,
|
2613
2596
|
retorno="Tela de Itens fornecedor - Multiplas referencias",
|
2614
2597
|
status=RpaHistoricoStatusEnum.Sucesso,
|
2615
2598
|
)
|
2616
2599
|
else:
|
2617
|
-
console.print(
|
2618
|
-
"Não possui a existencia de tela de selecionar Itens Fornecedor...\n"
|
2619
|
-
)
|
2620
|
-
|
2600
|
+
console.print("Não possui a existencia de tela de selecionar Itens Fornecedor...\n")
|
2621
2601
|
await worker_sleep(10)
|
2622
2602
|
console.print("Verificando a existe da tela dos itens com erro...\n")
|
2623
|
-
|
2624
|
-
|
2625
|
-
i = 0
|
2626
|
-
while i < max_attempts:
|
2627
|
-
logs_erro = await is_window_open_by_class(
|
2628
|
-
"TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
|
2629
|
-
)
|
2630
|
-
if logs_erro["IsOpened"] == True:
|
2631
|
-
break
|
2632
|
-
else:
|
2633
|
-
console.print(
|
2634
|
-
"Aguardando confirmação de tela de erro importação NFe...\n"
|
2635
|
-
)
|
2636
|
-
try:
|
2637
|
-
app = Application().connect(class_name="TFrmAguarde")
|
2638
|
-
main_window = app["TMessageForm"]
|
2639
|
-
console.print("Janela 'Information' encontrada!")
|
2640
|
-
window_title = main_window.window_text()
|
2641
|
-
if "Information" in window_title:
|
2642
|
-
main_window.type_keys("%n")
|
2643
|
-
else:
|
2644
|
-
console.print(
|
2645
|
-
"Não possui a existencia de 'Information'...\n"
|
2646
|
-
)
|
2647
|
-
except:
|
2648
|
-
console.print(
|
2649
|
-
"Não possui a existencia de tela de Information...\n"
|
2650
|
-
)
|
2651
|
-
await worker_sleep(5)
|
2652
|
-
i += 1
|
2653
|
-
|
2654
|
-
await worker_sleep(5)
|
2655
|
-
logs_erro = await is_window_open_by_class(
|
2656
|
-
"TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
|
2657
|
-
)
|
2658
|
-
if logs_erro["IsOpened"] == True:
|
2659
|
-
app = Application().connect(
|
2660
|
-
class_name="TFrmExibeLogErroImportacaoNfe"
|
2661
|
-
)
|
2603
|
+
if await wait_for_window_open_by_class("TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe", timeout=300, interval=5):
|
2604
|
+
app = Application().connect(class_name="TFrmExibeLogErroImportacaoNfe")
|
2662
2605
|
main_window = app["TFrmExibeLogErroImportacaoNfe"]
|
2663
|
-
console.print(
|
2664
|
-
|
2665
|
-
)
|
2666
|
-
|
2667
|
-
btn_save = main_window.child_window(
|
2668
|
-
title="Salvar", class_name="TBitBtn"
|
2669
|
-
)
|
2670
|
-
|
2606
|
+
console.print("Tela com itens com erro existe, salvando os itens...\n")
|
2607
|
+
btn_save = main_window.child_window(title="Salvar", class_name="TBitBtn")
|
2671
2608
|
if btn_save.exists():
|
2672
2609
|
max_attempts = 3
|
2673
2610
|
i = 0
|
@@ -2676,25 +2613,17 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
|
2676
2613
|
try:
|
2677
2614
|
btn_save.click()
|
2678
2615
|
except:
|
2679
|
-
console.print(
|
2680
|
-
"Não foi possivel clicar no Botão OK... \n"
|
2681
|
-
)
|
2616
|
+
console.print("Não foi possivel clicar no Botão OK... \n")
|
2682
2617
|
await worker_sleep(3)
|
2683
|
-
|
2684
|
-
console.print(
|
2685
|
-
"Verificando a existencia da tela 'Salvar'...\n"
|
2686
|
-
)
|
2618
|
+
console.print("Verificando a existencia da tela 'Salvar'...\n")
|
2687
2619
|
try:
|
2688
2620
|
app = Application().connect(title="Salvar")
|
2689
2621
|
main_window = app["Salvar"]
|
2690
2622
|
console.print("Tela 'Salvar' encontrada!")
|
2691
2623
|
break
|
2692
2624
|
except Exception as e:
|
2693
|
-
console.print(
|
2694
|
-
f"Tela 'Salvar' não encontrada. Tentativa {i + 1}/{max_attempts}."
|
2695
|
-
)
|
2625
|
+
console.print(f"Tela 'Salvar' não encontrada. Tentativa {i + 1}/{max_attempts}.")
|
2696
2626
|
i += 1
|
2697
|
-
|
2698
2627
|
if i == max_attempts:
|
2699
2628
|
return RpaRetornoProcessoDTO(
|
2700
2629
|
sucesso=False,
|
@@ -2702,31 +2631,20 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
|
2702
2631
|
status=RpaHistoricoStatusEnum.Falha,
|
2703
2632
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
2704
2633
|
)
|
2705
|
-
|
2706
2634
|
await worker_sleep(4)
|
2707
2635
|
console.print("Interagindo com a tela 'Salvar'...\n")
|
2708
|
-
path_to_txt =
|
2709
|
-
f"C:\\Users\\{username}\\Downloads\\erro_itens{xml}.txt"
|
2710
|
-
)
|
2711
|
-
|
2636
|
+
path_to_txt = f"C:\\Users\\{username}\\Downloads\\erro_itens{xml}.txt"
|
2712
2637
|
main_window.type_keys("%n")
|
2713
2638
|
pyautogui.write(path_to_txt)
|
2714
2639
|
await worker_sleep(1)
|
2715
2640
|
main_window.type_keys("%l")
|
2716
2641
|
console.print("Arquivo salvo com sucesso...\n")
|
2717
|
-
|
2718
2642
|
await worker_sleep(3)
|
2719
|
-
with open(
|
2720
|
-
path_to_txt, "r", encoding="latin1", errors="replace"
|
2721
|
-
) as arquivo:
|
2643
|
+
with open(path_to_txt, "r", encoding="latin1", errors="replace") as arquivo:
|
2722
2644
|
conteudo = arquivo.read()
|
2723
|
-
console.print(
|
2724
|
-
f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n"
|
2725
|
-
)
|
2726
|
-
|
2645
|
+
console.print(f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n")
|
2727
2646
|
os.remove(path_to_txt)
|
2728
2647
|
console.print("Removendo o arquivo...\n")
|
2729
|
-
|
2730
2648
|
return RpaRetornoProcessoDTO(
|
2731
2649
|
sucesso=False,
|
2732
2650
|
retorno=f"Itens nao localizados p/ fornecedor. Mensagem: {conteudo}",
|
@@ -2740,7 +2658,6 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
|
2740
2658
|
status=RpaHistoricoStatusEnum.Falha,
|
2741
2659
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
2742
2660
|
)
|
2743
|
-
|
2744
2661
|
else:
|
2745
2662
|
return RpaRetornoProcessoDTO(
|
2746
2663
|
sucesso=False,
|
@@ -2755,7 +2672,6 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
|
2755
2672
|
status=RpaHistoricoStatusEnum.Falha,
|
2756
2673
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
2757
2674
|
)
|
2758
|
-
|
2759
2675
|
elif "Information" in window_title:
|
2760
2676
|
console.print("Tela de NCM para o fornecedor...\n")
|
2761
2677
|
if main_window.exists():
|
@@ -2766,13 +2682,11 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
|
|
2766
2682
|
retorno="Tela de NCM - clicado em NO para andamento do processo",
|
2767
2683
|
status=RpaHistoricoStatusEnum.Sucesso,
|
2768
2684
|
)
|
2769
|
-
|
2770
2685
|
return RpaRetornoProcessoDTO(
|
2771
2686
|
sucesso=True,
|
2772
2687
|
retorno="Tela TMessageForm sem Title match. Seguindo...",
|
2773
2688
|
status=RpaHistoricoStatusEnum.Sucesso,
|
2774
2689
|
)
|
2775
|
-
|
2776
2690
|
except Exception as e:
|
2777
2691
|
return RpaRetornoProcessoDTO(
|
2778
2692
|
sucesso=False,
|
@@ -42,7 +42,7 @@ worker_automate_hub/tasks/jobs/cte_manual.py,sha256=JucHpRMjMiy-QEJ0wtFnytLpN53t
|
|
42
42
|
worker_automate_hub/tasks/jobs/descartes.py,sha256=2zODOekSJSr7nuO9sUzT_F3YeG7N5EHuxnp05RguirE,41361
|
43
43
|
worker_automate_hub/tasks/jobs/despesas_cte.py,sha256=TWbjBMZjYDugiqYUa_1DtCAUWOyVetoZI2SPs7AdDNc,13264
|
44
44
|
worker_automate_hub/tasks/jobs/devolucao_ctf.py,sha256=A41O9a6kVUweUBy7Lc2dpJoeAi8QYxu-pMc8u-g0yTg,110241
|
45
|
-
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=
|
45
|
+
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=y1tJhgp29hBp-kPz0GLDIpvhdl3uIFDWAEYhDmhBbBU,234732
|
46
46
|
worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=dKkf22nH5gp3RErq5u0UzRsKyJ81fc6ZZ4vLtUuMwHA,21002
|
47
47
|
worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=8WmKe4-MRtzHobXz2S4YBDNN8alfawkC-BBlRY-mn1g,1726
|
48
48
|
worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=C26zmpGQGUq6sP9lU9nanM3Fje-rkyx5tjwmRy4lyL8,25300
|
@@ -56,7 +56,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_32.py,sha256=yXi9xb7V1Gb_312zZ5c
|
|
56
56
|
worker_automate_hub/tasks/jobs/entrada_de_notas_33.py,sha256=YTRvZ59C--VqIJHF-T6HQr2PFoGEnoIvuWJMY8P19Y8,33607
|
57
57
|
worker_automate_hub/tasks/jobs/entrada_de_notas_34.py,sha256=79DgSzDvc9GDFo1ah1jPeh7SU8pIgkhU-fFIJnE_9Q8,33369
|
58
58
|
worker_automate_hub/tasks/jobs/entrada_de_notas_36.py,sha256=LW44NTCZJ_N5FCF5i4DRzG4GPdGEA3q_VJ1qJbH5omQ,34635
|
59
|
-
worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=
|
59
|
+
worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=UXlHTQfl5tNkwkJW3VTNMzW_JizLK47ixB-1-R6nkYE,142815
|
60
60
|
worker_automate_hub/tasks/jobs/entrada_de_notas_500.py,sha256=noYUpsq8qyiAhR6FvzEJGT8WTUZuWJtJoPhM6mvs4CI,44162
|
61
61
|
worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=xXeNipdXTSll8yAtAmN7v0sjN3oMlWU4THu30mKDddc,30339
|
62
62
|
worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=aSgHterguK9XGtq0Bf__YlXo5pewb9P-BRZTLnrH1D8,29020
|
@@ -82,10 +82,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
|
|
82
82
|
worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
|
83
83
|
worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
|
84
84
|
worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
|
85
|
-
worker_automate_hub/utils/util.py,sha256=
|
85
|
+
worker_automate_hub/utils/util.py,sha256=sadsyNEdhkhMHU2jVdDCJK59kHd4TWVDmmfQ62gc5Q8,182626
|
86
86
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=wmnpuOesmPSryZszmapa37b9YNC0E2MkeDYnbwr-0rU,33315
|
87
87
|
worker_automate_hub/worker.py,sha256=axdrr1xLTjWEyWfcyH3OCSpPTsyzck_fL_0u1DBLjvw,6525
|
88
|
-
worker_automate_hub-0.5.
|
89
|
-
worker_automate_hub-0.5.
|
90
|
-
worker_automate_hub-0.5.
|
91
|
-
worker_automate_hub-0.5.
|
88
|
+
worker_automate_hub-0.5.323.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
89
|
+
worker_automate_hub-0.5.323.dist-info/METADATA,sha256=nh1blhE9-x6eR8pI0gng86hE4xafZC8ud2YOwGg8YXM,3041
|
90
|
+
worker_automate_hub-0.5.323.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
91
|
+
worker_automate_hub-0.5.323.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.321.dist-info → worker_automate_hub-0.5.323.dist-info}/entry_points.txt
RENAMED
File without changes
|