worker-automate-hub 0.5.816__tar.gz → 0.5.818__tar.gz

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.

Potentially problematic release.


This version of worker-automate-hub might be problematic. Click here for more details.

Files changed (109) hide show
  1. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/PKG-INFO +1 -1
  2. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/pyproject.toml +1 -1
  3. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/geracao_balancetes_filial.py +83 -48
  4. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/README.md +0 -0
  5. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/__init__.py +0 -0
  6. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/__init__.py +0 -0
  7. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/ahead_service.py +0 -0
  8. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/client.py +0 -0
  9. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/datalake_service.py +0 -0
  10. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/helpers/__init__.py +0 -0
  11. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
  12. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/rdp_service.py +0 -0
  13. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/rpa_fila_service.py +0 -0
  14. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/rpa_historico_service.py +0 -0
  15. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/api/webhook_service.py +0 -0
  16. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/cli.py +0 -0
  17. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/config/__init__.py +0 -0
  18. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/config/settings.py +0 -0
  19. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/config.py +0 -0
  20. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/core/so_manipulation.py +0 -0
  21. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/__init__.py +0 -0
  22. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/deprecation.py +0 -0
  23. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/rate_limit.py +0 -0
  24. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/repeat.py +0 -0
  25. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/retry.py +0 -0
  26. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/singleton.py +0 -0
  27. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/decorators/timeit.py +0 -0
  28. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/__init__.py +0 -0
  29. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/__init__.py +0 -0
  30. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
  31. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/rpa_fila.py +0 -0
  32. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
  33. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
  34. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dao/rpa_robo.py +0 -0
  35. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/__init__.py +0 -0
  36. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
  37. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
  38. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
  39. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/rpa_sap_dto.py +0 -0
  40. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
  41. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/__init__.py +0 -0
  42. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
  43. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +0 -0
  44. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
  45. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
  46. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/cte_manual.py +0 -0
  47. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/cte_xml.py +0 -0
  48. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
  49. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/devolucao_ctf.py +0 -0
  50. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/devolucao_ctf_35.py +0 -0
  51. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +0 -0
  52. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
  53. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
  54. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
  55. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
  56. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
  57. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
  58. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_cte_1353.py +0 -0
  59. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_cte_333.py +0 -0
  60. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
  61. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
  62. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
  63. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_22.py +0 -0
  64. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
  65. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
  66. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
  67. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
  68. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_37.py +0 -0
  69. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
  70. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
  71. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_503.py +0 -0
  72. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
  73. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
  74. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
  75. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/entrada_de_notas_9000.py +0 -0
  76. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
  77. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/extracao_fechamento_contabil.py +0 -0
  78. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/extracao_fechamento_emsys.py +0 -0
  79. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/extracao_saldo_estoque.py +0 -0
  80. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/extracao_saldo_estoque_fiscal.py +0 -0
  81. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +0 -0
  82. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/fidc_exportacao_docs_portal_b2b.py +0 -0
  83. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
  84. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
  85. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py +0 -0
  86. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py +0 -0
  87. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py +0 -0
  88. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/integracao_contabil.py +0 -0
  89. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +0 -0
  90. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py +0 -0
  91. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/lancamento_rateio.py +0 -0
  92. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
  93. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +0 -0
  94. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +0 -0
  95. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/opex_capex.py +0 -0
  96. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/playground.py +0 -0
  97. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
  98. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
  99. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/task_definitions.py +0 -0
  100. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/tasks/task_executor.py +0 -0
  101. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/__init__.py +0 -0
  102. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/env.py +0 -0
  103. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
  104. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/logger.py +0 -0
  105. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/toast.py +0 -0
  106. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/updater.py +0 -0
  107. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/util.py +0 -0
  108. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
  109. {worker_automate_hub-0.5.816 → worker_automate_hub-0.5.818}/worker_automate_hub/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worker-automate-hub
3
- Version: 0.5.816
3
+ Version: 0.5.818
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "worker-automate-hub"
3
- version = "0.5.816"
3
+ version = "0.5.818"
4
4
  description = "Worker Automate HUB é uma aplicação para automatizar rotinas de RPA nos ambientes Argenta."
5
5
  authors = ["Joel Paim"]
6
6
  readme = "README.md"
@@ -4,6 +4,7 @@ import sys
4
4
  import os
5
5
  import io
6
6
  from pywinauto.keyboard import send_keys
7
+
7
8
  # sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
8
9
  from worker_automate_hub.models.dto.rpa_historico_request_dto import (
9
10
  RpaHistoricoStatusEnum,
@@ -21,15 +22,14 @@ from worker_automate_hub.utils.util import (
21
22
  from rich.console import Console
22
23
  import pyautogui
23
24
  from datetime import datetime
25
+
24
26
  # from dateutil.relativedelta import relativedelta
25
27
  from PIL import ImageFilter, ImageEnhance
26
28
  from pytesseract import image_to_string
27
29
  from pywinauto import Application, Desktop
28
30
  import subprocess
29
31
  import os
30
- from worker_automate_hub.api.client import (
31
- get_config_by_name, send_file
32
- )
32
+ from worker_automate_hub.api.client import get_config_by_name, send_file
33
33
  from worker_automate_hub.utils.utils_nfe_entrada import EMSys
34
34
  import psutil
35
35
  from time import sleep
@@ -69,7 +69,9 @@ async def open_contabil_processes():
69
69
  console.print(f"Error: {error}")
70
70
 
71
71
 
72
- async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
72
+ async def geracao_balancetes_filial(
73
+ task: RpaProcessoEntradaDTO,
74
+ ) -> RpaRetornoProcessoDTO:
73
75
  try:
74
76
  await kill_all_emsys()
75
77
  await open_contabil_processes()
@@ -112,7 +114,7 @@ async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
112
114
  await worker_sleep(4)
113
115
  pyautogui.write(config.conConfiguracao.get("pass"))
114
116
  pyautogui.press("enter")
115
-
117
+
116
118
  await worker_sleep(10)
117
119
 
118
120
  main_window = None
@@ -151,17 +153,23 @@ async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
151
153
  win = app.window(class_name="TFrmBalancete")
152
154
 
153
155
  # Seus índices: inicial = found_index=1, final = found_index=0
154
- ctrl_inicial = win.child_window(class_name="TRzEditDate", found_index=1).wrapper_object()
155
- ctrl_final = win.child_window(class_name="TRzEditDate", found_index=0).wrapper_object()
156
+ ctrl_inicial = win.child_window(
157
+ class_name="TRzEditDate", found_index=1
158
+ ).wrapper_object()
159
+ ctrl_final = win.child_window(
160
+ class_name="TRzEditDate", found_index=0
161
+ ).wrapper_object()
156
162
 
157
163
  # ---- Inicial ----
158
164
  try:
159
- ctrl_inicial.set_edit_text(periodo_inicial) # tenta via WM_SETTEXT
165
+ ctrl_inicial.set_edit_text(periodo_inicial) # tenta via WM_SETTEXT
160
166
  except Exception:
161
167
  ctrl_inicial.set_focus()
162
168
  ctrl_inicial.click_input()
163
- send_keys('^a{DELETE}')
164
- send_keys(periodo_inicial.replace('/', '')) # fallback: digita só dígitos (máscara)
169
+ send_keys("^a{DELETE}")
170
+ send_keys(
171
+ periodo_inicial.replace("/", "")
172
+ ) # fallback: digita só dígitos (máscara)
165
173
 
166
174
  # ---- Final ----
167
175
  try:
@@ -169,58 +177,76 @@ async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
169
177
  except Exception:
170
178
  ctrl_final.set_focus()
171
179
  ctrl_final.click_input()
172
- send_keys('^a{DELETE}')
173
- send_keys(periodo_final.replace('/', ''))
174
-
175
- await worker_sleep(2)
176
-
180
+ send_keys("^a{DELETE}")
181
+ send_keys(periodo_final.replace("/", ""))
182
+
183
+ await worker_sleep(4)
184
+
177
185
  console.print("Selecionar detalhada por centro de custo..")
178
- detalhada = win.child_window(
179
- class_name="TRzComboBox", found_index=0
180
- )
186
+ detalhada = win.child_window(class_name="TRzComboBox", found_index=0)
181
187
  detalhada.select("Centro de Custo")
182
-
183
- await worker_sleep(2)
188
+
189
+ await worker_sleep(6)
184
190
 
185
191
  console.print("Selecionar considerar contas analíticas zerada")
186
- contas_analit_zeradas = win.child_window(class_name="TRzCheckBox", found_index=2).click()
192
+ contas_analit_zeradas = win.child_window(
193
+ class_name="TRzCheckBox", found_index=2
194
+ ).click()
195
+
196
+ await worker_sleep(4)
187
197
 
188
198
  console.print("Selecionar considerar contas sintéticas zerada")
189
- contas_sint_zeradas = win.child_window(class_name="TRzCheckBox", found_index=0).click()
199
+ contas_sint_zeradas = win.child_window(
200
+ class_name="TRzCheckBox", found_index=0
201
+ ).click()
202
+
203
+ await worker_sleep(4)
190
204
 
191
205
  console.print("Selecionar por filiais")
192
- selec_filiais = win.child_window(class_name="TRzCheckBox", found_index=3).click()
206
+ selec_filiais = win.child_window(
207
+ class_name="TRzCheckBox", found_index=3
208
+ ).click()
209
+
210
+ await worker_sleep(4)
193
211
 
194
212
  console.print("Selecionar CSV")
195
213
  selec_csv = win.child_window(class_name="TRzComboBox", found_index=1)
196
214
  selec_csv.select("Arquivo CSV")
197
215
 
216
+ await worker_sleep(4)
217
+
198
218
  console.print("Clicar em gerar relatório")
199
- btn_gerar_relatorio = win.child_window(class_name="TBitBtn", found_index=0).click()
219
+ btn_gerar_relatorio = win.child_window(
220
+ class_name="TBitBtn", found_index=0
221
+ ).click()
200
222
 
201
223
  # Selecionar filial
202
- app = Application(backend="win32").connect(title="Seleção de Empresas", timeout=10)
203
- dlg = app.window(title ="Seleção de Empresas")
224
+ app = Application(backend="win32").connect(
225
+ title="Seleção de Empresas", timeout=10
226
+ )
227
+ dlg = app.window(title="Seleção de Empresas")
204
228
  edit = dlg.child_window(class_name="TEdit", found_index=0).wrapper_object()
205
229
 
206
230
  # Tenta via WM_SETTEXT
207
231
  try:
208
232
  edit.set_focus()
209
- edit.set_edit_text("") # limpa
210
- edit.set_edit_text("3") # escreve
233
+ edit.set_edit_text("") # limpa
234
+ edit.set_edit_text("3") # escreve
211
235
  except Exception:
212
236
  # Fallback: digita como teclado
213
237
  edit.set_focus()
214
238
  edit.click_input()
215
- send_keys('^a{DELETE}')
239
+ send_keys("^a{DELETE}")
216
240
  send_keys("3", with_spaces=True)
217
241
 
218
242
  await worker_sleep(3)
219
-
243
+
220
244
  # Marcar filial
221
245
  imagem_alvo = "assets\\geracao_bal_filial\\btn_selec_uma_filial.png"
222
246
 
223
- btn_sect_uma = pyautogui.locateCenterOnScreen(imagem_alvo, confidence=0.9) # requer opencv-python
247
+ btn_sect_uma = pyautogui.locateCenterOnScreen(
248
+ imagem_alvo, confidence=0.9
249
+ ) # requer opencv-python
224
250
  if btn_sect_uma: # se achou, clica
225
251
  pyautogui.click(btn_sect_uma)
226
252
 
@@ -228,53 +254,62 @@ async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
228
254
 
229
255
  # aguarda até a janela "Gera Arquivo CSV (Excel)" existir (ou ficar visível)
230
256
  csv_win = Desktop(backend="win32").window(title="Gera Arquivo CSV (Excel)")
231
- csv_win.wait('exists', timeout=3600)
257
+ csv_win.wait("exists", timeout=3600)
232
258
 
233
259
  app_csv = Application(backend="win32").connect(title="Gera Arquivo CSV (Excel)")
234
260
  dlg_csv = app_csv.window(title="Gera Arquivo CSV (Excel)")
235
261
  edit = dlg_csv.child_window(class_name="Edit", found_index=0)
236
262
  # Tenta via WM_SETTEXT (mais estável)
237
263
  try:
238
- periodo_inicial = periodo_inicial.replace("/","")
239
- periodo_final = periodo_final.replace("/","")
264
+ periodo_inicial = periodo_inicial.replace("/", "")
265
+ periodo_final = periodo_final.replace("/", "")
240
266
  edit.set_focus()
241
- edit.set_edit_text("") # limpa
242
- edit.set_edit_text(fr"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}")
267
+ edit.set_edit_text("") # limpa
268
+ edit.set_edit_text(
269
+ rf"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}"
270
+ )
243
271
  except Exception:
244
272
  # Fallback: digita como teclado
245
273
  edit.set_focus()
246
274
  edit.click_input()
247
- send_keys('^a{DELETE}')
248
- send_keys(fr"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}", with_spaces=True)
275
+ send_keys("^a{DELETE}")
276
+ send_keys(
277
+ rf"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}",
278
+ with_spaces=True,
279
+ )
249
280
 
250
281
  # Clicar em salvar
251
- app = Application(backend="win32").connect(title="Gera Arquivo CSV (Excel)", timeout=10)
252
- dlg = app.window(title ="Gera Arquivo CSV (Excel)")
282
+ app = Application(backend="win32").connect(
283
+ title="Gera Arquivo CSV (Excel)", timeout=10
284
+ )
285
+ dlg = app.window(title="Gera Arquivo CSV (Excel)")
253
286
  btn_salvar = dlg.child_window(class_name="Button", found_index=0).click()
254
287
 
255
288
  await worker_sleep(3)
256
289
 
257
290
  # Janela confirmação clicar em OK
258
291
  app = Application(backend="win32").connect(title="Informação", timeout=10)
259
- dlg = app.window(title ="Informação")
292
+ dlg = app.window(title="Informação")
260
293
  btn_ok = dlg.child_window(class_name="Button", found_index=0).click()
261
294
 
262
295
  console.print("Arquivo salvo com sucesso...\n")
263
296
  await worker_sleep(3)
264
- path_to_txt = fr"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}"
297
+ path_to_txt = rf"C:\Users\automatehub\Downloads\balancete_{periodo_inicial}_{periodo_final}_{filial}"
265
298
 
266
- with open(f"{path_to_txt}.csv", 'rb') as file:
299
+ with open(f"{path_to_txt}.csv", "rb") as file:
267
300
  file_bytes = io.BytesIO(file.read())
268
301
 
269
302
  timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
270
303
  desArquivo = f"balancete_{periodo_inicial}_{periodo_final}_{filial}.csv"
271
304
  try:
272
- await send_file(historico_id, desArquivo, "csv", file_bytes, file_extension="csv")
273
- os.remove(path_to_txt+".csv")
305
+ await send_file(
306
+ historico_id, desArquivo, "csv", file_bytes, file_extension="csv"
307
+ )
308
+ os.remove(path_to_txt + ".csv")
274
309
  return RpaRetornoProcessoDTO(
275
310
  sucesso=True,
276
311
  retorno="Balancete gerado com sucesso",
277
- status=RpaHistoricoStatusEnum.Sucesso
312
+ status=RpaHistoricoStatusEnum.Sucesso,
278
313
  )
279
314
  except Exception as e:
280
315
  result = f"Arquivo balancete 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}!"
@@ -283,9 +318,9 @@ async def geracao_balancetes_filial(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
283
318
  sucesso=False,
284
319
  retorno=result,
285
320
  status=RpaHistoricoStatusEnum.Falha,
286
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
321
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
287
322
  )
288
-
323
+
289
324
  except Exception as erro:
290
325
  return RpaRetornoProcessoDTO(
291
326
  sucesso=False,