worker-automate-hub 0.5.671__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.

@@ -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
- await worker_sleep(2)
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", app["TFrmMenuPrincipal"]["Edit"], True, "50"
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
- livros_fiscais_window = app.top_window()
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
- pyautogui.press("tab")
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
- pyautogui.press("tab")
138
- pyautogui.press("space")
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 = (676, 716)
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
- # Clicando em sim na janela de gerar registros após incluir
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
- # Clicando nao na tela de somar icms outros
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
- # Clicando sim em janela de confirmar observacao
168
- console.print("Clicando sim em janela de confirmar observacao")
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
- # Clicando sim em janela gerar Num Serie
179
- console.print("Clicando sim em janela gerar Numero de Serie")
180
- cords = (920, 560)
181
- pyautogui.click(x=cords[0], y=cords[1])
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
- # Clicando sim em janela somar os valores de IPI, Frete..
185
- console.print("Clicando sim em janela somar os valores de IPI Frete")
186
- cords = (920, 560)
187
- pyautogui.click(x=cords[0], y=cords[1])
188
- await worker_sleep(5)
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
- # Esperando janela aguarde
191
- console.print("Aguardando tela de aguarde ser finalizada")
192
- await wait_aguarde_window_closed(app)
193
- await worker_sleep(5)
306
+ # Clicar em fechar
307
+ main_window.close()
194
308
 
195
- app.top_window().set_focus()
196
- await worker_sleep(5)
309
+ await worker_sleep(3)
197
310
 
198
- # Clicando OK em janela de livro incluido
199
- console.print("Clicando em OK em janela de livro incluido")
200
- await emsys.verify_warning_and_error("Informação", "OK")
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
- console.print("Selecionando primeira linha da tabela")
204
- # Selecionando primeira linha da tabela
205
- pyautogui.click(604, 485)
206
- # Iterando apenas as 2 primeiras linhas da tabela para procurar entrada/saida
207
- for _ in range(2):
208
- conteudo = ctrl_c().lower()
209
- if (
210
- "entrada" in conteudo
211
- and "confirmado" in conteudo
212
- and competencia in conteudo
213
- ):
214
- console.print(f"Clicando em desconfirmar entrada na tabela...")
215
- click_desconfirmar()
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
- # Abrindo janela de apuracao de ICMS
234
- console.print("Abrindo janela de apuracao de ICMS")
235
- type_text_into_field(
236
- "Livro de Apuração ICMS", app["TFrmMenuPrincipal"]["Edit"], True, "50"
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
- await worker_sleep(5)
343
+ console.print("Clicando no último livro, primeira linha")
344
+ pyautogui.click(599,410)
345
+
346
+ await worker_sleep(1)
240
347
 
241
- pyautogui.press("enter", presses=2)
348
+ console.print("Clicando em Estornar Livro")
349
+ pyautogui.click(667,742)
242
350
 
243
- await worker_sleep(5)
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
- pyautogui.click(x=601, y=406)
254
- primeira_entrada = ctrl_c().lower()
255
- if "encerrado" in primeira_entrada:
256
- # Clicando em estornar livro
257
- console.print("Clicando em estornar livro")
258
- cords = (662, 739)
259
- pyautogui.click(x=cords[0], y=cords[1])
260
- await worker_sleep(4)
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
- # Preenchendo campo competencia
268
- console.print("Preenchendo campo competencia")
269
- pyautogui.write(competencia)
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
- # Clicando em incluir apuracao
272
- console.print("Clicando em incluir apuracao")
273
- cords = (659, 688)
274
- pyautogui.click(x=cords[0], y=cords[1])
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
- console.print("Operacao finalizada com sucesso")
278
- return RpaRetornoProcessoDTO(
279
- sucesso=True,
280
- retorno="Abertura de livro fiscal concluida com sucesso",
281
- status=RpaHistoricoStatusEnum.Sucesso,
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
- else:
285
- logger.info(f"\nError Message: {return_login.retorno}")
286
- console.print(
287
- "\nError Messsage: {return_login.retorno}", style="bold green"
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
- return return_login
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}")
@@ -318,6 +318,7 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
318
318
  main_window.set_focus()
319
319
  modelo_select = main_window.child_window(class_name="TDBIComboBox", found_index=1)
320
320
  modelo_select.click()
321
+ await worker_sleep(3)
321
322
  try:
322
323
  # Verifica mensagem danfe 077
323
324
  imagem_alvo = "assets\\entrada_notas\\danfe077.png"
@@ -375,61 +376,79 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
375
376
  else:
376
377
  field_fornecedor.set_edit_text(cod_empresa)
377
378
  field_fornecedor.click()
378
- pyautogui.press("tab")
379
+ pyautogui.press("enter")
379
380
  await worker_sleep(2)
380
381
 
381
382
 
382
383
  itens = nota.get('itens', [])
383
384
  itens_arla = [item for item in itens if item['descricao'].lower() == 'arla']
384
385
 
385
- #SELECIONAO A NOP
386
+ # SELECIONA A NOP
386
387
  console.print("SELECIONANDO A NOP...\n")
387
388
  select_box_nop_select = main_window.child_window(class_name="TDBIComboBox", found_index=0)
388
389
  select_box_nop_select.click()
389
390
 
391
+ await worker_sleep(3)
392
+
390
393
  itens_to_select = select_box_nop_select.texts()
391
394
  nop_to_be_select = ''
392
395
 
396
+ def normaliza(texto):
397
+ return texto.lower().replace(" ", "").strip()
398
+
399
+ # Função para buscar a NOP com sufixo prioritariamente
400
+ def buscar_nop(itens, codigo, sufixo_normalizado=None):
401
+ for item in itens:
402
+ if codigo in item:
403
+ item_normalizado = normaliza(item)
404
+ if sufixo_normalizado and sufixo_normalizado in item_normalizado:
405
+ return item # prioriza item com sufixo
406
+ for item in itens:
407
+ if codigo in item:
408
+ return item # fallback para item com mesmo código
409
+ return ''
410
+
411
+ # Lógica de seleção da NOP
393
412
  if len(itens_arla) == len(itens):
394
- for item in itens_to_select:
395
- if ('1202' in item and ('s/ est' in item.lower() or 's/est' in item.lower()) and ('c/ fin' in item.lower() or 'c/fin' in item.lower())):
396
- nop_to_be_select = item
397
- break
398
- elif '2202' in item and (('s/ est' in item.lower() or 's/est' in item.lower()) and ('c/ fin' in item.lower() or 'c/fin' in item.lower())):
399
- nop_to_be_select = item
400
- break
401
- else:
402
- for item in itens_to_select:
403
- if uf_posto:
404
- if uf_posto != uf_cliente:
405
- if '2662' in item and (('c/fi' in item.lower() or 'c /fi' in item.lower())):
406
- nop_to_be_select = item
407
- break
408
- else:
409
- if '1662' in item and (('c/fi' in item.lower() or 'c /fi' in item.lower())):
410
- nop_to_be_select = item
411
- break
412
- else:
413
- if '1662' in item and (('c/fi' in item.lower() or 'c /fi' in item.lower())):
414
- nop_to_be_select = item
415
- break
416
-
413
+ nop_to_be_select = buscar_nop(itens_to_select, '1202', 's/estc/fin')
414
+ if not nop_to_be_select:
415
+ nop_to_be_select = buscar_nop(itens_to_select, '2202', 's/estc/fin')
416
+ else:
417
+ if uf_posto and uf_posto != uf_cliente:
418
+ nop_to_be_select = buscar_nop(itens_to_select, '2662', 'devcombc/fi')
419
+ else:
420
+ nop_to_be_select = buscar_nop(itens_to_select, '1662', 'devcombc/fi')
417
421
 
422
+ # Se encontrou, faz a seleção precisa no combobox
418
423
  if nop_to_be_select != '':
419
424
  console.print(f"Nop a ser considerada: {nop_to_be_select}...\n")
420
425
  await worker_sleep(1)
421
426
  try:
422
- set_combobox("||List", nop_to_be_select)
423
- except:
427
+ # Clica para ativar o combobox
424
428
  select_box_nop_select.click()
425
429
  await worker_sleep(1)
426
- select_box_nop_select.click()
430
+
431
+ # Digita apenas o código inicial (ex: "1662") para posicionar
432
+ codigo_nop = nop_to_be_select.split('-')[0].strip()
433
+ select_box_nop_select.type_keys(codigo_nop)
427
434
  await worker_sleep(1)
428
- select_box_nop_select.select(nop_to_be_select)
429
- #set_combobox("||List", nop_to_be_select)
430
435
 
436
+ # Navega pela lista até encontrar o texto exato
437
+ for _ in range(10): # tenta até 10 movimentos para baixo
438
+ current_text = select_box_nop_select.window_text()
439
+ if nop_to_be_select.strip().lower() in current_text.strip().lower():
440
+ select_box_nop_select.type_keys('{ENTER}')
441
+ break
442
+ else:
443
+ select_box_nop_select.type_keys('{DOWN}')
444
+ await worker_sleep(0.5)
445
+
446
+ await worker_sleep(1)
447
+ select_box_nop_select.type_keys('{TAB}')
448
+ except Exception as e:
449
+ console.print(f"[red]Erro ao selecionar a NOP: {e}[/red]")
431
450
  else:
432
- retorno = f"Não foi possivel encontrar a nop \nEtapas Executadas:\n{steps}"
451
+ retorno = f"Não foi possível encontrar a NOP\nEtapas Executadas:\n{steps}"
433
452
  return RpaRetornoProcessoDTO(
434
453
  sucesso=False,
435
454
  retorno=retorno,
@@ -437,6 +456,7 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
437
456
  tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)]
438
457
  )
439
458
 
459
+
440
460
  await worker_sleep(7)
441
461
  try:
442
462
  pesquisar_icon = pyautogui.locateOnScreen(ASSETS_PATH + "\\emsys\\selecionar_venda.png", confidence=0.8)
@@ -1020,7 +1040,7 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
1020
1040
  #STEP 3
1021
1041
  type_text_into_field("Gerenciador de Notas Fiscais", app["TFrmMenuPrincipal"]["Edit"], True, "50")
1022
1042
  pyautogui.press("enter")
1023
- await worker_sleep(2)
1043
+ await worker_sleep(5)
1024
1044
  pyautogui.press("enter")
1025
1045
  await worker_sleep(5)
1026
1046
  console.print(f"\nPesquisa: 'Gerenciador de Notas Fiscais' realizada com sucesso 1ª Etapa",style="bold green")
@@ -1198,7 +1218,7 @@ async def devolucao_prazo_a_faturar(task: RpaProcessoEntradaDTO) -> RpaRetornoPr
1198
1218
 
1199
1219
  type_text_into_field("Gerenciador de Notas Fiscais", app["TFrmMenuPrincipal"]["Edit"], True, "50")
1200
1220
  pyautogui.press("enter")
1201
- await worker_sleep(2)
1221
+ await worker_sleep(5)
1202
1222
  pyautogui.press("enter")
1203
1223
  await worker_sleep(5)
1204
1224
  console.print(f"\nPesquisa: 'Gerenciador de Notas Fiscais' realizada com sucesso 2ª Etapa",style="bold green")
@@ -17,6 +17,8 @@ from pywinauto.keyboard import send_keys
17
17
  from pywinauto.timings import wait_until
18
18
  from pywinauto_recorder.player import set_combobox
19
19
  from rich.console import Console
20
+ import sys
21
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")))
20
22
  from worker_automate_hub.api.ahead_service import save_xml_to_downloads
21
23
  from worker_automate_hub.api.client import (
22
24
  get_config_by_name,
@@ -325,7 +327,8 @@ async def entrada_de_notas_33(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
325
327
  await worker_sleep(5)
326
328
 
327
329
  # Aguarda a tela de aguarde
328
- imagem_alvo = "assets\\entrada_notas\\aguarde.png"
330
+ # imagem_alvo = "assets\\entrada_notas\\aguarde.png"
331
+ imagem_alvo =r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\worker_automate_hub\assets\entrada_notas\aguarde.png"
329
332
  timeout = 300 # 5 minutos
330
333
  start_time = time.time()
331
334
 
@@ -362,7 +365,7 @@ async def entrada_de_notas_33(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
362
365
  try:
363
366
  # Verifica erro ncm nao encontrado
364
367
  imagem_alvo = "assets\\entrada_notas\\nao_encontrado_ncm.png"
365
-
368
+ imagem_alvo = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\worker_automate_hub\assets\entrada_notas\nao_encontrado_ncm.png"
366
369
  localizacao = pyautogui.locateOnScreen(imagem_alvo, confidence=0.9)
367
370
 
368
371
  if localizacao:
@@ -380,7 +383,8 @@ async def entrada_de_notas_33(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
380
383
  )
381
384
 
382
385
  # Aguarda a tela de aguarde
383
- imagem_alvo = "assets\\entrada_notas\\aguarde.png"
386
+ # imagem_alvo = "assets\\entrada_notas\\aguarde.png"
387
+ imagem_alvo =r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\worker_automate_hub\assets\entrada_notas\aguarde.png"
384
388
  timeout = 300 # 5 minutos
385
389
  start_time = time.time()
386
390
 
@@ -693,10 +697,14 @@ async def entrada_de_notas_33(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
693
697
  await worker_sleep(3)
694
698
  console.print(f"Incluindo registro...\n")
695
699
  try:
696
- ASSETS_PATH = "assets"
700
+ # ASSETS_PATH = "assets"
701
+ ASSETS_PATH = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\worker_automate_hub\assets\entrada_notas\IncluirRegistro.png"
697
702
  inserir_registro = pyautogui.locateOnScreen(
698
- ASSETS_PATH + "\\entrada_notas\\IncluirRegistro.png", confidence=0.8
703
+ ASSETS_PATH, confidence=0.8
699
704
  )
705
+ # inserir_registro = pyautogui.locateOnScreen(
706
+ # ASSETS_PATH + "\\entrada_notas\\IncluirRegistro.png", confidence=0.8
707
+ # )
700
708
  pyautogui.click(inserir_registro)
701
709
  except Exception as e:
702
710
  console.print(
@@ -886,3 +894,25 @@ async def entrada_de_notas_33(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
886
894
  finally:
887
895
  # Deleta o xml
888
896
  await delete_xml(nota.get("nfe"))
897
+
898
+ if __name__ == "__main__":
899
+
900
+ task = RpaProcessoEntradaDTO(
901
+ datEntradaFila= datetime.now(),
902
+ configEntrada= {"nfe":"43250703746938001387550040005122881902295895","cfop":"5102","itens":[{"qtd":"2.00","ocst":"000","ncmsh":"39232990","valorIpi":"0.00","valorIcms":"3.63","valorTotal":"21.34","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"21.34","codigoProduto":"030338","unidadeMedida":"UN","valorUnitario":"10.67","descricaoProduto":"Saco Plastico para Moedas Transparente 0,10m PCT 100UN"},{"qtd":"1.00","ocst":"000","ncmsh":"48211000","valorIpi":"0.00","valorIcms":"5.39","valorTotal":"31.72","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"31.72","codigoProduto":"044867","unidadeMedida":"ROL","valorUnitario":"31.72","descricaoProduto":"Etiqueta Adesiva 100X50mm Amarelo 101C RL 200UN"},{"qtd":"1.00","ocst":"000","ncmsh":"49111090","valorIpi":"0.00","valorIcms":"14.43","valorTotal":"84.90","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"84.90","codigoProduto":"041749","unidadeMedida":"PAC","valorUnitario":"84.90","descricaoProduto":"Bloco de Abastecimento 1 via 8 x 6,5cm PCT 50BL de 100fls"},{"qtd":"12.00","ocst":"000","ncmsh":"96081000","valorIpi":"0.00","valorIcms":"1.24","valorTotal":"7.32","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"7.32","codigoProduto":"029618","unidadeMedida":"UN","valorUnitario":"0.61","descricaoProduto":"Caneta Esferografica Compactor Economic 1.0mm Azul"},{"qtd":"20.00","ocst":"000","ncmsh":"96081000","valorIpi":"0.00","valorIcms":"2.07","valorTotal":"12.20","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"12.20","codigoProduto":"029618","unidadeMedida":"UN","valorUnitario":"0.61","descricaoProduto":"Caneta Esferografica Compactor Economic 1.0mm Azul"},{"qtd":"1.00","ocst":"100","ncmsh":"39191010","valorIpi":"0.83","valorIcms":"1.08","valorTotal":"5.50","aliquotaIpi":"15.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"6.33","codigoProduto":"050894","unidadeMedida":"UN","valorUnitario":"5.50","descricaoProduto":"Fita Adesiva Hot Melt Sooper PRO 45mmX45m Transparente"},{"qtd":"2.00","ocst":"000","ncmsh":"48119019","valorIpi":"6.78","valorIcms":"36.63","valorTotal":"208.66","aliquotaIpi":"3.25","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"215.44","codigoProduto":"041690","unidadeMedida":"UN","valorUnitario":"104.33","descricaoProduto":"Bobina Termica Rede Sim 80mmx80m 44g CX 16UN"},{"qtd":"1.00","ocst":"020","ncmsh":"17019900","valorIpi":"0.00","valorIcms":"1.57","valorTotal":"22.41","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"9.23","codigoProduto":"050962","unidadeMedida":"UN","valorUnitario":"22.41","descricaoProduto":"Acucar Refinado Alto Alegre Sache CX 400x5g"},{"qtd":"2.00","ocst":"000","ncmsh":"48232099","valorIpi":"0.00","valorIcms":"1.42","valorTotal":"8.38","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"8.38","codigoProduto":"009014","unidadeMedida":"UN","valorUnitario":"4.19","descricaoProduto":"Filtro de Papel Melitta No103 30UN"},{"qtd":"1.00","ocst":"200","ncmsh":"40151900","valorIpi":"0.00","valorIcms":"7.72","valorTotal":"45.41","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"45.41","codigoProduto":"020964","unidadeMedida":"CX","valorUnitario":"45.41","descricaoProduto":"Luva Latex Volk Cleanline Descartavel com Po G CX 100UN"},{"qtd":"2.00","ocst":"000","ncmsh":"68053090","valorIpi":"0.00","valorIcms":"0.33","valorTotal":"1.96","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"1.96","codigoProduto":"050637","unidadeMedida":"UN","valorUnitario":"0.98","descricaoProduto":"Esponja Esfrelux Lava Loucas Anti Bacteria"},{"qtd":"2.00","ocst":"200","ncmsh":"62160000","valorIpi":"0.00","valorIcms":"1.53","valorTotal":"9.00","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"9.00","codigoProduto":"025306","unidadeMedida":"PAR","valorUnitario":"4.50","descricaoProduto":"Luva Poliamida Volk Tatil PU Palma e Dedos Preta M"},{"qtd":"1.00","ocst":"000","ncmsh":"21039011","valorIpi":"0.00","valorIcms":"4.55","valorTotal":"26.78","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"26.78","codigoProduto":"100011581","unidadeMedida":"CX","valorUnitario":"26.78","descricaoProduto":"Maionese Sache Junior 7g CX 160UN"},{"qtd":"1.00","ocst":"100","ncmsh":"39235000","valorIpi":"3.45","valorIcms":"12.33","valorTotal":"69.05","aliquotaIpi":"5.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"72.50","codigoProduto":"053593","unidadeMedida":"CX","valorUnitario":"69.05","descricaoProduto":"Tampa Versaline PP Preta Copo de Papel PD 210ml CX 500UN"},{"qtd":"1.00","ocst":"000","ncmsh":"48211000","valorIpi":"0.00","valorIcms":"2.63","valorTotal":"15.46","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"15.46","codigoProduto":"053356","unidadeMedida":"ROL","valorUnitario":"15.46","descricaoProduto":"Etiqueta Validade Rede Sim 40x24mm RL 1000UN"},{"qtd":"12.00","ocst":"000","ncmsh":"39241000","valorIpi":"0.00","valorIcms":"9.28","valorTotal":"54.60","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"54.60","codigoProduto":"011523","unidadeMedida":"UN","valorUnitario":"4.55","descricaoProduto":"Copo Descartavel PS Branco 180ml PCT 100UN"},{"qtd":"1.00","ocst":"000","ncmsh":"21032010","valorIpi":"0.00","valorIcms":"4.53","valorTotal":"26.62","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"26.62","codigoProduto":"053435","unidadeMedida":"UN","valorUnitario":"26.62","descricaoProduto":"Ketchup Sache Junior 7g CX 168UN"},{"qtd":"1.00","ocst":"000","ncmsh":"39173229","valorIpi":"0.00","valorIcms":"0.83","valorTotal":"4.91","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"4.91","codigoProduto":"041209","unidadeMedida":"UN","valorUnitario":"4.91","descricaoProduto":"Canudo Oxi Biodegrad Strawplast Embalado Indiv 100UN"},{"qtd":"3.00","ocst":"000","ncmsh":"38089919","valorIpi":"0.00","valorIcms":"3.48","valorTotal":"20.49","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"20.49","codigoProduto":"054500","unidadeMedida":"UN","valorUnitario":"6.83","descricaoProduto":"Alcool Liquido 70o Super Vale 1L"},{"qtd":"2.00","ocst":"000","ncmsh":"48182000","valorIpi":"0.00","valorIcms":"13.49","valorTotal":"79.38","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"79.38","codigoProduto":"100010494","unidadeMedida":"CX","valorUnitario":"39.69","descricaoProduto":"Papel Higienico Rolo 300m Softpaper Eco FS 17g CX 8UN"},{"qtd":"2.00","ocst":"000","ncmsh":"39232190","valorIpi":"0.00","valorIcms":"2.15","valorTotal":"12.64","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"12.64","codigoProduto":"038796","unidadeMedida":"UN","valorUnitario":"6.32","descricaoProduto":"Saco para Lixo Basic Up Bag Azul 30L 50UN"},{"qtd":"2.00","ocst":"500","ncmsh":"48182000","valorIpi":"0.00","valorIcms":"29.07","valorTotal":"171.00","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"171.00","codigoProduto":"020684","unidadeMedida":"CX","valorUnitario":"85.50","descricaoProduto":"Papel Toalha Bobina 200m Softpaper Basic FS 24g CX 6UN"},{"qtd":"2.00","ocst":"020","ncmsh":"09012100","valorIpi":"0.00","valorIcms":"5.03","valorTotal":"71.78","aliquotaIpi":"0.00","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"29.56","codigoProduto":"047037","unidadeMedida":"UN","valorUnitario":"35.89","descricaoProduto":"Cafe em Po 1707 Tradicional Vacuo 500g"},{"qtd":"2.00","ocst":"100","ncmsh":"48236900","valorIpi":"37.59","valorIcms":"71.93","valorTotal":"385.54","aliquotaIpi":"9.75","cfopProduto":"5102","aliquotaIcms":"17.00","bCalculoIcms":"423.13","codigoProduto":"053592","unidadeMedida":"CX","valorUnitario":"192.77","descricaoProduto":"Copo Papel SIM PD 210ml FSCMisto70% CU-COC-855709 CX500UN"}],"natureza":"33","alocacoes":[],"valorNota":"1445.70","nomeFilial":"PF Praça Itália\t","numeroNota":"512288","dataEmissao":"14/07/2025","observacoes":"Vcto: 06/10/2025","existeDespesa":"Não","cnpjFornecedor":"03746938001387","dataVencimento":"06/10/2025","nomeFornecedor":"BRS SUPRIMENTOS CORPORATIVOS S/A","recebimentoFisico":"17/07/2025 14:52","filialEmpresaOrigem":"109"},
903
+ uuidProcesso='def194c2-ffa0-4b9e-b95c-920fb4ad4150',
904
+ nomProcesso='extracao_fechamento_emsys',
905
+ uuidFila="",
906
+ sistemas=[
907
+ {
908
+ "sistema": "EMSys",
909
+ "timeout": "1.0"
910
+ },
911
+ {
912
+ "sistema": "AutoSystem",
913
+ "timeout": "1.0"
914
+ }
915
+ ],
916
+ historico_id='2c4429c8-26ae-4ec6-b775-21583992e82f'
917
+ )
918
+ asyncio.run(entrada_de_notas_33(task))
@@ -4509,49 +4509,45 @@ async def cadastro_pre_venda_header(
4509
4509
 
4510
4510
  console.print("Navegando nos elementos...\n")
4511
4511
  panel_TPage = main_window.child_window(class_name="TPage", found_index=0)
4512
- panel_TGroup_Box = panel_TPage.child_window(
4513
- class_name="TGroupBox", found_index=0
4514
- )
4512
+ panel_TGroup_Box = panel_TPage.child_window(class_name="TGroupBox", found_index=0)
4515
4513
 
4516
4514
  console.print("Selecionando a condição de pagamento...\n")
4517
- condicao_select = panel_TGroup_Box.child_window(
4518
- class_name="TDBIComboBox", found_index=2
4519
- )
4515
+ condicao_select = panel_TGroup_Box.child_window(class_name="TDBIComboBox", found_index=2)
4520
4516
  condicao_select.click_input()
4521
- await worker_sleep(3)
4522
- if "vista" in cod_pagamento.lower():
4523
- try:
4524
- # Verifica mensagem sem lote pra integrar
4525
- imagem_alvo ="assets\\entrada_notas\\a_vista.png" #ALTERAR CAMINHO PARA ASSETS
4526
-
4527
- localizacao = pyautogui.locateOnScreen(imagem_alvo, confidence=0.9)
4517
+ await worker_sleep(2)
4528
4518
 
4529
- if localizacao:
4530
- centro = pyautogui.center(localizacao)
4531
- await worker_sleep(1)
4532
- pyautogui.click(centro)
4519
+ condicao_desejada = ""
4533
4520
 
4534
- except ImageNotFoundException:
4535
- console.print(
4536
- "Imagem não encontrada (exceção capturada). Tentando clicar no OK."
4537
- )
4538
-
4521
+ if "vista" in cod_pagamento.lower():
4522
+ condicao_desejada = "A VISTA"
4539
4523
  elif "21 dias" in cod_pagamento.lower():
4524
+ condicao_desejada = "21 DIAS"
4525
+
4526
+ if condicao_desejada:
4527
+ # Opcional: capturar os itens disponíveis, para debug
4540
4528
  try:
4541
- # Verifica mensagem sem lote pra integrar
4542
- imagem_alvo = "assets\\entrada_notas\\21_dias.png"
4543
- # imagem_alvo = r"C:\Users\automatehub\Documents\GitHub\worker-automate-hub\worker_automate_hub\assets\entrada_notas\21_dias.png"
4544
- localizacao = pyautogui.locateOnScreen(imagem_alvo, confidence=0.9)
4529
+ itens_disponiveis = condicao_select.texts()
4530
+ console.print(f"Opções disponíveis: {itens_disponiveis}")
4531
+ except:
4532
+ itens_disponiveis = []
4545
4533
 
4546
- if localizacao:
4547
- centro = pyautogui.center(localizacao)
4548
- await worker_sleep(1)
4549
- pyautogui.click(centro)
4534
+ # Digita parte inicial para ajudar no filtro (por exemplo "21" ou "A")
4535
+ condicao_select.type_keys(condicao_desejada[:2], with_spaces=True)
4536
+ await worker_sleep(1)
4537
+
4538
+ # Percorre até encontrar o valor exato
4539
+ for _ in range(10):
4540
+ texto_atual = condicao_select.window_text()
4541
+ if condicao_desejada.lower() in texto_atual.lower():
4542
+ condicao_select.type_keys("{ENTER}")
4543
+ break
4544
+ else:
4545
+ condicao_select.type_keys("{DOWN}")
4546
+ await worker_sleep(0.5)
4547
+
4548
+ # Confirma e sai do campo
4549
+ condicao_select.type_keys("{TAB}")
4550
4550
 
4551
- except ImageNotFoundException:
4552
- console.print(
4553
- "Imagem não encontrada (exceção capturada). Tentando clicar no OK."
4554
- )
4555
4551
  await worker_sleep(2)
4556
4552
 
4557
4553
  console.print("Inserindo codigo do cliente...\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: worker-automate-hub
3
- Version: 0.5.671
3
+ Version: 0.5.673
4
4
  Summary: Worker Automate HUB é uma aplicação para automatizar rotinas de RPA nos ambientes Argenta.
5
5
  Author: Joel Paim
6
6
  Requires-Python: >=3.12,<4.0
@@ -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=mX5GeaqwTa-bu61wpOSYtlmgy_HpMDWXITaqeYsVnVs,11175
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
@@ -44,7 +44,7 @@ worker_automate_hub/tasks/jobs/cte_xml.py,sha256=m4BkJDgp95Vr3oqEh6wXeeb31qzZhRF
44
44
  worker_automate_hub/tasks/jobs/descartes.py,sha256=E5kKef8j7e0PTm6NBeZAXkljUoAFEMjVWvHaJ8g2fv4,44451
45
45
  worker_automate_hub/tasks/jobs/devolucao_ctf.py,sha256=zQcRXZ9TxJhyL4jHjBTS-iW5BcmRoSPv9FsBLy0-eWQ,250793
46
46
  worker_automate_hub/tasks/jobs/devolucao_ctf_35.py,sha256=e9t5k2mtZcUcEGKPWysbWzsH_gqrK-6aBXjWe2jWfTg,253948
47
- worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=xDuTEtvTGwU6vHAb3wXzTjp23rxx7XpY9N1a8atyFuA,271308
47
+ worker_automate_hub/tasks/jobs/devolucao_prazo_a_faturar.py,sha256=Bxo5E5fwIMAE1Um0ZbwsYUmX6Z7YSJhsQ3_cqlPnvJU,272110
48
48
  worker_automate_hub/tasks/jobs/ecac_estadual_go.py,sha256=dKkf22nH5gp3RErq5u0UzRsKyJ81fc6ZZ4vLtUuMwHA,21002
49
49
  worker_automate_hub/tasks/jobs/ecac_estadual_main.py,sha256=8WmKe4-MRtzHobXz2S4YBDNN8alfawkC-BBlRY-mn1g,1726
50
50
  worker_automate_hub/tasks/jobs/ecac_estadual_mt.py,sha256=C26zmpGQGUq6sP9lU9nanM3Fje-rkyx5tjwmRy4lyL8,25300
@@ -57,7 +57,7 @@ worker_automate_hub/tasks/jobs/entrada_de_notas_15.py,sha256=BYmdPLJFZEHD_lVSpua
57
57
  worker_automate_hub/tasks/jobs/entrada_de_notas_16.py,sha256=xVz5bhbAYt1IeXbkYYXG6JvFWZ8Z0-mHOi218evI1So,36829
58
58
  worker_automate_hub/tasks/jobs/entrada_de_notas_207.py,sha256=A5HM2Eh2bGZueVefnQL9KiCWW95j8zX1v2MslgbDcUE,36871
59
59
  worker_automate_hub/tasks/jobs/entrada_de_notas_32.py,sha256=lku233FqwOknXF14HHC6fZ75WubE69Jp32bAUhKPtGQ,34575
60
- worker_automate_hub/tasks/jobs/entrada_de_notas_33.py,sha256=54jl4ys2Tv4tJcf6WW3T2-kHkZoKL06oIZPPbpOXda0,36798
60
+ worker_automate_hub/tasks/jobs/entrada_de_notas_33.py,sha256=a4uybabnC2AONW3Q7-XREmiu6-5d71rbRCdXeV7uqyM,46655
61
61
  worker_automate_hub/tasks/jobs/entrada_de_notas_34.py,sha256=AXUL8DakrDeTxWW8dn36W830XfIuO47MFUusbUkrnUc,33586
62
62
  worker_automate_hub/tasks/jobs/entrada_de_notas_36.py,sha256=z494n0SUyxorjhvpbat2ELnj7lbhtWPb9JOIsattwA8,35216
63
63
  worker_automate_hub/tasks/jobs/entrada_de_notas_39.py,sha256=whsK_TfNZSmzt0PNHnVi0q4OIxzfKiR5nGuB9WfEYeI,47071
@@ -95,10 +95,10 @@ worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1
95
95
  worker_automate_hub/utils/logger.py,sha256=FYV9fg0_RAYJF_ZOCJEbqQAiCXlXk2gMpvUU1rzT_xs,671
96
96
  worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg3Ft68,1162
97
97
  worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
98
- worker_automate_hub/utils/util.py,sha256=yCi3QVgNJS_kVdAvqKEcDFFnIhKTgaOcQPTkTJjEMtk,206633
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.671.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
102
- worker_automate_hub-0.5.671.dist-info/METADATA,sha256=Pnwe864FBwEYDwCvs5RlH44R0AvX5JoM-S1UqG4pDHE,3049
103
- worker_automate_hub-0.5.671.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
104
- worker_automate_hub-0.5.671.dist-info/RECORD,,
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,,