worker-automate-hub 0.5.721__tar.gz → 0.5.727__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.
Files changed (103) hide show
  1. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/PKG-INFO +1 -1
  2. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/pyproject.toml +1 -1
  3. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +2 -2
  4. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +172 -114
  5. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/util.py +18 -3
  6. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/utils_nfe_entrada.py +3 -0
  7. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/worker.py +3 -2
  8. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/README.md +0 -0
  9. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/__init__.py +0 -0
  10. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/__init__.py +0 -0
  11. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/ahead_service.py +0 -0
  12. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/client.py +0 -0
  13. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/datalake_service.py +0 -0
  14. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/helpers/__init__.py +0 -0
  15. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
  16. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/rdp_service.py +0 -0
  17. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/rpa_fila_service.py +0 -0
  18. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/rpa_historico_service.py +0 -0
  19. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/api/webhook_service.py +0 -0
  20. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/cli.py +0 -0
  21. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/config/__init__.py +0 -0
  22. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/config/settings.py +0 -0
  23. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/config.py +0 -0
  24. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/core/so_manipulation.py +0 -0
  25. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/__init__.py +0 -0
  26. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/deprecation.py +0 -0
  27. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/rate_limit.py +0 -0
  28. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/repeat.py +0 -0
  29. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/retry.py +0 -0
  30. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/singleton.py +0 -0
  31. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/decorators/timeit.py +0 -0
  32. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/__init__.py +0 -0
  33. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/__init__.py +0 -0
  34. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
  35. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/rpa_fila.py +0 -0
  36. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
  37. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
  38. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dao/rpa_robo.py +0 -0
  39. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/__init__.py +0 -0
  40. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
  41. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
  42. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
  43. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/rpa_sap_dto.py +0 -0
  44. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
  45. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/__init__.py +0 -0
  46. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
  47. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +0 -0
  48. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
  49. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
  50. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/cte_manual.py +0 -0
  51. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/cte_xml.py +0 -0
  52. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
  53. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/devolucao_ctf.py +0 -0
  54. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/devolucao_ctf_35.py +0 -0
  55. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +0 -0
  56. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
  57. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
  58. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
  59. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
  60. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
  61. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
  62. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_cte_1353.py +0 -0
  63. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_cte_333.py +0 -0
  64. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
  65. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
  66. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
  67. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
  68. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
  69. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
  70. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
  71. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
  72. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_503.py +0 -0
  73. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
  74. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
  75. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/entrada_de_notas_9000.py +0 -0
  76. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
  77. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/extracao_fechamento_contabil.py +0 -0
  78. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/extracao_fechamento_emsys.py +0 -0
  79. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +0 -0
  80. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/fidc_exportacao_docs_portal_b2b.py +0 -0
  81. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
  82. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
  83. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py +0 -0
  84. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py +0 -0
  85. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py +0 -0
  86. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/integracao_contabil.py +0 -0
  87. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +0 -0
  88. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py +0 -0
  89. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/lancamento_rateio.py +0 -0
  90. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
  91. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +0 -0
  92. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +0 -0
  93. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/playground.py +0 -0
  94. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
  95. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
  96. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/task_definitions.py +0 -0
  97. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/tasks/task_executor.py +0 -0
  98. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/__init__.py +0 -0
  99. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/env.py +0 -0
  100. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
  101. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/logger.py +0 -0
  102. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/toast.py +0 -0
  103. {worker_automate_hub-0.5.721 → worker_automate_hub-0.5.727}/worker_automate_hub/utils/updater.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: worker-automate-hub
3
- Version: 0.5.721
3
+ Version: 0.5.727
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.721"
3
+ version = "0.5.727"
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"
@@ -596,8 +596,8 @@ async def entrada_de_notas_15(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
596
596
  await emsys.incluir_registro()
597
597
  await worker_sleep(5)
598
598
 
599
- await emsys.verify_warning_and_error("Warning", "No")
600
- await emsys.verify_warning_and_error("Warning", "&No")
599
+ # await emsys.verify_warning_and_error("Warning", "No")
600
+ # await emsys.verify_warning_and_error("Warning", "&No")
601
601
 
602
602
  try:
603
603
  erro_pop_up = await is_window_open("Information")
@@ -59,59 +59,59 @@ pyautogui.PAUSE = 0.5
59
59
  pyautogui.FAILSAFE = False
60
60
  console = Console()
61
61
 
62
+
62
63
  async def parse_copied_content(content):
63
- lines = content.strip().split("\n")
64
- data_list = []
65
- i = 0
66
- while i < len(lines):
67
- line = lines[i].strip()
68
- if line.startswith("Código"):
69
- headers_line = line
70
- headers = headers_line.split("\t")
71
- i += 1
72
- if i < len(lines):
73
- data_line = lines[i].strip()
74
- data = data_line.split("\t")
75
- if len(headers) == len(data):
76
- item_dict = dict(zip(headers, data))
77
- data_list.append(item_dict)
78
- else:
79
- console.print(
80
- "Número de cabeçalhos e dados não correspondem.",
81
- style="bold red",
82
- )
83
- console.print(f"Cabeçalhos: {headers}")
84
- console.print(f"Dados: {data}")
64
+ lines = content.strip().split("\n")
65
+ data_list = []
66
+ i = 0
67
+ while i < len(lines):
68
+ line = lines[i].strip()
69
+ if line.startswith("Código"):
70
+ headers_line = line
71
+ headers = headers_line.split("\t")
72
+ i += 1
73
+ if i < len(lines):
74
+ data_line = lines[i].strip()
75
+ data = data_line.split("\t")
76
+ if len(headers) == len(data):
77
+ item_dict = dict(zip(headers, data))
78
+ data_list.append(item_dict)
85
79
  else:
86
80
  console.print(
87
- "Sem linha de dados após cabeçalho.", style="bold red"
81
+ "Número de cabeçalhos e dados não correspondem.",
82
+ style="bold red",
88
83
  )
89
- i += 1
84
+ console.print(f"Cabeçalhos: {headers}")
85
+ console.print(f"Dados: {data}")
90
86
  else:
91
- i += 1
87
+ console.print("Sem linha de dados após cabeçalho.", style="bold red")
88
+ i += 1
89
+ else:
90
+ i += 1
91
+
92
+ final_list = []
93
+ for item in data_list:
94
+ try:
95
+ new_item = {
96
+ "codigo": int(item["Código"]),
97
+ "descricao": item["Descrição"],
98
+ "curto": float(item["R$ Curto"].replace(".", "").replace(",", ".")),
99
+ "custo_min": float(
100
+ item["R$ Custo Min."]
101
+ .replace("worker_automate_hub/utils/utils_nfe_entrada.py.", "")
102
+ .replace(",", ".")
103
+ ),
104
+ "custo_max": float(
105
+ item["R$ Custo Máx."].replace(".", "").replace(",", ".")
106
+ ),
107
+ }
108
+ final_list.append(new_item)
109
+ except Exception as e:
110
+ console.print(
111
+ f"Erro ao processar item: {item}. Erro: {e}", style="bold red"
112
+ )
113
+ return final_list
92
114
 
93
- final_list = []
94
- for item in data_list:
95
- try:
96
- new_item = {
97
- "codigo": int(item["Código"]),
98
- "descricao": item["Descrição"],
99
- "curto": float(item["R$ Curto"].replace(".", "").replace(",", ".")),
100
- "custo_min": float(
101
- item["R$ Custo Min."]
102
- .replace("worker_automate_hub/utils/utils_nfe_entrada.py.", "")
103
- .replace(",", ".")
104
- ),
105
- "custo_max": float(
106
- item["R$ Custo Máx."].replace(".", "").replace(",", ".")
107
- ),
108
- }
109
- final_list.append(new_item)
110
- except Exception as e:
111
- console.print(
112
- f"Erro ao processar item: {item}. Erro: {e}", style="bold red"
113
- )
114
- return final_list
115
115
 
116
116
  async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
117
117
  """
@@ -173,7 +173,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
173
173
  sucesso=False,
174
174
  retorno=document_type.retorno,
175
175
  status=RpaHistoricoStatusEnum.Falha,
176
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
176
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
177
177
  )
178
178
 
179
179
  await worker_sleep(4)
@@ -187,7 +187,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
187
187
  sucesso=False,
188
188
  retorno=imported_nfe.retorno,
189
189
  status=RpaHistoricoStatusEnum.Falha,
190
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
190
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
191
191
  )
192
192
 
193
193
  await worker_sleep(5)
@@ -208,7 +208,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
208
208
  sucesso=False,
209
209
  retorno=warning_work.retorno,
210
210
  status=RpaHistoricoStatusEnum.Falha,
211
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
211
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
212
212
  )
213
213
 
214
214
  # VERIFICANDO A EXISTENCIA DE ERRO
@@ -219,7 +219,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
219
219
  sucesso=error_work.sucesso,
220
220
  retorno=error_work.retorno,
221
221
  status=error_work.status,
222
- tags=error_work.tags
222
+ tags=error_work.tags,
223
223
  )
224
224
 
225
225
  app = Application().connect(
@@ -240,7 +240,6 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
240
240
  f"A chave recebimentoFisico não está presente na config de entrada...\n"
241
241
  )
242
242
 
243
-
244
243
  # INTERAGINDO COM A NATUREZA DA OPERACAO
245
244
  cfop = int(nota.get("cfop"))
246
245
  console.print(f"Inserindo a informação da CFOP, caso se aplique {cfop} ...\n")
@@ -270,7 +269,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
270
269
  sucesso=False,
271
270
  retorno=f"Erro mapeado, CFOP diferente de 5655 ou 56, necessario ação manual ou ajuste no robo",
272
271
  status=RpaHistoricoStatusEnum.Falha,
273
- tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
272
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
274
273
  )
275
274
 
276
275
  try:
@@ -294,28 +293,39 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
294
293
  await worker_sleep(2)
295
294
 
296
295
  console.print(f"Obtendo item com multiplas referências...\n")
297
- console.print(f"Tirando print da janela para realização do OCR...\n")
296
+ console.print(
297
+ f"Tirando print da janela para realização do OCR...\n"
298
+ )
298
299
 
299
300
  text_captured = False
300
301
  count_while = 0
301
302
  max_attempts = 3
302
- item_da_nota = ''
303
+ item_da_nota = ""
303
304
 
304
305
  while count_while < max_attempts:
305
306
  window_rect = window.rectangle()
306
- console.print(f"Area que sera utulizada para o screenshot {window_rect}...\n")
307
+ console.print(
308
+ f"Area que sera utulizada para o screenshot {window_rect}...\n"
309
+ )
307
310
  screenshot = window.capture_as_image()
308
311
 
309
312
  username = getpass.getuser()
310
- short_uuid = str(uuid.uuid4()).replace('-', '')[:6]
311
- path_to_png = f"C:\\Users\\{username}\\Downloads\\{short_uuid}.png"
313
+ short_uuid = str(uuid.uuid4()).replace("-", "")[:6]
314
+ path_to_png = (
315
+ f"C:\\Users\\{username}\\Downloads\\{short_uuid}.png"
316
+ )
312
317
  screenshot.save(path_to_png)
313
- while not os.path.exists(path_to_png) or os.path.getsize(path_to_png) == 0:
318
+ while (
319
+ not os.path.exists(path_to_png)
320
+ or os.path.getsize(path_to_png) == 0
321
+ ):
314
322
  time.sleep(0.1)
315
323
  console.print(f"Print salvo em {path_to_png}...\n")
316
324
 
317
325
  await worker_sleep(2)
318
- console.print("Preparando a imagem para maior resolução e assertividade no OCR...\n")
326
+ console.print(
327
+ "Preparando a imagem para maior resolução e assertividade no OCR...\n"
328
+ )
319
329
  image = Image.open(path_to_png)
320
330
  image = image.convert("L")
321
331
  enhancer = ImageEnhance.Contrast(image)
@@ -328,36 +338,52 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
328
338
 
329
339
  console.print("Realizando OCR...\n")
330
340
  captured_text = pytesseract.image_to_string(image)
331
- console.print(f"Texto Full capturado {captured_text}, tentando obter o item da nota...\n")
341
+ console.print(
342
+ f"Texto Full capturado {captured_text}, tentando obter o item da nota...\n"
343
+ )
332
344
 
333
345
  match = re.search(r"Item da Nota:\s*(.*)\s*", captured_text)
334
346
  if os.path.exists(path_to_png):
335
347
  os.remove(path_to_png)
336
- console.print(f"Imagem apagada com sucesso do diretorio {path_to_png}... \n")
348
+ console.print(
349
+ f"Imagem apagada com sucesso do diretorio {path_to_png}... \n"
350
+ )
337
351
  else:
338
- console.print(f"Imagem não encontrada para realização do OCR... \n")
352
+ console.print(
353
+ f"Imagem não encontrada para realização do OCR... \n"
354
+ )
339
355
 
340
356
  console.print(f"Texto extraido do RegEx: {match}... \n")
341
357
  if match:
342
358
  item_da_nota = match.group(1).strip()
343
- console.print(f"Item da Nota capturado: {item_da_nota}... \n")
359
+ console.print(
360
+ f"Item da Nota capturado: {item_da_nota}... \n"
361
+ )
344
362
  text_captured = True
345
363
  break
346
364
  else:
347
365
  if match:
348
366
  item_da_nota = match.group(1).strip()
349
- console.print(f"Item da Nota capturado: {item_da_nota}... \n")
367
+ console.print(
368
+ f"Item da Nota capturado: {item_da_nota}... \n"
369
+ )
350
370
  text_captured = True
351
371
  break
352
372
  else:
353
- match = re.search(r"Item da (Nota|Nata|N0ta)\s*(.*)\s*", captured_text)
373
+ match = re.search(
374
+ r"Item da (Nota|Nata|N0ta)\s*(.*)\s*", captured_text
375
+ )
354
376
  if match:
355
377
  item_da_nota = match.group(1).strip()
356
- console.print(f"Item da Nota capturado: {item_da_nota}... \n")
378
+ console.print(
379
+ f"Item da Nota capturado: {item_da_nota}... \n"
380
+ )
357
381
  text_captured = True
358
382
  break
359
383
  else:
360
- console.print(f"Tentativa {count_while + 1} de {max_attempts} falhou. Tentando novamente...\n")
384
+ console.print(
385
+ f"Tentativa {count_while + 1} de {max_attempts} falhou. Tentando novamente...\n"
386
+ )
361
387
  count_while += 1
362
388
 
363
389
  if not text_captured:
@@ -365,7 +391,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
365
391
  sucesso=False,
366
392
  retorno="Quantidade de tentativa atingida (3), não foi possivel capturar o item da nota com multiplas referencias para andamento no processo",
367
393
  status=RpaHistoricoStatusEnum.Falha,
368
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
394
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
369
395
  )
370
396
 
371
397
  console.print(
@@ -461,10 +487,12 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
461
487
  sucesso=False,
462
488
  retorno=f"Não foi possivel encontrar o item mais proximo ao item da nota com multiplas referencias {itens_nao_semelhantes}",
463
489
  status=RpaHistoricoStatusEnum.Falha,
464
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
490
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
465
491
  )
466
492
  except Exception as error:
467
- console.print("Erro durante a trativa de multiplas referencias, erro : {error}")
493
+ console.print(
494
+ "Erro durante a trativa de multiplas referencias, erro : {error}"
495
+ )
468
496
 
469
497
  # INTERAGINDO COM O CAMPO ALMOXARIFADO
470
498
  filialEmpresaOrigem = nota.get("filialEmpresaOrigem")
@@ -490,10 +518,12 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
490
518
  sucesso=False,
491
519
  retorno=f"Erro ao iterar itens de almoxarifado: {e}",
492
520
  status=RpaHistoricoStatusEnum.Falha,
493
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
521
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
494
522
  )
495
-
496
- window.child_window(title="Manter Natureza de Operação selecionada", control_type="CheckBox").click()
523
+
524
+ window.child_window(
525
+ title="Manter Natureza de Operação selecionada", control_type="CheckBox"
526
+ ).click()
497
527
 
498
528
  await worker_sleep(2)
499
529
  console.print("Clicando em OK... \n")
@@ -546,7 +576,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
546
576
  "sucesso": False,
547
577
  "retorno": f"Número máximo de tentativas atingido, Não foi possivel finalizar os trabalhos na tela de Informações para importação da Nota Fiscal Eletrônica",
548
578
  }
549
-
579
+
550
580
  await worker_sleep(2)
551
581
  waiting_for_delay = await carregamento_import_xml()
552
582
  if waiting_for_delay.sucesso:
@@ -556,12 +586,14 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
556
586
  sucesso=False,
557
587
  retorno=waiting_for_delay.retorno,
558
588
  status=RpaHistoricoStatusEnum.Falha,
559
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
589
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
560
590
  )
561
591
 
562
592
  try:
563
593
  console.print("Verificando itens não localizados ou NCM...\n")
564
- itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
594
+ itens_by_supplier = await is_window_open_by_class(
595
+ "TFrmAguarde", "TMessageForm"
596
+ )
565
597
 
566
598
  if itens_by_supplier["IsOpened"] == True:
567
599
  itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
@@ -574,17 +606,19 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
574
606
  sucesso=False,
575
607
  retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
576
608
  status=RpaHistoricoStatusEnum.Falha,
577
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
609
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
578
610
  )
579
-
580
- logs_erro = await is_window_open_by_class("TFrmExibeLogErroImportacaoNfe","TFrmExibeLogErroImportacaoNfe")
611
+
612
+ logs_erro = await is_window_open_by_class(
613
+ "TFrmExibeLogErroImportacaoNfe", "TFrmExibeLogErroImportacaoNfe"
614
+ )
581
615
  if logs_erro["IsOpened"] == True:
582
616
  errors_genetared = await errors_generate_after_import(nota.get("nfe"))
583
617
  return RpaRetornoProcessoDTO(
584
618
  sucesso=False,
585
619
  retorno=errors_genetared.retorno,
586
620
  status=RpaHistoricoStatusEnum.Falha,
587
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
621
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
588
622
  )
589
623
 
590
624
  await worker_sleep(6)
@@ -615,12 +649,14 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
615
649
  "sucesso": False,
616
650
  "retorno": f"Número máximo de tentativas atingido. A tela para Aguarde não foi encerrada.",
617
651
  }
618
-
652
+
619
653
  await worker_sleep(2)
620
-
654
+
621
655
  try:
622
656
  console.print("Verificando itens não localizados ou NCM...\n")
623
- itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
657
+ itens_by_supplier = await is_window_open_by_class(
658
+ "TFrmAguarde", "TMessageForm"
659
+ )
624
660
 
625
661
  if itens_by_supplier["IsOpened"] == True:
626
662
  itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
@@ -633,7 +669,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
633
669
  sucesso=False,
634
670
  retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
635
671
  status=RpaHistoricoStatusEnum.Falha,
636
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
672
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
637
673
  )
638
674
 
639
675
  console.print("Navegando pela Janela de Nota Fiscal de Entrada...\n")
@@ -661,16 +697,23 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
661
697
 
662
698
  console.print("Verificando o tipo de cobrança selecionado... \n")
663
699
  tipo_selecionado = tipo_cobranca.window_text()
664
- if "boleto" in tipo_selecionado.lower() or 'carteira' in tipo_selecionado.lower():
665
- console.print(f"Tipo de cobrança corretamente selecionado {tipo_selecionado}... \n")
700
+ if (
701
+ "boleto" in tipo_selecionado.lower()
702
+ or "carteira" in tipo_selecionado.lower()
703
+ ):
704
+ console.print(
705
+ f"Tipo de cobrança corretamente selecionado {tipo_selecionado}... \n"
706
+ )
666
707
  else:
667
- console.print(f"Tipo de cobrança não foi selecionado corretamente, interagindo com o campo para selecionar o campo corretamente... \n")
708
+ console.print(
709
+ f"Tipo de cobrança não foi selecionado corretamente, interagindo com o campo para selecionar o campo corretamente... \n"
710
+ )
668
711
  tipo_cobranca.click()
669
712
  try:
670
713
  set_combobox("||List", "BANCO DO BRASIL BOLETO")
671
714
  except:
672
715
  set_combobox("||List", "CARTEIRA")
673
-
716
+
674
717
  await worker_sleep(2)
675
718
 
676
719
  # Inclui registro
@@ -687,10 +730,9 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
687
730
  f"Não foi possivel incluir o registro utilizando reconhecimento de imagem, Error: {e}...\n tentando inserir via posição...\n"
688
731
  )
689
732
  await incluir_registro()
690
-
691
733
 
692
- await worker_sleep(6)
693
-
734
+ await worker_sleep(10)
735
+
694
736
  try:
695
737
  console.print("Iniciando a coleta de dados do grid...\n")
696
738
  app = Application(backend="uia").connect(class_name="TFrmTelaSelecao")
@@ -765,7 +807,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
765
807
  sucesso=False,
766
808
  retorno=observacao,
767
809
  status=RpaHistoricoStatusEnum.Falha,
768
- tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
810
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
769
811
  )
770
812
  else:
771
813
  console.print(
@@ -790,22 +832,20 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
790
832
 
791
833
  await worker_sleep(2)
792
834
  except:
793
- observacao = (
794
- "Falha ao clicar em OK no POP-UP de Itens que Ultrapassam a Variação Máxima de Custo."
795
- )
835
+ observacao = "Falha ao clicar em OK no POP-UP de Itens que Ultrapassam a Variação Máxima de Custo."
796
836
  return RpaRetornoProcessoDTO(
797
837
  sucesso=False,
798
838
  retorno=observacao,
799
839
  status=RpaHistoricoStatusEnum.Falha,
800
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
840
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
801
841
  )
802
-
842
+
803
843
  await worker_sleep(5)
804
-
805
-
806
- panel_TPage = main_window.child_window(class_name="TPage", title="Formulario")
807
-
808
-
844
+
845
+ panel_TPage = main_window.child_window(
846
+ class_name="TPage", title="Formulario"
847
+ )
848
+
809
849
  nf_imported = await check_nota_importada(nota.get("nfe"))
810
850
  if nf_imported.sucesso == True:
811
851
  await worker_sleep(3)
@@ -813,7 +853,10 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
813
853
  nf_chave_acesso = int(nota.get("nfe"))
814
854
  status_nf_emsys = await get_status_nf_emsys(nf_chave_acesso)
815
855
  if status_nf_emsys.get("status") == "Lançada":
816
- console.print("\nNota lançada com sucesso, processo finalizado...", style="bold green")
856
+ console.print(
857
+ "\nNota lançada com sucesso, processo finalizado...",
858
+ style="bold green",
859
+ )
817
860
  return RpaRetornoProcessoDTO(
818
861
  sucesso=True,
819
862
  retorno="Nota Lançada com sucesso!",
@@ -825,7 +868,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
825
868
  sucesso=False,
826
869
  retorno=f"Pop-up nota incluida encontrada, porém nota encontrada como 'já lançada' trazendo as seguintes informações: {nf_imported.retorno} - {error_work}",
827
870
  status=RpaHistoricoStatusEnum.Falha,
828
- tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
871
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
829
872
  )
830
873
  else:
831
874
  console.print("Erro ao lançar nota", style="bold red")
@@ -833,16 +876,31 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
833
876
  sucesso=False,
834
877
  retorno=f"Erro ao lançar nota, erro: {nf_imported.retorno}",
835
878
  status=RpaHistoricoStatusEnum.Falha,
836
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
837
- )
838
-
879
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
880
+ )
881
+
839
882
  except Exception as error:
840
- return RpaRetornoProcessoDTO(
841
- sucesso=False,
842
- retorno=f"Erro inesperado: {str(error)}",
843
- status=RpaHistoricoStatusEnum.Falha,
844
- tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
845
- )
883
+ nf_imported = await check_nota_importada(nota.get("nfe"))
884
+ if nf_imported.sucesso == True:
885
+ console.print("\nVerifica se a nota ja foi lançada...")
886
+ status_nf_emsys = await get_status_nf_emsys(nf_chave_acesso)
887
+ if status_nf_emsys.get("status") == "Lançada":
888
+ console.print(
889
+ "\nNota lançada com sucesso, processo finalizado...",
890
+ style="bold green",
891
+ )
892
+ return RpaRetornoProcessoDTO(
893
+ sucesso=True,
894
+ retorno="Nota Lançada com sucesso!",
895
+ status=RpaHistoricoStatusEnum.Sucesso,
896
+ )
897
+ else:
898
+ return RpaRetornoProcessoDTO(
899
+ sucesso=False,
900
+ retorno=f"Erro inesperado: {str(error)}",
901
+ status=RpaHistoricoStatusEnum.Falha,
902
+ tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
903
+ )
846
904
 
847
905
  except Exception as ex:
848
906
  observacao = f"Erro Processo Entrada de Notas: {str(ex)}"
@@ -713,7 +713,7 @@ async def login_emsys(config: dict, app, task: RpaProcessoEntradaDTO, **kwargs):
713
713
  )
714
714
 
715
715
  # Aguarda emsys abrir
716
- max_attempts = 10
716
+ max_attempts = 15
717
717
  current_attempt = 0
718
718
  while current_attempt <= max_attempts:
719
719
  try:
@@ -3442,9 +3442,24 @@ async def check_nota_importada(xml_nota: str) -> RpaRetornoProcessoDTO:
3442
3442
  break
3443
3443
  else:
3444
3444
  console.print(f"Aguardando confirmação de nota incluida...\n")
3445
- await worker_sleep(5)
3445
+ await worker_sleep(8)
3446
3446
  i += 1
3447
-
3447
+ try:
3448
+ status_nf_emsys = await get_status_nf_emsys(int(xml_nota))
3449
+ if status_nf_emsys.get("status") == "Lançada":
3450
+ console.print(
3451
+ "\nNota lançada com sucesso, processo finalizado...",
3452
+ style="bold green",
3453
+ )
3454
+ return RpaRetornoProcessoDTO(
3455
+ sucesso=True,
3456
+ retorno="Nota Lançada com sucesso!",
3457
+ status=RpaHistoricoStatusEnum.Sucesso,
3458
+ )
3459
+ except:
3460
+ pass
3461
+
3462
+
3448
3463
  information_pop_up = await is_window_open("Information")
3449
3464
  if information_pop_up["IsOpened"] == True:
3450
3465
  app = Application().connect(class_name="TFrmNotaFiscalEntrada")
@@ -454,6 +454,9 @@ class EMSys:
454
454
  await worker_sleep(3)
455
455
  i += 1
456
456
 
457
+ await self.verify_warning_and_error("Warning", "No")
458
+ await self.verify_warning_and_error("Warning", "&No")
459
+
457
460
  if chave_nfe is not None:
458
461
  await worker_sleep(20)
459
462
  console.print("\nVerifica se a nota ja foi lançada...")
@@ -1,6 +1,7 @@
1
1
  import asyncio
2
2
  import os
3
3
  import threading
4
+ import random
4
5
  from pathlib import Path
5
6
 
6
7
  import pyfiglet
@@ -88,10 +89,10 @@ async def check_and_execute_tasks(stop_event: threading.Event):
88
89
  url_retorno, RpaHistoricoStatusEnum.Descartado, log_message
89
90
  )
90
91
  else:
91
- await asyncio.sleep(5)
92
+ await asyncio.sleep(random.randint(5, 10))
92
93
  except Exception as e:
93
94
  logger.error(f"Ocorreu um erro de execução: {e}")
94
- await asyncio.sleep(5)
95
+ await asyncio.sleep(random.randint(5, 10))
95
96
 
96
97
 
97
98
  async def notify_alive(stop_event: threading.Event):