worker-automate-hub 0.5.749__py3-none-any.whl → 0.5.912__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.
Files changed (36) hide show
  1. worker_automate_hub/api/client.py +186 -68
  2. worker_automate_hub/api/rpa_historico_service.py +1 -0
  3. worker_automate_hub/cli.py +91 -111
  4. worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +112 -229
  5. worker_automate_hub/tasks/jobs/descartes.py +91 -77
  6. worker_automate_hub/tasks/jobs/devolucao_produtos.py +1386 -0
  7. worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +3 -46
  8. worker_automate_hub/tasks/jobs/entrada_de_notas_22.py +833 -0
  9. worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +29 -9
  10. worker_automate_hub/tasks/jobs/entrada_de_notas_37.py +619 -0
  11. worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +1 -1
  12. worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +63 -16
  13. worker_automate_hub/tasks/jobs/extracao_dados_nielsen.py +504 -0
  14. worker_automate_hub/tasks/jobs/extracao_saldo_estoque.py +242 -108
  15. worker_automate_hub/tasks/jobs/extracao_saldo_estoque_fiscal.py +688 -0
  16. worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +2 -2
  17. worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +25 -16
  18. worker_automate_hub/tasks/jobs/geracao_balancetes_filial.py +330 -0
  19. worker_automate_hub/tasks/jobs/importacao_extratos.py +538 -0
  20. worker_automate_hub/tasks/jobs/importacao_extratos_748.py +800 -0
  21. worker_automate_hub/tasks/jobs/inclusao_pedidos_ipiranga.py +222 -0
  22. worker_automate_hub/tasks/jobs/inclusao_pedidos_raizen.py +174 -0
  23. worker_automate_hub/tasks/jobs/inclusao_pedidos_vibra.py +327 -0
  24. worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +438 -157
  25. worker_automate_hub/tasks/jobs/opex_capex.py +540 -326
  26. worker_automate_hub/tasks/jobs/sped_fiscal.py +8 -8
  27. worker_automate_hub/tasks/jobs/transferencias.py +52 -41
  28. worker_automate_hub/tasks/task_definitions.py +46 -1
  29. worker_automate_hub/tasks/task_executor.py +11 -0
  30. worker_automate_hub/utils/util.py +252 -215
  31. worker_automate_hub/utils/utils_nfe_entrada.py +1 -1
  32. worker_automate_hub/worker.py +1 -9
  33. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/METADATA +4 -2
  34. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/RECORD +36 -25
  35. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/WHEEL +1 -1
  36. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/entry_points.txt +0 -0
@@ -338,8 +338,28 @@ async def login_emsys_fiscal(
338
338
  category=UserWarning,
339
339
  message="32-bit application should be automated using 32-bit Python",
340
340
  )
341
+ await worker_sleep(2)
342
+ filial_cod = (
343
+ task.configEntrada.get("empresa")
344
+ or task.configEntrada.get("filialEmpresaOrigem")
345
+ or task.configEntrada.get("descricaoFilial")
346
+ )
347
+
348
+ # Extrai apenas os dígitos iniciais da string
349
+ num = None
350
+ if filial_cod is not None:
351
+ s = str(filial_cod).strip()
352
+ m = re.match(r'^(\d+)', s) # pega o número do INÍCIO
353
+ if not m:
354
+ m = re.search(r'\d+', s) # fallback: primeiro número que aparecer
355
+ if m:
356
+ num = m.group(1)
341
357
 
342
- filial_cod = task.configEntrada.get("empresa")
358
+ if num is None:
359
+ raise ValueError(f"Não foi possível extrair número de: {filial_cod!r}")
360
+
361
+ filial_cod = num
362
+
343
363
  console.print(f"Empresa a ser processada: {filial_cod}")
344
364
 
345
365
  try:
@@ -493,7 +513,7 @@ async def login_emsys_fiscal(
493
513
  )
494
514
  else:
495
515
  i = i + 1
496
- await worker_sleep(1)
516
+ await worker_sleep(3)
497
517
 
498
518
  if i >= max_attempts:
499
519
  return RpaRetornoProcessoDTO(
@@ -702,10 +722,23 @@ async def login_emsys_old(
702
722
  )
703
723
 
704
724
  #Login novo
705
- async def login_emsys(config: dict, app, task: RpaProcessoEntradaDTO, **kwargs):
706
- # Para processos onde a config_entrada é enviada vazia, obtemos
707
- # o número da filial através do **kwargs
708
- filial_origem = kwargs.get("filial_origem", None)
725
+ async def login_emsys(config: dict, app, task: RpaProcessoEntradaDTO, filial_origem=None, **kwargs):
726
+ # Fonte de verdade: param explícito > kwargs > task.configEntrada
727
+ filial_origem = (
728
+ filial_origem
729
+ or kwargs.get("filial_origem")
730
+ or kwargs.get("descricaoFilial")
731
+ or (getattr(task, "configEntrada", {}) or {}).get("descricaoFilial")
732
+ or (getattr(task, "configEntrada", {}) or {}).get("codigoEmpresa")
733
+ or (getattr(task, "configEntrada", {}) or {}).get("filialEmpresaOrigem")
734
+ )
735
+
736
+ # Extrai só o número (ex.: "69" de "69 - Gravataí Free Way")
737
+ if filial_origem:
738
+ m = re.search(r"\d+", str(filial_origem))
739
+ if m:
740
+ filial_origem = m.group(0)
741
+
709
742
  warnings.filterwarnings(
710
743
  "ignore",
711
744
  category=UserWarning,
@@ -888,27 +921,31 @@ async def send_to_webhook(
888
921
  "valor_nota": valor_nota,
889
922
  }
890
923
 
891
- try:
892
- async with aiohttp.ClientSession(
893
- connector=aiohttp.TCPConnector(verify_ssl=True)
894
- ) as session:
895
- async with session.post(f"{urlSimplifica}", data=data) as response:
896
- if response.status != 200:
897
- raise Exception(f"Erro ao enviar notificacao: {response.text()}")
898
-
899
- data = await response.text()
900
- log_msg = f"\nSucesso ao enviar {data}\n para o webhook"
901
- console.print(
902
- log_msg,
903
- style="bold green",
904
- )
905
- logger.info(log_msg)
906
-
907
- except Exception as e:
908
- err_msg = f"Erro ao comunicar com endpoint do webhoook: {e}"
909
- console.print(f"\n{err_msg}\n", style="bold red")
910
- logger.info(err_msg)
911
-
924
+ i = 0
925
+ while i < 5:
926
+ try:
927
+
928
+ async with aiohttp.ClientSession(
929
+ connector=aiohttp.TCPConnector(verify_ssl=True)
930
+ ) as session:
931
+ async with session.post(f"{urlSimplifica}", data=data) as response:
932
+ if response.status != 200:
933
+ raise Exception(f"Erro ao enviar notificacao: {response.text()}")
934
+
935
+ data = await response.text()
936
+ log_msg = f"\nSucesso ao enviar {data}\n para o webhook"
937
+ console.print(
938
+ log_msg,
939
+ style="bold green",
940
+ )
941
+ logger.info(log_msg)
942
+ break
943
+ except Exception as e:
944
+ err_msg = f"Erro ao comunicar com endpoint do webhoook: {e}"
945
+ console.print(f"\n{err_msg}\n", style="bold red")
946
+ logger.info(err_msg)
947
+ i += 1
948
+ await worker_sleep(3)
912
949
 
913
950
  def add_start_on_boot_to_registry():
914
951
  import winreg as reg
@@ -1996,7 +2033,7 @@ async def faturar_pre_venda(task: RpaProcessoEntradaDTO) -> dict:
1996
2033
  await worker_sleep(2)
1997
2034
  console.print(f"Clicou em: 'Faturar'", style="bold green")
1998
2035
 
1999
- await worker_sleep(10)
2036
+ await worker_sleep(20)
2000
2037
 
2001
2038
  # Aviso "Deseja faturar pré-venda?"
2002
2039
  button_yes = (918, 557) # find_target_position(screenshot_path, "yes", attempts=15)
@@ -2023,7 +2060,7 @@ async def faturar_pre_venda(task: RpaProcessoEntradaDTO) -> dict:
2023
2060
  logger.info(log_msg)
2024
2061
  console.print(log_msg, style="bold yellow")
2025
2062
 
2026
- await worker_sleep(8)
2063
+ await worker_sleep(13)
2027
2064
 
2028
2065
  # Seleciona Modelo
2029
2066
  console.log("Selecionando o modelo...\n", style="bold green")
@@ -2034,11 +2071,8 @@ async def faturar_pre_venda(task: RpaProcessoEntradaDTO) -> dict:
2034
2071
  combo_box_model = main_window.child_window(
2035
2072
  class_name="TDBIComboBox", found_index=1
2036
2073
  )
2037
- combo_box_model.click()
2038
-
2039
- await worker_sleep(3)
2040
- set_combobox("||List", "NFe - NOTA FISCAL ELETRONICA PROPRIA - DANFE SERIE 077")
2041
- await worker_sleep(3)
2074
+ combo_box_model.select("NFe - NOTA FISCAL ELETRONICA PROPRIA - DANFE SERIE 077")
2075
+
2042
2076
 
2043
2077
  except Exception as e:
2044
2078
 
@@ -2365,7 +2399,7 @@ async def extract_group_by_itens(itens):
2365
2399
  f"Tentando obter o formato no primeiro regex - item {descricao}.. \n"
2366
2400
  )
2367
2401
  try:
2368
- match = re.search(r"\((\d+)X(\d+)(L|KG)?\)", descricao)
2402
+ match = re.search(r"\((\d+)X(\d+(?:[.,]\d+)?)(L|KG)?\)", descricao)
2369
2403
  formato = match.group(0) if match else None
2370
2404
  except Exception as e:
2371
2405
  console.print(
@@ -2754,7 +2788,183 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
2754
2788
  else:
2755
2789
  break
2756
2790
 
2757
- await worker_sleep(3)
2791
+ await worker_sleep(7)
2792
+
2793
+ window_title = main_window.window_text()
2794
+
2795
+ if "Confirm" in window_title or "Seleciona Itens Fornecedor" in window_title:
2796
+ console.print("Itens nao localizados para o fornecedor...\n")
2797
+ if main_window.exists():
2798
+ main_window.type_keys("%n")
2799
+ await worker_sleep(10)
2800
+
2801
+ console.print(
2802
+ "Verificando a existencia de tela de selecionar Itens...\n"
2803
+ )
2804
+ itens_fornecedor = await is_window_open_by_class(
2805
+ "TFrmSelecionaItensFornecedor", "TFrmSelecionaItensFornecedor"
2806
+ )
2807
+
2808
+ if itens_fornecedor["IsOpened"] == True:
2809
+ return RpaRetornoProcessoDTO(
2810
+ sucesso=True,
2811
+ retorno="Tela de Itens fornecedor - Multiplas referencias",
2812
+ status=RpaHistoricoStatusEnum.Sucesso,
2813
+ )
2814
+ else:
2815
+ console.print(
2816
+ "Não possui a existencia de tela de selecionar Itens Fornecedor...\n"
2817
+ )
2818
+
2819
+ await worker_sleep(10)
2820
+ console.print("Verificando a existe da tela dos itens com erro...\n")
2821
+
2822
+ max_attempts = 60
2823
+ i = 0
2824
+ while i < max_attempts:
2825
+ logs_erro = await is_window_open_by_class(
2826
+ "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2827
+ )
2828
+ if logs_erro["IsOpened"] == True:
2829
+ break
2830
+ else:
2831
+ console.print(
2832
+ "Aguardando confirmação de tela de erro importação NFe...\n"
2833
+ )
2834
+ try:
2835
+ app = Application().connect(class_name="TFrmAguarde")
2836
+ main_window = app["TMessageForm"]
2837
+ console.print("Janela 'Information' encontrada!")
2838
+ window_title = main_window.window_text()
2839
+ if "Information" in window_title:
2840
+ main_window.type_keys("%n")
2841
+ else:
2842
+ console.print(
2843
+ "Não possui a existencia de 'Information'...\n"
2844
+ )
2845
+ except:
2846
+ console.print(
2847
+ "Não possui a existencia de tela de Information...\n"
2848
+ )
2849
+ await worker_sleep(5)
2850
+ i += 1
2851
+
2852
+ await worker_sleep(5)
2853
+ logs_erro = await is_window_open_by_class(
2854
+ "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
2855
+ )
2856
+ if logs_erro["IsOpened"] == True:
2857
+ app = Application().connect(
2858
+ class_name="TFrmExibeLogErroImportacaoNfe"
2859
+ )
2860
+ main_window = app["TFrmExibeLogErroImportacaoNfe"]
2861
+ console.print(
2862
+ "Tela com itens com erro existe, salvando os itens...\n"
2863
+ )
2864
+
2865
+ btn_save = main_window.child_window(
2866
+ title="Salvar", class_name="TBitBtn"
2867
+ )
2868
+
2869
+ if btn_save.exists():
2870
+ max_attempts = 3
2871
+ i = 0
2872
+ while i < max_attempts:
2873
+ console.print("Clicando no botão de salvar...\n")
2874
+ try:
2875
+ btn_save.click()
2876
+ except:
2877
+ console.print(
2878
+ "Não foi possivel clicar no Botão OK... \n"
2879
+ )
2880
+ await worker_sleep(3)
2881
+
2882
+ console.print(
2883
+ "Verificando a existencia da tela 'Salvar'...\n"
2884
+ )
2885
+ try:
2886
+ app = Application().connect(title="Salvar")
2887
+ main_window = app["Salvar"]
2888
+ console.print("Tela 'Salvar' encontrada!")
2889
+ break
2890
+ except Exception as e:
2891
+ console.print(
2892
+ f"Tela 'Salvar' não encontrada. Tentativa {i + 1}/{max_attempts}."
2893
+ )
2894
+ i += 1
2895
+
2896
+ if i == max_attempts:
2897
+ return RpaRetornoProcessoDTO(
2898
+ sucesso=False,
2899
+ retorno="Número máximo de tentativas ao tentar conectar à tela 'Salvar'.",
2900
+ status=RpaHistoricoStatusEnum.Falha,
2901
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2902
+ )
2903
+
2904
+ await worker_sleep(4)
2905
+ console.print("Interagindo com a tela 'Salvar'...\n")
2906
+ path_to_txt = (
2907
+ f"C:\\Users\\{username}\\Downloads\\erro_itens{xml}.txt"
2908
+ )
2909
+
2910
+ main_window.type_keys("%n")
2911
+ pyautogui.write(path_to_txt)
2912
+ await worker_sleep(1)
2913
+ main_window.type_keys("%l")
2914
+ console.print("Arquivo salvo com sucesso...\n")
2915
+
2916
+ await worker_sleep(3)
2917
+ with open(
2918
+ path_to_txt, "r", encoding="latin1", errors="replace"
2919
+ ) as arquivo:
2920
+ conteudo = arquivo.read()
2921
+ console.print(
2922
+ f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n"
2923
+ )
2924
+
2925
+ os.remove(path_to_txt)
2926
+ console.print("Removendo o arquivo...\n")
2927
+
2928
+ return RpaRetornoProcessoDTO(
2929
+ sucesso=False,
2930
+ retorno=f"Itens nao localizados p/ fornecedor. Mensagem: {conteudo}",
2931
+ status=RpaHistoricoStatusEnum.Falha,
2932
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
2933
+ )
2934
+ else:
2935
+ return RpaRetornoProcessoDTO(
2936
+ sucesso=False,
2937
+ retorno="Botao Salvar - Não foi encontrado",
2938
+ status=RpaHistoricoStatusEnum.Falha,
2939
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2940
+ )
2941
+
2942
+ else:
2943
+ return RpaRetornoProcessoDTO(
2944
+ sucesso=False,
2945
+ retorno="Tela 'TFrmExibeLogErroImportacaoNfe' não encontrada, tentar novamente...",
2946
+ status=RpaHistoricoStatusEnum.Falha,
2947
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2948
+ )
2949
+ else:
2950
+ return RpaRetornoProcessoDTO(
2951
+ sucesso=False,
2952
+ retorno="Erro não mapeado, pop-up Confirm não encontrado...",
2953
+ status=RpaHistoricoStatusEnum.Falha,
2954
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
2955
+ )
2956
+
2957
+ elif "Information" in window_title:
2958
+ console.print("Tela de NCM para o fornecedor...\n")
2959
+ if main_window.exists():
2960
+ console.print("Tela de NCM, clicando em NO para prosseguir...\n")
2961
+ main_window.type_keys("%n")
2962
+ return RpaRetornoProcessoDTO(
2963
+ sucesso=True,
2964
+ retorno="Tela de NCM - clicado em NO para andamento do processo",
2965
+ status=RpaHistoricoStatusEnum.Sucesso,
2966
+ )
2967
+
2758
2968
  except Exception as e:
2759
2969
  console.print(f"Erro ao tentar acessar TMessageForm: {e}")
2760
2970
  janela_aguarde = await is_window_open_by_class(
@@ -2780,180 +2990,7 @@ async def itens_not_found_supplier(xml: str) -> RpaRetornoProcessoDTO:
2780
2990
  await worker_sleep(3)
2781
2991
  i += 1
2782
2992
 
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
- )
2993
+
2957
2994
 
2958
2995
  return RpaRetornoProcessoDTO(
2959
2996
  sucesso=True,
@@ -3433,7 +3470,7 @@ async def check_nota_importada(xml_nota: str) -> RpaRetornoProcessoDTO:
3433
3470
  from worker_automate_hub.api.client import get_status_nf_emsys
3434
3471
 
3435
3472
  try:
3436
- max_attempts = 100
3473
+ max_attempts = 10
3437
3474
  i = 0
3438
3475
 
3439
3476
  while i < max_attempts:
@@ -3442,7 +3479,7 @@ async def check_nota_importada(xml_nota: str) -> RpaRetornoProcessoDTO:
3442
3479
  break
3443
3480
  else:
3444
3481
  console.print(f"Aguardando confirmação de nota incluida...\n")
3445
- await worker_sleep(8)
3482
+ await worker_sleep(13)
3446
3483
  i += 1
3447
3484
  try:
3448
3485
  status_nf_emsys = await get_status_nf_emsys(int(xml_nota))
@@ -4996,7 +5033,7 @@ async def get_text_display_window(dados_texto):
4996
5033
 
4997
5034
  async def wait_nf_ready():
4998
5035
  current_try = 0
4999
- max_tries = 60
5036
+ max_tries = 100
5000
5037
  while current_try < max_tries:
5001
5038
  window_closed = await wait_window_close("Aguarde...")
5002
5039
  if not window_closed:
@@ -5004,7 +5041,7 @@ async def wait_nf_ready():
5004
5041
  try:
5005
5042
  window = desktop.window(title_re="Aguarde...")
5006
5043
  if window.exists():
5007
- await worker_sleep(30)
5044
+ await worker_sleep(5)
5008
5045
  current_try += 1
5009
5046
  continue
5010
5047
  except Exception as e:
@@ -5070,7 +5107,7 @@ async def wait_nf_ready():
5070
5107
 
5071
5108
  else:
5072
5109
  current_try +=1
5073
- await worker_sleep(15)
5110
+ await worker_sleep(5)
5074
5111
  continue
5075
5112
 
5076
5113
  return {"sucesso": False, "retorno": f"Número máximo de tentativas excedido ao tentar transmitir a nota"}
@@ -330,7 +330,7 @@ class EMSys:
330
330
  # pyautogui.click(893, 549)
331
331
  await worker_sleep(5)
332
332
  try:
333
- caminho_imagem = "assets\\banco_boleto.png"
333
+ caminho_imagem = "assets\\entrada_de_notas_16\\banco_boleto.png"
334
334
  # Verifica se apareceu a imagem de "sem dados"
335
335
  localizacao = pyautogui.locateOnScreen(caminho_imagem, confidence=0.9)
336
336
  if localizacao:
@@ -54,17 +54,9 @@ async def check_and_execute_tasks(stop_event: threading.Event):
54
54
  if task is not None:
55
55
  processo_existe = await is_uuid_in_tasks(task.uuidProcesso)
56
56
  if processo_existe:
57
- i = 0
58
- while i < 10:
59
- try:
60
- await burn_queue(task.uuidFila)
61
- break
62
- except:
63
- i += 1
64
- await asyncio.sleep(5)
65
- pass
66
57
  logger.info(f"Executando a task: {task.nomProcesso}")
67
58
  await perform_task(task)
59
+
68
60
  else:
69
61
  log_message = f"O processo [{task.nomProcesso}] não existe no Worker [{worker_config['NOME_ROBO']}] e foi removido da fila."
70
62
  console.print(f"\n{log_message}\n", style="yellow")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: worker-automate-hub
3
- Version: 0.5.749
3
+ Version: 0.5.912
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
@@ -10,6 +10,7 @@ Classifier: Natural Language :: Portuguese (Brazilian)
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
13
14
  Classifier: Topic :: Utilities
14
15
  Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
15
16
  Requires-Dist: beautifulsoup4 (>=4.12.3,<5.0.0)
@@ -49,6 +50,7 @@ Requires-Dist: timedelta (>=2020.12.3,<2021.0.0)
49
50
  Requires-Dist: toml (>=0.10.2,<0.11.0)
50
51
  Requires-Dist: torch (>=2.4.0,<3.0.0)
51
52
  Requires-Dist: typer (>=0.12.3,<0.13.0)
53
+ Requires-Dist: unidecode (>=1.4.0,<2.0.0)
52
54
  Requires-Dist: webdriver-manager (>=4.0.2,<5.0.0)
53
55
  Requires-Dist: win10toast (>=0.9,<0.10)
54
56
  Requires-Dist: xhtml2pdf (>=0.2.16,<0.3.0)