worker-automate-hub 0.4.445__py3-none-any.whl → 0.4.446__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.
@@ -39,6 +39,7 @@ from worker_automate_hub.utils.util import (
39
39
  worker_sleep,
40
40
  check_nota_importada,
41
41
  carregamento_import_xml,
42
+ errors_generate_after_import,
42
43
  )
43
44
 
44
45
  pyautogui.PAUSE = 0.5
@@ -276,23 +277,41 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
276
277
  status=RpaHistoricoStatusEnum.Falha,
277
278
  )
278
279
 
279
- await worker_sleep(4)
280
- console.print(
281
- "Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
282
- )
283
- itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
284
- if itens_by_supplier["IsOpened"] == True:
285
- itens_by_supplier_work = await itens_not_found_supplier(nota["nfe"])
286
- if itens_by_supplier_work["window"] == "NCM":
287
- console.log(itens_by_supplier_work["retorno"], style="bold green")
288
- else:
289
- return {
290
- "sucesso": False,
291
- "retorno": f"{itens_by_supplier_work['retorno']}",
292
- }
280
+ try:
281
+ console.print(
282
+ "Verificando a existencia de POP-UP de Itens não localizados ou NCM ...\n"
283
+ )
284
+ itens_by_supplier = await is_window_open_by_class("TFrmAguarde", "TMessageForm")
285
+ if itens_by_supplier["IsOpened"] == True:
286
+ itens_by_supplier_work = await itens_not_found_supplier(nota.get("nfe"))
287
+ if itens_by_supplier_work.get("window") == "NCM":
288
+ console.log(itens_by_supplier_work.get("retorno"), style="bold green")
289
+ else:
290
+ return RpaRetornoProcessoDTO(
291
+ sucesso=False,
292
+ retorno=itens_by_supplier_work.get("retorno"),
293
+ status=RpaHistoricoStatusEnum.Falha,
294
+ )
295
+ except Exception as error:
296
+ return RpaRetornoProcessoDTO(
297
+ sucesso=False,
298
+ retorno=f"Falha ao verificar a existência de POP-UP de itens não localizados: {error}",
299
+ status=RpaHistoricoStatusEnum.Falha,
300
+ )
301
+
302
+
303
+ logs_erro = await is_window_open_by_class("TFrmExibeLogErroImportacaoNfe","TFrmExibeLogErroImportacaoNfe")
304
+ if logs_erro["IsOpened"] == True:
305
+ errors_genetared = await errors_generate_after_import(nota.get("nfe"))
306
+ return RpaRetornoProcessoDTO(
307
+ sucesso=False,
308
+ retorno=errors_genetared.retorno,
309
+ status=RpaHistoricoStatusEnum.Falha,
310
+ )
293
311
 
294
312
  await worker_sleep(6)
295
313
 
314
+
296
315
  max_attempts = 7
297
316
  i = 0
298
317
  while i < max_attempts:
@@ -334,6 +353,7 @@ async def entrada_de_notas_7139(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
334
353
  f"Não foi possivel incluir o registro utilizando reconhecimento de imagem, Error: {e}...\n tentando inserir via posição...\n"
335
354
  )
336
355
  await incluir_registro()
356
+
337
357
 
338
358
  await worker_sleep(6)
339
359
  nf_imported = await check_nota_importada(nota.get("nfe"))
@@ -2188,6 +2188,7 @@ async def select_documento_type(document_type: str) -> RpaRetornoProcessoDTO:
2188
2188
  main_window = app["TFrmNotaFiscalEntrada"]
2189
2189
 
2190
2190
  main_window.set_focus()
2191
+ await worker_sleep(3)
2191
2192
 
2192
2193
  console.print(
2193
2194
  "Controles encontrados na janela 'Nota Fiscal de Entrada, navegando entre eles...\n"
@@ -3196,4 +3197,106 @@ async def kill_all_emsys():
3196
3197
  sucesso=False,
3197
3198
  retorno=f"Erro ao fechar o emsys, erro{e}",
3198
3199
  status=RpaHistoricoStatusEnum.Falha,
3200
+ )
3201
+
3202
+
3203
+ async def errors_generate_after_import(xml_nota: str) -> RpaRetornoProcessoDTO:
3204
+ try:
3205
+ app = Application().connect(class_name="TFrmExibeLogErroImportacaoNfe")
3206
+ main_window = app["TFrmExibeLogErroImportacaoNfe"]
3207
+ console.print("Tela com itens com erro existe, salvando os itens...\n")
3208
+
3209
+ btn_save = main_window.child_window(
3210
+ title="Salvar", class_name="TBitBtn"
3211
+ )
3212
+
3213
+ if btn_save.exists():
3214
+ max_attempts = 3
3215
+ i = 0
3216
+ while i < max_attempts:
3217
+ console.print("Clicando no botão de salvar...\n")
3218
+ try:
3219
+ btn_save.click()
3220
+ except:
3221
+ console.print("Não foi possivel clicar no Botão OK... \n")
3222
+
3223
+ await worker_sleep(3)
3224
+
3225
+ console.print(
3226
+ "Verificando a existencia da tela para informar o caminho do arquivo...\n"
3227
+ )
3228
+
3229
+ try:
3230
+ app = Application().connect(title="Salvar")
3231
+ main_window = app["Salvar"]
3232
+ console.print(
3233
+ "Tela para informar o caminho do arquivo existe"
3234
+ )
3235
+ break
3236
+ except Exception as e:
3237
+ console.print(
3238
+ f"Tela para informar o caminho do arquivo não encontrada. Tentativa {i + 1}/{max_attempts}."
3239
+ )
3240
+
3241
+ i += 1
3242
+
3243
+ if i == max_attempts:
3244
+ raise Exception(
3245
+ "Número máximo de tentativas atingido. Tela para informar o caminho do arquivo existe."
3246
+ )
3247
+
3248
+ await worker_sleep(4)
3249
+ console.print(
3250
+ "Interagindo com a tela para informar o caminho do arquivo...\n"
3251
+ )
3252
+ app = Application().connect(title="Salvar")
3253
+ main_window = app["Salvar"]
3254
+ console.print(
3255
+ "Tela para informar o caminho do arquivo existe, inserindo o diretorio...\n"
3256
+ )
3257
+ await worker_sleep(2)
3258
+ main_window.type_keys("%n")
3259
+ username = getpass.getuser()
3260
+ path_to_txt = (
3261
+ f"C:\\Users\\{username}\\Downloads\\erro_itens{xml_nota}.txt"
3262
+ )
3263
+ pyautogui.write(path_to_txt)
3264
+ await worker_sleep(1)
3265
+ main_window.type_keys("%l")
3266
+ console.print(f"Arquivo salvo com sucesso... \n")
3267
+
3268
+ conteudo = ""
3269
+ await worker_sleep(3)
3270
+ with open(
3271
+ path_to_txt, "r", encoding="latin1", errors="replace"
3272
+ ) as arquivo:
3273
+ conteudo = arquivo.read()
3274
+ console.print(
3275
+ f"Arquivo salvo com sucesso, itens com erro {conteudo}...\n"
3276
+ )
3277
+
3278
+ os.remove(path_to_txt)
3279
+ console.print(
3280
+ f"Removendo o arquivo e enviando os itens para o backoffice... \n"
3281
+ )
3282
+ console.print(
3283
+ f"Itens nao localizados para o fornecedor salvo e retornando como falha no backoffice para correção...\n"
3284
+ )
3285
+ return RpaRetornoProcessoDTO(
3286
+ sucesso=True,
3287
+ retorno=f"Itens nao localizados para o fornecedor, Mensagem: {conteudo}",
3288
+ status=RpaHistoricoStatusEnum.Sucesso,
3289
+ )
3290
+ else:
3291
+ console.print(f"Botao Salvar - Não foi encontrado...\n")
3292
+ return RpaRetornoProcessoDTO(
3293
+ sucesso=False,
3294
+ retorno=f"Erro ao processar - Tela de Erros gerados na importação do NF-e - Botao Salvar - Não foi encontrado",
3295
+ status=RpaHistoricoStatusEnum.Sucesso,
3296
+ )
3297
+ except Exception as e:
3298
+ return RpaRetornoProcessoDTO(
3299
+ sucesso=False,
3300
+ retorno=f"Erro ao processar - Tela de Erros gerados na importação do NF-e, {e}",
3301
+ status=RpaHistoricoStatusEnum.Falha,
3199
3302
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worker-automate-hub
3
- Version: 0.4.445
3
+ Version: 0.4.446
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
@@ -49,7 +49,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_36.py,sha256=vFkDcgJ9uxrMMLYdeON
49
49
  worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=r4q3QRwho0GsX2Lo6HBenQyMIEQO6EaqlaQQ9ee80m8,32796
50
50
  worker_automate_hub/tasks/jobs/entrada_de_notas_500.py,sha256=MYPaYAP2iwdBYDZUf39f7yGibTME9uObEash_QTCmFA,32231
51
51
  worker_automate_hub/tasks/jobs/entrada_de_notas_505.py,sha256=jIml8gjXPdI6_x7S9VVV8IrKZRF7_PTNOMnhNmYMDTU,14490
52
- worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=DOyf0A7BSggD8KgzZ66dtfwhOeEhztylpQAy9RCEnxE,14651
52
+ worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py,sha256=oxH2CUJj3UyhYoSxEY2hUr_6wFgZPLcHswEbApIu8VY,15558
53
53
  worker_automate_hub/tasks/jobs/entrada_de_notas_9.py,sha256=Urt_7dZNuyUkSyG9fYb2ArBXzEONXlrqWIesoXeL1EI,50984
54
54
  worker_automate_hub/tasks/jobs/exemplo_processo.py,sha256=3-zxbb-9YHPmSA_K1Qgxp_FwSqg2QDjGBRCLxDZ8QoQ,3451
55
55
  worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py,sha256=mZ6mCaz1lYmyFxwC8MVLXPsgynE1VkNKlEzYGsciDiY,10179
@@ -66,10 +66,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
66
66
  worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
67
67
  worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
68
68
  worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
69
- worker_automate_hub/utils/util.py,sha256=SWpivcmtSH-4RVwjupyyE8wpRcuFlOlGq3_Z29gvUPM,121845
69
+ worker_automate_hub/utils/util.py,sha256=h0AoZgFND72mR0HufpvT0KB-QBa5lRml0pDKh_7pyrI,125955
70
70
  worker_automate_hub/utils/utils_nfe_entrada.py,sha256=p5r_L5k7gqCBvV8v6dbLFM6INKiSpGc4Gegid0_YAh4,29017
71
71
  worker_automate_hub/worker.py,sha256=tftQpX8liC-_0_bOUf1YYzXSCvloMQBvjmQ6lzfEE-c,4816
72
- worker_automate_hub-0.4.445.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
73
- worker_automate_hub-0.4.445.dist-info/METADATA,sha256=-oJMTPOMZAQPgl7VRBiCBbAMf8h32yn11ISzfxC029U,2895
74
- worker_automate_hub-0.4.445.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
75
- worker_automate_hub-0.4.445.dist-info/RECORD,,
72
+ worker_automate_hub-0.4.446.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
73
+ worker_automate_hub-0.4.446.dist-info/METADATA,sha256=bqncVJ3KxXMYV5kwpwogbmbDczMDcu5AiqZJKw6ghcM,2895
74
+ worker_automate_hub-0.4.446.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
75
+ worker_automate_hub-0.4.446.dist-info/RECORD,,