worker-automate-hub 0.5.661__py3-none-any.whl → 0.5.663__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/lancamento_pis_cofins.py +179 -132
- {worker_automate_hub-0.5.661.dist-info → worker_automate_hub-0.5.663.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.661.dist-info → worker_automate_hub-0.5.663.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.661.dist-info → worker_automate_hub-0.5.663.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.661.dist-info → worker_automate_hub-0.5.663.dist-info}/entry_points.txt +0 -0
|
@@ -149,126 +149,148 @@ async def lancamento_pis_cofins(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
|
|
|
149
149
|
)
|
|
150
150
|
periodo_field.set_edit_text(periodo_dt)
|
|
151
151
|
|
|
152
|
-
console.print("Selecionando Replicar para empresas...\n")
|
|
153
|
-
replicar_para_empresas_check = main_window.child_window(
|
|
154
|
-
|
|
155
|
-
)
|
|
156
|
-
replicar_para_empresas_check.click_input()
|
|
157
|
-
console.print(
|
|
158
|
-
|
|
159
|
-
)
|
|
152
|
+
# console.print("Selecionando Replicar para empresas...\n")
|
|
153
|
+
# replicar_para_empresas_check = main_window.child_window(
|
|
154
|
+
# class_name="TcxCheckBox", found_index=0
|
|
155
|
+
# )
|
|
156
|
+
# replicar_para_empresas_check.click_input()
|
|
157
|
+
# console.print(
|
|
158
|
+
# "A opção 'Aplicar Rateio aos Itens Selecionados' selecionado com sucesso... \n"
|
|
159
|
+
# )
|
|
160
|
+
try:
|
|
161
|
+
await worker_sleep(5)
|
|
162
|
+
console.print("Confirmando Pop-up - ...Pode causar lentidão no sistema...\n")
|
|
163
|
+
console.print(f"Verificando a presença de Confirm...")
|
|
164
|
+
confirm_pop_up = await is_window_open_by_class("TMessageForm", "TMessageForm")
|
|
165
|
+
if confirm_pop_up["IsOpened"] == True:
|
|
166
|
+
app = Application().connect(class_name="TMessageForm")
|
|
167
|
+
main_window = app["TMessageForm"]
|
|
168
|
+
main_window.set_focus()
|
|
169
|
+
main_window.child_window(title="&Yes").click()
|
|
170
|
+
console.print(f"Yes clicado com sucesso...")
|
|
160
171
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
await worker_sleep(5)
|
|
173
|
+
console.print(
|
|
174
|
+
f"Verificando se foi aberto a tela de Seleção de Empresas clicado com sucesso..."
|
|
175
|
+
)
|
|
176
|
+
selecao_empresas_screen = await is_window_open_by_class(
|
|
177
|
+
"TFrmSelecionaEmpresas", "TFrmSelecionaEmpresas"
|
|
178
|
+
)
|
|
179
|
+
if selecao_empresas_screen["IsOpened"] == True:
|
|
180
|
+
console.print(f"Janela de Seleção de Empresas foi aberta com sucesso...")
|
|
181
|
+
app = Application().connect(class_name="TFrmSelecionaEmpresas", timeout=120)
|
|
182
|
+
main_window = app["TFrmSelecionaEmpresas"]
|
|
183
|
+
main_window.set_focus()
|
|
184
|
+
console.print(f"Clicando em seleciona todas...")
|
|
185
|
+
try:
|
|
186
|
+
selecionar_todos_itens = (
|
|
187
|
+
ASSETS_PATH + "\\lancamento_pis_cofins\\btn_selecionar_todas.png"
|
|
188
|
+
)
|
|
189
|
+
# Tenta localizar a imagem na tela
|
|
190
|
+
localizacao = pyautogui.locateOnScreen(
|
|
191
|
+
selecionar_todos_itens, confidence=0.9
|
|
192
|
+
)
|
|
193
|
+
await worker_sleep(3)
|
|
194
|
+
if localizacao:
|
|
195
|
+
centro = pyautogui.center(localizacao)
|
|
196
|
+
pyautogui.moveTo(centro)
|
|
197
|
+
pyautogui.click()
|
|
198
|
+
console.print("Clique realizado com sucesso!")
|
|
199
|
+
else:
|
|
200
|
+
console.print("Imagem não encontrada na tela.")
|
|
201
|
+
except Exception as e:
|
|
202
|
+
retorno = f"Não foi possivel clicar em selecionar todos os itens na Seleção de Empresas, erro: {e} "
|
|
203
|
+
pass
|
|
204
|
+
try:
|
|
205
|
+
console.print(f"Clicando em OK - para andamento do processo...")
|
|
206
|
+
app = Application().connect(class_name="TFrmSelecionaEmpresas", timeout=120)
|
|
207
|
+
main_window = app["TFrmSelecionaEmpresas"]
|
|
208
|
+
main_window.set_focus()
|
|
171
209
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
)
|
|
179
|
-
if selecao_empresas_screen["IsOpened"] == True:
|
|
180
|
-
console.print(f"Janela de Seleção de Empresas foi aberta com sucesso...")
|
|
181
|
-
app = Application().connect(class_name="TFrmSelecionaEmpresas", timeout=120)
|
|
182
|
-
main_window = app["TFrmSelecionaEmpresas"]
|
|
183
|
-
main_window.set_focus()
|
|
184
|
-
console.print(f"Clicando em seleciona todas...")
|
|
185
|
-
try:
|
|
186
|
-
selecionar_todos_itens = (
|
|
187
|
-
ASSETS_PATH + "\\lancamento_pis_cofins\\btn_selecionar_todas.png"
|
|
188
|
-
)
|
|
189
|
-
# Tenta localizar a imagem na tela
|
|
190
|
-
localizacao = pyautogui.locateOnScreen(
|
|
191
|
-
selecionar_todos_itens, confidence=0.9
|
|
192
|
-
)
|
|
193
|
-
await worker_sleep(3)
|
|
194
|
-
if localizacao:
|
|
195
|
-
centro = pyautogui.center(localizacao)
|
|
196
|
-
pyautogui.moveTo(centro)
|
|
197
|
-
pyautogui.click()
|
|
198
|
-
console.print("Clique realizado com sucesso!")
|
|
199
|
-
else:
|
|
200
|
-
console.print("Imagem não encontrada na tela.")
|
|
201
|
-
except Exception as e:
|
|
202
|
-
retorno = f"Não foi possivel clicar em selecionar todos os itens na Seleção de Empresas, erro: {e} "
|
|
203
|
-
return RpaRetornoProcessoDTO(
|
|
204
|
-
sucesso=False,
|
|
205
|
-
retorno=retorno,
|
|
206
|
-
status=RpaHistoricoStatusEnum.Falha,
|
|
207
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.Tecnico)],
|
|
208
|
-
)
|
|
210
|
+
try:
|
|
211
|
+
btn_ok = main_window.child_window(title="OK")
|
|
212
|
+
btn_ok.click()
|
|
213
|
+
except:
|
|
214
|
+
btn_ok = main_window.child_window(title="&OK")
|
|
215
|
+
btn_ok.click()
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
await worker_sleep(3)
|
|
218
|
+
except:
|
|
219
|
+
pass
|
|
220
|
+
except:
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
try:
|
|
224
|
+
selecionar_todos_itens = (
|
|
225
|
+
ASSETS_PATH + "\\lancamento_pis_cofins\\botao_incluir.png"
|
|
226
|
+
)
|
|
227
|
+
# Tenta localizar a imagem na tela
|
|
228
|
+
localizacao = pyautogui.locateOnScreen(
|
|
229
|
+
selecionar_todos_itens, confidence=0.9
|
|
230
|
+
)
|
|
231
|
+
await worker_sleep(3)
|
|
232
|
+
if localizacao:
|
|
233
|
+
centro = pyautogui.center(localizacao)
|
|
234
|
+
pyautogui.moveTo(centro)
|
|
235
|
+
pyautogui.click()
|
|
236
|
+
console.print("Clique realizado com sucesso!")
|
|
237
|
+
else:
|
|
238
|
+
console.print("Imagem não encontrada na tela.")
|
|
239
|
+
except Exception as e:
|
|
240
|
+
pass
|
|
241
|
+
|
|
242
|
+
await worker_sleep(10)
|
|
243
|
+
|
|
244
|
+
try:
|
|
245
|
+
app = Application().connect(title="Aviso", timeout=10)
|
|
246
|
+
main_window = app["Aviso"]
|
|
213
247
|
main_window.set_focus()
|
|
214
248
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
except:
|
|
219
|
-
btn_ok = main_window.child_window(title="&OK")
|
|
220
|
-
btn_ok.click()
|
|
249
|
+
# Pega o segundo Static usando child_window (não children)
|
|
250
|
+
aviso = main_window.child_window(class_name="Static", found_index=1)
|
|
251
|
+
texto_aviso = aviso.window_text()
|
|
221
252
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
try:
|
|
225
|
-
selecionar_todos_itens = (
|
|
226
|
-
ASSETS_PATH + "\\lancamento_pis_cofins\\botao_incluir.png"
|
|
227
|
-
)
|
|
228
|
-
# Tenta localizar a imagem na tela
|
|
229
|
-
localizacao = pyautogui.locateOnScreen(
|
|
230
|
-
selecionar_todos_itens, confidence=0.9
|
|
231
|
-
)
|
|
232
|
-
await worker_sleep(3)
|
|
233
|
-
if localizacao:
|
|
234
|
-
centro = pyautogui.center(localizacao)
|
|
235
|
-
pyautogui.moveTo(centro)
|
|
236
|
-
pyautogui.click()
|
|
237
|
-
console.print("Clique realizado com sucesso!")
|
|
238
|
-
else:
|
|
239
|
-
console.print("Imagem não encontrada na tela.")
|
|
240
|
-
except Exception as e:
|
|
241
|
-
retorno = f"Não foi possivel clicar em selecionar todos os itens na Seleção de Empresas, erro: {e} "
|
|
253
|
+
if "livro fiscal com status diferente de Confirmado/Encerrado" in texto_aviso:
|
|
254
|
+
retorno = texto_aviso
|
|
242
255
|
return RpaRetornoProcessoDTO(
|
|
243
256
|
sucesso=False,
|
|
244
257
|
retorno=retorno,
|
|
245
258
|
status=RpaHistoricoStatusEnum.Falha,
|
|
246
|
-
tags=[RpaTagDTO(descricao=RpaTagEnum.
|
|
259
|
+
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
|
247
260
|
)
|
|
248
261
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
262
|
+
except Exception as e:
|
|
263
|
+
print(f"Erro ao capturar o aviso: {e}")
|
|
264
|
+
|
|
265
|
+
await worker_sleep(2)
|
|
266
|
+
|
|
267
|
+
# Verificar se já existe registro no mês apurado
|
|
268
|
+
try:
|
|
269
|
+
selecionar_todos_itens = ASSETS_PATH + "\\lancamento_pis_cofins\\ja_existe_periodo.png"
|
|
270
|
+
|
|
271
|
+
localizacao = None
|
|
272
|
+
for tentativa in range(10):
|
|
273
|
+
localizacao = pyautogui.locateOnScreen(selecionar_todos_itens, confidence=0.9)
|
|
260
274
|
if localizacao:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
break
|
|
276
|
+
await worker_sleep(2) # espera 2 segundos antes da próxima tentativa
|
|
277
|
+
|
|
278
|
+
if localizacao:
|
|
279
|
+
app = Application().connect(title="Informação", timeout=60)
|
|
280
|
+
main_window = app["Informação"]
|
|
281
|
+
main_window.set_focus()
|
|
282
|
+
informacao = main_window.child_window(title="OK")
|
|
283
|
+
informacao.click()
|
|
284
|
+
console.print("Clique realizado com sucesso!")
|
|
285
|
+
else:
|
|
286
|
+
console.print("Imagem não encontrada na tela após 10 tentativas.")
|
|
287
|
+
|
|
288
|
+
except Exception as e:
|
|
289
|
+
pass
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
await worker_sleep(5)
|
|
293
|
+
try:
|
|
272
294
|
console.print("Verificando se possui tela de Informação... \n")
|
|
273
295
|
information_pop_up = await is_window_open("Information")
|
|
274
296
|
if information_pop_up["IsOpened"] == True:
|
|
@@ -295,34 +317,35 @@ async def lancamento_pis_cofins(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
|
|
|
295
317
|
)
|
|
296
318
|
else:
|
|
297
319
|
console.print("Não possui tela de Informação... \n")
|
|
320
|
+
except:
|
|
321
|
+
pass
|
|
322
|
+
# PRECISO TESTAR ADICIONAR EXCESSÃO PARA A TELA DE AVISO
|
|
323
|
+
pop_up_aviso = []
|
|
324
|
+
console.print(f"Verificando se possui tela de Aviso...")
|
|
325
|
+
while True:
|
|
326
|
+
aviso_screen_opened = await is_window_open("Aviso")
|
|
327
|
+
if aviso_screen_opened["IsOpened"] == True:
|
|
328
|
+
msg_pop_up = await ocr_title("aviso_pop_up_cofins", "Aviso")
|
|
329
|
+
console.print(f"retorno:{msg_pop_up.sucesso}")
|
|
330
|
+
if msg_pop_up.sucesso == True:
|
|
331
|
+
msg_retorno = msg_pop_up.retorno
|
|
332
|
+
console.print(msg_retorno)
|
|
333
|
+
pop_up_aviso.append(msg_retorno)
|
|
298
334
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
while True:
|
|
303
|
-
aviso_screen_opened = await is_window_open("Aviso")
|
|
304
|
-
if aviso_screen_opened["IsOpened"] == True:
|
|
305
|
-
msg_pop_up = await ocr_title("aviso_pop_up_cofins", "Aviso")
|
|
306
|
-
console.print(f"retorno:{msg_pop_up.sucesso}")
|
|
307
|
-
if msg_pop_up.sucesso == True:
|
|
308
|
-
msg_retorno = msg_pop_up.retorno
|
|
309
|
-
console.print(msg_retorno)
|
|
310
|
-
pop_up_aviso.append(msg_retorno)
|
|
311
|
-
|
|
312
|
-
app = Application().connect(title="Aviso", timeout=120)
|
|
313
|
-
main_window = app["Aviso"]
|
|
314
|
-
main_window.set_focus()
|
|
335
|
+
app = Application().connect(title="Aviso", timeout=120)
|
|
336
|
+
main_window = app["Aviso"]
|
|
337
|
+
main_window.set_focus()
|
|
315
338
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
339
|
+
try:
|
|
340
|
+
btn_ok = main_window.child_window(title="OK")
|
|
341
|
+
btn_ok.click()
|
|
342
|
+
except:
|
|
343
|
+
btn_ok = main_window.child_window(title="&OK")
|
|
344
|
+
btn_ok.click()
|
|
322
345
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
346
|
+
await worker_sleep(5)
|
|
347
|
+
else:
|
|
348
|
+
break
|
|
326
349
|
|
|
327
350
|
if len(pop_up_aviso) > 0:
|
|
328
351
|
return RpaRetornoProcessoDTO(
|
|
@@ -335,6 +358,28 @@ async def lancamento_pis_cofins(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
|
|
|
335
358
|
console.print(
|
|
336
359
|
"Não possui tela de Aviso ou Pop-up de informação, seguindo com o andamento do processo... \n"
|
|
337
360
|
)
|
|
361
|
+
try:
|
|
362
|
+
app = Application().connect(class_name="TFrmMovtoApuraPisCofins", timeout=60)
|
|
363
|
+
main_window = app["TFrmMovtoApuraPisCofins"]
|
|
364
|
+
|
|
365
|
+
# Tenta fechar a janela até 10 vezes
|
|
366
|
+
for tentativa in range(10):
|
|
367
|
+
try:
|
|
368
|
+
if main_window.exists(timeout=2):
|
|
369
|
+
main_window.close()
|
|
370
|
+
await worker_sleep(2)
|
|
371
|
+
|
|
372
|
+
if not main_window.exists(timeout=2):
|
|
373
|
+
console.print("Tela de Movimento Apuração, fechada com sucesso... \n")
|
|
374
|
+
break
|
|
375
|
+
except Exception as e:
|
|
376
|
+
console.print(f"Tentativa {tentativa + 1}: Erro ao tentar fechar a janela: {e}")
|
|
377
|
+
await worker_sleep(2)
|
|
378
|
+
else:
|
|
379
|
+
console.print("Não foi possível fechar a tela de Movimento Apuração após 10 tentativas.")
|
|
380
|
+
|
|
381
|
+
except Exception as e:
|
|
382
|
+
console.print(f"Erro ao conectar com a janela TFrmMovtoApuraPisCofins: {e}")
|
|
338
383
|
app = Application().connect(
|
|
339
384
|
class_name="TFrmMovtoApuraPisCofins", timeout=120
|
|
340
385
|
)
|
|
@@ -874,3 +919,5 @@ async def lancamento_pis_cofins(task: RpaProcessoEntradaDTO) -> RpaRetornoProces
|
|
|
874
919
|
status=RpaHistoricoStatusEnum.Falha,
|
|
875
920
|
tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
|
|
876
921
|
)
|
|
922
|
+
|
|
923
|
+
|
|
@@ -79,7 +79,7 @@ worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos.py,sha256=QzK2aG5d9pmFb
|
|
|
79
79
|
worker_automate_hub/tasks/jobs/geracao_aprovacao_pedidos_novo.py,sha256=5-wn583Cm0_NJ3TcVpYcurBTRxgwW6MU8WqaYawLS2k,21345
|
|
80
80
|
worker_automate_hub/tasks/jobs/integracao_contabil.py,sha256=psoIU0tjtTJq2W8aGXjXrfkAOYlIpUtHZyNolI7dp-0,16263
|
|
81
81
|
worker_automate_hub/tasks/jobs/integracao_contabil_generica.py,sha256=qIuWvouE88GooP57tRHmwfFV-2PcboJaErQo1VLolf8,21520
|
|
82
|
-
worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py,sha256=
|
|
82
|
+
worker_automate_hub/tasks/jobs/lancamento_pis_cofins.py,sha256=0mlu-oPwRd9qCocB-6tWsEI0-wd48mkBJn5juYqOAX8,40788
|
|
83
83
|
worker_automate_hub/tasks/jobs/lancamento_rateio.py,sha256=0cvbpuJiHl5mca5gpZudX7uQY5Rqe5xzwt6juQcMhjo,15875
|
|
84
84
|
worker_automate_hub/tasks/jobs/login_emsys.py,sha256=dO9S027qRTtjOfytF6IWO-m6hDld8kZqOVAsn91l1YA,5684
|
|
85
85
|
worker_automate_hub/tasks/jobs/login_emsys_versao_especifica.py,sha256=_6CFh79eaW9KdPGR6FMV01ASPjJzNzzBK1MvC_uiSOo,5625
|
|
@@ -98,7 +98,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
|
98
98
|
worker_automate_hub/utils/util.py,sha256=GJvJdRil1DLVgZFgGg2n_WI3UKoy-xVmXF3IIefW59I,206009
|
|
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.663.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
|
102
|
+
worker_automate_hub-0.5.663.dist-info/METADATA,sha256=CXuQG9DoPUUP37a1XmHtiFodfiqgiPFkua-qTchNYbY,3049
|
|
103
|
+
worker_automate_hub-0.5.663.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
104
|
+
worker_automate_hub-0.5.663.dist-info/RECORD,,
|
|
File without changes
|
{worker_automate_hub-0.5.661.dist-info → worker_automate_hub-0.5.663.dist-info}/entry_points.txt
RENAMED
|
File without changes
|