worker-automate-hub 0.4.344__py3-none-any.whl → 0.4.346__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.
@@ -790,9 +790,11 @@ async def descartes(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
790
790
  # Pode não precisar em descartes, mas em trânsferencias é obrigatório
791
791
  app = Application().connect(class_name="TFrmPreVenda")
792
792
  pre_venda = app["TFrmPreVenda"]
793
- confirma_pre_venda = pre_venda.child_window(title="&Confirma", class_name="TBitBtn", found_index=0)
794
- if confirma_pre_venda.is_enabled() and confirma_pre_venda.exists():
795
- confirma_pre_venda.click()
793
+ confirma_pre_venda = pre_venda.child_window(title="&Confirma", class_name="TBitBtn")
794
+
795
+ if confirma_pre_venda.exists():
796
+ if confirma_pre_venda.is_enabled():
797
+ confirma_pre_venda.click()
796
798
  else:
797
799
  log_msg = f"Botao 'Confirma' nao encontrado"
798
800
  console.print(log_msg, style="bold yellow")
@@ -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
 
@@ -692,9 +692,11 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
692
692
  # Pode não precisar em descartes, mas em trânsferencias é obrigatório
693
693
  app = Application().connect(class_name="TFrmPreVenda")
694
694
  pre_venda = app["TFrmPreVenda"]
695
- confirma_pre_venda = pre_venda.child_window(title="&Confirma", class_name="TBitBtn", found_index=0)
696
- if confirma_pre_venda.is_enabled() and confirma_pre_venda.exists() and confirma_pre_venda is not None:
697
- confirma_pre_venda.click()
695
+ confirma_pre_venda = pre_venda.child_window(title="&Confirma", class_name="TBitBtn")
696
+
697
+ if confirma_pre_venda.exists():
698
+ if confirma_pre_venda.is_enabled():
699
+ confirma_pre_venda.click()
698
700
  else:
699
701
  log_msg = f"Botao 'Confirma' nao encontrado"
700
702
  console.print(log_msg, style="bold yellow")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worker-automate-hub
3
- Version: 0.4.344
3
+ Version: 0.4.346
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
@@ -30,7 +30,7 @@ worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
30
30
  worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=rf4fW-FaHUl1MS7b03z4cwI3zHfNw8FWxvjvNY3Xn20,28773
32
32
  worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=0-oLMupu6zucZ9kVshLjG94i0W9v4pbcgYHvI6uipGc,10376
33
- worker_automate_hub/tasks/jobs/descartes.py,sha256=2EtI-bIxcBq4LgNcq6mdqPo-685NIgtO_Fb_81_5aR4,40122
33
+ worker_automate_hub/tasks/jobs/descartes.py,sha256=RIjrZIzkW77NiKeXbxFN9k872cz3fl9cG1m5TJpjmmY,40134
34
34
  worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=aPckQRlRozFS_OK3C9wNdMCmqO6AM4djwqY2uSSaPmo,20687
35
35
  worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=FFpAdtZLO4uelWZooCVpm4JePv_iDt5nwVKrk1ipZJQ,1599
36
36
  worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=4fe5Ri--lNIlRBSusbjyYtFKwYpu1P4Y2EYgHgQsrqE,24985
@@ -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
@@ -55,7 +55,7 @@ worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py,sha256=QBGm6eS5J
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
57
  worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=7HxF-bHoBXtLmJFAWoG556e9NlmjyvbkI6zdlYdynNg,19548
58
- worker_automate_hub/tasks/jobs/transferencias.py,sha256=tuLgYrjUJWACkdPee9RZY0j-NSH-UXxXHE6wblIuz-o,36103
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
61
61
  worker_automate_hub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -67,7 +67,7 @@ worker_automate_hub/utils/updater.py,sha256=0LR6Xpe3HZk-xu-trH7vKRhP5FXp0nhp1qxt
67
67
  worker_automate_hub/utils/util.py,sha256=O3gPOqUJOQBaxEGvjXlQRWxW76kPb5pJOizshzWP3cA,117264
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.344.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
71
- worker_automate_hub-0.4.344.dist-info/METADATA,sha256=h1Z3EF0AbSWLhV72CtjLxJIKKyMet5RJ3yZpJCDOz4s,2895
72
- worker_automate_hub-0.4.344.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
73
- worker_automate_hub-0.4.344.dist-info/RECORD,,
70
+ worker_automate_hub-0.4.346.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
71
+ worker_automate_hub-0.4.346.dist-info/METADATA,sha256=KlAnt1TlwvtMkMRhxLF0tzqbp88RFTx3TdIdWjjeBT0,2895
72
+ worker_automate_hub-0.4.346.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
73
+ worker_automate_hub-0.4.346.dist-info/RECORD,,