worker-automate-hub 0.4.345__py3-none-any.whl → 0.4.347__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.
@@ -169,25 +169,184 @@ async def entrada_de_notas_39(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
169
169
  await worker_sleep(3)
170
170
 
171
171
  try:
172
+
173
+ #INTERAGINDO COM A TELA DE NOTAS DE OUTRAS EMPRESAS
174
+ app = Application().connect(class_name="TFrmImportarNotaOutraEmpresa")
175
+ main_window = app["TFrmImportarNotaOutraEmpresa"]
176
+ console.print("A tela de Importar Nota de Outra Empresa foi encontrada!")
177
+
178
+ console.print('Inserindo o codigo da empresa...')
172
179
  empresa = str(int(nota.get("cnpjFornecedor")[8:12]))
173
- max_attempts = 10
180
+
181
+ edit = main_window.child_window(
182
+ class_name="TDBIEditCode", found_index=0
183
+ )
184
+ edit.set_edit_text(empresa)
185
+
186
+ await worker_sleep(1)
187
+
188
+ pyautogui.hotkey('tab')
189
+
190
+ console.print('Inserindo a data de emissão da nota')
191
+ dt_emissao = nota.get("dataEmissao")
192
+ numero_nota = nota.get("numeroNota")
193
+
194
+ edit = main_window.child_window(
195
+ class_name="TDBIEditDate", found_index=0
196
+ )
197
+ edit.set_edit_text(dt_emissao)
198
+ edit = main_window.child_window(
199
+ class_name="TDBIEditDate", found_index=1
200
+ )
201
+ edit.set_edit_text(dt_emissao)
202
+
203
+ console.print('Inserindo o numero da nota')
204
+ edit = main_window.child_window(
205
+ class_name="TDBIEditString", found_index=0
206
+ )
207
+ edit.set_edit_text(numero_nota)
208
+
209
+ await worker_sleep(2)
210
+
211
+ pesquisar_full_path = "assets\\entrada_notas\\PesquisarNFOutrasEmpresas.png"
212
+ try:
213
+ button_location = pyautogui.locateCenterOnScreen(pesquisar_full_path, confidence=0.6)
214
+ if button_location:
215
+ pyautogui.click(button_location)
216
+ console.print("Botão 'Pesquisar' clicado com sucesso!")
217
+ except pyautogui.ImageNotFoundException:
218
+ window_rect = main_window.rectangle()
219
+ console.print(f"Area que sera utulizada para o screenshot {window_rect}...\n")
220
+
221
+ try:
222
+ button_location = pyautogui.locateCenterOnScreen(pesquisar_full_path, region=(window_rect.left, window_rect.top, window_rect.width(), window_rect.height()))
223
+ if button_location:
224
+ button_location = (button_location.x + window_rect.left, button_location.y + window_rect.top)
225
+ console.print(f"Botão encontrado nas coordenadas: {button_location}")
226
+ pyautogui.click(button_location)
227
+ except pyautogui.ImageNotFoundException:
228
+ console.print("Erro - Botão Pesquisar na tela de Importação de Outras Empresas não foi encontrado após tentar capturar a tela")
229
+ return RpaRetornoProcessoDTO(
230
+ sucesso=False,
231
+ retorno="Erro - Botão Pesquisar na tela de Importação de Outras Empresas não foi encontrado após tentar capturar a tela",
232
+ status=RpaHistoricoStatusEnum.Falha,
233
+ )
234
+ except Exception as e:
235
+ console.print(
236
+ f"Não foi possivel seguir pois não foi fois possivel interagir com o botão de Pesquisar na tela Importação de Outras Empresas,Error: {e}...\n"
237
+ )
238
+ return RpaRetornoProcessoDTO(
239
+ sucesso=False,
240
+ retorno=f"Não foi possivel seguir pois não foi fois possivel interagir com o botão de Pesquisar na tela Importação de Outras Empresas,Error: {e}",
241
+ status=RpaHistoricoStatusEnum.Falha,
242
+ )
243
+
174
244
  i = 0
245
+ max_attempts = 17
175
246
 
176
247
  while i < max_attempts:
248
+ i += 1
249
+ console.print("Verificando se a nota foi encontrada...\n")
177
250
  try:
178
- success = await importar_notas_outras_empresas(
179
- nota.get("dataEmissao"), nota.get("numeroNota"), empresa
180
- )
181
- if success:
182
- console.print("Nota importada com sucesso!\n")
183
- break
184
- else:
185
- console.print("Não foi possível importar a nota, tentando novamente...\n")
251
+ main_window.set_focus()
252
+ no_data_full_path = "assets\\entrada_notas\\no_data_display.png"
253
+ img_no_data = pyautogui.locateCenterOnScreen(no_data_full_path, confidence=0.6)
254
+ if img_no_data:
255
+ console.print("'No data display' ainda aparente. Tentando novamente...")
256
+ await worker_sleep(10)
257
+ except pyautogui.ImageNotFoundException:
258
+ console.print("'No data display' não encontrado na tela!")
259
+ break
260
+
186
261
  except Exception as e:
187
- console.print(f"Erro durante a tentativa de importar a nota: {e}\n")
262
+ console.print(f"Ocorreu um erro: {e}")
263
+
264
+
265
+ console.print(f"Clicando em Importar")
266
+ pyautogui.press('tab', presses=2)
267
+ importar_btn_full_path = "assets\\entrada_notas\\importar_nf_outras_empresa.png"
268
+ try:
269
+ button_location = pyautogui.locateCenterOnScreen(importar_btn_full_path, confidence=0.6)
270
+ if button_location:
271
+ pyautogui.moveTo(button_location)
272
+ await worker_sleep(1)
273
+ pyautogui.click(button_location)
274
+ console.print("Botão 'Importar' clicado com sucesso!")
275
+ await worker_sleep(1)
276
+
277
+ attempts = 0
278
+ max_attempts = 7
279
+ while attempts < max_attempts:
280
+ attempts += 1
281
+ try:
282
+ button_location = pyautogui.locateCenterOnScreen(importar_btn_full_path, confidence=0.6)
283
+ if button_location:
284
+ pyautogui.moveTo(button_location)
285
+ await worker_sleep(20)
286
+ pyautogui.click(button_location)
287
+ console.print("Botão 'Importar' ainda persiste, clicando...")
288
+ except pyautogui.ImageNotFoundException:
289
+ console.print("Botão 'Importar' não encontrado, saindo...")
290
+ break
291
+ except pyautogui.ImageNotFoundException:
292
+ window_rect = main_window.rectangle()
293
+ console.print(f"Area que sera utlizada para o screenshot {window_rect}...\n")
188
294
 
189
- await worker_sleep(30)
190
- i += 1
295
+ try:
296
+ button_location = pyautogui.locateCenterOnScreen(importar_btn_full_path, region=(window_rect.left, window_rect.top, window_rect.width(), window_rect.height()))
297
+ if button_location:
298
+ button_location = (button_location.x + window_rect.left, button_location.y + window_rect.top)
299
+ console.print(f"Botão encontrado nas coordenadas: {button_location}")
300
+ pyautogui.click(button_location)
301
+ except pyautogui.ImageNotFoundException:
302
+ console.print("Erro - Botão Importar na tela de Importação de Outras Empresas não foi encontrado após tentar capturar a tela")
303
+ return RpaRetornoProcessoDTO(
304
+ sucesso=False,
305
+ retorno="Erro - Botão Importar na tela de Importação de Outras Empresas não foi encontrado após tentar capturar a tela",
306
+ status=RpaHistoricoStatusEnum.Falha,
307
+ )
308
+ except Exception as e:
309
+ console.print(
310
+ f"Não foi possivel seguir pois não foi fois possivel interagir com o botão de Importar na tela Importação de Outras Empresas,Error: {e}...\n"
311
+ )
312
+ return RpaRetornoProcessoDTO(
313
+ sucesso=False,
314
+ retorno=f"Não foi possivel seguir pois não foi fois possivel interagir com o botão de Importar na tela Importação de Outras Empresas,Error: {e}",
315
+ status=RpaHistoricoStatusEnum.Falha,
316
+ )
317
+
318
+
319
+ await worker_sleep(5)
320
+ # VERIFICANDO A EXISTENCIA DE ERRO
321
+ erro_pop_up = await is_window_open("Erro")
322
+ if erro_pop_up["IsOpened"] == True:
323
+ console.print("Aveia")
324
+ return RpaRetornoProcessoDTO(
325
+ sucesso=False,
326
+ retorno="Nota não encontrada no EMsys",
327
+ status=RpaHistoricoStatusEnum.Falha,
328
+ )
329
+
330
+
331
+ max_attempts = 10
332
+ i = 0
333
+
334
+ while i < max_attempts:
335
+ information_pop_up = await is_window_open("Informações para importação da Nota Fiscal Eletrônica")
336
+ if information_pop_up["IsOpened"] == True:
337
+ break
338
+ else:
339
+ console.print(f"Aguardando a tela Informações para importação da Nota Fiscal Eletrônica...\n")
340
+ await worker_sleep(3)
341
+ i += 1
342
+
343
+ if i >= max_attempts:
344
+ console.print("batata")
345
+ return RpaRetornoProcessoDTO(
346
+ sucesso=False,
347
+ retorno="Nota não encontrada no EMsys",
348
+ status=RpaHistoricoStatusEnum.Falha,
349
+ )
191
350
 
192
351
  await worker_sleep(10)
193
352
 
@@ -56,6 +56,7 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
56
56
 
57
57
  # Fecha a instancia do emsys - caso esteja aberta
58
58
  await kill_process("EMSysFiscal")
59
+ await kill_process("EMSys")
59
60
 
60
61
  app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal.exe")
61
62
  warnings.filterwarnings(
@@ -75,7 +76,7 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
75
76
  status=RpaHistoricoStatusEnum.Falha,
76
77
  )
77
78
 
78
-
79
+
79
80
  return_login = await login_emsys_fiscal(config.conConfiguracao, app, task)
80
81
  if return_login.sucesso == True:
81
82
  type_text_into_field(
@@ -340,6 +340,7 @@ async def login_emsys_fiscal(
340
340
 
341
341
  await worker_sleep(2)
342
342
  pyautogui.press("enter")
343
+ await worker_sleep(6)
343
344
 
344
345
  # Seleciona a filial do emsys
345
346
  console.print("Seleciona a filial do emsys...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worker-automate-hub
3
- Version: 0.4.345
3
+ Version: 0.4.347
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
@@ -44,7 +44,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_32.py,sha256=bAzQZD6EP7_eofC0GL4
44
44
  worker_automate_hub/tasks/jobs/entrada_de_notas_33.py,sha256=zwDQzPbqqw1RpjJkF3VSkMnqgrzjFAXLGq7xrFo5D0o,31459
45
45
  worker_automate_hub/tasks/jobs/entrada_de_notas_34.py,sha256=RGYSCUwVIsdM3pRIOhezR0IKlfwfDFy_NPZO1auBXwk,31811
46
46
  worker_automate_hub/tasks/jobs/entrada_de_notas_36.py,sha256=s6FVDaEer86EGM623IswqUTQEdTcusZRCrhB2vdxHf8,22719
47
- worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=v_cFb8DiHAIlBuyo-Nmkxob1rtQ79apudaWOVhLFT_Y,21851
47
+ worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=aAYbF2bPdFp6xya6s8sGtktpMs5SKnwikTiEKK49038,30359
48
48
  worker_automate_hub/tasks/jobs/entrada_de_notas_500.py,sha256=Pls1zcdhgiU8csrtXGUq9m8rCZm2xmK45dld6N1MKdM,26598
49
49
  worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=G2EwCtsltWOAVg5iUg0VSp88OBJeI5U4122QfZORyp4,14493
50
50
  worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=Fp9hCyXqKY2o7Ijsd_tll5ZcR2KLxxlzdWeyGWnggcI,14187
@@ -54,7 +54,7 @@ worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=Y-mKYcgX1kwcy_s
54
54
  worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py,sha256=QBGm6eS5JghgNWNqZlk1g2a2iV8LnBLiOTBBL3Giet0,4181
55
55
  worker_automate_hub/tasks/jobs/login_emsys.py,sha256=IoGCIvO4UwmuxOZEn3cvYJlKyhsWvtHvbFk8vwjTroQ,5620
56
56
  worker_automate_hub/tasks/jobs/playground.py,sha256=bdnXv3C7WLQUxt4edGZDfAbRJJ2-q4zuIQaK3GLnaUc,1765
57
- worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=7HxF-bHoBXtLmJFAWoG556e9NlmjyvbkI6zdlYdynNg,19548
57
+ worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=eoH7_gK550OXacA0zjWms0CnZ7JysynrTjCn2zz7dcY,19577
58
58
  worker_automate_hub/tasks/jobs/transferencias.py,sha256=keCUlvbPhLrTiZQ9Co_r6IqL5wjYqVGB_-mgvdDe9pM,36080
59
59
  worker_automate_hub/tasks/task_definitions.py,sha256=2Jp1H4_qJZqqGyaP6MA87KLt4QNrtWBYWbXu-2gymFo,4459
60
60
  worker_automate_hub/tasks/task_executor.py,sha256=QqVNRljSlSbSXzTwKLezMjCLej6AixuBcDAhDrqmAkU,8435
@@ -64,10 +64,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
64
64
  worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
65
65
  worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
66
66
  worker_automate_hub/utils/updater.py,sha256=0LR6Xpe3HZk-xu-trH7vKRhP5FXp0nhp1qxtygE2Jps,7280
67
- worker_automate_hub/utils/util.py,sha256=O3gPOqUJOQBaxEGvjXlQRWxW76kPb5pJOizshzWP3cA,117264
67
+ worker_automate_hub/utils/util.py,sha256=Ec0NblD-0Og4PVI2SRCf8R1ao51mJPSRR-GIxOGnBBs,117295
68
68
  worker_automate_hub/utils/utils_nfe_entrada.py,sha256=4--3HDyWddT8vw2mBNY_-9IscvAQYBygwPIMiKvAG-w,27583
69
69
  worker_automate_hub/worker.py,sha256=vkl_x7gSo6nQlhSBLwRkGx6LEONnYptfBaGxOy1ZLsE,4634
70
- worker_automate_hub-0.4.345.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
71
- worker_automate_hub-0.4.345.dist-info/METADATA,sha256=uU4UUprCb2TxuP59g_V4h2KZhFZcbMIeRRtOL8i_oQM,2895
72
- worker_automate_hub-0.4.345.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
73
- worker_automate_hub-0.4.345.dist-info/RECORD,,
70
+ worker_automate_hub-0.4.347.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
71
+ worker_automate_hub-0.4.347.dist-info/METADATA,sha256=k8TW4CxaRNnneZQhA3vstLgm35Lb18UTeZqy1bOnxjI,2895
72
+ worker_automate_hub-0.4.347.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
73
+ worker_automate_hub-0.4.347.dist-info/RECORD,,