worker-automate-hub 0.4.395__tar.gz → 0.4.397__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/PKG-INFO +1 -1
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/pyproject.toml +1 -1
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/sped_fiscal.py +131 -3
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/README.md +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/ahead_service.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/client.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/helpers/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/rpa_historico_service.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/cli.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/config/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/config/settings.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/config.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/core/so_manipulation.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/deprecation.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/rate_limit.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/repeat.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/retry.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/singleton.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/timeit.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dao/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dto/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/conexao_rdp.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/playground.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/task_definitions.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/tasks/task_executor.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/__init__.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/env.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/logger.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/toast.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/updater.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/util.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
- {worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/worker.py +0 -0
@@ -3,18 +3,22 @@ import warnings
|
|
3
3
|
import os
|
4
4
|
import io
|
5
5
|
import uuid
|
6
|
-
from datetime import datetime
|
6
|
+
from datetime import datetime,date
|
7
|
+
import calendar
|
7
8
|
|
8
9
|
import pyautogui
|
10
|
+
import pyperclip
|
9
11
|
import pytesseract
|
10
12
|
from pywinauto.application import Application
|
13
|
+
from pywinauto.mouse import double_click
|
14
|
+
from pywinauto.keyboard import send_keys
|
15
|
+
import win32clipboard
|
11
16
|
from PIL import Image, ImageEnhance
|
12
17
|
from rich.console import Console
|
13
18
|
|
14
19
|
from worker_automate_hub.api.client import (
|
15
20
|
get_config_by_name,
|
16
21
|
send_file,
|
17
|
-
get_historico_by_processo_identificador,
|
18
22
|
)
|
19
23
|
|
20
24
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import (
|
@@ -49,6 +53,25 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
49
53
|
# Get config from BOF
|
50
54
|
config = await get_config_by_name("login_emsys")
|
51
55
|
console.print(task)
|
56
|
+
try:
|
57
|
+
get_config_gerar_inventario = await get_config_by_name("SPED_gerar_inventario")
|
58
|
+
console.print(get_config_gerar_inventario)
|
59
|
+
con_config = get_config_gerar_inventario.get("conConfiguracao")
|
60
|
+
if con_config is not None:
|
61
|
+
gerar_inventario = con_config.get("gerar")
|
62
|
+
else:
|
63
|
+
return RpaRetornoProcessoDTO(
|
64
|
+
sucesso=False,
|
65
|
+
retorno="Não foi possivel recuperar o valor da configuração Gerar Inventario, não sendo possivel seguir com o processo.",
|
66
|
+
status=RpaHistoricoStatusEnum.Falha,
|
67
|
+
)
|
68
|
+
except Exception as e:
|
69
|
+
return RpaRetornoProcessoDTO(
|
70
|
+
sucesso=False,
|
71
|
+
retorno=f"Não foi possivel recuperar o valor da configuração Gerar Inventario, erro: {e}.",
|
72
|
+
status=RpaHistoricoStatusEnum.Falha,
|
73
|
+
)
|
74
|
+
|
52
75
|
|
53
76
|
# Seta config entrada na var sped_processar para melhor entendimento
|
54
77
|
sped_processar = task.configEntrada
|
@@ -210,9 +233,114 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
|
|
210
233
|
retorno=f"Erro ao interagir com a tela de gerar sped fiscal, erro: {e}",
|
211
234
|
status=RpaHistoricoStatusEnum.Falha,
|
212
235
|
)
|
236
|
+
|
237
|
+
ano_atual = datetime.now().year
|
238
|
+
if str(periodo_dt) == f"02/{ano_atual}":
|
239
|
+
console.print("Filtrando período pelo Inventario...\n")
|
240
|
+
ano_passado = ano_atual - 1
|
241
|
+
data_busca = f"31/12/{ano_passado}"
|
213
242
|
|
243
|
+
periodo_filtro_inicio = main_window.child_window(class_name="TEditDate", found_index=1)
|
244
|
+
periodo_filtro_inicio.set_edit_text(data_busca)
|
245
|
+
await worker_sleep(2)
|
246
|
+
periodo_filtro_fim = main_window.child_window(class_name="TEditDate", found_index=0)
|
247
|
+
periodo_filtro_fim.set_edit_text(data_busca)
|
248
|
+
await worker_sleep(2)
|
249
|
+
periodo_btn_buscar = main_window.child_window(class_name="TBitBtn", found_index=0)
|
250
|
+
periodo_btn_buscar.click()
|
251
|
+
await worker_sleep(2)
|
252
|
+
periodo_btn_buscar = main_window.child_window(class_name="TcxGrid", found_index=0)
|
253
|
+
rect = periodo_btn_buscar.rectangle()
|
254
|
+
center_x = (rect.left + rect.right) // 2
|
255
|
+
center_y = (rect.top + rect.bottom) // 2
|
256
|
+
double_click(coords=(center_x, center_y))
|
257
|
+
elif gerar_inventario:
|
258
|
+
mes_atual = datetime.now().month
|
259
|
+
if mes_atual == 1:
|
260
|
+
mes_anterior = 12
|
261
|
+
ano_anterior = ano_atual - 1
|
262
|
+
else:
|
263
|
+
mes_anterior = mes_atual - 1
|
264
|
+
ano_anterior = ano_atual
|
265
|
+
|
266
|
+
ultimo_dia = calendar.monthrange(ano_anterior, mes_anterior)[1]
|
267
|
+
data_ultimo_dia = date(ano_anterior, mes_anterior, ultimo_dia)
|
268
|
+
data_formatada = data_ultimo_dia.strftime("%d/%m/%Y")
|
269
|
+
|
270
|
+
periodo_filtro_inicio = main_window.child_window(class_name="TEditDate", found_index=1)
|
271
|
+
periodo_filtro_inicio.set_edit_text(data_formatada)
|
272
|
+
await worker_sleep(2)
|
273
|
+
periodo_filtro_fim = main_window.child_window(class_name="TEditDate", found_index=0)
|
274
|
+
periodo_filtro_fim.set_edit_text(data_formatada)
|
275
|
+
await worker_sleep(2)
|
276
|
+
periodo_btn_buscar = main_window.child_window(class_name="TBitBtn", found_index=0)
|
277
|
+
periodo_btn_buscar.click()
|
278
|
+
await worker_sleep(2)
|
279
|
+
grid_inventario = main_window.child_window(class_name="TcxGrid", found_index=0)
|
280
|
+
rect = grid_inventario.rectangle()
|
281
|
+
center_x = (rect.left + rect.right) // 2
|
282
|
+
center_y = (rect.top + rect.bottom) // 2
|
283
|
+
grid_inventario.click_input(coords=(center_x, center_y))
|
284
|
+
await worker_sleep(2)
|
285
|
+
send_keys("^({HOME})")
|
286
|
+
pyperclip.copy('')
|
287
|
+
await worker_sleep(3)
|
214
288
|
|
215
|
-
|
289
|
+
while True:
|
290
|
+
last_line_inventario_emsys_fiscal = 'x'
|
291
|
+
await worker_sleep(1)
|
292
|
+
with pyautogui.hold('ctrl'):
|
293
|
+
pyautogui.press('c')
|
294
|
+
|
295
|
+
await worker_sleep(1)
|
296
|
+
|
297
|
+
with pyautogui.hold('ctrl'):
|
298
|
+
pyautogui.press('c')
|
299
|
+
|
300
|
+
win32clipboard.OpenClipboard()
|
301
|
+
line_inventario_emsys_fiscal = win32clipboard.GetClipboardData().strip()
|
302
|
+
win32clipboard.CloseClipboard()
|
303
|
+
console.print(f"Linha atual copiada do Emsys Fiscal: {line_inventario_emsys_fiscal}\nUltima Linha copiada: {last_line_inventario_emsys_fiscal}")
|
304
|
+
|
305
|
+
if len(line_inventario_emsys_fiscal) <= 4:
|
306
|
+
return RpaRetornoProcessoDTO(
|
307
|
+
sucesso=False,
|
308
|
+
retorno=f"Erro: Nenhum registro encontrado com a data informada {periodo_btn_buscar}.",
|
309
|
+
status=RpaHistoricoStatusEnum.Falha,
|
310
|
+
)
|
311
|
+
|
312
|
+
|
313
|
+
if 'no final do' in line_inventario_emsys_fiscal.lower():
|
314
|
+
selecionar_registro_full_path = "assets\\emsys\\button_selecionar_registro_fiscal.png"
|
315
|
+
try:
|
316
|
+
button_location = pyautogui.locateCenterOnScreen(selecionar_registro_full_path, confidence=0.6)
|
317
|
+
if button_location:
|
318
|
+
pyautogui.click(button_location)
|
319
|
+
console.print("Botão 'Selecionar Registro' clicado com sucesso!")
|
320
|
+
break
|
321
|
+
except Exception as e:
|
322
|
+
return RpaRetornoProcessoDTO(
|
323
|
+
sucesso=False,
|
324
|
+
retorno=f"Erro: Não foi clicar na opção Selecionar Registro no Inventario, erro: {e}.",
|
325
|
+
status=RpaHistoricoStatusEnum.Falha,
|
326
|
+
)
|
327
|
+
|
328
|
+
|
329
|
+
if bool(line_inventario_emsys_fiscal):
|
330
|
+
if last_line_inventario_emsys_fiscal == line_inventario_emsys_fiscal:
|
331
|
+
return RpaRetornoProcessoDTO(
|
332
|
+
sucesso=False,
|
333
|
+
retorno=f"Erro: Não foi encontrado a opção do período de busca {periodo_filtro_inicio} nas opções do inventário.",
|
334
|
+
status=RpaHistoricoStatusEnum.Falha,
|
335
|
+
)
|
336
|
+
else:
|
337
|
+
last_line_inventario_emsys_fiscal = line_inventario_emsys_fiscal
|
338
|
+
pyautogui.press('down')
|
339
|
+
|
340
|
+
else:
|
341
|
+
console.print("Mês não é igual a Fevereiro e SPED Inventario é falso, seguindo com a geração do SPED...\n")
|
342
|
+
|
343
|
+
await worker_sleep(3)
|
216
344
|
pesquisar_full_path = "assets\\emsys\\button_gerar_sped_fiscal.png"
|
217
345
|
try:
|
218
346
|
button_location = pyautogui.locateCenterOnScreen(pesquisar_full_path, confidence=0.6)
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/ahead_service.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/api/client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/config/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/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.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/repeat.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/retry.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/decorators/timeit.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/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
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/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
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/env.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/logger.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/toast.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/updater.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.395 → worker_automate_hub-0.4.397}/worker_automate_hub/utils/util.py
RENAMED
File without changes
|
File without changes
|
File without changes
|