worker-automate-hub 0.4.395__tar.gz → 0.4.396__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/PKG-INFO +1 -1
  2. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/pyproject.toml +1 -1
  3. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/sped_fiscal.py +114 -3
  4. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/README.md +0 -0
  5. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/__init__.py +0 -0
  6. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/__init__.py +0 -0
  7. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/ahead_service.py +0 -0
  8. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/client.py +0 -0
  9. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/helpers/__init__.py +0 -0
  10. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
  11. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/api/rpa_historico_service.py +0 -0
  12. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/cli.py +0 -0
  13. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/config/__init__.py +0 -0
  14. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/config/settings.py +0 -0
  15. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/config.py +0 -0
  16. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/core/so_manipulation.py +0 -0
  17. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/__init__.py +0 -0
  18. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/deprecation.py +0 -0
  19. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/rate_limit.py +0 -0
  20. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/repeat.py +0 -0
  21. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/retry.py +0 -0
  22. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/singleton.py +0 -0
  23. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/decorators/timeit.py +0 -0
  24. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/__init__.py +0 -0
  25. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dao/__init__.py +0 -0
  26. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
  27. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
  28. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
  29. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dto/__init__.py +0 -0
  30. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
  31. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
  32. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
  33. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/__init__.py +0 -0
  34. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
  35. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
  36. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
  37. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
  38. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
  39. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
  40. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
  41. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
  42. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
  43. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
  44. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
  45. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
  46. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
  47. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
  48. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
  49. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
  50. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
  51. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
  52. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
  53. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
  54. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
  55. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
  56. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
  57. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
  58. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
  59. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
  60. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/playground.py +0 -0
  61. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
  62. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/task_definitions.py +0 -0
  63. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/tasks/task_executor.py +0 -0
  64. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/__init__.py +0 -0
  65. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/env.py +0 -0
  66. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
  67. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/logger.py +0 -0
  68. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/toast.py +0 -0
  69. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/updater.py +0 -0
  70. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/util.py +0 -0
  71. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
  72. {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.396}/worker_automate_hub/worker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worker-automate-hub
3
- Version: 0.4.395
3
+ Version: 0.4.396
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.4.395"
3
+ version = "0.4.396"
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"
@@ -3,18 +3,22 @@ import warnings
3
3
  import os
4
4
  import io
5
5
  import uuid
6
- from datetime import datetime
6
+ from datetime import datetime,date
7
+ import calendar
7
8
 
8
9
  import pyautogui
10
+ import pyperclip
9
11
  import pytesseract
10
12
  from pywinauto.application import Application
13
+ from pywinauto.mouse import double_click
14
+ from pywinauto.keyboard import send_keys
15
+ import win32clipboard
11
16
  from PIL import Image, ImageEnhance
12
17
  from rich.console import Console
13
18
 
14
19
  from worker_automate_hub.api.client import (
15
20
  get_config_by_name,
16
21
  send_file,
17
- get_historico_by_processo_identificador,
18
22
  )
19
23
 
20
24
  from worker_automate_hub.models.dto.rpa_historico_request_dto import (
@@ -47,6 +51,8 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
47
51
  """
48
52
  try:
49
53
  # Get config from BOF
54
+ get_config_gerar_inventario = await get_config_by_name("SPED_gerar_inventario")
55
+ gerar_inventario = get_config_gerar_inventario["conConfiguracao"]["gerar"]
50
56
  config = await get_config_by_name("login_emsys")
51
57
  console.print(task)
52
58
 
@@ -210,9 +216,114 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
210
216
  retorno=f"Erro ao interagir com a tela de gerar sped fiscal, erro: {e}",
211
217
  status=RpaHistoricoStatusEnum.Falha,
212
218
  )
219
+
220
+ ano_atual = datetime.now().year
221
+ if str(periodo_dt) == f"02/{ano_atual}":
222
+ console.print("Filtrando período pelo Inventario...\n")
223
+ ano_passado = ano_atual - 1
224
+ data_busca = f"31/12/{ano_passado}"
213
225
 
226
+ periodo_filtro_inicio = main_window.child_window(class_name="TEditDate", found_index=1)
227
+ periodo_filtro_inicio.set_edit_text(data_busca)
228
+ await worker_sleep(2)
229
+ periodo_filtro_fim = main_window.child_window(class_name="TEditDate", found_index=0)
230
+ periodo_filtro_fim.set_edit_text(data_busca)
231
+ await worker_sleep(2)
232
+ periodo_btn_buscar = main_window.child_window(class_name="TBitBtn", found_index=0)
233
+ periodo_btn_buscar.click()
234
+ await worker_sleep(2)
235
+ periodo_btn_buscar = main_window.child_window(class_name="TcxGrid", found_index=0)
236
+ rect = periodo_btn_buscar.rectangle()
237
+ center_x = (rect.left + rect.right) // 2
238
+ center_y = (rect.top + rect.bottom) // 2
239
+ double_click(coords=(center_x, center_y))
240
+ elif gerar_inventario:
241
+ mes_atual = datetime.now().month
242
+ if mes_atual == 1:
243
+ mes_anterior = 12
244
+ ano_anterior = ano_atual - 1
245
+ else:
246
+ mes_anterior = mes_atual - 1
247
+ ano_anterior = ano_atual
248
+
249
+ ultimo_dia = calendar.monthrange(ano_anterior, mes_anterior)[1]
250
+ data_ultimo_dia = date(ano_anterior, mes_anterior, ultimo_dia)
251
+ data_formatada = data_ultimo_dia.strftime("%d/%m/%Y")
252
+
253
+ periodo_filtro_inicio = main_window.child_window(class_name="TEditDate", found_index=1)
254
+ periodo_filtro_inicio.set_edit_text(data_formatada)
255
+ await worker_sleep(2)
256
+ periodo_filtro_fim = main_window.child_window(class_name="TEditDate", found_index=0)
257
+ periodo_filtro_fim.set_edit_text(data_formatada)
258
+ await worker_sleep(2)
259
+ periodo_btn_buscar = main_window.child_window(class_name="TBitBtn", found_index=0)
260
+ periodo_btn_buscar.click()
261
+ await worker_sleep(2)
262
+ grid_inventario = main_window.child_window(class_name="TcxGrid", found_index=0)
263
+ rect = grid_inventario.rectangle()
264
+ center_x = (rect.left + rect.right) // 2
265
+ center_y = (rect.top + rect.bottom) // 2
266
+ grid_inventario.click_input(coords=(center_x, center_y))
267
+ await worker_sleep(2)
268
+ send_keys("^({HOME})")
269
+ pyperclip.copy('')
270
+ await worker_sleep(3)
214
271
 
215
- await worker_sleep(2)
272
+ while True:
273
+ last_line_inventario_emsys_fiscal = 'x'
274
+ await worker_sleep(1)
275
+ with pyautogui.hold('ctrl'):
276
+ pyautogui.press('c')
277
+
278
+ await worker_sleep(1)
279
+
280
+ with pyautogui.hold('ctrl'):
281
+ pyautogui.press('c')
282
+
283
+ win32clipboard.OpenClipboard()
284
+ line_inventario_emsys_fiscal = win32clipboard.GetClipboardData().strip()
285
+ win32clipboard.CloseClipboard()
286
+ console.print(f"Linha atual copiada do Emsys Fiscal: {line_inventario_emsys_fiscal}\nUltima Linha copiada: {last_line_inventario_emsys_fiscal}")
287
+
288
+ if len(line_inventario_emsys_fiscal) <= 4:
289
+ return RpaRetornoProcessoDTO(
290
+ sucesso=False,
291
+ retorno=f"Erro: Nenhum registro encontrado com a data informada {periodo_btn_buscar}.",
292
+ status=RpaHistoricoStatusEnum.Falha,
293
+ )
294
+
295
+
296
+ if 'no final do' in line_inventario_emsys_fiscal.lower():
297
+ selecionar_registro_full_path = "assets\\emsys\\button_selecionar_registro_fiscal.png"
298
+ try:
299
+ button_location = pyautogui.locateCenterOnScreen(selecionar_registro_full_path, confidence=0.6)
300
+ if button_location:
301
+ pyautogui.click(button_location)
302
+ console.print("Botão 'Selecionar Registro' clicado com sucesso!")
303
+ break
304
+ except Exception as e:
305
+ return RpaRetornoProcessoDTO(
306
+ sucesso=False,
307
+ retorno=f"Erro: Não foi clicar na opção Selecionar Registro no Inventario, erro: {e}.",
308
+ status=RpaHistoricoStatusEnum.Falha,
309
+ )
310
+
311
+
312
+ if bool(line_inventario_emsys_fiscal):
313
+ if last_line_inventario_emsys_fiscal == line_inventario_emsys_fiscal:
314
+ return RpaRetornoProcessoDTO(
315
+ sucesso=False,
316
+ retorno=f"Erro: Não foi encontrado a opção do período de busca {periodo_filtro_inicio} nas opções do inventário.",
317
+ status=RpaHistoricoStatusEnum.Falha,
318
+ )
319
+ else:
320
+ last_line_inventario_emsys_fiscal = line_inventario_emsys_fiscal
321
+ pyautogui.press('down')
322
+
323
+ else:
324
+ console.print("Mês não é igual a Fevereiro e SPED Inventario é falso, seguindo com a geração do SPED...\n")
325
+
326
+ await worker_sleep(3)
216
327
  pesquisar_full_path = "assets\\emsys\\button_gerar_sped_fiscal.png"
217
328
  try:
218
329
  button_location = pyautogui.locateCenterOnScreen(pesquisar_full_path, confidence=0.6)