worker-automate-hub 0.5.331__py3-none-any.whl → 0.5.333__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.
@@ -3939,169 +3939,177 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
3939
3939
 
3940
3940
 
3941
3941
  #GERAR RELATORIO FINAL
3942
- await worker_sleep(2)
3943
- console.print(f"\nPesquisa: 'Relatório Boletim Caixa",style="bold green")
3944
- type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
3945
- pyautogui.press("enter")
3946
- await worker_sleep(2)
3947
- pyautogui.press("enter")
3948
- await worker_sleep(5)
3949
-
3950
- boletim_caixa_opened = await is_window_open_by_class("TFrmRelBoletimCaixa", "TFrmRelBoletimCaixa")
3951
- if boletim_caixa_opened["IsOpened"] == True:
3952
- console.print(f"\nRelatório Boletim Caixa esta aberta",style="bold green")
3953
- else:
3942
+ if nota.get("clienteFIDC").lower() == 'não':
3943
+ await worker_sleep(2)
3954
3944
  console.print(f"\nPesquisa: 'Relatório Boletim Caixa",style="bold green")
3955
3945
  type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
3956
3946
  pyautogui.press("enter")
3957
3947
  await worker_sleep(2)
3958
- pyautogui.press("tab")
3959
- await worker_sleep(1)
3960
- pyautogui.press("tab")
3961
- await worker_sleep(1)
3962
3948
  pyautogui.press("enter")
3963
3949
  await worker_sleep(5)
3964
3950
 
3951
+ boletim_caixa_opened = await is_window_open_by_class("TFrmRelBoletimCaixa", "TFrmRelBoletimCaixa")
3952
+ if boletim_caixa_opened["IsOpened"] == True:
3953
+ console.print(f"\nRelatório Boletim Caixa esta aberta",style="bold green")
3954
+ else:
3955
+ console.print(f"\nPesquisa: 'Relatório Boletim Caixa",style="bold green")
3956
+ type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
3957
+ pyautogui.press("enter")
3958
+ await worker_sleep(2)
3959
+ pyautogui.press("tab")
3960
+ await worker_sleep(1)
3961
+ pyautogui.press("tab")
3962
+ await worker_sleep(1)
3963
+ pyautogui.press("enter")
3964
+ await worker_sleep(5)
3965
3965
 
3966
3966
 
3967
- try:
3968
- app = Application().connect(class_name="TFrmRelBoletimCaixa", timeout=60)
3969
- main_window = app["TFrmRelBoletimCaixa"]
3970
- except Exception as e:
3971
- retorno = f"Não foi possivel abrir a tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
3972
- return RpaRetornoProcessoDTO(
3973
- sucesso=False,
3974
- retorno=retorno,
3975
- status=RpaHistoricoStatusEnum.Falha,
3976
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
3977
- )
3978
-
3979
-
3980
-
3981
3967
 
3982
- console.print(f"\nNavegando entre os elementos do Rel Boletim Caixa ",style="bold green")
3983
- try:
3984
- tgroup_box = main_window.child_window(class_name="TGroupBox", found_index=0)
3968
+ try:
3969
+ app = Application().connect(class_name="TFrmRelBoletimCaixa", timeout=60)
3970
+ main_window = app["TFrmRelBoletimCaixa"]
3971
+ except Exception as e:
3972
+ retorno = f"Não foi possivel abrir a tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
3973
+ return RpaRetornoProcessoDTO(
3974
+ sucesso=False,
3975
+ retorno=retorno,
3976
+ status=RpaHistoricoStatusEnum.Falha,
3977
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
3978
+ )
3985
3979
 
3986
- dt_inicio = tgroup_box.child_window(class_name="TDBIEditDate", found_index=0)
3987
- dt_inicio.set_edit_text(data_hoje)
3988
- dt_final = main_window.child_window(class_name="TDBIEditDate", found_index=1)
3989
- dt_final.set_edit_text(data_hoje)
3990
-
3991
- #SELECIONANDO A ESPECIE
3992
- select_especie = main_window.child_window(class_name="TDBIComboBox", found_index=0)
3993
- select_especie.click()
3994
- set_combobox("||List", "13 - DEVOLUCAO DE VENDA")
3995
- send_keys("%g")
3996
- except Exception as e:
3997
- retorno = f"Não foi possivel filtar Devolução de Venda na tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
3998
- return RpaRetornoProcessoDTO(
3999
- sucesso=False,
4000
- retorno=retorno,
4001
- status=RpaHistoricoStatusEnum.Falha,
4002
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4003
- )
4004
3980
 
4005
- #CLICANDO NO ICONE DE IMPRIMIR
4006
- await worker_sleep(10)
4007
- screen_width, screen_height = pyautogui.size()
4008
- x = 10
4009
- y = screen_height - 280 - (96 * 2) / .254
4010
- pyautogui.click(x,y)
4011
-
4012
-
4013
- #INTERAGINDO COM A TELA DE PRINT
4014
- try:
4015
- console.print("Interagindo com a tela 'PRINT'...\n")
4016
- app = Application().connect(class_name="TppPrintDialog", timeout=20)
4017
- main_window = app["TppPrintDialog"]
4018
- tpanel_btn_ok = main_window.child_window(class_name="TPanel", found_index=1)
4019
- btn_ok_print_screen = tpanel_btn_ok.child_window(class_name="TButton", found_index=1)
4020
- btn_ok_print_screen.click()
4021
- await worker_sleep(5)
4022
3981
 
4023
-
4024
- #INSERINDO O DIRETORIO E SALVANDO O ARQUIVO
4025
- app = Application().connect(title="Salvar Saída de Impressão como")
4026
- main_window = app["Dialog"]
4027
- console.print("Tela 'Salvar' encontrada!")
4028
3982
 
4029
- console.print("Interagindo com a tela 'Salvar'...\n")
4030
- username = getpass.getuser()
4031
- path_to_txt = f"C:\\Users\\{username}\\Downloads\\CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}"
3983
+ console.print(f"\nNavegando entre os elementos do Rel Boletim Caixa ",style="bold green")
3984
+ try:
3985
+ tgroup_box = main_window.child_window(class_name="TGroupBox", found_index=0)
3986
+
3987
+ dt_inicio = tgroup_box.child_window(class_name="TDBIEditDate", found_index=0)
3988
+ dt_inicio.set_edit_text(data_hoje)
3989
+ dt_final = main_window.child_window(class_name="TDBIEditDate", found_index=1)
3990
+ dt_final.set_edit_text(data_hoje)
3991
+
3992
+ #SELECIONANDO A ESPECIE
3993
+ select_especie = main_window.child_window(class_name="TDBIComboBox", found_index=0)
3994
+ select_especie.click()
3995
+ set_combobox("||List", "13 - DEVOLUCAO DE VENDA")
3996
+ send_keys("%g")
3997
+ except Exception as e:
3998
+ retorno = f"Não foi possivel filtar Devolução de Venda na tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
3999
+ return RpaRetornoProcessoDTO(
4000
+ sucesso=False,
4001
+ retorno=retorno,
4002
+ status=RpaHistoricoStatusEnum.Falha,
4003
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4004
+ )
4032
4005
 
4033
- main_window.type_keys("%n")
4034
- pyautogui.write(path_to_txt)
4035
- await worker_sleep(1)
4036
- main_window.type_keys("%l")
4037
- console.print("Arquivo salvo com sucesso...\n")
4006
+ #CLICANDO NO ICONE DE IMPRIMIR
4038
4007
  await worker_sleep(10)
4039
- except Exception as e:
4040
- retorno = f"Não foi possivel salvar o relatorio referente ao Boletim Caixa, erro {e}, \nEtapas Executadas:\n{steps}"
4041
- return RpaRetornoProcessoDTO(
4042
- sucesso=False,
4043
- retorno=retorno,
4044
- status=RpaHistoricoStatusEnum.Falha,
4045
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4046
- )
4047
-
4048
- txt = ""
4049
- with open(f"{path_to_txt}.pdf", "rb") as f:
4050
- reader = PdfReader(f)
4051
- for p in reader.pages:
4052
- txt += p.extract_text()
4053
-
4054
- console.print(f"Texto extraido {txt}...\n")
4055
- v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
4056
-
4057
- ultimo_valor = v[-1]
4058
- penultimo_valor = v[-2]
4008
+ screen_width, screen_height = pyautogui.size()
4009
+ x = 10
4010
+ y = screen_height - 280 - (96 * 2) / .254
4011
+ pyautogui.click(x,y)
4059
4012
 
4060
- if ultimo_valor == penultimo_valor:
4061
- console.print("Valores no relatorio corretamente gerados...\n")
4062
- with open(f"{path_to_txt}.pdf", 'rb') as file:
4063
- file_bytes = io.BytesIO(file.read())
4064
-
4065
- timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
4066
- desArquivo = f"CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}.pdf"
4013
+
4014
+ #INTERAGINDO COM A TELA DE PRINT
4067
4015
  try:
4068
- await send_file(historico_id, desArquivo, "pdf", file_bytes, file_extension="pdf")
4069
- os.remove(f"{path_to_txt}.pdf")
4070
- retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
4016
+ console.print("Interagindo com a tela 'PRINT'...\n")
4017
+ app = Application().connect(class_name="TppPrintDialog", timeout=20)
4018
+ main_window = app["TppPrintDialog"]
4019
+ tpanel_btn_ok = main_window.child_window(class_name="TPanel", found_index=1)
4020
+ btn_ok_print_screen = tpanel_btn_ok.child_window(class_name="TButton", found_index=1)
4021
+ btn_ok_print_screen.click()
4022
+ await worker_sleep(5)
4023
+
4024
+
4025
+ #INSERINDO O DIRETORIO E SALVANDO O ARQUIVO
4026
+ app = Application().connect(title="Salvar Saída de Impressão como")
4027
+ main_window = app["Dialog"]
4028
+ console.print("Tela 'Salvar' encontrada!")
4071
4029
 
4072
- try:
4073
- url_retorno = nota.get("urlRetorno")
4074
- identificador = nota.get("identificador")
4030
+ console.print("Interagindo com a tela 'Salvar'...\n")
4031
+ username = getpass.getuser()
4032
+ path_to_txt = f"C:\\Users\\{username}\\Downloads\\CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}"
4075
4033
 
4076
- if url_retorno and identificador:
4077
- await post_partner(url_retorno, identificador, numero_nota_fiscal, valor_nota_fiscal)
4078
- else:
4079
- console.print("Não foi possivel obter o valor de urlRetorno/identificador")
4080
- except:
4081
- console.print(f"Erro ao obter os dados ou enviar a requisição: {e}")
4082
-
4034
+ main_window.type_keys("%n")
4035
+ pyautogui.write(path_to_txt)
4036
+ await worker_sleep(1)
4037
+ main_window.type_keys("%l")
4038
+ console.print("Arquivo salvo com sucesso...\n")
4039
+ await worker_sleep(10)
4040
+ except Exception as e:
4041
+ retorno = f"Não foi possivel salvar o relatorio referente ao Boletim Caixa, erro {e}, \nEtapas Executadas:\n{steps}"
4083
4042
  return RpaRetornoProcessoDTO(
4084
- sucesso=True,
4043
+ sucesso=False,
4085
4044
  retorno=retorno,
4086
- status=RpaHistoricoStatusEnum.Sucesso)
4087
- except Exception as e:
4088
- result = f"Arquivo CAIXA 13 DEVOLUÇÃO gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {path_to_txt} !"
4089
- console.print(result, style="bold red")
4045
+ status=RpaHistoricoStatusEnum.Falha,
4046
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4047
+ )
4048
+
4049
+ txt = ""
4050
+ with open(f"{path_to_txt}.pdf", "rb") as f:
4051
+ reader = PdfReader(f)
4052
+ for p in reader.pages:
4053
+ txt += p.extract_text()
4054
+
4055
+ console.print(f"Texto extraido {txt}...\n")
4056
+ v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
4057
+
4058
+ ultimo_valor = v[-1]
4059
+ penultimo_valor = v[-2]
4060
+
4061
+ if ultimo_valor == penultimo_valor:
4062
+ console.print("Valores no relatorio corretamente gerados...\n")
4063
+ with open(f"{path_to_txt}.pdf", 'rb') as file:
4064
+ file_bytes = io.BytesIO(file.read())
4065
+
4066
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
4067
+ desArquivo = f"CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}.pdf"
4068
+ try:
4069
+ await send_file(historico_id, desArquivo, "pdf", file_bytes, file_extension="pdf")
4070
+ os.remove(f"{path_to_txt}.pdf")
4071
+ retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
4072
+
4073
+ try:
4074
+ url_retorno = nota.get("urlRetorno")
4075
+ identificador = nota.get("identificador")
4076
+
4077
+ if url_retorno and identificador:
4078
+ await post_partner(url_retorno, identificador, numero_nota_fiscal, valor_nota_fiscal)
4079
+ else:
4080
+ console.print("Não foi possivel obter o valor de urlRetorno/identificador")
4081
+ except:
4082
+ console.print(f"Erro ao obter os dados ou enviar a requisição: {e}")
4083
+
4084
+ return RpaRetornoProcessoDTO(
4085
+ sucesso=True,
4086
+ retorno=retorno,
4087
+ status=RpaHistoricoStatusEnum.Sucesso)
4088
+ except Exception as e:
4089
+ result = f"Arquivo CAIXA 13 DEVOLUÇÃO gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {path_to_txt} !"
4090
+ console.print(result, style="bold red")
4091
+ return RpaRetornoProcessoDTO(
4092
+ sucesso=False,
4093
+ retorno=result,
4094
+ status=RpaHistoricoStatusEnum.Falha,
4095
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4096
+ )
4097
+ else:
4098
+ os.remove(f"{path_to_txt}.pdf")
4090
4099
  return RpaRetornoProcessoDTO(
4091
4100
  sucesso=False,
4092
- retorno=result,
4101
+ retorno=f"O valor de entrada {penultimo_valor} não esta batendo com o valor de saída {ultimo_valor}, por favor verificar. \nEtapas Executadas:\n{steps}",
4093
4102
  status=RpaHistoricoStatusEnum.Falha,
4094
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
4103
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
4095
4104
  )
4096
4105
  else:
4097
- os.remove(f"{path_to_txt}.pdf")
4106
+ console.print("Cliente FIDC não é necessario gerar relatorio final, encerrando processo.")
4107
+ retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
4098
4108
  return RpaRetornoProcessoDTO(
4099
- sucesso=False,
4100
- retorno=f"O valor de entrada {penultimo_valor} não esta batendo com o valor de saída {ultimo_valor}, por favor verificar. \nEtapas Executadas:\n{steps}",
4101
- status=RpaHistoricoStatusEnum.Falha,
4102
- tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
4109
+ sucesso=True,
4110
+ retorno=retorno,
4111
+ status=RpaHistoricoStatusEnum.Sucesso
4103
4112
  )
4104
-
4105
4113
  except Exception as ex:
4106
4114
  retorno = f"Erro Processo Devolução Prazo a Faturar: {str(ex)} \nEtapas Executadas:\n{steps}"
4107
4115
  logger.error(retorno)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: worker-automate-hub
3
- Version: 0.5.331
3
+ Version: 0.5.333
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
@@ -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=l75ybIiVb9VIo6dhiEoszFOaJIJq7dUbkGLNtqGDHXw,243961
45
+ worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=D-2GK0kstyP0Rql7OoMidDuwzMEGPCEr-em3nIBi-no,244991
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
@@ -85,7 +85,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
85
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.331.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
89
- worker_automate_hub-0.5.331.dist-info/METADATA,sha256=160zZC56WQlRv-qL1CES4poUbcwE3Pw2O2LikJ_T4NQ,3041
90
- worker_automate_hub-0.5.331.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
91
- worker_automate_hub-0.5.331.dist-info/RECORD,,
88
+ worker_automate_hub-0.5.333.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
89
+ worker_automate_hub-0.5.333.dist-info/METADATA,sha256=m0zyv0BG3VbkHoEaYX5NAVSrlvxqtnaksYV-wtVc6wQ,3041
90
+ worker_automate_hub-0.5.333.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
91
+ worker_automate_hub-0.5.333.dist-info/RECORD,,