worker-automate-hub 0.5.330__py3-none-any.whl → 0.5.332__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/tasks/jobs/devolucao_prazo_a_faturar.py +253 -185
- {worker_automate_hub-0.5.330.dist-info → worker_automate_hub-0.5.332.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.330.dist-info → worker_automate_hub-0.5.332.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.330.dist-info → worker_automate_hub-0.5.332.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.330.dist-info → worker_automate_hub-0.5.332.dist-info}/entry_points.txt +0 -0
@@ -3315,7 +3315,7 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
3315
3315
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3316
3316
|
)
|
3317
3317
|
|
3318
|
-
|
3318
|
+
|
3319
3319
|
#VERIFICANDO SE POSSUI POP UP WARNING
|
3320
3320
|
console.print("Verificando a presença de Warning... \n")
|
3321
3321
|
warning_boo = False
|
@@ -3604,57 +3604,43 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
3604
3604
|
else:
|
3605
3605
|
console.print("Não possui warning para alterar tributação... \n")
|
3606
3606
|
|
3607
|
-
try:
|
3608
|
-
|
3609
|
-
|
3610
|
-
|
3611
|
-
|
3612
|
-
|
3613
|
-
|
3614
|
-
|
3615
|
-
|
3616
|
-
|
3617
|
-
|
3618
|
-
btn_ok.click()
|
3607
|
+
# try:
|
3608
|
+
# #Clcica no OK para seguir a transmissão da pré-venda
|
3609
|
+
# app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=60)
|
3610
|
+
# main_window = app["TFrmDadosFaturamentoPreVenda"]
|
3611
|
+
# main_window.set_focus()
|
3612
|
+
# btn_ok = main_window.child_window(class_name="TBitBtn", found_index=1)
|
3613
|
+
# btn_ok.click()
|
3614
|
+
# except:
|
3615
|
+
# btn_ok = main_window.child_window(title="&Ok")
|
3616
|
+
# btn_ok.click()
|
3617
|
+
# await worker_sleep(5)
|
3619
3618
|
|
3620
|
-
|
3621
|
-
|
3622
|
-
|
3623
|
-
console.print("Clicando em sim para faturar pre-venda... \n")
|
3624
|
-
app = Application().connect(class_name="TMessageForm", timeout=10, title="Confirm")
|
3625
|
-
main_window = app["TMessageForm"]
|
3626
|
-
main_window.set_focus()
|
3627
|
-
main_window.chiwld_window(title="&Yes").click()
|
3628
|
-
except:
|
3629
|
-
...
|
3630
|
-
|
3631
|
-
#Lucas Fim
|
3632
|
-
#ADICIONANDO MENSAGEM
|
3633
|
-
|
3619
|
+
#Lucas Fim
|
3620
|
+
#ADICIONANDO MENSAGEM
|
3621
|
+
await worker_sleep(5)
|
3634
3622
|
try:
|
3635
|
-
console.print("Identificando
|
3623
|
+
console.print("Identificando - TFrmDadosFaturamentoPreVenda 1")
|
3636
3624
|
app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=10)
|
3637
3625
|
main_window = app["Confirm"]
|
3638
3626
|
main_window.set_focus()
|
3639
3627
|
except:
|
3640
|
-
console.print("Identificando
|
3641
|
-
app = Application().connect(class_name="TMessageForm", timeout=10)
|
3628
|
+
console.print("Identificando - TMessageForm 1")
|
3629
|
+
app = Application().connect(class_name="TMessageForm", timeout=10, title='Confirm')
|
3642
3630
|
main_window = app["TMessageForm"]
|
3643
3631
|
main_window.set_focus()
|
3644
|
-
|
3645
|
-
|
3646
|
-
btn_yes = main_window.child_window(class_name="TButton", found_index=1)
|
3632
|
+
|
3633
|
+
btn_yes = main_window.child_window(class_name="TButton", title="&Yes")
|
3647
3634
|
btn_yes.click()
|
3648
3635
|
|
3649
3636
|
await worker_sleep(5)
|
3650
3637
|
|
3651
3638
|
try:
|
3652
|
-
console.print(
|
3639
|
+
console.print('Identificando - TFrmDadosFaturamentoPreVenda 2')
|
3653
3640
|
app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=10)
|
3654
3641
|
main_window = app["TMessageForm"]
|
3655
3642
|
except Exception as ex:
|
3656
|
-
console.print(f'{ex}')
|
3657
|
-
console.print("Identificando tela - 'TMessageForm' 2 ")
|
3643
|
+
console.print(f'{ex} - TMessageForm 2')
|
3658
3644
|
app = Application().connect(class_name="TMessageForm", timeout=10)
|
3659
3645
|
main_window = app["TMessageForm"]
|
3660
3646
|
|
@@ -3824,33 +3810,113 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
3824
3810
|
)
|
3825
3811
|
except:
|
3826
3812
|
console.print("Janela TFrmProcessamentoNFe2 ja fechada")
|
3813
|
+
|
3827
3814
|
|
3828
|
-
|
3829
|
-
|
3830
|
-
|
3831
|
-
|
3832
|
-
|
3833
|
-
|
3834
|
-
|
3835
|
-
|
3815
|
+
console.print("Verificando se possui pop-up imprimir boleta")
|
3816
|
+
boleta_screen = await is_window_open("Confirm")
|
3817
|
+
if boleta_screen["IsOpened"] == True:
|
3818
|
+
console.print("Janela aberta, fechando")
|
3819
|
+
try:
|
3820
|
+
console.print("Confirm")
|
3821
|
+
app = Application().connect(title="Confirm", timeout=10)
|
3822
|
+
main_window = app["Confirm"]
|
3823
|
+
main_window.set_focus()
|
3824
|
+
except:
|
3825
|
+
console.print("Identificando - TMessageForm 1")
|
3826
|
+
app = Application().connect(class_name="TMessageForm", timeout=10, title='Confirm')
|
3827
|
+
main_window = app["TMessageForm"]
|
3828
|
+
main_window.set_focus()
|
3829
|
+
|
3830
|
+
btn_no = main_window.child_window(class_name="TButton", title="&No")
|
3831
|
+
btn_no.click()
|
3836
3832
|
|
3837
3833
|
|
3834
|
+
await worker_sleep(7)
|
3835
|
+
erro_screen = await is_window_open_by_class("TFrmDadosFaturamentoPreVenda","Confirm")
|
3836
|
+
if erro_screen["IsOpened"] == True:
|
3837
|
+
console.print("Janela aberta, fechando")
|
3838
|
+
try:
|
3839
|
+
console.print("Identificando - TFrmDadosFaturamentoPreVenda 1")
|
3840
|
+
app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=10)
|
3841
|
+
main_window = app["Confirm"]
|
3842
|
+
main_window.set_focus()
|
3843
|
+
except:
|
3844
|
+
console.print("Identificando - TMessageForm 1")
|
3845
|
+
app = Application().connect(class_name="TMessageForm", timeout=10, title='Confirm')
|
3846
|
+
main_window = app["TMessageForm"]
|
3847
|
+
main_window.set_focus()
|
3848
|
+
|
3849
|
+
btn_no = main_window.child_window(class_name="TButton", title="&No")
|
3850
|
+
btn_no.click()
|
3851
|
+
|
3852
|
+
|
3853
|
+
await worker_sleep(10)
|
3854
|
+
console.print("Verificando se a tela de Mensagem esta aberta")
|
3838
3855
|
erro_screen = await is_window_open_by_class("TMemo","TMemo")
|
3839
3856
|
if erro_screen["IsOpened"] == True:
|
3857
|
+
console.print("Janela aberta, fechando")
|
3840
3858
|
app = Application().connect(class_name="TMemo", timeout=10)
|
3841
3859
|
main_window = app["TMemo"]
|
3842
3860
|
main_window.set_focus()
|
3843
|
-
await worker_sleep(
|
3861
|
+
await worker_sleep(5)
|
3844
3862
|
main_window.close()
|
3863
|
+
|
3845
3864
|
|
3865
|
+
console.print("Verificando se a tela de Faturamento Pre venda esta aberta")
|
3866
|
+
close_dados_faturamento = await is_window_open_by_class("TFrmDadosFaturamentoPreVenda","TFrmDadosFaturamentoPreVenda")
|
3867
|
+
if close_dados_faturamento["IsOpened"] == True:
|
3868
|
+
console.print("Janela aberta, fechando")
|
3869
|
+
try:
|
3870
|
+
app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=60)
|
3871
|
+
main_window = app["TFrmDadosFaturamentoPreVenda"]
|
3872
|
+
main_window.set_focus()
|
3873
|
+
btn_cancelar = main_window.child_window(class_name="TBitBtn", found_index=0)
|
3874
|
+
btn_cancelar.click()
|
3875
|
+
except:
|
3876
|
+
btn_cancelar = main_window.child_window(title="&Cancela")
|
3877
|
+
btn_cancelar.click()
|
3846
3878
|
|
3879
|
+
|
3880
|
+
await worker_sleep(10)
|
3881
|
+
console.print("Verificando se a tela de Faturamento Pre venda esta aberta")
|
3847
3882
|
close_dados_faturamento = await is_window_open_by_class("TFrmDadosFaturamentoPreVenda","TFrmDadosFaturamentoPreVenda")
|
3848
3883
|
if close_dados_faturamento["IsOpened"] == True:
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3884
|
+
console.print("Janela aberta, fechando")
|
3885
|
+
try:
|
3886
|
+
app = Application().connect(class_name="TFrmDadosFaturamentoPreVenda", timeout=180)
|
3887
|
+
main_window = app["TFrmDadosFaturamentoPreVenda"]
|
3888
|
+
main_window.set_focus()
|
3889
|
+
await worker_sleep(2)
|
3890
|
+
main_window.close()
|
3891
|
+
except Exception as e:
|
3892
|
+
console.print(f"Erro ao fechar a janela de dados faturamento pre venda {e}")
|
3893
|
+
|
3894
|
+
|
3895
|
+
await worker_sleep(5)
|
3896
|
+
console.print("Verificando se a tela de Gerenciador esta aberta")
|
3897
|
+
window_gerenciador_screen = await is_window_open_by_class("TFrmGerenciadorNFe2","TFrmGerenciadorNFe2")
|
3898
|
+
if window_gerenciador_screen["IsOpened"] == True:
|
3899
|
+
app = Application().connect(class_name="TFrmGerenciadorNFe2", timeout=10)
|
3900
|
+
window_gerenciador = app["TFrmGerenciadorNFe2"]
|
3901
|
+
window_gerenciador.set_focus()
|
3852
3902
|
await worker_sleep(2)
|
3853
|
-
|
3903
|
+
window_gerenciador.close()
|
3904
|
+
else:
|
3905
|
+
console.print("Janela TFrmGerenciadorNFe2 ja fechada")
|
3906
|
+
|
3907
|
+
|
3908
|
+
await worker_sleep(10)
|
3909
|
+
console.print("Verificando se a tela de Pre venda esta aberta")
|
3910
|
+
window_gerenciador_screen = await is_window_open_by_class("TFrmPreVenda","TFrmPreVenda")
|
3911
|
+
if window_gerenciador_screen["IsOpened"] == True:
|
3912
|
+
app = Application().connect(class_name="TFrmPreVenda", timeout=10)
|
3913
|
+
window_gerenciador = app["TFrmPreVenda"]
|
3914
|
+
window_gerenciador.set_focus()
|
3915
|
+
await worker_sleep(2)
|
3916
|
+
window_gerenciador.close()
|
3917
|
+
else:
|
3918
|
+
console.print("Janela TFrmPreVenda ja fechada")
|
3919
|
+
|
3854
3920
|
|
3855
3921
|
except Exception as e:
|
3856
3922
|
retorno = f"Não foi possivel concluir o processo de pré venda {e} \nEtapas Executadas:\n{steps}"
|
@@ -3873,169 +3939,171 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
|
|
3873
3939
|
|
3874
3940
|
|
3875
3941
|
#GERAR RELATORIO FINAL
|
3876
|
-
|
3877
|
-
|
3878
|
-
type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
|
3879
|
-
pyautogui.press("enter")
|
3880
|
-
await worker_sleep(2)
|
3881
|
-
pyautogui.press("enter")
|
3882
|
-
await worker_sleep(5)
|
3883
|
-
|
3884
|
-
boletim_caixa_opened = await is_window_open_by_class("TFrmRelBoletimCaixa", "TFrmRelBoletimCaixa")
|
3885
|
-
if boletim_caixa_opened["IsOpened"] == True:
|
3886
|
-
console.print(f"\nRelatório Boletim Caixa esta aberta",style="bold green")
|
3887
|
-
else:
|
3942
|
+
if nota.get("clienteFIDC").lower() == 'não':
|
3943
|
+
await worker_sleep(2)
|
3888
3944
|
console.print(f"\nPesquisa: 'Relatório Boletim Caixa",style="bold green")
|
3889
3945
|
type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
|
3890
3946
|
pyautogui.press("enter")
|
3891
3947
|
await worker_sleep(2)
|
3892
|
-
pyautogui.press("tab")
|
3893
|
-
await worker_sleep(1)
|
3894
|
-
pyautogui.press("tab")
|
3895
|
-
await worker_sleep(1)
|
3896
3948
|
pyautogui.press("enter")
|
3897
3949
|
await worker_sleep(5)
|
3898
3950
|
|
3951
|
+
boletim_caixa_opened = await is_window_open_by_class("TFrmRelBoletimCaixa", "TFrmRelBoletimCaixa")
|
3952
|
+
if boletim_caixa_opened["IsOpened"] == True:
|
3953
|
+
console.print(f"\nRelatório Boletim Caixa esta aberta",style="bold green")
|
3954
|
+
else:
|
3955
|
+
console.print(f"\nPesquisa: 'Relatório Boletim Caixa",style="bold green")
|
3956
|
+
type_text_into_field("Rel. Boletim Caixa", app["TFrmMenuPrincipal"]["Edit"], True, "50")
|
3957
|
+
pyautogui.press("enter")
|
3958
|
+
await worker_sleep(2)
|
3959
|
+
pyautogui.press("tab")
|
3960
|
+
await worker_sleep(1)
|
3961
|
+
pyautogui.press("tab")
|
3962
|
+
await worker_sleep(1)
|
3963
|
+
pyautogui.press("enter")
|
3964
|
+
await worker_sleep(5)
|
3899
3965
|
|
3900
3966
|
|
3901
|
-
try:
|
3902
|
-
app = Application().connect(class_name="TFrmRelBoletimCaixa", timeout=60)
|
3903
|
-
main_window = app["TFrmRelBoletimCaixa"]
|
3904
|
-
except Exception as e:
|
3905
|
-
retorno = f"Não foi possivel abrir a tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
|
3906
|
-
return RpaRetornoProcessoDTO(
|
3907
|
-
sucesso=False,
|
3908
|
-
retorno=retorno,
|
3909
|
-
status=RpaHistoricoStatusEnum.Falha,
|
3910
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3911
|
-
)
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
3915
3967
|
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3968
|
+
try:
|
3969
|
+
app = Application().connect(class_name="TFrmRelBoletimCaixa", timeout=60)
|
3970
|
+
main_window = app["TFrmRelBoletimCaixa"]
|
3971
|
+
except Exception as e:
|
3972
|
+
retorno = f"Não foi possivel abrir a tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
|
3973
|
+
return RpaRetornoProcessoDTO(
|
3974
|
+
sucesso=False,
|
3975
|
+
retorno=retorno,
|
3976
|
+
status=RpaHistoricoStatusEnum.Falha,
|
3977
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3978
|
+
)
|
3919
3979
|
|
3920
|
-
dt_inicio = tgroup_box.child_window(class_name="TDBIEditDate", found_index=0)
|
3921
|
-
dt_inicio.set_edit_text(data_hoje)
|
3922
|
-
dt_final = main_window.child_window(class_name="TDBIEditDate", found_index=1)
|
3923
|
-
dt_final.set_edit_text(data_hoje)
|
3924
|
-
|
3925
|
-
#SELECIONANDO A ESPECIE
|
3926
|
-
select_especie = main_window.child_window(class_name="TDBIComboBox", found_index=0)
|
3927
|
-
select_especie.click()
|
3928
|
-
set_combobox("||List", "13 - DEVOLUCAO DE VENDA")
|
3929
|
-
send_keys("%g")
|
3930
|
-
except Exception as e:
|
3931
|
-
retorno = f"Não foi possivel filtar Devolução de Venda na tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
|
3932
|
-
return RpaRetornoProcessoDTO(
|
3933
|
-
sucesso=False,
|
3934
|
-
retorno=retorno,
|
3935
|
-
status=RpaHistoricoStatusEnum.Falha,
|
3936
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3937
|
-
)
|
3938
|
-
|
3939
|
-
#CLICANDO NO ICONE DE IMPRIMIR
|
3940
|
-
await worker_sleep(10)
|
3941
|
-
screen_width, screen_height = pyautogui.size()
|
3942
|
-
x = 10
|
3943
|
-
y = screen_height - 280 - (96 * 2) / .254
|
3944
|
-
pyautogui.click(x,y)
|
3945
3980
|
|
3946
|
-
|
3947
|
-
#INTERAGINDO COM A TELA DE PRINT
|
3948
|
-
try:
|
3949
|
-
console.print("Interagindo com a tela 'PRINT'...\n")
|
3950
|
-
app = Application().connect(class_name="TppPrintDialog", timeout=20)
|
3951
|
-
main_window = app["TppPrintDialog"]
|
3952
|
-
tpanel_btn_ok = main_window.child_window(class_name="TPanel", found_index=1)
|
3953
|
-
btn_ok_print_screen = tpanel_btn_ok.child_window(class_name="TButton", found_index=1)
|
3954
|
-
btn_ok_print_screen.click()
|
3955
|
-
await worker_sleep(5)
|
3956
|
-
|
3957
3981
|
|
3958
|
-
#INSERINDO O DIRETORIO E SALVANDO O ARQUIVO
|
3959
|
-
app = Application().connect(title="Salvar Saída de Impressão como")
|
3960
|
-
main_window = app["Dialog"]
|
3961
|
-
console.print("Tela 'Salvar' encontrada!")
|
3962
3982
|
|
3963
|
-
console.print("
|
3964
|
-
|
3965
|
-
|
3983
|
+
console.print(f"\nNavegando entre os elementos do Rel Boletim Caixa ",style="bold green")
|
3984
|
+
try:
|
3985
|
+
tgroup_box = main_window.child_window(class_name="TGroupBox", found_index=0)
|
3986
|
+
|
3987
|
+
dt_inicio = tgroup_box.child_window(class_name="TDBIEditDate", found_index=0)
|
3988
|
+
dt_inicio.set_edit_text(data_hoje)
|
3989
|
+
dt_final = main_window.child_window(class_name="TDBIEditDate", found_index=1)
|
3990
|
+
dt_final.set_edit_text(data_hoje)
|
3991
|
+
|
3992
|
+
#SELECIONANDO A ESPECIE
|
3993
|
+
select_especie = main_window.child_window(class_name="TDBIComboBox", found_index=0)
|
3994
|
+
select_especie.click()
|
3995
|
+
set_combobox("||List", "13 - DEVOLUCAO DE VENDA")
|
3996
|
+
send_keys("%g")
|
3997
|
+
except Exception as e:
|
3998
|
+
retorno = f"Não foi possivel filtar Devolução de Venda na tela de Rel. Boletim Caixa \nEtapas Executadas:\n{steps}"
|
3999
|
+
return RpaRetornoProcessoDTO(
|
4000
|
+
sucesso=False,
|
4001
|
+
retorno=retorno,
|
4002
|
+
status=RpaHistoricoStatusEnum.Falha,
|
4003
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4004
|
+
)
|
3966
4005
|
|
3967
|
-
|
3968
|
-
pyautogui.write(path_to_txt)
|
3969
|
-
await worker_sleep(1)
|
3970
|
-
main_window.type_keys("%l")
|
3971
|
-
console.print("Arquivo salvo com sucesso...\n")
|
4006
|
+
#CLICANDO NO ICONE DE IMPRIMIR
|
3972
4007
|
await worker_sleep(10)
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
3977
|
-
retorno=retorno,
|
3978
|
-
status=RpaHistoricoStatusEnum.Falha,
|
3979
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
3980
|
-
)
|
3981
|
-
|
3982
|
-
txt = ""
|
3983
|
-
with open(f"{path_to_txt}.pdf", "rb") as f:
|
3984
|
-
reader = PdfReader(f)
|
3985
|
-
for p in reader.pages:
|
3986
|
-
txt += p.extract_text()
|
3987
|
-
|
3988
|
-
console.print(f"Texto extraido {txt}...\n")
|
3989
|
-
v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
|
3990
|
-
|
3991
|
-
ultimo_valor = v[-1]
|
3992
|
-
penultimo_valor = v[-2]
|
4008
|
+
screen_width, screen_height = pyautogui.size()
|
4009
|
+
x = 10
|
4010
|
+
y = screen_height - 280 - (96 * 2) / .254
|
4011
|
+
pyautogui.click(x,y)
|
3993
4012
|
|
3994
|
-
|
3995
|
-
|
3996
|
-
with open(f"{path_to_txt}.pdf", 'rb') as file:
|
3997
|
-
file_bytes = io.BytesIO(file.read())
|
3998
|
-
|
3999
|
-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
4000
|
-
desArquivo = f"CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}.pdf"
|
4013
|
+
|
4014
|
+
#INTERAGINDO COM A TELA DE PRINT
|
4001
4015
|
try:
|
4002
|
-
|
4003
|
-
|
4004
|
-
|
4016
|
+
console.print("Interagindo com a tela 'PRINT'...\n")
|
4017
|
+
app = Application().connect(class_name="TppPrintDialog", timeout=20)
|
4018
|
+
main_window = app["TppPrintDialog"]
|
4019
|
+
tpanel_btn_ok = main_window.child_window(class_name="TPanel", found_index=1)
|
4020
|
+
btn_ok_print_screen = tpanel_btn_ok.child_window(class_name="TButton", found_index=1)
|
4021
|
+
btn_ok_print_screen.click()
|
4022
|
+
await worker_sleep(5)
|
4023
|
+
|
4024
|
+
|
4025
|
+
#INSERINDO O DIRETORIO E SALVANDO O ARQUIVO
|
4026
|
+
app = Application().connect(title="Salvar Saída de Impressão como")
|
4027
|
+
main_window = app["Dialog"]
|
4028
|
+
console.print("Tela 'Salvar' encontrada!")
|
4005
4029
|
|
4006
|
-
|
4007
|
-
|
4008
|
-
|
4030
|
+
console.print("Interagindo com a tela 'Salvar'...\n")
|
4031
|
+
username = getpass.getuser()
|
4032
|
+
path_to_txt = f"C:\\Users\\{username}\\Downloads\\CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}"
|
4009
4033
|
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
|
4014
|
-
|
4015
|
-
|
4016
|
-
|
4034
|
+
main_window.type_keys("%n")
|
4035
|
+
pyautogui.write(path_to_txt)
|
4036
|
+
await worker_sleep(1)
|
4037
|
+
main_window.type_keys("%l")
|
4038
|
+
console.print("Arquivo salvo com sucesso...\n")
|
4039
|
+
await worker_sleep(10)
|
4040
|
+
except Exception as e:
|
4041
|
+
retorno = f"Não foi possivel salvar o relatorio referente ao Boletim Caixa, erro {e}, \nEtapas Executadas:\n{steps}"
|
4017
4042
|
return RpaRetornoProcessoDTO(
|
4018
|
-
sucesso=
|
4043
|
+
sucesso=False,
|
4019
4044
|
retorno=retorno,
|
4020
|
-
status=RpaHistoricoStatusEnum.
|
4021
|
-
|
4022
|
-
|
4023
|
-
|
4045
|
+
status=RpaHistoricoStatusEnum.Falha,
|
4046
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4047
|
+
)
|
4048
|
+
|
4049
|
+
txt = ""
|
4050
|
+
with open(f"{path_to_txt}.pdf", "rb") as f:
|
4051
|
+
reader = PdfReader(f)
|
4052
|
+
for p in reader.pages:
|
4053
|
+
txt += p.extract_text()
|
4054
|
+
|
4055
|
+
console.print(f"Texto extraido {txt}...\n")
|
4056
|
+
v = re.findall(r'\b\d{1,3},\d{2}\b(?!\s*\d+\.\d+\.\d+)',txt)
|
4057
|
+
|
4058
|
+
ultimo_valor = v[-1]
|
4059
|
+
penultimo_valor = v[-2]
|
4060
|
+
|
4061
|
+
if ultimo_valor == penultimo_valor:
|
4062
|
+
console.print("Valores no relatorio corretamente gerados...\n")
|
4063
|
+
with open(f"{path_to_txt}.pdf", 'rb') as file:
|
4064
|
+
file_bytes = io.BytesIO(file.read())
|
4065
|
+
|
4066
|
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
4067
|
+
desArquivo = f"CAIXA 13 DEVOLUCAO {numero_cupom_fiscal}.pdf"
|
4068
|
+
try:
|
4069
|
+
await send_file(historico_id, desArquivo, "pdf", file_bytes, file_extension="pdf")
|
4070
|
+
os.remove(f"{path_to_txt}.pdf")
|
4071
|
+
retorno = f"Processo de devolução executado com sucesso \nEtapas Executadas:\n{steps}"
|
4072
|
+
|
4073
|
+
try:
|
4074
|
+
url_retorno = nota.get("urlRetorno")
|
4075
|
+
identificador = nota.get("identificador")
|
4076
|
+
|
4077
|
+
if url_retorno and identificador:
|
4078
|
+
await post_partner(url_retorno, identificador, numero_nota_fiscal, valor_nota_fiscal)
|
4079
|
+
else:
|
4080
|
+
console.print("Não foi possivel obter o valor de urlRetorno/identificador")
|
4081
|
+
except:
|
4082
|
+
console.print(f"Erro ao obter os dados ou enviar a requisição: {e}")
|
4083
|
+
|
4084
|
+
return RpaRetornoProcessoDTO(
|
4085
|
+
sucesso=True,
|
4086
|
+
retorno=retorno,
|
4087
|
+
status=RpaHistoricoStatusEnum.Sucesso)
|
4088
|
+
except Exception as e:
|
4089
|
+
result = f"Arquivo CAIXA 13 DEVOLUÇÃO gerado com sucesso, porém gerou erro ao realizar o envio para o backoffice {e} - Arquivo ainda salvo na dispositivo utilizado no diretório {path_to_txt} !"
|
4090
|
+
console.print(result, style="bold red")
|
4091
|
+
return RpaRetornoProcessoDTO(
|
4092
|
+
sucesso=False,
|
4093
|
+
retorno=result,
|
4094
|
+
status=RpaHistoricoStatusEnum.Falha,
|
4095
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)]
|
4096
|
+
)
|
4097
|
+
else:
|
4098
|
+
os.remove(f"{path_to_txt}.pdf")
|
4024
4099
|
return RpaRetornoProcessoDTO(
|
4025
4100
|
sucesso=False,
|
4026
|
-
retorno=
|
4101
|
+
retorno=f"O valor de entrada {penultimo_valor} não esta batendo com o valor de saída {ultimo_valor}, por favor verificar. \nEtapas Executadas:\n{steps}",
|
4027
4102
|
status=RpaHistoricoStatusEnum.Falha,
|
4028
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.
|
4103
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
4029
4104
|
)
|
4030
4105
|
else:
|
4031
|
-
|
4032
|
-
return RpaRetornoProcessoDTO(
|
4033
|
-
sucesso=False,
|
4034
|
-
retorno=f"O valor de entrada {penultimo_valor} não esta batendo com o valor de saída {ultimo_valor}, por favor verificar. \nEtapas Executadas:\n{steps}",
|
4035
|
-
status=RpaHistoricoStatusEnum.Falha,
|
4036
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
|
4037
|
-
)
|
4038
|
-
|
4106
|
+
console.print("Cliente FIDC não é necessario gerar relatorio final, encerrando processo.", style="bold red")
|
4039
4107
|
except Exception as ex:
|
4040
4108
|
retorno = f"Erro Processo Devolução Prazo a Faturar: {str(ex)} \nEtapas Executadas:\n{steps}"
|
4041
4109
|
logger.error(retorno)
|
@@ -42,7 +42,7 @@ worker_automate_hub/tasks/jobs/cte_manual.py,sha256=JucHpRMjMiy-QEJ0wtFnytLpN53t
|
|
42
42
|
worker_automate_hub/tasks/jobs/descartes.py,sha256=2zODOekSJSr7nuO9sUzT_F3YeG7N5EHuxnp05RguirE,41361
|
43
43
|
worker_automate_hub/tasks/jobs/despesas_cte.py,sha256=TWbjBMZjYDugiqYUa_1DtCAUWOyVetoZI2SPs7AdDNc,13264
|
44
44
|
worker_automate_hub/tasks/jobs/devolucao_ctf.py,sha256=A41O9a6kVUweUBy7Lc2dpJoeAi8QYxu-pMc8u-g0yTg,110241
|
45
|
-
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256
|
45
|
+
worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=uQzuN3Tk-szEo5a4Dtcdtt99JWK0Zh4DF3odYMNIVC8,244729
|
46
46
|
worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=dKkf22nH5gp3RErq5u0UzRsKyJ81fc6ZZ4vLtUuMwHA,21002
|
47
47
|
worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=8WmKe4-MRtzHobXz2S4YBDNN8alfawkC-BBlRY-mn1g,1726
|
48
48
|
worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=C26zmpGQGUq6sP9lU9nanM3Fje-rkyx5tjwmRy4lyL8,25300
|
@@ -85,7 +85,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
85
85
|
worker_automate_hub/utils/util.py,sha256=sadsyNEdhkhMHU2jVdDCJK59kHd4TWVDmmfQ62gc5Q8,182626
|
86
86
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=wmnpuOesmPSryZszmapa37b9YNC0E2MkeDYnbwr-0rU,33315
|
87
87
|
worker_automate_hub/worker.py,sha256=axdrr1xLTjWEyWfcyH3OCSpPTsyzck_fL_0u1DBLjvw,6525
|
88
|
-
worker_automate_hub-0.5.
|
89
|
-
worker_automate_hub-0.5.
|
90
|
-
worker_automate_hub-0.5.
|
91
|
-
worker_automate_hub-0.5.
|
88
|
+
worker_automate_hub-0.5.332.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
89
|
+
worker_automate_hub-0.5.332.dist-info/METADATA,sha256=YF_M7dflEYp-LcWh2jJhO_YZsSAIj6J7UTCyD70gpmM,3041
|
90
|
+
worker_automate_hub-0.5.332.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
91
|
+
worker_automate_hub-0.5.332.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.330.dist-info → worker_automate_hub-0.5.332.dist-info}/entry_points.txt
RENAMED
File without changes
|