worker-automate-hub 0.5.751__py3-none-any.whl → 0.5.752__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.
@@ -2755,6 +2755,182 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
2755
2755
  break
2756
2756
 
2757
2757
  await worker_sleep(3)
2758
+
2759
+ window_title = main_window.window_text()
2760
+
2761
+ if "Confirm" in window_title or "Seleciona Itens Fornecedor" in window_title:
2762
+ console.print("Itens nao localizados para o fornecedor...\n")
2763
+ if main_window.exists():
2764
+ main_window.type_keys("%n")
2765
+ await worker_sleep(10)
2766
+
2767
+ console.print(
2768
+ "Verificando a existencia de tela de selecionar Itens...\n"
2769
+ )
2770
+ itens_fornecedor = await is_window_open_by_class(
2771
+ "TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor"
2772
+ )
2773
+
2774
+ if itens_fornecedor["IsOpened"] == True:
2775
+ return RpaRetornoProcessoDTO(
2776
+ sucesso=True,
2777
+ retorno="Tela de Itens fornecedor - Multiplas referencias",
2778
+ status=RpaHistoricoStatusEnum.Sucesso,
2779
+ )
2780
+ else:
2781
+ console.print(
2782
+ "Não possui a existencia de tela de selecionar Itens Fornecedor...\n"
2783
+ )
2784
+
2785
+ await worker_sleep(10)
2786
+ console.print("Verificando a existe da tela dos itens com erro...\n")
2787
+
2788
+ max_attempts = 60
2789
+ i = 0
2790
+ while i < max_attempts:
2791
+ logs_erro = await is_window_open_by_class(
2792
+ "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2793
+ )
2794
+ if logs_erro["IsOpened"] == True:
2795
+ break
2796
+ else:
2797
+ console.print(
2798
+ "Aguardando confirmação de tela de erro importação NFe...\n"
2799
+ )
2800
+ try:
2801
+ app = Application().connect(class_name="TFrmAguarde")
2802
+ main_window = app["TMessageForm"]
2803
+ console.print("Janela 'Information' encontrada!")
2804
+ window_title = main_window.window_text()
2805
+ if "Information" in window_title:
2806
+ main_window.type_keys("%n")
2807
+ else:
2808
+ console.print(
2809
+ "Não possui a existencia de 'Information'...\n"
2810
+ )
2811
+ except:
2812
+ console.print(
2813
+ "Não possui a existencia de tela de Information...\n"
2814
+ )
2815
+ await worker_sleep(5)
2816
+ i += 1
2817
+
2818
+ await worker_sleep(5)
2819
+ logs_erro = await is_window_open_by_class(
2820
+ "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2821
+ )
2822
+ if logs_erro["IsOpened"] == True:
2823
+ app = Application().connect(
2824
+ class_name="TFrmExibeLogErroImportacaoNfe"
2825
+ )
2826
+ main_window = app["TFrmExibeLogErroImportacaoNfe"]
2827
+ console.print(
2828
+ "Tela com itens com erro existe, salvando os itens...\n"
2829
+ )
2830
+
2831
+ btn_save = main_window.child_window(
2832
+ title="Salvar", class_name="TBitBtn"
2833
+ )
2834
+
2835
+ if btn_save.exists():
2836
+ max_attempts = 3
2837
+ i = 0
2838
+ while i < max_attempts:
2839
+ console.print("Clicando no botão de salvar...\n")
2840
+ try:
2841
+ btn_save.click()
2842
+ except:
2843
+ console.print(
2844
+ "Não foi possivel clicar no Botão OK... \n"
2845
+ )
2846
+ await worker_sleep(3)
2847
+
2848
+ console.print(
2849
+ "Verificando a existencia da tela 'Salvar'...\n"
2850
+ )
2851
+ try:
2852
+ app = Application().connect(title="Salvar")
2853
+ main_window = app["Salvar"]
2854
+ console.print("Tela 'Salvar' encontrada!")
2855
+ break
2856
+ except Exception as e:
2857
+ console.print(
2858
+ f"Tela 'Salvar' não encontrada. Tentativa {i + 1}/{max_attempts}."
2859
+ )
2860
+ i += 1
2861
+
2862
+ if i == max_attempts:
2863
+ return RpaRetornoProcessoDTO(
2864
+ sucesso=False,
2865
+ retorno="Número máximo de tentativas ao tentar conectar à tela 'Salvar'.",
2866
+ status=RpaHistoricoStatusEnum.Falha,
2867
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2868
+ )
2869
+
2870
+ await worker_sleep(4)
2871
+ console.print("Interagindo com a tela 'Salvar'...\n")
2872
+ path_to_txt = (
2873
+ f"C:\\Users\\{username}\\Downloads\\erro_itens{xml}.txt"
2874
+ )
2875
+
2876
+ main_window.type_keys("%n")
2877
+ pyautogui.write(path_to_txt)
2878
+ await worker_sleep(1)
2879
+ main_window.type_keys("%l")
2880
+ console.print("Arquivo salvo com sucesso...\n")
2881
+
2882
+ await worker_sleep(3)
2883
+ with open(
2884
+ path_to_txt, "r", encoding="latin1", errors="replace"
2885
+ ) as arquivo:
2886
+ conteudo = arquivo.read()
2887
+ console.print(
2888
+ f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n"
2889
+ )
2890
+
2891
+ os.remove(path_to_txt)
2892
+ console.print("Removendo o arquivo...\n")
2893
+
2894
+ return RpaRetornoProcessoDTO(
2895
+ sucesso=False,
2896
+ retorno=f"Itens nao localizados p/ fornecedor. Mensagem: {conteudo}",
2897
+ status=RpaHistoricoStatusEnum.Falha,
2898
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
2899
+ )
2900
+ else:
2901
+ return RpaRetornoProcessoDTO(
2902
+ sucesso=False,
2903
+ retorno="Botao Salvar - Não foi encontrado",
2904
+ status=RpaHistoricoStatusEnum.Falha,
2905
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2906
+ )
2907
+
2908
+ else:
2909
+ return RpaRetornoProcessoDTO(
2910
+ sucesso=False,
2911
+ retorno="Tela 'TFrmExibeLogErroImportacaoNfe' não encontrada, tentar novamente...",
2912
+ status=RpaHistoricoStatusEnum.Falha,
2913
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2914
+ )
2915
+ else:
2916
+ return RpaRetornoProcessoDTO(
2917
+ sucesso=False,
2918
+ retorno="Erro não mapeado, pop-up Confirm não encontrado...",
2919
+ status=RpaHistoricoStatusEnum.Falha,
2920
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2921
+ )
2922
+
2923
+ elif "Information" in window_title:
2924
+ console.print("Tela de NCM para o fornecedor...\n")
2925
+ if main_window.exists():
2926
+ console.print("Tela de NCM, clicando em NO para prosseguir...\n")
2927
+ main_window.type_keys("%n")
2928
+ return RpaRetornoProcessoDTO(
2929
+ sucesso=True,
2930
+ retorno="Tela de NCM - clicado em NO para andamento do processo",
2931
+ status=RpaHistoricoStatusEnum.Sucesso,
2932
+ )
2933
+
2758
2934
  except Exception as e:
2759
2935
  console.print(f"Erro ao tentar acessar TMessageForm: {e}")
2760
2936
  janela_aguarde = await is_window_open_by_class(
@@ -2780,180 +2956,7 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
2780
2956
  await worker_sleep(3)
2781
2957
  i += 1
2782
2958
 
2783
- window_title = main_window.window_text()
2784
-
2785
- if "Confirm" in window_title or "Seleciona Itens Fornecedor" in window_title:
2786
- console.print("Itens nao localizados para o fornecedor...\n")
2787
- if main_window.exists():
2788
- main_window.type_keys("%n")
2789
- await worker_sleep(10)
2790
-
2791
- console.print(
2792
- "Verificando a existencia de tela de selecionar Itens...\n"
2793
- )
2794
- itens_fornecedor = await is_window_open_by_class(
2795
- "TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor"
2796
- )
2797
-
2798
- if itens_fornecedor["IsOpened"] == True:
2799
- return RpaRetornoProcessoDTO(
2800
- sucesso=True,
2801
- retorno="Tela de Itens fornecedor - Multiplas referencias",
2802
- status=RpaHistoricoStatusEnum.Sucesso,
2803
- )
2804
- else:
2805
- console.print(
2806
- "Não possui a existencia de tela de selecionar Itens Fornecedor...\n"
2807
- )
2808
-
2809
- await worker_sleep(10)
2810
- console.print("Verificando a existe da tela dos itens com erro...\n")
2811
-
2812
- max_attempts = 60
2813
- i = 0
2814
- while i < max_attempts:
2815
- logs_erro = await is_window_open_by_class(
2816
- "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2817
- )
2818
- if logs_erro["IsOpened"] == True:
2819
- break
2820
- else:
2821
- console.print(
2822
- "Aguardando confirmação de tela de erro importação NFe...\n"
2823
- )
2824
- try:
2825
- app = Application().connect(class_name="TFrmAguarde")
2826
- main_window = app["TMessageForm"]
2827
- console.print("Janela 'Information' encontrada!")
2828
- window_title = main_window.window_text()
2829
- if "Information" in window_title:
2830
- main_window.type_keys("%n")
2831
- else:
2832
- console.print(
2833
- "Não possui a existencia de 'Information'...\n"
2834
- )
2835
- except:
2836
- console.print(
2837
- "Não possui a existencia de tela de Information...\n"
2838
- )
2839
- await worker_sleep(5)
2840
- i += 1
2841
-
2842
- await worker_sleep(5)
2843
- logs_erro = await is_window_open_by_class(
2844
- "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2845
- )
2846
- if logs_erro["IsOpened"] == True:
2847
- app = Application().connect(
2848
- class_name="TFrmExibeLogErroImportacaoNfe"
2849
- )
2850
- main_window = app["TFrmExibeLogErroImportacaoNfe"]
2851
- console.print(
2852
- "Tela com itens com erro existe, salvando os itens...\n"
2853
- )
2854
-
2855
- btn_save = main_window.child_window(
2856
- title="Salvar", class_name="TBitBtn"
2857
- )
2858
-
2859
- if btn_save.exists():
2860
- max_attempts = 3
2861
- i = 0
2862
- while i < max_attempts:
2863
- console.print("Clicando no botão de salvar...\n")
2864
- try:
2865
- btn_save.click()
2866
- except:
2867
- console.print(
2868
- "Não foi possivel clicar no Botão OK... \n"
2869
- )
2870
- await worker_sleep(3)
2871
-
2872
- console.print(
2873
- "Verificando a existencia da tela 'Salvar'...\n"
2874
- )
2875
- try:
2876
- app = Application().connect(title="Salvar")
2877
- main_window = app["Salvar"]
2878
- console.print("Tela 'Salvar' encontrada!")
2879
- break
2880
- except Exception as e:
2881
- console.print(
2882
- f"Tela 'Salvar' não encontrada. Tentativa {i + 1}/{max_attempts}."
2883
- )
2884
- i += 1
2885
-
2886
- if i == max_attempts:
2887
- return RpaRetornoProcessoDTO(
2888
- sucesso=False,
2889
- retorno="Número máximo de tentativas ao tentar conectar à tela 'Salvar'.",
2890
- status=RpaHistoricoStatusEnum.Falha,
2891
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2892
- )
2893
-
2894
- await worker_sleep(4)
2895
- console.print("Interagindo com a tela 'Salvar'...\n")
2896
- path_to_txt = (
2897
- f"C:\\Users\\{username}\\Downloads\\erro_itens{xml}.txt"
2898
- )
2899
-
2900
- main_window.type_keys("%n")
2901
- pyautogui.write(path_to_txt)
2902
- await worker_sleep(1)
2903
- main_window.type_keys("%l")
2904
- console.print("Arquivo salvo com sucesso...\n")
2905
-
2906
- await worker_sleep(3)
2907
- with open(
2908
- path_to_txt, "r", encoding="latin1", errors="replace"
2909
- ) as arquivo:
2910
- conteudo = arquivo.read()
2911
- console.print(
2912
- f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n"
2913
- )
2914
-
2915
- os.remove(path_to_txt)
2916
- console.print("Removendo o arquivo...\n")
2917
-
2918
- return RpaRetornoProcessoDTO(
2919
- sucesso=False,
2920
- retorno=f"Itens nao localizados p/ fornecedor. Mensagem: {conteudo}",
2921
- status=RpaHistoricoStatusEnum.Falha,
2922
- tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
2923
- )
2924
- else:
2925
- return RpaRetornoProcessoDTO(
2926
- sucesso=False,
2927
- retorno="Botao Salvar - Não foi encontrado",
2928
- status=RpaHistoricoStatusEnum.Falha,
2929
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2930
- )
2931
-
2932
- else:
2933
- return RpaRetornoProcessoDTO(
2934
- sucesso=False,
2935
- retorno="Tela 'TFrmExibeLogErroImportacaoNfe' não encontrada, tentar novamente...",
2936
- status=RpaHistoricoStatusEnum.Falha,
2937
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2938
- )
2939
- else:
2940
- return RpaRetornoProcessoDTO(
2941
- sucesso=False,
2942
- retorno="Erro não mapeado, pop-up Confirm não encontrado...",
2943
- status=RpaHistoricoStatusEnum.Falha,
2944
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2945
- )
2946
-
2947
- elif "Information" in window_title:
2948
- console.print("Tela de NCM para o fornecedor...\n")
2949
- if main_window.exists():
2950
- console.print("Tela de NCM, clicando em NO para prosseguir...\n")
2951
- main_window.type_keys("%n")
2952
- return RpaRetornoProcessoDTO(
2953
- sucesso=True,
2954
- retorno="Tela de NCM - clicado em NO para andamento do processo",
2955
- status=RpaHistoricoStatusEnum.Sucesso,
2956
- )
2959
+
2957
2960
 
2958
2961
  return RpaRetornoProcessoDTO(
2959
2962
  sucesso=True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: worker-automate-hub
3
- Version: 0.5.751
3
+ Version: 0.5.752
4
4
  Summary: Worker Automate HUB é uma aplicação para automatizar rotinas de RPA nos ambientes Argenta.
5
5
  Author: Joel Paim
6
6
  Requires-Python: >=3.12,<4.0
@@ -97,10 +97,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
97
97
  worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
98
98
  worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
99
99
  worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
100
- worker_automate_hub/utils/util.py,sha256=gFe4yrF2G6sToawOzlgRFWEJKlqtWYp4lXQFKgNQpZg,207420
100
+ worker_automate_hub/utils/util.py,sha256=Vqr7CxpvlegSKEjt8wwFYd154tetfFSxbRKxoTu0bhk,209934
101
101
  worker_automate_hub/utils/utils_nfe_entrada.py,sha256=TOXKSHOPxy8N3-ROpTGjNIHstX0i2b8qekcj1tRvjG8,38174
102
102
  worker_automate_hub/worker.py,sha256=uhZ3f-iaQ1i8cANbljp50vkYl-Xm0_sHtjwwF_2y72o,7191
103
- worker_automate_hub-0.5.751.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
104
- worker_automate_hub-0.5.751.dist-info/METADATA,sha256=InFgMNvp97iVLoHcgK3iTAbLr_12mSDwPfIAVHEC0mI,3049
105
- worker_automate_hub-0.5.751.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
- worker_automate_hub-0.5.751.dist-info/RECORD,,
103
+ worker_automate_hub-0.5.752.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
104
+ worker_automate_hub-0.5.752.dist-info/METADATA,sha256=GYTKD9VTG0QAT9bAJ_CGDN9q2GV9LxgKZGqzafGyT9c,3049
105
+ worker_automate_hub-0.5.752.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
+ worker_automate_hub-0.5.752.dist-info/RECORD,,