worker-automate-hub 0.5.798__tar.gz → 0.5.800__tar.gz
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-0.5.798 → worker_automate_hub-0.5.800}/PKG-INFO +1 -1
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/pyproject.toml +1 -1
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +115 -189
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/README.md +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/ahead_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/client.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/datalake_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/helpers/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/rdp_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/rpa_fila_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/rpa_historico_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/webhook_service.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/cli.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/config/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/config/settings.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/config.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/core/so_manipulation.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/deprecation.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/rate_limit.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/repeat.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/retry.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/singleton.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/timeit.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/rpa_fila.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dao/rpa_robo.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/rpa_sap_dto.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/cte_manual.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/cte_xml.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/devolucao_ctf.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/devolucao_ctf_35.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_cte_1353.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_cte_333.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_22.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_37.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_503.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/entrada_de_notas_9000.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/extracao_fechamento_contabil.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/extracao_fechamento_emsys.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/extracao_saldo_estoque.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/extracao_saldo_estoque_fiscal.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/fechar_conexao_rdp.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/fidc_exportacao_docs_portal_b2b.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/fidc_retorno_cobranca.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/integracao_contabil.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/integracao_contabil_generica.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/lancamento_rateio.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/opex_capex.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/playground.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/task_definitions.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/task_executor.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/__init__.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/env.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/logger.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/toast.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/updater.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/util.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
- {worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/worker.py +0 -0
@@ -7,10 +7,7 @@ import sys
|
|
7
7
|
import os
|
8
8
|
from pywinauto.findwindows import ElementNotFoundError
|
9
9
|
from pywinauto.keyboard import send_keys
|
10
|
-
|
11
10
|
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
12
|
-
|
13
|
-
|
14
11
|
from worker_automate_hub.utils.logger import logger
|
15
12
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
16
13
|
RpaHistoricoStatusEnum,
|
@@ -87,7 +84,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
87
84
|
# Fecha a instancia do emsys - caso esteja aberta
|
88
85
|
await kill_all_emsys()
|
89
86
|
|
90
|
-
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\
|
87
|
+
app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSysFiscal_39.exe")
|
91
88
|
warnings.filterwarnings(
|
92
89
|
"ignore",
|
93
90
|
category=UserWarning,
|
@@ -205,6 +202,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
205
202
|
saida_checkbox.click_input()
|
206
203
|
|
207
204
|
console.print("Aguardar marcar caixa de saida")
|
205
|
+
# imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\saida_marcada.png"
|
208
206
|
imagem = "assets\\abertura_livros\\saida_marcada.png"
|
209
207
|
|
210
208
|
tempo_limite = 600 # 10 minutos
|
@@ -242,7 +240,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
242
240
|
# Clicando em incluir livro
|
243
241
|
try:
|
244
242
|
console.print("Clicando em incluir livro")
|
245
|
-
cords = (
|
243
|
+
cords = (698, 728)
|
246
244
|
pyautogui.click(x=cords[0], y=cords[1])
|
247
245
|
await worker_sleep(5)
|
248
246
|
except:
|
@@ -341,6 +339,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
341
339
|
await worker_sleep(5)
|
342
340
|
|
343
341
|
console.print("Aguardar o término de carregar")
|
342
|
+
# imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livros_incluidos.png"
|
344
343
|
imagem = "assets\\abertura_livros\\livros_incluidos.png"
|
345
344
|
|
346
345
|
tempo_limite = 1200 # 20 minutos
|
@@ -502,181 +501,8 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
502
501
|
|
503
502
|
main_window.close()
|
504
503
|
|
505
|
-
await worker_sleep(
|
506
|
-
|
507
|
-
console.print("Selecionar Livro Saída aberto")
|
508
|
-
|
509
|
-
# Selecionar linha livro de saída aberto
|
510
|
-
# imagem = "assets\\abertura_livros\\livro_saida_aberto.png"
|
511
|
-
imagem = "assets\\abertura_livros\\livro_saida_aberto.png"
|
512
|
-
|
513
|
-
# Tenta localizar a imagem na tela
|
514
|
-
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9)
|
515
|
-
|
516
|
-
if localizacao:
|
517
|
-
print(f"Imagem livro de saída aberto encontrado em: {localizacao}")
|
518
|
-
pyautogui.moveTo(localizacao)
|
519
|
-
pyautogui.click()
|
520
|
-
else:
|
521
|
-
console.print("Imagem livro de saída aberto não encontrado na tela.")
|
522
|
-
|
523
|
-
# Clicar em alterar livro
|
524
|
-
# imagem = "assets\\abertura_livros\\alterar_livro.png"
|
525
|
-
imagem = "assets\\abertura_livros\\alterar_livro.png"
|
526
|
-
# Tenta localizar a imagem na tela
|
527
|
-
localizacao = pyautogui.locateCenterOnScreen(
|
528
|
-
imagem, confidence=0.9
|
529
|
-
) # você pode ajustar o confidence
|
530
|
-
|
531
|
-
if localizacao:
|
532
|
-
print(f"Imagem alterar livro encontrado em: {localizacao}")
|
533
|
-
pyautogui.moveTo(localizacao)
|
534
|
-
pyautogui.click()
|
535
|
-
else:
|
536
|
-
console.print("Imagem alterar livro não encontrada na tela.")
|
537
|
-
|
538
|
-
await worker_sleep(8)
|
539
|
-
|
540
|
-
# Clicar em Livro fiscal
|
541
|
-
# imagem = "assets\\abertura_livros\\livro_fiscal.png"
|
542
|
-
imagem = "assets\\abertura_livros\\livro_fiscal.png"
|
543
|
-
# Tenta localizar a imagem na tela
|
544
|
-
localizacao = pyautogui.locateCenterOnScreen(
|
545
|
-
imagem, confidence=0.9
|
546
|
-
) # você pode ajustar o confidence
|
547
|
-
|
548
|
-
if localizacao:
|
549
|
-
print(f"Imagem Livro fiscal encontrado em: {localizacao}")
|
550
|
-
pyautogui.moveTo(localizacao)
|
551
|
-
pyautogui.click()
|
552
|
-
else:
|
553
|
-
console.print("Imagem Livro fiscal não encontrada na tela.")
|
554
|
-
|
555
|
-
await worker_sleep(4)
|
556
|
-
|
557
|
-
# Clicar em Gerar Relatório
|
558
|
-
# imagem = "assets\\abertura_livros\\gerar_registros.png"
|
559
|
-
imagem = "assets\\abertura_livros\\gerar_registros.png"
|
560
|
-
|
561
|
-
# Tenta localizar a imagem na tela
|
562
|
-
localizacao = pyautogui.locateCenterOnScreen(
|
563
|
-
imagem, confidence=0.9
|
564
|
-
) # você pode ajustar o confidence
|
565
|
-
|
566
|
-
if localizacao:
|
567
|
-
print(f"Imagem gerar relatório encontrado em: {localizacao}")
|
568
|
-
pyautogui.moveTo(localizacao)
|
569
|
-
pyautogui.click()
|
570
|
-
else:
|
571
|
-
console.print("Imagem gerar relatório não encontrada na tela.")
|
572
|
-
|
573
|
-
await worker_sleep(4)
|
574
|
-
|
575
|
-
##### Janela Gerar Registro ####
|
576
|
-
console.print("Confirmar Registro")
|
577
|
-
app = Application().connect(class_name="TMsgBox", timeout=60)
|
578
|
-
main_window = app["TMsgBox"]
|
579
|
-
main_window.set_focus()
|
580
|
-
|
581
|
-
# Clicar em Sim
|
582
|
-
main_window.child_window(class_name="TBitBtn", found_index=1).click_input()
|
583
|
-
|
584
|
-
await worker_sleep(4)
|
585
|
-
|
586
|
-
console.print("Clicar em confirmar")
|
587
|
-
app = Application().connect(
|
588
|
-
class_name="TPerguntasLivrosFiscaisForm", timeout=60
|
589
|
-
)
|
590
|
-
main_window = app["TPerguntasLivrosFiscaisForm"]
|
591
|
-
main_window.set_focus()
|
592
|
-
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
593
|
-
|
594
|
-
await worker_sleep(60)
|
595
|
-
|
596
|
-
# Clicar no aviso
|
597
|
-
try:
|
598
|
-
app_msgbox = Application().connect(class_name="TMsgBox", timeout=10)
|
599
|
-
box = app_msgbox["TMsgBox"]
|
600
|
-
print("Janela 'TMsgBox' encontrada.")
|
601
|
-
box.set_focus()
|
602
|
-
box.child_window(class_name="TBitBtn", found_index=0).click_input()
|
603
|
-
print("1Clicou no botão 'TBitBtn'.")
|
604
|
-
await worker_sleep(5)
|
605
|
-
except:
|
606
|
-
pass
|
607
|
-
await worker_sleep(5)
|
608
|
-
try:
|
609
|
-
app_msg = Application().connect(class_name="TMessageForm", timeout=10)
|
610
|
-
form = app_msg["TMessageForm"]
|
611
|
-
console.print("Janela de confirmação 'TMessageForm' encontrada.")
|
612
|
-
form.set_focus()
|
613
|
-
form.child_window(class_name="TButton", found_index=1).click_input()
|
614
|
-
print("2Clicou no botão de confirmação.")
|
615
|
-
await worker_sleep(5)
|
616
|
-
except:
|
617
|
-
pass
|
618
|
-
await worker_sleep(5)
|
619
|
-
try:
|
620
|
-
app_msg = Application().connect(class_name="TMessageForm", timeout=10)
|
621
|
-
form = app_msg["TMessageForm"]
|
622
|
-
console.print("Janela de confirmação 'TMessageForm' encontrada.")
|
623
|
-
form.set_focus()
|
624
|
-
form.child_window(class_name="TButton", found_index=0).click_input()
|
625
|
-
print("3Clicou no botão de confirmação.")
|
626
|
-
await worker_sleep(5)
|
627
|
-
except:
|
628
|
-
pass
|
629
|
-
await worker_sleep(5)
|
630
|
-
try:
|
631
|
-
app_msg = Application().connect(class_name="TMessageForm", timeout=10)
|
632
|
-
form = app_msg["TMessageForm"]
|
633
|
-
console.print("Janela de confirmação 'TMessageForm' encontrada.")
|
634
|
-
form.set_focus()
|
635
|
-
form.child_window(class_name="TButton", found_index=1).click_input()
|
636
|
-
print("4Clicou no botão de confirmação.")
|
637
|
-
await worker_sleep(5)
|
638
|
-
except:
|
639
|
-
pass
|
640
|
-
await worker_sleep(5)
|
641
|
-
try:
|
642
|
-
app_msg = Application().connect(class_name="TMessageForm", timeout=10)
|
643
|
-
form = app_msg["TMessageForm"]
|
644
|
-
console.print("Janela de confirmação 'TMessageForm' encontrada.")
|
645
|
-
form.set_focus()
|
646
|
-
form.child_window(class_name="TButton", found_index=0).click_input()
|
647
|
-
print("5Clicou no botão de confirmação.")
|
648
|
-
await worker_sleep(5)
|
649
|
-
except:
|
650
|
-
pass
|
651
|
-
await worker_sleep(5)
|
652
|
-
try:
|
653
|
-
# Caminho da imagem que deve desaparecer
|
654
|
-
console.print("Aguardar carregar dados")
|
655
|
-
# imagem = "assets\\abertura_livros\\janela_carregada.png"
|
656
|
-
imagem = "assets\\abertura_livros\\janela_carregada.png"
|
657
|
-
|
658
|
-
# Tempo máximo de espera (em segundos)
|
659
|
-
tempo_limite = 600 # 10 minutos
|
660
|
-
intervalo = 2 # segundos entre as verificações
|
661
|
-
|
662
|
-
inicio = time.time()
|
663
|
-
|
664
|
-
while True:
|
665
|
-
localizacao = pyautogui.locateOnScreen(imagem, confidence=0.9)
|
666
|
-
|
667
|
-
if localizacao:
|
668
|
-
print("Imagem ainda presente... aguardando")
|
669
|
-
else:
|
670
|
-
print("Imagem desapareceu da tela.")
|
671
|
-
break # A imagem sumiu, podemos seguir
|
672
|
-
|
673
|
-
if time.time() - inicio > tempo_limite:
|
674
|
-
print("Tempo esgotado. A imagem não desapareceu.")
|
675
|
-
break
|
504
|
+
await worker_sleep(3)
|
676
505
|
|
677
|
-
time.sleep(intervalo)
|
678
|
-
except:
|
679
|
-
pass
|
680
506
|
# Conecta na janela principal
|
681
507
|
console.print("Janela Livro de Apuração ICMS 2ª Etapa")
|
682
508
|
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
@@ -712,7 +538,7 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
712
538
|
await worker_sleep(2)
|
713
539
|
send_keys("{ENTER}")
|
714
540
|
|
715
|
-
await worker_sleep(5)
|
541
|
+
# await worker_sleep(5)
|
716
542
|
console.print("Inserindo competência...")
|
717
543
|
|
718
544
|
# Conecta na janela
|
@@ -734,27 +560,126 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
734
560
|
|
735
561
|
console.print("Clicando no botão incluir apuração")
|
736
562
|
# Clicar em incluir apuração
|
737
|
-
# imagem = "assets
|
563
|
+
# imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\btn_incluir_apuracao.png"
|
738
564
|
imagem = "assets\\abertura_livros\\btn_incluir_apuracao.png"
|
739
565
|
|
740
566
|
# Tenta localizar a imagem na tela
|
741
567
|
localizacao = pyautogui.locateCenterOnScreen(
|
742
568
|
imagem, confidence=0.9
|
743
|
-
)
|
744
|
-
|
569
|
+
)
|
570
|
+
|
745
571
|
if localizacao:
|
746
|
-
print(f"Imagem incluir apuração encontrado em: {localizacao}")
|
572
|
+
console.print(f"Imagem incluir apuração encontrado em: {localizacao}")
|
747
573
|
pyautogui.moveTo(localizacao)
|
748
574
|
pyautogui.click()
|
749
|
-
console.print("
|
750
|
-
|
575
|
+
console.print("Botão incluir clicado com sucesso")
|
576
|
+
|
577
|
+
await worker_sleep(2)
|
578
|
+
|
579
|
+
desk = Desktop(backend="win32")
|
580
|
+
dlg = None
|
581
|
+
t_end = time.time() + 8.0 # até 8s procurando a janela
|
582
|
+
while time.time() < t_end:
|
583
|
+
try:
|
584
|
+
# variações: Aviso | Atenção | Erro
|
585
|
+
wins = desk.windows(title_re=".*(Aviso|Aten[cç][aã]o|Erro).*", visible_only=True)
|
586
|
+
if wins:
|
587
|
+
dlg = wins[0]
|
588
|
+
break
|
589
|
+
except Exception:
|
590
|
+
pass
|
591
|
+
time.sleep(0.25)
|
592
|
+
|
593
|
+
if dlg:
|
594
|
+
console.print("Janela 'Aviso' detectada. Capturando texto e screenshot...")
|
595
|
+
|
596
|
+
# === 2) Captura de screenshot da janela ===
|
597
|
+
try:
|
598
|
+
# pasta de prints (ajuste se quiser outra)
|
599
|
+
prints_dir = os.path.join(os.getcwd(), "prints")
|
600
|
+
os.makedirs(prints_dir, exist_ok=True)
|
601
|
+
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
|
602
|
+
screenshot_path = os.path.join(prints_dir, f"aviso_{ts}.png")
|
603
|
+
dlg.set_focus()
|
604
|
+
img = dlg.capture_as_image()
|
605
|
+
img.save(screenshot_path)
|
606
|
+
console.print(f"Screenshot salvo: {screenshot_path}")
|
607
|
+
except Exception as e:
|
608
|
+
screenshot_path = None
|
609
|
+
console.print(f"Falha ao salvar screenshot do 'Aviso': {e}")
|
610
|
+
|
611
|
+
# === 3) Lê todo o texto da janela ===
|
612
|
+
texto_aviso = ""
|
613
|
+
try:
|
614
|
+
partes = []
|
615
|
+
for ctrl in dlg.descendants():
|
616
|
+
try:
|
617
|
+
t = ctrl.window_text()
|
618
|
+
if t and t.strip():
|
619
|
+
partes.append(t.strip())
|
620
|
+
except Exception:
|
621
|
+
pass
|
622
|
+
texto_aviso = " ".join(dict.fromkeys(partes)) # remove duplicados mantendo ordem
|
623
|
+
console.print(f"Texto do Aviso: {texto_aviso}")
|
624
|
+
except Exception as e:
|
625
|
+
console.print(f"Falha ao coletar texto do 'Aviso': {e}")
|
626
|
+
|
627
|
+
# === 4) Validação do conteúdo (edite/adicione frases-chave conforme seu caso) ===
|
628
|
+
FRASES_ERRO = [
|
629
|
+
"O período para apuração informado",
|
630
|
+
"situação diferente de confirmado",
|
631
|
+
]
|
632
|
+
|
633
|
+
contem_msg_erro = any(frase.lower() in texto_aviso.lower() for frase in FRASES_ERRO)
|
634
|
+
|
635
|
+
if contem_msg_erro:
|
636
|
+
console.print("Confirmação de erro pelo texto da janela 'Aviso'. Retornando falha.")
|
637
|
+
retorno_msg = "Erro ao Incluir apuração."
|
638
|
+
if texto_aviso:
|
639
|
+
retorno_msg += f" Detalhe: {texto_aviso}"
|
640
|
+
if screenshot_path:
|
641
|
+
retorno_msg += f" | Print: {screenshot_path}"
|
642
|
+
|
643
|
+
return RpaRetornoProcessoDTO(
|
644
|
+
sucesso=False,
|
645
|
+
retorno=retorno_msg,
|
646
|
+
status=RpaHistoricoStatusEnum.Falha,
|
647
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
648
|
+
)
|
649
|
+
else:
|
650
|
+
console.print("Janela 'Aviso' não contém mensagem de erro mapeada. Seguindo fluxo.")
|
651
|
+
# (Opcional) você pode clicar no 'OK' e continuar:
|
652
|
+
try:
|
653
|
+
# tenta clicar em botão OK se existir
|
654
|
+
for c in dlg.descendants():
|
655
|
+
try:
|
656
|
+
if c.window_text().strip().lower() in ("ok", "&ok"):
|
657
|
+
c.click_input()
|
658
|
+
break
|
659
|
+
except Exception:
|
660
|
+
pass
|
661
|
+
except Exception:
|
662
|
+
pass
|
663
|
+
# não retorna aqui; deixa seguir para sucesso
|
664
|
+
|
665
|
+
# === 5) Se não houve 'Aviso' com erro mapeado, considera sucesso ===
|
666
|
+
console.print("Nenhum erro confirmado. Fluxo OK.")
|
667
|
+
try:
|
668
|
+
main_window.close()
|
669
|
+
console.print("Janela principal fechada.")
|
670
|
+
except Exception as e:
|
671
|
+
console.print(f"Falha ao fechar janela principal (ignorado): {e}")
|
672
|
+
|
673
|
+
retorno = "Apuração incluída com sucesso"
|
751
674
|
return RpaRetornoProcessoDTO(
|
752
|
-
sucesso=True,
|
675
|
+
sucesso=True,
|
676
|
+
retorno=retorno,
|
677
|
+
status=RpaHistoricoStatusEnum.Sucesso,
|
753
678
|
)
|
754
|
-
|
755
|
-
console.print("Imagem incluir apuração não encontrada na tela.")
|
679
|
+
|
756
680
|
|
757
681
|
except Exception as erro:
|
682
|
+
|
758
683
|
console.print(f"Erro ao executar abertura de livros fiscais, erro : {erro}")
|
759
684
|
return RpaRetornoProcessoDTO(
|
760
685
|
sucesso=False,
|
@@ -762,3 +687,4 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
762
687
|
status=RpaHistoricoStatusEnum.Falha,
|
763
688
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
764
689
|
)
|
690
|
+
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/ahead_service.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/api/rdp_service.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/config/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/config/settings.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/repeat.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/retry.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/decorators/timeit.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/models/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/tasks/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/env.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/logger.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/toast.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/updater.py
RENAMED
File without changes
|
{worker_automate_hub-0.5.798 → worker_automate_hub-0.5.800}/worker_automate_hub/utils/util.py
RENAMED
File without changes
|
File without changes
|
File without changes
|