worker-automate-hub 0.5.672__py3-none-any.whl → 0.5.673__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.
Potentially problematic release.
This version of worker-automate-hub might be problematic. Click here for more details.
- worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +318 -121
- {worker_automate_hub-0.5.672.dist-info → worker_automate_hub-0.5.673.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.672.dist-info → worker_automate_hub-0.5.673.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.672.dist-info → worker_automate_hub-0.5.673.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.672.dist-info → worker_automate_hub-0.5.673.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import time
|
|
2
2
|
import pyautogui
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
from pywinauto.keyboard import send_keys
|
|
9
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
|
|
10
|
+
|
|
3
11
|
|
|
4
12
|
from worker_automate_hub.utils.logger import logger
|
|
5
13
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
|
@@ -99,10 +107,79 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
|
99
107
|
)
|
|
100
108
|
return_login = await login_emsys_fiscal(config.conConfiguracao, app, task)
|
|
101
109
|
if return_login.sucesso:
|
|
102
|
-
|
|
110
|
+
try:
|
|
111
|
+
##### Janela Confirm #####
|
|
112
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
113
|
+
main_window = app["TMessageForm"]
|
|
114
|
+
main_window.set_focus()
|
|
115
|
+
|
|
116
|
+
# Clicar em Não
|
|
117
|
+
console.print("Navegando nos elementos...\n")
|
|
118
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
119
|
+
await worker_sleep(2)
|
|
120
|
+
except:
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
##### Janela Principal ####
|
|
124
|
+
console.print("Navegando para Livros Fiscais")
|
|
125
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
126
|
+
main_window = app["TFrmPrincipalFiscal"]
|
|
127
|
+
main_window.set_focus()
|
|
128
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0)
|
|
103
129
|
type_text_into_field(
|
|
104
|
-
"Livros Fiscais",
|
|
130
|
+
"Livros Fiscais", input_livros, True, "50"
|
|
131
|
+
)
|
|
132
|
+
await worker_sleep(5)
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
##### Janela Confirm #####
|
|
136
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
137
|
+
main_window = app["TMessageForm"]
|
|
138
|
+
main_window.set_focus()
|
|
139
|
+
|
|
140
|
+
# Clicar em Não
|
|
141
|
+
console.print("Navegando nos elementos...\n")
|
|
142
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
143
|
+
await worker_sleep(2)
|
|
144
|
+
except:
|
|
145
|
+
pass
|
|
146
|
+
|
|
147
|
+
# Clicar no input inicial
|
|
148
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0).click_input()
|
|
149
|
+
pyautogui.press("enter")
|
|
150
|
+
await worker_sleep(2)
|
|
151
|
+
pyautogui.press("down")
|
|
152
|
+
await worker_sleep(2)
|
|
153
|
+
pyautogui.press("enter")
|
|
154
|
+
console.print(
|
|
155
|
+
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
|
156
|
+
style="bold green",
|
|
105
157
|
)
|
|
158
|
+
|
|
159
|
+
await worker_sleep(10)
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
##### Janela Confirm #####
|
|
163
|
+
app = Application().connect(class_name="TMessageForm", timeout=5)
|
|
164
|
+
main_window = app["TMessageForm"]
|
|
165
|
+
main_window.set_focus()
|
|
166
|
+
|
|
167
|
+
# Clicar em Não
|
|
168
|
+
console.print("Navegando nos elementos...\n")
|
|
169
|
+
main_window.child_window(class_name="TButton", found_index=0).click()
|
|
170
|
+
await worker_sleep(2)
|
|
171
|
+
except:
|
|
172
|
+
pass
|
|
173
|
+
|
|
174
|
+
await worker_sleep(2)
|
|
175
|
+
|
|
176
|
+
##### Janela Principal ####
|
|
177
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
178
|
+
main_window = app["TFrmPrincipalFiscal"]
|
|
179
|
+
main_window.set_focus()
|
|
180
|
+
|
|
181
|
+
# Clicar no input inicial
|
|
182
|
+
input_livros = main_window.child_window(class_name="TEdit", found_index=0).click_input()
|
|
106
183
|
pyautogui.press("enter")
|
|
107
184
|
await worker_sleep(2)
|
|
108
185
|
pyautogui.press("down")
|
|
@@ -112,8 +189,19 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
|
112
189
|
"\nPesquisa: 'Livros Fiscais' realizada com sucesso.",
|
|
113
190
|
style="bold green",
|
|
114
191
|
)
|
|
192
|
+
|
|
115
193
|
await worker_sleep(10)
|
|
116
|
-
|
|
194
|
+
|
|
195
|
+
##### janela Movimento de Livro Fiscal #####
|
|
196
|
+
app = Application().connect(class_name="TFrmMovtoLivroFiscal", timeout=20)
|
|
197
|
+
main_window = app["TFrmMovtoLivroFiscal"]
|
|
198
|
+
main_window.set_focus()
|
|
199
|
+
data_input = main_window.child_window(class_name="TDBIEditDate", found_index=0)
|
|
200
|
+
competencia = task.configEntrada.get("periodo")
|
|
201
|
+
type_text_into_field(
|
|
202
|
+
competencia, data_input, True, "50"
|
|
203
|
+
)
|
|
204
|
+
|
|
117
205
|
# Preenchendo campo competencia
|
|
118
206
|
console.print("Preenchendo campo competencia...")
|
|
119
207
|
pyautogui.press("tab")
|
|
@@ -121,27 +209,20 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
|
121
209
|
pyautogui.write(competencia)
|
|
122
210
|
await worker_sleep(3)
|
|
123
211
|
|
|
124
|
-
# Resetando tabs
|
|
125
|
-
console.print("Levando cursor para campo competencia")
|
|
126
|
-
pyautogui.click(729, 321)
|
|
127
|
-
await worker_sleep(2)
|
|
128
|
-
|
|
129
212
|
# Marcando caixa Entrada
|
|
130
213
|
console.print("Marcando caixa entrada")
|
|
131
|
-
|
|
132
|
-
pyautogui.press("space")
|
|
133
|
-
await worker_sleep(2)
|
|
214
|
+
entrada = main_window.child_window(class_name="TcxCheckBox", found_index=9).click_input()
|
|
134
215
|
|
|
135
216
|
# Marcando caixa Saida
|
|
136
217
|
console.print("Marcando caixa saida")
|
|
137
|
-
|
|
138
|
-
|
|
218
|
+
saida = main_window.child_window(class_name="TcxCheckBox", found_index=8).click_input()
|
|
219
|
+
|
|
139
220
|
await worker_sleep(2)
|
|
140
221
|
|
|
141
222
|
# Clicando em incluir livro
|
|
142
223
|
try:
|
|
143
224
|
console.print("Clicando em incluir livro")
|
|
144
|
-
cords = (
|
|
225
|
+
cords = (695, 729)
|
|
145
226
|
pyautogui.click(x=cords[0], y=cords[1])
|
|
146
227
|
await worker_sleep(5)
|
|
147
228
|
except:
|
|
@@ -152,141 +233,257 @@ async def abertura_livros_fiscais(task: RpaProcessoEntradaDTO) -> RpaRetornoProc
|
|
|
152
233
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
153
234
|
)
|
|
154
235
|
|
|
155
|
-
|
|
156
|
-
console.print("Clicando em sim na janela de gerar registros após incluir")
|
|
157
|
-
cords = (942, 603)
|
|
158
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
236
|
+
##### Janela Pergunta das Geração dos Livros Fiscais #####
|
|
159
237
|
await worker_sleep(5)
|
|
238
|
+
app = Application().connect(class_name="TPerguntasLivrosFiscaisForm", timeout=20)
|
|
239
|
+
main_window = app["TPerguntasLivrosFiscaisForm"]
|
|
240
|
+
main_window.set_focus()
|
|
241
|
+
console.print("Clicando sim em janela somar os valores de IPI Frete")
|
|
242
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=0).click_input()
|
|
243
|
+
|
|
244
|
+
await worker_sleep(1)
|
|
245
|
+
send_keys("Sim{ENTER}")
|
|
246
|
+
await worker_sleep(2)
|
|
247
|
+
|
|
248
|
+
console.print("Clicando sim em janela gerar Numero de Serie do SAT")
|
|
249
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=4).click_input()
|
|
250
|
+
|
|
251
|
+
await worker_sleep(1)
|
|
252
|
+
send_keys("Sim{ENTER}")
|
|
253
|
+
await worker_sleep(2)
|
|
254
|
+
|
|
255
|
+
console.print("Clicando sim em janela gerar Numero de Serie a partir da chave do documento")
|
|
256
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=1).click_input()
|
|
257
|
+
|
|
258
|
+
await worker_sleep(1)
|
|
259
|
+
send_keys("Sim{ENTER}")
|
|
260
|
+
await worker_sleep(2)
|
|
261
|
+
|
|
262
|
+
console.print("Clicando sim em janela gerar livro com observação da nota fiscal")
|
|
263
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=3).click_input()
|
|
264
|
+
|
|
265
|
+
await worker_sleep(1)
|
|
266
|
+
send_keys("Sim{ENTER}")
|
|
267
|
+
await worker_sleep(2)
|
|
268
|
+
|
|
269
|
+
console.print("Clicando sim em janela somar valores de ICMS...")
|
|
270
|
+
main_window.child_window(class_name="TDBIComboBoxValues", found_index=2).click_input()
|
|
271
|
+
|
|
272
|
+
await worker_sleep(1)
|
|
273
|
+
send_keys("Sim{ENTER}")
|
|
160
274
|
|
|
161
|
-
|
|
162
|
-
console.print("Clicando em nao na janela de calcular icms Outros.")
|
|
163
|
-
cords = (1000, 570)
|
|
164
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
165
|
-
await worker_sleep(5)
|
|
275
|
+
await worker_sleep(2)
|
|
166
276
|
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
-
cords = (920, 560)
|
|
170
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
171
|
-
await worker_sleep(5)
|
|
277
|
+
# Clicar em confirmar
|
|
278
|
+
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
|
172
279
|
|
|
173
|
-
# Esperando janela aguarde
|
|
174
|
-
console.print("Aguardando tela de aguarde ser finalizada")
|
|
175
|
-
await wait_aguarde_window_closed(app)
|
|
176
280
|
await worker_sleep(5)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
281
|
+
##### Janela Gerar Registro ####
|
|
282
|
+
console.print("Confirmar Registro")
|
|
283
|
+
app = Application().connect(title="Gerar Registros", timeout=60)
|
|
284
|
+
main_window = app["Gerar Registros"]
|
|
285
|
+
main_window.set_focus()
|
|
286
|
+
|
|
287
|
+
# Clicar em Sim
|
|
288
|
+
main_window.child_window(class_name="Button", found_index=0).click_input()
|
|
289
|
+
|
|
290
|
+
# try:
|
|
291
|
+
# # Esperando janela aguarde
|
|
292
|
+
# console.print("Aguardando tela de aguarde ser finalizada")
|
|
293
|
+
# await wait_aguarde_window_closed(app)
|
|
294
|
+
# await worker_sleep(5)
|
|
295
|
+
# except:
|
|
296
|
+
# pass
|
|
297
|
+
|
|
182
298
|
await worker_sleep(5)
|
|
183
299
|
|
|
184
|
-
|
|
185
|
-
console.print("
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
300
|
+
##### Janela Pré-visualizando Relatório #####
|
|
301
|
+
console.print("Fechar Janela Pré-visualizando Relatório ")
|
|
302
|
+
app = Application().connect(class_name="TFrmPreviewRelatorio", timeout=60)
|
|
303
|
+
main_window = app["TFrmPreviewRelatorio"]
|
|
304
|
+
main_window.set_focus()
|
|
189
305
|
|
|
190
|
-
#
|
|
191
|
-
|
|
192
|
-
await wait_aguarde_window_closed(app)
|
|
193
|
-
await worker_sleep(5)
|
|
306
|
+
# Clicar em fechar
|
|
307
|
+
main_window.close()
|
|
194
308
|
|
|
195
|
-
|
|
196
|
-
await worker_sleep(5)
|
|
309
|
+
await worker_sleep(3)
|
|
197
310
|
|
|
198
|
-
|
|
199
|
-
console.print("
|
|
200
|
-
|
|
311
|
+
##### Janela Principal ####
|
|
312
|
+
console.print("Navegando para Livro de Apuração ICMS... ")
|
|
313
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
314
|
+
input_principal = main_window = app["TFrmPrincipalFiscal"]
|
|
315
|
+
input_principal.set_focus()
|
|
316
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0)
|
|
317
|
+
type_text_into_field(
|
|
318
|
+
"Livro de Apuração ICMS", input_livros, True, "50"
|
|
319
|
+
)
|
|
201
320
|
await worker_sleep(5)
|
|
202
321
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
await worker_sleep(2)
|
|
217
|
-
if (
|
|
218
|
-
"saida" in conteudo
|
|
219
|
-
and "confirmado" in conteudo
|
|
220
|
-
and competencia in conteudo
|
|
221
|
-
):
|
|
222
|
-
console.print(f"Clicando em desconfirmar saida na tabela...")
|
|
223
|
-
click_desconfirmar()
|
|
224
|
-
await worker_sleep(2)
|
|
225
|
-
pyautogui.press("down")
|
|
226
|
-
await worker_sleep(5)
|
|
322
|
+
try:
|
|
323
|
+
##### Janela Confirm #####
|
|
324
|
+
app = Application().connect(class_name="TMessageForm", timeout=60)
|
|
325
|
+
main_window = app["TMessageForm"]
|
|
326
|
+
main_window.set_focus()
|
|
327
|
+
main_window.child_window(class_name="TButton", found_index=0).click_input()
|
|
328
|
+
except:
|
|
329
|
+
pass
|
|
330
|
+
console.print("Selecionar Livro de Apuração")
|
|
331
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0).click_input()
|
|
332
|
+
pyautogui.press("enter")
|
|
333
|
+
await worker_sleep(1)
|
|
334
|
+
pyautogui.press("enter")
|
|
227
335
|
|
|
228
|
-
# Fechando janela de livro fiscal
|
|
229
|
-
console.print("Fechando janela de livro fiscal")
|
|
230
|
-
livros_fiscais_window.close()
|
|
231
336
|
await worker_sleep(5)
|
|
232
337
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)
|
|
338
|
+
##### Janela Movimentação de Apuração ICMS #####
|
|
339
|
+
app = Application().connect(class_name="TFrmMovtoApuraIcmsNew", timeout=60)
|
|
340
|
+
main_window = app["TFrmMovtoApuraIcmsNew"]
|
|
341
|
+
main_window.set_focus()
|
|
238
342
|
|
|
239
|
-
|
|
343
|
+
console.print("Clicando no último livro, primeira linha")
|
|
344
|
+
pyautogui.click(599,410)
|
|
345
|
+
|
|
346
|
+
await worker_sleep(1)
|
|
240
347
|
|
|
241
|
-
|
|
348
|
+
console.print("Clicando em Estornar Livro")
|
|
349
|
+
pyautogui.click(667,742)
|
|
242
350
|
|
|
243
|
-
await worker_sleep(
|
|
244
|
-
titulo_atual = app.top_window().window_text().lower()
|
|
245
|
-
if "apuração icms" not in titulo_atual:
|
|
246
|
-
return RpaRetornoProcessoDTO(
|
|
247
|
-
sucesso=False,
|
|
248
|
-
retorno=f"Erro, ocorreu um problema ao tentar interagir com a janela de apuração.",
|
|
249
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
250
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
251
|
-
)
|
|
351
|
+
await worker_sleep(3)
|
|
252
352
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
353
|
+
main_window.close()
|
|
354
|
+
|
|
355
|
+
await worker_sleep(2)
|
|
356
|
+
|
|
357
|
+
console.print("Selecionar Livro Saída aberto")
|
|
358
|
+
|
|
359
|
+
# Selecionar linha livro de saída aberto
|
|
360
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livro_saida_aberto.png"
|
|
361
|
+
|
|
362
|
+
# Tenta localizar a imagem na tela
|
|
363
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9)
|
|
364
|
+
|
|
365
|
+
if localizacao:
|
|
366
|
+
print(f"Imagem livro de saída aberto encontrado em: {localizacao}")
|
|
367
|
+
pyautogui.moveTo(localizacao)
|
|
368
|
+
pyautogui.click()
|
|
369
|
+
else:
|
|
370
|
+
console.print("Imagem livro de saída aberto não encontrado na tela.")
|
|
371
|
+
|
|
372
|
+
# Clicar em alterar livro
|
|
373
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\alterar_livro.png"
|
|
374
|
+
|
|
375
|
+
# Tenta localizar a imagem na tela
|
|
376
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
377
|
+
|
|
378
|
+
if localizacao:
|
|
379
|
+
print(f"Imagem alterar livro encontrado em: {localizacao}")
|
|
380
|
+
pyautogui.moveTo(localizacao)
|
|
381
|
+
pyautogui.click()
|
|
382
|
+
else:
|
|
383
|
+
console.print("Imagem alterar livro não encontrada na tela.")
|
|
261
384
|
|
|
262
|
-
# Clicando no campo competencia antes de preencher
|
|
263
|
-
cords = (670, 329)
|
|
264
|
-
pyautogui.click(x=cords[0], y=cords[1])
|
|
265
385
|
await worker_sleep(4)
|
|
266
386
|
|
|
267
|
-
#
|
|
268
|
-
|
|
269
|
-
|
|
387
|
+
# Clicar em Livro fiscal
|
|
388
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\livro_fiscal.png"
|
|
389
|
+
|
|
390
|
+
# Tenta localizar a imagem na tela
|
|
391
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
270
392
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
393
|
+
if localizacao:
|
|
394
|
+
print(f"Imagem Livro fiscal encontrado em: {localizacao}")
|
|
395
|
+
pyautogui.moveTo(localizacao)
|
|
396
|
+
pyautogui.click()
|
|
397
|
+
else:
|
|
398
|
+
console.print("Imagem Livro fiscal não encontrada na tela.")
|
|
399
|
+
|
|
275
400
|
await worker_sleep(4)
|
|
401
|
+
|
|
402
|
+
# Clicar em Gerar Relatório
|
|
403
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\gerar_registros.png"
|
|
404
|
+
|
|
405
|
+
# Tenta localizar a imagem na tela
|
|
406
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
407
|
+
|
|
408
|
+
if localizacao:
|
|
409
|
+
print(f"Imagem gerar relatório encontrado em: {localizacao}")
|
|
410
|
+
pyautogui.moveTo(localizacao)
|
|
411
|
+
pyautogui.click()
|
|
412
|
+
else:
|
|
413
|
+
console.print("Imagem gerar relatório não encontrada na tela.")
|
|
414
|
+
|
|
415
|
+
##### Janela Gerar Registro ####
|
|
416
|
+
console.print("Confirmar Registro")
|
|
417
|
+
app = Application().connect(class_name="TMsgBox", timeout=60)
|
|
418
|
+
main_window = app["TMsgBox"]
|
|
419
|
+
main_window.set_focus()
|
|
420
|
+
|
|
421
|
+
# Clicar em Sim
|
|
422
|
+
main_window.child_window(class_name="TBitBtn", found_index=1).click_input()
|
|
276
423
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
424
|
+
await worker_sleep(4)
|
|
425
|
+
|
|
426
|
+
console.print("Clicar em confirmar")
|
|
427
|
+
app = Application().connect(class_name="TPerguntasLivrosFiscaisForm", timeout=60)
|
|
428
|
+
main_window = app["TPerguntasLivrosFiscaisForm"]
|
|
429
|
+
main_window.set_focus()
|
|
430
|
+
main_window.child_window(class_name="TButton", found_index=1).click_input()
|
|
431
|
+
|
|
432
|
+
# Caminho da imagem que deve desaparecer
|
|
433
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\janela_carregada.png"
|
|
434
|
+
|
|
435
|
+
# Tempo máximo de espera (em segundos)
|
|
436
|
+
tempo_limite = 600 # 10 minutos
|
|
437
|
+
intervalo = 2 # segundos entre as verificações
|
|
438
|
+
|
|
439
|
+
inicio = time.time()
|
|
440
|
+
|
|
441
|
+
while True:
|
|
442
|
+
localizacao = pyautogui.locateOnScreen(imagem, confidence=0.9)
|
|
443
|
+
|
|
444
|
+
if not localizacao:
|
|
445
|
+
print("Imagem desapareceu da tela.")
|
|
446
|
+
break # A imagem sumiu, podemos seguir
|
|
447
|
+
|
|
448
|
+
if time.time() - inicio > tempo_limite:
|
|
449
|
+
print("Tempo esgotado. A imagem não desapareceu.")
|
|
450
|
+
break
|
|
451
|
+
|
|
452
|
+
print("Imagem ainda presente... aguardando")
|
|
453
|
+
time.sleep(intervalo)
|
|
454
|
+
|
|
455
|
+
##### Janela Principal ####
|
|
456
|
+
console.print("Navegando para Livro de Apuração ICMS... ")
|
|
457
|
+
app = Application().connect(class_name="TFrmPrincipalFiscal", timeout=60)
|
|
458
|
+
input_principal = main_window = app["TFrmPrincipalFiscal"]
|
|
459
|
+
input_principal.set_focus()
|
|
460
|
+
input_livros = input_principal.child_window(class_name="TEdit", found_index=0)
|
|
461
|
+
type_text_into_field(
|
|
462
|
+
"Livro de Apuração ICMS", input_livros, True, "50"
|
|
282
463
|
)
|
|
464
|
+
await worker_sleep(5)
|
|
283
465
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
466
|
+
app = Application().connect(class_name="TFrmMovtoApuraIcmsNew", timeout=60)
|
|
467
|
+
main_window = app["TFrmMovtoApuraIcmsNew"]
|
|
468
|
+
main_window.set_focus()
|
|
469
|
+
data_input = main_window.child_window(class_name="TDBIEditDate", found_index=0)
|
|
470
|
+
competencia = competencia #task.configEntrada.get("periodo")
|
|
471
|
+
type_text_into_field(
|
|
472
|
+
competencia, data_input, True, "50"
|
|
288
473
|
)
|
|
289
|
-
|
|
474
|
+
|
|
475
|
+
# Clicar em incluir apuração
|
|
476
|
+
imagem = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\assets\abertura_livros\btn_incluir_apuracao.png"
|
|
477
|
+
|
|
478
|
+
# Tenta localizar a imagem na tela
|
|
479
|
+
localizacao = pyautogui.locateCenterOnScreen(imagem, confidence=0.9) # você pode ajustar o confidence
|
|
480
|
+
|
|
481
|
+
if localizacao:
|
|
482
|
+
print(f"Imagem incluir apuração encontrado em: {localizacao}")
|
|
483
|
+
pyautogui.moveTo(localizacao)
|
|
484
|
+
pyautogui.click()
|
|
485
|
+
else:
|
|
486
|
+
console.print("Imagem incluir apuração não encontrada na tela.")
|
|
290
487
|
|
|
291
488
|
except Exception as erro:
|
|
292
489
|
console.print(f"Erro ao executar abertura de livros fiscais, erro : {erro}")
|
|
@@ -36,7 +36,7 @@ worker_automate_hub/models/dto/rpa_sap_dto.py,sha256=eovdvKCtVIhRct3PL98KjsdlngL
|
|
|
36
36
|
worker_automate_hub/models/dto/rpa_sistema_dto.py,sha256=sLkmJei8x6sl-1-IXUKDmYQuKx0sotYQREPyhQqPmRg,161
|
|
37
37
|
worker_automate_hub/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
38
|
worker_automate_hub/tasks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=
|
|
39
|
+
worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py,sha256=zsKgOA4nFcEaOy4oZFQ7hBGE5nl6xZUQC0K4m8j91Q0,20061
|
|
40
40
|
worker_automate_hub/tasks/jobs/coleta_dje_process.py,sha256=UkLWTC5Ub2qBb0yY-8IZ0DLLOVJOfNTq_z9krx_t25Q,29476
|
|
41
41
|
worker_automate_hub/tasks/jobs/conexao_rdp.py,sha256=S6QC4xhuo0pB5FjaUJZNMm1LIgEjpjifReCTBDqxH-U,11719
|
|
42
42
|
worker_automate_hub/tasks/jobs/cte_manual.py,sha256=JucHpRMjMiy-QEJ0wtFnytLpN53tKXgCDI05nGLGclU,603
|
|
@@ -98,7 +98,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
|
98
98
|
worker_automate_hub/utils/util.py,sha256=xA13nQqZglwkvfAKH18Unv4UoZUyvL58CacSrzUpYTw,206352
|
|
99
99
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=L_z1Aps6BFWl-6_Ibm45vDid1S4kFDz5O78N2uO1Rq0,36458
|
|
100
100
|
worker_automate_hub/worker.py,sha256=axdrr1xLTjWEyWfcyH3OCSpPTsyzck_fL_0u1DBLjvw,6525
|
|
101
|
-
worker_automate_hub-0.5.
|
|
102
|
-
worker_automate_hub-0.5.
|
|
103
|
-
worker_automate_hub-0.5.
|
|
104
|
-
worker_automate_hub-0.5.
|
|
101
|
+
worker_automate_hub-0.5.673.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
|
102
|
+
worker_automate_hub-0.5.673.dist-info/METADATA,sha256=mwE25Inm5t-1EMhFxR6QBHuvQPDmIAOJAGQzejODTWc,3049
|
|
103
|
+
worker_automate_hub-0.5.673.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
104
|
+
worker_automate_hub-0.5.673.dist-info/RECORD,,
|
|
File without changes
|
{worker_automate_hub-0.5.672.dist-info → worker_automate_hub-0.5.673.dist-info}/entry_points.txt
RENAMED
|
File without changes
|