worker-automate-hub 0.5.38__py3-none-any.whl → 0.5.40__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.
- worker_automate_hub/api/client.py +3 -0
- worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +1488 -0
- worker_automate_hub/tasks/task_definitions.py +2 -0
- worker_automate_hub/tasks/task_executor.py +1 -1
- worker_automate_hub/utils/util.py +545 -8
- {worker_automate_hub-0.5.38.dist-info → worker_automate_hub-0.5.40.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.38.dist-info → worker_automate_hub-0.5.40.dist-info}/RECORD +9 -8
- {worker_automate_hub-0.5.38.dist-info → worker_automate_hub-0.5.40.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.38.dist-info → worker_automate_hub-0.5.40.dist-info}/entry_points.txt +0 -0
@@ -56,6 +56,7 @@ from worker_automate_hub.tasks.jobs.login_emsys_versao_especifica import login_e
|
|
56
56
|
from worker_automate_hub.tasks.jobs.playground import playground
|
57
57
|
from worker_automate_hub.tasks.jobs.transferencias import transferencias
|
58
58
|
from worker_automate_hub.tasks.jobs.sped_fiscal import sped_fiscal
|
59
|
+
from worker_automate_hub.tasks.jobs.devolucao_prazo_a_faturar import devolucao_prazo_a_faturar
|
59
60
|
|
60
61
|
task_definitions = {
|
61
62
|
"5b295021-8df7-40a1-a45e-fe7109ae3902": exemplo_processo,
|
@@ -84,6 +85,7 @@ task_definitions = {
|
|
84
85
|
"8d45aa6b-e24c-464d-afba-9a3147b3f506": gerar_nosso_numero,
|
85
86
|
"0aa423c1-fc7f-4b7e-a2b2-a1012c09deae": remessa_cobranca_cnab240,
|
86
87
|
"276d0c41-0b7c-4446-ae0b-dd5d782917cc": sped_fiscal,
|
88
|
+
"5d8a529e-b323-453f-82a3-980184a16b52": devolucao_prazo_a_faturar,
|
87
89
|
}
|
88
90
|
|
89
91
|
|
@@ -55,7 +55,7 @@ async def perform_task(task: RpaProcessoEntradaDTO):
|
|
55
55
|
try:
|
56
56
|
if task_uuid in task_definitions:
|
57
57
|
# Executar a task
|
58
|
-
if task_uuid == "276d0c41-0b7c-4446-ae0b-dd5d782917cc":
|
58
|
+
if task_uuid == "276d0c41-0b7c-4446-ae0b-dd5d782917cc" or task_uuid == "5d8a529e-b323-453f-82a3-980184a16b52":
|
59
59
|
task.historico_id = historico.uuidHistorico
|
60
60
|
|
61
61
|
result: RpaRetornoProcessoDTO = await task_definitions[task_uuid](task)
|
@@ -9,7 +9,8 @@ import subprocess
|
|
9
9
|
import time
|
10
10
|
import warnings
|
11
11
|
import xml.etree.ElementTree as ET
|
12
|
-
from datetime import datetime
|
12
|
+
from datetime import datetime, timedelta
|
13
|
+
import calendar
|
13
14
|
from pathlib import Path
|
14
15
|
from typing import Dict, TypedDict
|
15
16
|
|
@@ -559,13 +560,12 @@ async def login_emsys(
|
|
559
560
|
console.print(f"Selecao filial posição fixa: {selecao_filial}")
|
560
561
|
|
561
562
|
pyautogui.click(selecao_filial)
|
562
|
-
|
563
|
-
f"Escrevendo [{task.configEntrada.get("filialEmpresaOrigem", "N/A")}] no campo filial..."
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
task.configEntrada.get("
|
568
|
-
)
|
563
|
+
try:
|
564
|
+
console.print(f"Escrevendo [{task.configEntrada.get("filialEmpresaOrigem", "N/A")}] no campo filial...")
|
565
|
+
pyautogui.write(task.configEntrada.get("filialEmpresaOrigem"))
|
566
|
+
except:
|
567
|
+
console.print(f"Escrevendo [{task.configEntrada.get("codigoEmpresa", "N/A")}] no campo filial...")
|
568
|
+
pyautogui.write(task.configEntrada.get("codigoEmpresa"))
|
569
569
|
|
570
570
|
else:
|
571
571
|
console.print(
|
@@ -3355,3 +3355,540 @@ async def errors_generate_after_import(xml_nota: str) -> RpaRetornoProcessoDTO:
|
|
3355
3355
|
status=RpaHistoricoStatusEnum.Falha,
|
3356
3356
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3357
3357
|
)
|
3358
|
+
|
3359
|
+
|
3360
|
+
|
3361
|
+
async def ultimo_dia_util_do_mes(data_atual):
|
3362
|
+
ano = data_atual.year
|
3363
|
+
mes = data_atual.month
|
3364
|
+
|
3365
|
+
ultimo_dia_mes = calendar.monthrange(ano, mes)[1]
|
3366
|
+
ultimo_dia = datetime(ano, mes, ultimo_dia_mes)
|
3367
|
+
|
3368
|
+
if ultimo_dia.weekday() == 5:
|
3369
|
+
ultimo_dia -= timedelta(days=1)
|
3370
|
+
elif ultimo_dia.weekday() == 6:
|
3371
|
+
ultimo_dia -= timedelta(days=2)
|
3372
|
+
|
3373
|
+
return ultimo_dia
|
3374
|
+
|
3375
|
+
|
3376
|
+
async def e_ultimo_dia_util():
|
3377
|
+
hoje = datetime.today()
|
3378
|
+
ultimo_dia_util = ultimo_dia_util_do_mes(hoje)
|
3379
|
+
|
3380
|
+
return hoje.date() == ultimo_dia_util.date()
|
3381
|
+
|
3382
|
+
|
3383
|
+
async def ocr_warnings(numero_nota: str)-> RpaRetornoProcessoDTO:
|
3384
|
+
try:
|
3385
|
+
app = Application().connect(title="Warning")
|
3386
|
+
main_window = app["Warning"]
|
3387
|
+
main_window.set_focus()
|
3388
|
+
|
3389
|
+
console.print(f"Obtendo texto do Warning...\n")
|
3390
|
+
console.print(f"Tirando print da janela do warning para realização do OCR...\n")
|
3391
|
+
|
3392
|
+
window_rect = main_window.rectangle()
|
3393
|
+
screenshot = pyautogui.screenshot(
|
3394
|
+
region=(
|
3395
|
+
window_rect.left,
|
3396
|
+
window_rect.top,
|
3397
|
+
window_rect.width(),
|
3398
|
+
window_rect.height(),
|
3399
|
+
)
|
3400
|
+
)
|
3401
|
+
username = getpass.getuser()
|
3402
|
+
path_to_png = f"C:\\Users\\{username}\\Downloads\\warning_popup_{numero_nota}.png"
|
3403
|
+
screenshot.save(path_to_png)
|
3404
|
+
console.print(f"Print salvo em {path_to_png}...\n")
|
3405
|
+
|
3406
|
+
console.print(
|
3407
|
+
f"Preparando a imagem para maior resolução e assertividade no OCR...\n"
|
3408
|
+
)
|
3409
|
+
image = Image.open(path_to_png)
|
3410
|
+
image = image.convert("L")
|
3411
|
+
enhancer = ImageEnhance.Contrast(image)
|
3412
|
+
image = enhancer.enhance(2.0)
|
3413
|
+
image.save(path_to_png)
|
3414
|
+
console.print(f"Imagem preparada com sucesso...\n")
|
3415
|
+
console.print(f"Realizando OCR...\n")
|
3416
|
+
captured_text = pytesseract.image_to_string(Image.open(path_to_png))
|
3417
|
+
console.print(
|
3418
|
+
f"Texto Full capturado {captured_text}...\n"
|
3419
|
+
)
|
3420
|
+
return RpaRetornoProcessoDTO(
|
3421
|
+
sucesso=True,
|
3422
|
+
retorno=captured_text,
|
3423
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
3424
|
+
)
|
3425
|
+
except Exception as e:
|
3426
|
+
return RpaRetornoProcessoDTO(
|
3427
|
+
sucesso=False,
|
3428
|
+
retorno=f"Erro ao realizar a extração do texto vinculado ao warning, erro - {e}",
|
3429
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3430
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3431
|
+
)
|
3432
|
+
finally:
|
3433
|
+
try:
|
3434
|
+
os.remove(path_to_png)
|
3435
|
+
except:
|
3436
|
+
pass
|
3437
|
+
|
3438
|
+
|
3439
|
+
async def nf_busca_nf_saida(num_nota_fiscal: str) -> RpaRetornoProcessoDTO:
|
3440
|
+
try:
|
3441
|
+
app = Application().connect(class_name="TFrmNotaFiscalSaida", timeout=60)
|
3442
|
+
main_window = app["TFrmNotaFiscalSaida"]
|
3443
|
+
|
3444
|
+
main_window.set_focus()
|
3445
|
+
await worker_sleep(3)
|
3446
|
+
|
3447
|
+
console.print(
|
3448
|
+
"Controles encontrados na janela 'Nota Fiscal de Saida', navegando entre eles...\n"
|
3449
|
+
)
|
3450
|
+
panel_TPageControl = main_window.child_window(
|
3451
|
+
class_name="TPageControl", found_index=0
|
3452
|
+
)
|
3453
|
+
panel_TTabSheet = panel_TPageControl.child_window(
|
3454
|
+
class_name="TTabSheet", found_index=0
|
3455
|
+
)
|
3456
|
+
text_numero_nota = panel_TTabSheet.child_window(
|
3457
|
+
class_name="TDBIEditString", found_index=8
|
3458
|
+
)
|
3459
|
+
text_numero_nota.set_edit_text(num_nota_fiscal)
|
3460
|
+
console.print("Inserindo no numero da nota para buscar...\n")
|
3461
|
+
await worker_sleep(2)
|
3462
|
+
|
3463
|
+
try:
|
3464
|
+
pesquisar_icon = pyautogui.locateOnScreen(
|
3465
|
+
ASSETS_PATH + "\\emsys\\icon_pesquisa_nota_saida.png", confidence=0.8
|
3466
|
+
)
|
3467
|
+
pyautogui.click(pesquisar_icon)
|
3468
|
+
await worker_sleep(5)
|
3469
|
+
return RpaRetornoProcessoDTO(
|
3470
|
+
sucesso=True,
|
3471
|
+
retorno=f"Processo Executado com Sucesso",
|
3472
|
+
status=RpaHistoricoStatusEnum.Sucesso
|
3473
|
+
)
|
3474
|
+
except Exception as e:
|
3475
|
+
return RpaRetornoProcessoDTO(
|
3476
|
+
sucesso=False,
|
3477
|
+
retorno=f"Não foi possivel clicar na Lupa para buscar a nota fiscal na tela de nota fiscal de saída, erro: {e}",
|
3478
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3479
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3480
|
+
)
|
3481
|
+
except Exception as e:
|
3482
|
+
return RpaRetornoProcessoDTO(
|
3483
|
+
sucesso=False,
|
3484
|
+
retorno=f"Não foi possivel realizar a atividade na tela de Nota fiscal de Saida, erro: {e}",
|
3485
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3486
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3487
|
+
)
|
3488
|
+
|
3489
|
+
|
3490
|
+
async def nf_devolucao_liquidar_cupom(num_nota_fiscal: str, data_atual: str) -> RpaRetornoProcessoDTO:
|
3491
|
+
try:
|
3492
|
+
app = Application().connect(class_name="TFrmTituloReceber", timeout=60)
|
3493
|
+
main_window = app["TFrmTituloReceber"]
|
3494
|
+
main_window.set_focus()
|
3495
|
+
console.print("Inserindo o numero da nota fiscal para buscar...\n")
|
3496
|
+
panel_TTab_Sheet = main_window.child_window(class_name="TTabSheet", found_index=0)
|
3497
|
+
n_titulo = panel_TTab_Sheet.child_window(class_name="TDBIEditString", found_index=8)
|
3498
|
+
n_titulo.set_edit_text(num_nota_fiscal)
|
3499
|
+
await worker_sleep(2)
|
3500
|
+
console.print("Numero da nota fiscal inserido com sucesso...\n")
|
3501
|
+
|
3502
|
+
|
3503
|
+
try:
|
3504
|
+
pesquisar_icon = pyautogui.locateOnScreen(ASSETS_PATH + "\\emsys\\icon_pesquisa_nota_saida.png", confidence=0.8)
|
3505
|
+
pyautogui.click(pesquisar_icon)
|
3506
|
+
await worker_sleep(5)
|
3507
|
+
except Exception as e:
|
3508
|
+
return RpaRetornoProcessoDTO(
|
3509
|
+
sucesso=False,
|
3510
|
+
retorno=f"Não foi possivel clicar na Lupa para buscar a nota fiscal, erro: {e}",
|
3511
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3512
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3513
|
+
)
|
3514
|
+
|
3515
|
+
panel_TTab_Sheet = main_window.child_window(class_name="TTabSheet", found_index=0)
|
3516
|
+
panel_status = panel_TTab_Sheet.child_window(class_name="TDBIGroupBox", found_index=1)
|
3517
|
+
|
3518
|
+
radio_aberto = panel_status.child_window(class_name="TDBIRadioButton", found_index=4)
|
3519
|
+
radio_em_protesto = panel_status.child_window(class_name="TDBIRadioButton", found_index=0)
|
3520
|
+
radio_negociado = panel_status.child_window(class_name="TDBIRadioButton", found_index=1)
|
3521
|
+
radio_faturado = panel_status.child_window(class_name="TDBIRadioButton", found_index=2)
|
3522
|
+
radio_liquidado = panel_status.child_window(class_name="TDBIRadioButton", found_index=3)
|
3523
|
+
|
3524
|
+
if radio_aberto.is_checked():
|
3525
|
+
console.print("Botão 'Aberto' está selecionado, seguindo com o processo...\n")
|
3526
|
+
else:
|
3527
|
+
status_selecionado = None
|
3528
|
+
if radio_em_protesto.is_checked():
|
3529
|
+
console.print("O botão 'Em Protesto' está selecionado.")
|
3530
|
+
status_selecionado = 'Em Protesto'
|
3531
|
+
elif radio_negociado.is_checked():
|
3532
|
+
console.print("O botão 'Negociado' está selecionado.")
|
3533
|
+
status_selecionado = 'Negociado'
|
3534
|
+
elif radio_faturado.is_checked():
|
3535
|
+
console.print("O botão 'Faturado' está selecionado.")
|
3536
|
+
status_selecionado = 'Faturado'
|
3537
|
+
elif radio_liquidado.is_checked():
|
3538
|
+
console.print("O botão 'Liquidado' está selecionado.")
|
3539
|
+
status_selecionado = 'Liquidado'
|
3540
|
+
else:
|
3541
|
+
console.print("Nenhum botão de rádio está selecionado.")
|
3542
|
+
status_selecionado = 'Nenhum status está selecionado.'
|
3543
|
+
|
3544
|
+
return RpaRetornoProcessoDTO(
|
3545
|
+
sucesso=False,
|
3546
|
+
retorno=f"Cupom/titulo com status {status_selecionado} por favor, verificar",
|
3547
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3548
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
3549
|
+
)
|
3550
|
+
|
3551
|
+
console.print('Acessando a opção de Caixa')
|
3552
|
+
panel_TPage = main_window.child_window(class_name="TcxTreeView")
|
3553
|
+
panel_TTabSheet = panel_TPage.child_window(class_name="TcxCustomInnerTreeView")
|
3554
|
+
panel_TTabSheet.wait("visible")
|
3555
|
+
panel_TTabSheet.click()
|
3556
|
+
send_keys("^({HOME})")
|
3557
|
+
await worker_sleep(1)
|
3558
|
+
send_keys("{DOWN " + ("2") + "}")
|
3559
|
+
await worker_sleep(2)
|
3560
|
+
|
3561
|
+
main_window.set_focus()
|
3562
|
+
|
3563
|
+
page_control = main_window.child_window(class_name="TPageControl")
|
3564
|
+
# Navegar até a aba TabSheetLiquidacao
|
3565
|
+
tab_sheet_liquidacao = page_control.child_window(title="TabSheetLiquidacao")
|
3566
|
+
panel_liquidacao = tab_sheet_liquidacao.child_window(class_name="TPanel", found_index=0)
|
3567
|
+
db_edit_date = panel_liquidacao.child_window(class_name="TDBIEditDate", found_index=0)
|
3568
|
+
console.print('Inserindo a data atual')
|
3569
|
+
db_edit_date.set_edit_text(data_atual)
|
3570
|
+
await worker_sleep(1)
|
3571
|
+
|
3572
|
+
# Clicar na Calculador
|
3573
|
+
tab_sheet_caixa = tab_sheet_liquidacao.child_window(title="TabSheetCaixa")
|
3574
|
+
calculador_button = tab_sheet_caixa.child_window(class_name="TBitBtn", found_index=0)
|
3575
|
+
console.print('Clicando sobre Calculadora')
|
3576
|
+
calculador_button.click_input()
|
3577
|
+
await worker_sleep(1)
|
3578
|
+
|
3579
|
+
console.print('Inserindo 13 em Especie')
|
3580
|
+
db_edit_code = tab_sheet_caixa.child_window(class_name="TDBIEditCode", found_index=0)
|
3581
|
+
db_edit_code.set_edit_text("13")
|
3582
|
+
await worker_sleep(1)
|
3583
|
+
pyautogui.press('tab')
|
3584
|
+
|
3585
|
+
# Clicar no botão Liquidar dentro de TabSheetLiquidacao
|
3586
|
+
liquidar_button = panel_liquidacao.child_window(class_name="TBitBtn", found_index=2)
|
3587
|
+
console.print('Clicando em Liquidar')
|
3588
|
+
await worker_sleep(1)
|
3589
|
+
liquidar_button.click_input()
|
3590
|
+
|
3591
|
+
await worker_sleep(3)
|
3592
|
+
confirm_pop_up = await is_window_open_by_class("TMessageForm","TMessageForm")
|
3593
|
+
if confirm_pop_up["IsOpened"] == True:
|
3594
|
+
app_confirm = Application().connect(class_name="TMessageForm")
|
3595
|
+
main_window_confirm = app_confirm["TMessageForm"]
|
3596
|
+
|
3597
|
+
btn_yes = main_window_confirm["&Yes"]
|
3598
|
+
try:
|
3599
|
+
btn_yes.click()
|
3600
|
+
await worker_sleep(3)
|
3601
|
+
console.print("O botão Yes foi clicado com sucesso.", style="green")
|
3602
|
+
#main_window.close()
|
3603
|
+
except:
|
3604
|
+
return RpaRetornoProcessoDTO(
|
3605
|
+
sucesso=False,
|
3606
|
+
retorno=f"Não foi possivel clicar em Yes durante para a confirmação da liquidação do titulo",
|
3607
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3608
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3609
|
+
)
|
3610
|
+
|
3611
|
+
console.print('Aguardando a confirmação de Liquidação realizado com sucesso')
|
3612
|
+
try:
|
3613
|
+
app = Application().connect(title="Informação", timeout=60)
|
3614
|
+
main_window = app["Informação"]
|
3615
|
+
main_window.set_focus()
|
3616
|
+
btn_ok = main_window.child_window(class_name="Button")
|
3617
|
+
btn_ok.click()
|
3618
|
+
except Exception as e:
|
3619
|
+
return RpaRetornoProcessoDTO(
|
3620
|
+
sucesso=False,
|
3621
|
+
retorno=f"Não foi possivel obter a confirmação de titulo liquidado com sucesso, erro: {e}",
|
3622
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3623
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3624
|
+
)
|
3625
|
+
|
3626
|
+
console.print('Confirmando se o titulo alterou para Liquidado')
|
3627
|
+
panel_TPage = main_window.child_window(class_name="TcxTreeView")
|
3628
|
+
panel_TTabSheet = panel_TPage.child_window(class_name="TcxCustomInnerTreeView")
|
3629
|
+
panel_TTabSheet.wait("visible")
|
3630
|
+
panel_TTabSheet.click()
|
3631
|
+
send_keys("^({HOME})")
|
3632
|
+
await worker_sleep(1)
|
3633
|
+
|
3634
|
+
panel_TTab_Sheet = main_window.child_window(class_name="TTabSheet", found_index=0)
|
3635
|
+
panel_status = panel_TTab_Sheet.child_window(class_name="TDBIGroupBox", found_index=1)
|
3636
|
+
radio_liquidado = panel_status.child_window(class_name="TDBIRadioButton", found_index=3)
|
3637
|
+
|
3638
|
+
if radio_liquidado.is_checked():
|
3639
|
+
console.print("Botão 'Liquidado' está selecionado, seguindo com o processo...\n")
|
3640
|
+
main_window.close()
|
3641
|
+
else:
|
3642
|
+
return RpaRetornoProcessoDTO(
|
3643
|
+
sucesso=False,
|
3644
|
+
retorno=f"Status diferente de liquidado",
|
3645
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3646
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3647
|
+
)
|
3648
|
+
|
3649
|
+
except Exception as e:
|
3650
|
+
return RpaRetornoProcessoDTO(
|
3651
|
+
sucesso=False,
|
3652
|
+
retorno=f"Não foi possivel concluir as atividades para realizar a liquidação do titulo, erro: {e}",
|
3653
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3654
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3655
|
+
)
|
3656
|
+
|
3657
|
+
|
3658
|
+
async def gerenciador_nf_header(periodo: str, cod_cliente: str) -> RpaRetornoProcessoDTO:
|
3659
|
+
try:
|
3660
|
+
app = Application().connect(class_name="TFrmGerenciadorNFe2", timeout=60)
|
3661
|
+
main_window = app["TFrmGerenciadorNFe2"]
|
3662
|
+
main_window.set_focus()
|
3663
|
+
console.print("Inserindo o período vigente para buscar...\n")
|
3664
|
+
panel_TGroup_Box= main_window.child_window(class_name="TGroupBox", found_index=0)
|
3665
|
+
periodo_vigente_inicio = panel_TGroup_Box.child_window(class_name="TDBIEditDate", found_index=0)
|
3666
|
+
periodo_vigente_fim = panel_TGroup_Box.child_window(class_name="TDBIEditDate", found_index=1)
|
3667
|
+
situacao_select = panel_TGroup_Box.child_window(class_name="TDBIComboBoxValues", found_index=2)
|
3668
|
+
field_cod_cliente = panel_TGroup_Box.child_window(class_name="TDBIEditCode", found_index=1)
|
3669
|
+
btn_pesquisar = panel_TGroup_Box.child_window(class_name="TDBIEditCode", found_index=1)
|
3670
|
+
periodo_vigente_inicio.set_edit_text(periodo)
|
3671
|
+
await worker_sleep(1)
|
3672
|
+
periodo_vigente_fim.set_edit_text(periodo)
|
3673
|
+
await worker_sleep(2)
|
3674
|
+
|
3675
|
+
|
3676
|
+
console.print("Verificando a situação...\n")
|
3677
|
+
situacao_text = situacao_select.window_text()
|
3678
|
+
if "não transmitida" in situacao_text.lower():
|
3679
|
+
console.print("Situação corretamente selecionada...\n")
|
3680
|
+
else:
|
3681
|
+
situacao_select.click()
|
3682
|
+
set_combobox("||List", "Não Transmitida")
|
3683
|
+
|
3684
|
+
console.print("Inserindo o codigo do cliente...\n")
|
3685
|
+
field_cod_cliente.click()
|
3686
|
+
await worker_sleep(1)
|
3687
|
+
field_cod_cliente.set_edit_text(cod_cliente)
|
3688
|
+
await worker_sleep(1)
|
3689
|
+
field_cod_cliente.click()
|
3690
|
+
pyautogui.press('tab')
|
3691
|
+
|
3692
|
+
console.print("Cicando em Pesquisar...\n")
|
3693
|
+
btn_pesquisar.click()
|
3694
|
+
await worker_sleep(20)
|
3695
|
+
|
3696
|
+
i = 0
|
3697
|
+
max_attempts = 17
|
3698
|
+
|
3699
|
+
while i < max_attempts:
|
3700
|
+
i += 1
|
3701
|
+
console.print("Verificando se a nota foi encontrada...\n")
|
3702
|
+
try:
|
3703
|
+
main_window.set_focus()
|
3704
|
+
no_data_full_path = "assets\\entrada_notas\\no_data_display.png"
|
3705
|
+
img_no_data = pyautogui.locateCenterOnScreen(no_data_full_path, confidence=0.6)
|
3706
|
+
if img_no_data:
|
3707
|
+
console.print("'No data display' ainda aparente. Tentando novamente...")
|
3708
|
+
await worker_sleep(10)
|
3709
|
+
except pyautogui.ImageNotFoundException:
|
3710
|
+
console.print("'No data display' não encontrado na tela!")
|
3711
|
+
break
|
3712
|
+
|
3713
|
+
except Exception as e:
|
3714
|
+
console.print(f"Ocorreu um erro: {e}")
|
3715
|
+
|
3716
|
+
if i == max_attempts:
|
3717
|
+
return RpaRetornoProcessoDTO(
|
3718
|
+
sucesso=False,
|
3719
|
+
retorno=f"Tempo esgotado, No data display ainda presente na busca pela nota em Gerenciador NF-e",
|
3720
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3721
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3722
|
+
)
|
3723
|
+
|
3724
|
+
try:
|
3725
|
+
selecionar_todos_itens = pyautogui.locateOnScreen(ASSETS_PATH + "\\emsys\\selecinar_todos_itens_quadro_azul.png", confidence=0.8)
|
3726
|
+
pyautogui.click(selecionar_todos_itens)
|
3727
|
+
await worker_sleep(5)
|
3728
|
+
return RpaRetornoProcessoDTO(
|
3729
|
+
sucesso=True,
|
3730
|
+
retorno=f"Sucesso",
|
3731
|
+
status=RpaHistoricoStatusEnum.Sucesso
|
3732
|
+
)
|
3733
|
+
except Exception as e:
|
3734
|
+
return RpaRetornoProcessoDTO(
|
3735
|
+
sucesso=False,
|
3736
|
+
retorno=f"Não foi possivel clicar em selecionar todos os itens na tela de Gerenciador de NF-e, erro: {e}",
|
3737
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3738
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3739
|
+
)
|
3740
|
+
except Exception as e:
|
3741
|
+
return RpaRetornoProcessoDTO(
|
3742
|
+
sucesso=False,
|
3743
|
+
retorno=f"Não foi possivel clicar na Lupa para buscar a nota fiscal na tela de nota fiscal de saída, erro: {e}",
|
3744
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3745
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3746
|
+
)
|
3747
|
+
|
3748
|
+
|
3749
|
+
async def cadastro_pre_venda_header(nop: str, cod_cliente: str, cod_pagamento: str) -> RpaRetornoProcessoDTO:
|
3750
|
+
try:
|
3751
|
+
app = Application().connect(class_name="TFrmPreVenda", timeout=60)
|
3752
|
+
main_window = app["TFrmPreVenda"]
|
3753
|
+
main_window.set_focus()
|
3754
|
+
|
3755
|
+
console.print("Navegando nos elementos...\n")
|
3756
|
+
panel_TPage= main_window.child_window(class_name="TPage", found_index=0)
|
3757
|
+
panel_TGroup_Box= panel_TPage.child_window(class_name="TGroupBox", found_index=0)
|
3758
|
+
|
3759
|
+
console.print("Selecionando a condição de pagamento...\n")
|
3760
|
+
condicao_select = panel_TGroup_Box.child_window(class_name="TDBIComboBox", found_index=2)
|
3761
|
+
condicao_select.click()
|
3762
|
+
await worker_sleep(1)
|
3763
|
+
set_combobox("||List", cod_pagamento)
|
3764
|
+
await worker_sleep(1)
|
3765
|
+
|
3766
|
+
console.print("Inserindo codigo do cliente...\n")
|
3767
|
+
field_cod_cliente = panel_TGroup_Box.child_window(class_name="TDBIEditNumber", found_index=0)
|
3768
|
+
field_cod_cliente.click()
|
3769
|
+
pyautogui.press('del')
|
3770
|
+
pyautogui.press('backspace')
|
3771
|
+
field_cod_cliente.set_edit_text(cod_cliente)
|
3772
|
+
pyautogui.press('tab')
|
3773
|
+
|
3774
|
+
console.print("Obtendo cidade do cliente")
|
3775
|
+
field_cidade_cliente = panel_TGroup_Box.child_window(class_name="TDBIEditDescription", found_index=0)
|
3776
|
+
field_cidade_cliente.window_text()
|
3777
|
+
|
3778
|
+
|
3779
|
+
console.print("Inserindo NOP...\n")
|
3780
|
+
nop_select_box = panel_TGroup_Box.child_window(class_name="TDBIComboBox", found_index=1)
|
3781
|
+
nop_select_box.click()
|
3782
|
+
await worker_sleep(1)
|
3783
|
+
set_combobox("||List", nop)
|
3784
|
+
await worker_sleep(1)
|
3785
|
+
|
3786
|
+
|
3787
|
+
return RpaRetornoProcessoDTO(
|
3788
|
+
sucesso=True,
|
3789
|
+
retorno=field_cidade_cliente,
|
3790
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
3791
|
+
)
|
3792
|
+
except Exception as e:
|
3793
|
+
return RpaRetornoProcessoDTO(
|
3794
|
+
sucesso=False,
|
3795
|
+
retorno=f"Não foi possivel clicar na Lupa para buscar a nota fiscal na tela de pre venda, erro: {e}",
|
3796
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3797
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3798
|
+
)
|
3799
|
+
|
3800
|
+
|
3801
|
+
async def post_partner(url_retorno: str, idetificador: str, num_nota: str, valor_nota: str):
|
3802
|
+
try:
|
3803
|
+
import json
|
3804
|
+
url = url_retorno
|
3805
|
+
dados = {
|
3806
|
+
"status": "S",
|
3807
|
+
"numero_nota": num_nota,
|
3808
|
+
"observacao": "Nota lançada com sucesso!",
|
3809
|
+
"valor_nota": valor_nota,
|
3810
|
+
"identificador": idetificador
|
3811
|
+
}
|
3812
|
+
|
3813
|
+
headers = {"Content-Type": "application/json"}
|
3814
|
+
|
3815
|
+
async with aiohttp.ClientSession() as session:
|
3816
|
+
async with session.post(url, data=json.dumps(dados), headers=headers) as response:
|
3817
|
+
if response.status == 200:
|
3818
|
+
console.print(f"Dados enviado com sucesso")
|
3819
|
+
except Exception as e:
|
3820
|
+
err_msg = f"Erro ao comunicar com endpoint do webhook: {e}"
|
3821
|
+
console.print(f"\n{err_msg}\n", style="bold red")
|
3822
|
+
logger.info(err_msg)
|
3823
|
+
|
3824
|
+
|
3825
|
+
async def pessoas_ativa_cliente_fornecedor(cod_cliente: str, ativar_cliente: bool, ativar_forcedor: bool) -> RpaRetornoProcessoDTO:
|
3826
|
+
try:
|
3827
|
+
app = Application().connect(class_name="TFrmCadastroPessoaNew", timeout=60)
|
3828
|
+
main_window = app["TFrmCadastroPessoaNew"]
|
3829
|
+
main_window.set_focus()
|
3830
|
+
|
3831
|
+
panel_Capa = main_window.child_window(class_name="TGroupBox", found_index=1)
|
3832
|
+
cod_pessoa = panel_Capa.child_window(class_name="TDBIEditNumber", found_index=0)
|
3833
|
+
cod_pessoa.click()
|
3834
|
+
for _ in range(3):
|
3835
|
+
pyautogui.press("del")
|
3836
|
+
pyautogui.press("backspace")
|
3837
|
+
|
3838
|
+
cod_pessoa.set_edit_text(cod_cliente)
|
3839
|
+
cod_pessoa.click()
|
3840
|
+
pyautogui.press("enter")
|
3841
|
+
await worker_sleep(3)
|
3842
|
+
|
3843
|
+
main_window.set_focus()
|
3844
|
+
panel_Capa = main_window.child_window(class_name="TGroupBox", found_index=0)
|
3845
|
+
grp_classificacao = panel_Capa.child_window(class_name="TDBIGroupBox", found_index=0)
|
3846
|
+
|
3847
|
+
if ativar_forcedor:
|
3848
|
+
checkbox_fornecedor = grp_classificacao.child_window(title="Fornecedor", class_name="TDBICheckBox")
|
3849
|
+
if not checkbox_fornecedor.get_toggle_state() == 1:
|
3850
|
+
checkbox_fornecedor.click()
|
3851
|
+
console.print("Ativo como fornecedor... \n")
|
3852
|
+
|
3853
|
+
if ativar_cliente:
|
3854
|
+
checkbox_cliente = grp_classificacao.child_window(title="Cliente",class_name="TDBICheckBox")
|
3855
|
+
if not checkbox_cliente.get_toggle_state() == 1:
|
3856
|
+
checkbox_cliente.click()
|
3857
|
+
console.print("Ativo como Cliente...\n")
|
3858
|
+
|
3859
|
+
await worker_sleep(2)
|
3860
|
+
inserir_registro = pyautogui.locateOnScreen(ASSETS_PATH + "\\entrada_notas\\IncluirRegistro.png", confidence=0.8)
|
3861
|
+
pyautogui.click(inserir_registro)
|
3862
|
+
await worker_sleep(3)
|
3863
|
+
|
3864
|
+
console.print("Verificando a existência de Confirmação...\n")
|
3865
|
+
confirm_pop_up = await is_window_open_by_class("TMessageForm","TMessageForm")
|
3866
|
+
if confirm_pop_up["IsOpened"] == True:
|
3867
|
+
app_confirm = Application().connect(class_name="TMessageForm")
|
3868
|
+
main_window_confirm = app_confirm["TMessageForm"]
|
3869
|
+
|
3870
|
+
btn_no = main_window_confirm["&No"]
|
3871
|
+
try:
|
3872
|
+
btn_no.click()
|
3873
|
+
await worker_sleep(3)
|
3874
|
+
console.print("O botão No foi clicado com sucesso.", style="green")
|
3875
|
+
main_window.close()
|
3876
|
+
await worker_sleep(2)
|
3877
|
+
return RpaRetornoProcessoDTO(
|
3878
|
+
sucesso=True,
|
3879
|
+
retorno=f"Sucesso",
|
3880
|
+
status=RpaHistoricoStatusEnum.Sucesso)
|
3881
|
+
except:
|
3882
|
+
return RpaRetornoProcessoDTO(
|
3883
|
+
sucesso=False,
|
3884
|
+
retorno=f"Não foi possivel clicar em No durante a alteração no tipo de cadastro",
|
3885
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3886
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3887
|
+
)
|
3888
|
+
except Exception as e:
|
3889
|
+
return RpaRetornoProcessoDTO(
|
3890
|
+
sucesso=False,
|
3891
|
+
retorno=f"Não foi possivel clicar na Lupa para buscar a nota fiscal na tela de nota fiscal de saída, erro: {e}",
|
3892
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3893
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3894
|
+
)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
worker_automate_hub/__init__.py,sha256=LV28uQvBfpPIqudGIMJmVB8E941MjXHcu8DMoX5n8AM,25
|
2
2
|
worker_automate_hub/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
worker_automate_hub/api/ahead_service.py,sha256=_zqvVOEYZm0khuzlUGipUpAW_is9nSC_H7gJ9WOoaP0,2230
|
4
|
-
worker_automate_hub/api/client.py,sha256=
|
4
|
+
worker_automate_hub/api/client.py,sha256=uYmKPEdt2zUS7tKYJpk4NqXAGS413rpR4m33Eq3_5IU,19840
|
5
5
|
worker_automate_hub/api/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
worker_automate_hub/api/helpers/api_helpers.py,sha256=SkheO2fXexeh-a4shr8Qzsz_kZhuSG0DJ7kbODctRbM,3696
|
7
7
|
worker_automate_hub/api/rdp_service.py,sha256=L7orr60FkJr6zjETtA4me8tRYCW9m1g-i5pq6AILUFo,1647
|
@@ -37,6 +37,7 @@ worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
37
37
|
worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=UkLWTC5Ub2qBb0yY-8IZ0DLLOVJOfNTq_z9krx_t25Q,29476
|
38
38
|
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=lNjD-JxpPTXdvFEJAkajC_Ltyw81rIEJeu7FUfRf2qI,9586
|
39
39
|
worker_automate_hub/tasks/jobs/descartes.py,sha256=0bMCJ0xIcK8TLSgjF6taAbGFLMU-sGDVFIhUYSRtrbg,41092
|
40
|
+
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=YSfi4_7SnQ4gNnNpFLCu2d6YTsyIbElzhgaoPP_fL7U,77202
|
40
41
|
worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=dKkf22nH5gp3RErq5u0UzRsKyJ81fc6ZZ4vLtUuMwHA,21002
|
41
42
|
worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=8WmKe4-MRtzHobXz2S4YBDNN8alfawkC-BBlRY-mn1g,1726
|
42
43
|
worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=C26zmpGQGUq6sP9lU9nanM3Fje-rkyx5tjwmRy4lyL8,25300
|
@@ -64,18 +65,18 @@ worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py,sha256=jcfhppG-M
|
|
64
65
|
worker_automate_hub/tasks/jobs/playground.py,sha256=7vWDg9DwToHwGJ6_XOa8TQ6LmfRV5Qz2TaOV3q3P9sA,1918
|
65
66
|
worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=uHA5zQmAqqb-L_jdbBKiqINV4vXI58CL3wAI-2Xt_oQ,28938
|
66
67
|
worker_automate_hub/tasks/jobs/transferencias.py,sha256=i3fCanHZ_pSwPW03THpQPqlzrDjbV4QbKkXpUqV3dxM,39272
|
67
|
-
worker_automate_hub/tasks/task_definitions.py,sha256=
|
68
|
-
worker_automate_hub/tasks/task_executor.py,sha256=
|
68
|
+
worker_automate_hub/tasks/task_definitions.py,sha256=yNu2GSC1PxjblcMgT7UOFhEUq4CMaQqDfN3hAF4yz_U,4954
|
69
|
+
worker_automate_hub/tasks/task_executor.py,sha256=Hup_C2LeOkn7GEHQaEDqo8MIPdSPuaJ4hzHOOK7nqZU,5311
|
69
70
|
worker_automate_hub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
70
71
|
worker_automate_hub/utils/env.py,sha256=TacQjGRO7PUNpttrhTAc5Gnegaiysl2Knsv1P8qfkfs,57
|
71
72
|
worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1wiaMoJAGZeSy0D37sYdU,2212
|
72
73
|
worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
|
73
74
|
worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
|
74
75
|
worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
|
75
|
-
worker_automate_hub/utils/util.py,sha256=
|
76
|
+
worker_automate_hub/utils/util.py,sha256=aoKnUcE7FvNH9-kXjs3okDva2ytdJDdMLt4lPz8WC3s,154900
|
76
77
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=ZTb1XoKWZY7coXt06iIE8KI56N6AguhZv5DEPX2qUu8,31862
|
77
78
|
worker_automate_hub/worker.py,sha256=CT-poyP1ZYvubArYsnnNd9oJ53SPaDwgr6p6keS3nI4,6248
|
78
|
-
worker_automate_hub-0.5.
|
79
|
-
worker_automate_hub-0.5.
|
80
|
-
worker_automate_hub-0.5.
|
81
|
-
worker_automate_hub-0.5.
|
79
|
+
worker_automate_hub-0.5.40.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
80
|
+
worker_automate_hub-0.5.40.dist-info/METADATA,sha256=HooOmi-pOGB4eOz1FM6AckI74TLpG2tdp59mgK6AVsg,2894
|
81
|
+
worker_automate_hub-0.5.40.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
82
|
+
worker_automate_hub-0.5.40.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.38.dist-info → worker_automate_hub-0.5.40.dist-info}/entry_points.txt
RENAMED
File without changes
|