worker-automate-hub 0.5.749__py3-none-any.whl → 0.5.912__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.
Files changed (36) hide show
  1. worker_automate_hub/api/client.py +186 -68
  2. worker_automate_hub/api/rpa_historico_service.py +1 -0
  3. worker_automate_hub/cli.py +91 -111
  4. worker_automate_hub/tasks/jobs/abertura_livros_fiscais.py +112 -229
  5. worker_automate_hub/tasks/jobs/descartes.py +91 -77
  6. worker_automate_hub/tasks/jobs/devolucao_produtos.py +1386 -0
  7. worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +3 -46
  8. worker_automate_hub/tasks/jobs/entrada_de_notas_22.py +833 -0
  9. worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +29 -9
  10. worker_automate_hub/tasks/jobs/entrada_de_notas_37.py +619 -0
  11. worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +1 -1
  12. worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +63 -16
  13. worker_automate_hub/tasks/jobs/extracao_dados_nielsen.py +504 -0
  14. worker_automate_hub/tasks/jobs/extracao_saldo_estoque.py +242 -108
  15. worker_automate_hub/tasks/jobs/extracao_saldo_estoque_fiscal.py +688 -0
  16. worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +2 -2
  17. worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +25 -16
  18. worker_automate_hub/tasks/jobs/geracao_balancetes_filial.py +330 -0
  19. worker_automate_hub/tasks/jobs/importacao_extratos.py +538 -0
  20. worker_automate_hub/tasks/jobs/importacao_extratos_748.py +800 -0
  21. worker_automate_hub/tasks/jobs/inclusao_pedidos_ipiranga.py +222 -0
  22. worker_automate_hub/tasks/jobs/inclusao_pedidos_raizen.py +174 -0
  23. worker_automate_hub/tasks/jobs/inclusao_pedidos_vibra.py +327 -0
  24. worker_automate_hub/tasks/jobs/notas_faturamento_sap.py +438 -157
  25. worker_automate_hub/tasks/jobs/opex_capex.py +540 -326
  26. worker_automate_hub/tasks/jobs/sped_fiscal.py +8 -8
  27. worker_automate_hub/tasks/jobs/transferencias.py +52 -41
  28. worker_automate_hub/tasks/task_definitions.py +46 -1
  29. worker_automate_hub/tasks/task_executor.py +11 -0
  30. worker_automate_hub/utils/util.py +252 -215
  31. worker_automate_hub/utils/utils_nfe_entrada.py +1 -1
  32. worker_automate_hub/worker.py +1 -9
  33. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/METADATA +4 -2
  34. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/RECORD +36 -25
  35. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/WHEEL +1 -1
  36. {worker_automate_hub-0.5.749.dist-info → worker_automate_hub-0.5.912.dist-info}/entry_points.txt +0 -0
@@ -108,11 +108,11 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
108
108
  message="32-bit application should be automated using 32-bit Python",
109
109
  )
110
110
 
111
- await worker_sleep(4)
111
+ await worker_sleep(8)
112
112
 
113
113
  try:
114
114
  app = Application(backend="win32").connect(
115
- class_name="TFrmLoginModulo", timeout=50
115
+ class_name="TFrmLoginModulo", timeout=120
116
116
  )
117
117
  except:
118
118
  return RpaRetornoProcessoDTO(
@@ -131,12 +131,12 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
131
131
  await worker_sleep(10)
132
132
  console.print(f"Verificando a presença de Confirm...")
133
133
  confirm_pop_up = await is_window_open("Confirm")
134
- if confirm_pop_up["IsOpened"] == True:
134
+ if confirm_pop_up["IsOpened"] == True:
135
135
  app = Application().connect(class_name="TMessageForm")
136
136
  main_window = app["TMessageForm"]
137
137
  main_window.set_focus()
138
138
  main_window.child_window(title="&No").click()
139
- pyautogui.click(120,173)
139
+ pyautogui.click(120, 173)
140
140
  pyautogui.press("enter")
141
141
  await worker_sleep(2)
142
142
  pyautogui.press("enter")
@@ -298,7 +298,7 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
298
298
  )
299
299
  periodo_btn_buscar.click()
300
300
  await worker_sleep(2)
301
- #As vezes o click de cima não funciona
301
+ # As vezes o click de cima não funciona
302
302
  pyautogui.click(915, 664)
303
303
  await worker_sleep(2)
304
304
  periodo_btn_buscar = main_window.child_window(
@@ -307,7 +307,7 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
307
307
  rect = periodo_btn_buscar.rectangle()
308
308
  center_x = (rect.left + rect.right) // 2
309
309
  center_y = (rect.top + rect.bottom) // 2
310
- double_click(coords=(center_x, center_y))
310
+ double_click(coords=(center_x, center_y))
311
311
  elif gerar_inventario:
312
312
  mes_atual = datetime.now().month
313
313
  if mes_atual == 1:
@@ -336,7 +336,7 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
336
336
  )
337
337
  periodo_btn_buscar.click()
338
338
  await worker_sleep(2)
339
- #As vezes o click de cima não funciona
339
+ # As vezes o click de cima não funciona
340
340
  pyautogui.click(915, 664)
341
341
  await worker_sleep(2)
342
342
  try:
@@ -707,4 +707,4 @@ async def sped_fiscal(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
707
707
  retorno=observacao,
708
708
  status=RpaHistoricoStatusEnum.Falha,
709
709
  tags=[RpaTagDTO(descricao=RpaTagEnum.Negocio)],
710
- )
710
+ )
@@ -18,6 +18,7 @@ from worker_automate_hub.models.dto.rpa_processo_entrada_dto import (
18
18
  RpaProcessoEntradaDTO,
19
19
  )
20
20
  from worker_automate_hub.utils.logger import logger
21
+ from pywinauto.keyboard import send_keys
21
22
  from worker_automate_hub.utils.toast import show_toast
22
23
  from worker_automate_hub.utils.util import (
23
24
  send_to_webhook,
@@ -67,7 +68,7 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
67
68
 
68
69
  # Fecha a instancia do emsys - caso esteja aberta
69
70
  await kill_all_emsys()
70
- app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSys3_38.exe")
71
+ app = Application(backend="win32").start("C:\\Rezende\\EMSys3\\EMSys3_10.exe")
71
72
  warnings.filterwarnings(
72
73
  "ignore",
73
74
  category=UserWarning,
@@ -122,17 +123,22 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
122
123
 
123
124
 
124
125
  # Preenche o campo do cliente com o número da filial
125
- cliente_field_position = await find_element_center(
126
- ASSETS_BASE_PATH + "field_cliente.png", (795, 354, 128, 50), 10
127
- )
128
- if cliente_field_position == None:
129
- cliente_field_position = (884, 384)
130
-
131
- pyautogui.click(cliente_field_position)
132
- pyautogui.hotkey("ctrl", "a")
133
- pyautogui.hotkey("del")
134
- pyautogui.write(task.configEntrada.get("filialEmpresaDestino"))
135
- pyautogui.hotkey("tab")
126
+ console.print("Preenchendo o campo do cliente com o número da filial...\n")
127
+ campo = pre_venda.child_window(class_name="TDBIEditNumber", found_index=2)
128
+ campo.set_focus()
129
+ send_keys(task.configEntrada["filialEmpresaDestino"])
130
+ send_keys("{TAB}")
131
+ # cliente_field_position = await find_element_center(
132
+ # ASSETS_BASE_PATH + "field_cliente.png", (795, 354, 128, 50), 10
133
+ # )
134
+ # if cliente_field_position == None:
135
+ # cliente_field_position = (884, 384)
136
+
137
+ # pyautogui.click(cliente_field_position)
138
+ # pyautogui.hotkey("ctrl", "a")
139
+ # pyautogui.hotkey("del")
140
+ # pyautogui.write(task.configEntrada.get("filialEmpresaDestino"))
141
+ # pyautogui.hotkey("tab")
136
142
  await worker_sleep(10)
137
143
 
138
144
  try:
@@ -223,33 +229,38 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
223
229
  console.print(log_msg, style="bold yellow")
224
230
 
225
231
  # Define representante para "1"
226
- screenshot_path = take_screenshot()
227
- field_representante_position = find_target_position(
228
- screenshot_path, "Representante", 0, 50, attempts=15
229
- )
232
+ console.print("Definindo representante para '1'\n")
233
+ campo_representate = pre_venda.child_window(class_name="TDBIEditCode", found_index=3)
234
+ campo_representate.set_focus()
235
+ send_keys("1")
236
+ send_keys("{TAB}")
237
+ # screenshot_path = take_screenshot()
238
+ # field_representante_position = find_target_position(
239
+ # screenshot_path, "Representante", 0, 50, attempts=15
240
+ # )
230
241
 
231
- if field_representante_position == None:
232
- field_representante_position = await find_element_center(
233
- ASSETS_BASE_PATH + "field_representante.png", (679, 416, 214, 72), 15
234
- )
235
- if field_representante_position is not None:
236
- lista = list(field_representante_position)
237
- lista[0] += 50
238
- lista[1] += 1
239
- field_representante_position = tuple(lista)
240
-
241
- if field_representante_position is not None:
242
- pyautogui.doubleClick(field_representante_position)
243
- pyautogui.hotkey("ctrl", "a")
244
- pyautogui.hotkey("del")
245
- pyautogui.write("1")
246
- pyautogui.hotkey("tab")
247
- else:
248
- pyautogui.doubleClick(800, 457)
249
- pyautogui.hotkey("ctrl", "a")
250
- pyautogui.hotkey("del")
251
- pyautogui.write("1")
252
- pyautogui.hotkey("tab")
242
+ # if field_representante_position == None:
243
+ # field_representante_position = await find_element_center(
244
+ # ASSETS_BASE_PATH + "field_representante.png", (679, 416, 214, 72), 15
245
+ # )
246
+ # if field_representante_position is not None:
247
+ # lista = list(field_representante_position)
248
+ # lista[0] += 50
249
+ # lista[1] += 1
250
+ # field_representante_position = tuple(lista)
251
+
252
+ # if field_representante_position is not None:
253
+ # pyautogui.doubleClick(field_representante_position)
254
+ # pyautogui.hotkey("ctrl", "a")
255
+ # pyautogui.hotkey("del")
256
+ # pyautogui.write("1")
257
+ # pyautogui.hotkey("tab")
258
+ # else:
259
+ # pyautogui.doubleClick(800, 457)
260
+ # pyautogui.hotkey("ctrl", "a")
261
+ # pyautogui.hotkey("del")
262
+ # pyautogui.write("1")
263
+ # pyautogui.hotkey("tab")
253
264
 
254
265
  await worker_sleep(5)
255
266
 
@@ -259,7 +270,7 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
259
270
  )
260
271
 
261
272
  if menu_itens == None:
262
- menu_itens = (570, 317)
273
+ menu_itens = (570, 296)
263
274
 
264
275
  if menu_itens is not None:
265
276
  pyautogui.click(menu_itens)
@@ -288,7 +299,7 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
288
299
  console.print("Clicando em Incluir...\n")
289
300
  button_incluir = (
290
301
  905,
291
- 573,
302
+ 546,
292
303
  ) # find_target_position(screenshot_path, "Incluir", 0, 0, attempts=15)
293
304
  if button_incluir is not None:
294
305
  pyautogui.click(button_incluir)
@@ -432,7 +443,7 @@ async def transferencias(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoDTO:
432
443
  task.configEntrada["urlRetorno"],
433
444
  "ERRO",
434
445
  error,
435
- task.configEntrada.get("uuidSimplifica") if transferencia else task.configEntrada.get("identificador"),
446
+ task.configEntrada.get("uuidSimplifica") if transferencia else task.configEntrada.get("identificador"),
436
447
  nota_fiscal,
437
448
  valor_nota,
438
449
  transferencia
@@ -17,6 +17,9 @@ from worker_automate_hub.tasks.jobs.geracao_aprovacao_pedidos import (
17
17
  geracao_aprovacao_pedidos_171,
18
18
  geracao_aprovacao_pedidos_34,
19
19
  )
20
+ from worker_automate_hub.tasks.jobs.inclusao_pedidos_raizen import inclusao_pedidos_raizen
21
+ from worker_automate_hub.tasks.jobs.inclusao_pedidos_vibra import inclusao_pedidos_vibra
22
+ from worker_automate_hub.tasks.jobs.inclusao_pedidos_ipiranga import inclusao_pedidos_ipiranga
20
23
  from worker_automate_hub.tasks.jobs.notas_faturamento_sap import notas_faturamento_sap
21
24
  from worker_automate_hub.tasks.jobs.descartes import descartes
22
25
  from worker_automate_hub.tasks.jobs.ecac_estadual_main import (
@@ -30,8 +33,12 @@ from worker_automate_hub.tasks.jobs.entrada_de_notas_9 import entrada_de_notas_9
30
33
  from worker_automate_hub.tasks.jobs.entrada_de_notas_9000 import entrada_de_notas_9000
31
34
  from worker_automate_hub.tasks.jobs.entrada_de_notas_7139 import entrada_de_notas_7139
32
35
  from worker_automate_hub.tasks.jobs.entrada_de_notas_36 import entrada_de_notas_36
36
+ from worker_automate_hub.tasks.jobs.entrada_de_notas_37 import entrada_de_notas_37
33
37
  from worker_automate_hub.tasks.jobs.entrada_de_notas_503 import entrada_de_notas_503
34
38
  from worker_automate_hub.tasks.jobs.extracao_saldo_estoque import extracao_saldo_estoque
39
+ from worker_automate_hub.tasks.jobs.extracao_saldo_estoque_fiscal import (
40
+ extracao_saldo_estoque_fiscal,
41
+ )
35
42
  from worker_automate_hub.tasks.jobs.fidc_remessa_cobranca_cnab240 import (
36
43
  remessa_cobranca_cnab240,
37
44
  )
@@ -97,7 +104,31 @@ from worker_automate_hub.tasks.jobs.extracao_fechamento_contabil import (
97
104
  from worker_automate_hub.tasks.jobs.extracao_fechamento_emsys import (
98
105
  extracao_fechamento_emsys,
99
106
  )
107
+ from worker_automate_hub.tasks.jobs.opex_capex import (
108
+ opex_capex,
109
+ )
110
+ from worker_automate_hub.tasks.jobs.entrada_de_notas_22 import (
111
+ entrada_de_notas_22,
112
+ )
113
+ from worker_automate_hub.tasks.jobs.geracao_balancetes_filial import (
114
+ geracao_balancetes_filial,
115
+ )
116
+
117
+ from worker_automate_hub.tasks.jobs.devolucao_produtos import (
118
+ devolucao_produtos,
119
+ )
100
120
 
121
+ from worker_automate_hub.tasks.jobs.importacao_extratos import (
122
+ importacao_extratos,
123
+ )
124
+
125
+ from worker_automate_hub.tasks.jobs.importacao_extratos_748 import (
126
+ importacao_extratos_748,
127
+ )
128
+
129
+ from worker_automate_hub.tasks.jobs.extracao_dados_nielsen import (
130
+ extracao_dados_nielsen,
131
+ )
101
132
 
102
133
  task_definitions = {
103
134
  "5b295021-8df7-40a1-a45e-fe7109ae3902": exemplo_processo,
@@ -115,6 +146,7 @@ task_definitions = {
115
146
  "9e5a1c05-9336-4b2d-814e-4d0e9f0057e1": entrada_de_notas_33,
116
147
  "08a112db-7683-417b-9a87-14ad0e1548da": entrada_de_notas_34,
117
148
  "1e354c95-f4e4-4e12-aaf6-4ef836cc741b": entrada_de_notas_36,
149
+ "33d9edeb-7cb2-449b-9096-ed9cf3d3f6c3": entrada_de_notas_37,
118
150
  "bf763394-918b-47be-bb36-7cddc81a8174": entrada_de_notas_39,
119
151
  "dafc0407-da8f-43a1-b97a-d27f966e122a": entrada_de_notas_207,
120
152
  "e1051c43-3495-4ca7-91d5-527fea2b5f79": entrada_de_notas_500,
@@ -190,6 +222,7 @@ task_definitions = {
190
222
  "30544b48-7dc4-4f3e-ac6c-16be7bca57a4": integracao_contabil_generica,
191
223
  "0436cb8c-0c58-41a1-9609-443cc37c1801": integracao_contabil_generica,
192
224
  "d34d8593-0cbf-4f8c-8647-5736e1168d89": integracao_contabil_generica,
225
+ "9010528a-ad86-4d1f-b03a-165229988bdc": integracao_contabil_generica,
193
226
  "c8527e90-c65b-4d68-b4cf-25008b678957": geracao_aprovacao_pedidos_34,
194
227
  "260380b7-a3e5-4c23-ab69-b428ee552830": geracao_aprovacao_pedidos_171,
195
228
  "c10bbf8c-3949-4a0e-9e10-3d85d367263d": abertura_livros_fiscais,
@@ -199,7 +232,19 @@ task_definitions = {
199
232
  "58de6a65-68cd-4e68-ab28-31b543b6de02": transferencias, # Logistica reverse
200
233
  "ca7ac373-e8e7-4ac2-aa7e-298070e0d9a0": extracao_fechamento_contabil,
201
234
  "8c28726d-458d-4119-afa0-202695b79a8f": extracao_fechamento_emsys,
202
- "16debe45-3520-4f63-acfe-ef0e8784fcab": extracao_saldo_estoque
235
+ "16debe45-3520-4f63-acfe-ef0e8784fcab": extracao_saldo_estoque,
236
+ "9cbc6016-7c0e-4a3a-8ee9-fb9dc4b35e33": extracao_saldo_estoque_fiscal,
237
+ "07072711-c9d0-49e4-b180-530cecbe0728": opex_capex,
238
+ "98bc6679-2e6b-4757-9fdc-b27eebd98f54": entrada_de_notas_22,
239
+ "2ebcc2e5-2fa1-4130-a92a-3af349a1920c": devolucao_produtos,
240
+ "d7794924-0330-453c-b79b-74f3c8991562": geracao_balancetes_filial,
241
+ "75ba49a7-4ffa-44bb-9b47-9bad07ae9ede": inclusao_pedidos_vibra, # Pedidos Vibra
242
+ "2187af6d-6b34-439b-9a62-3e10d9a24f9c": inclusao_pedidos_ipiranga, # Pedidos Ipiranga
243
+ "dda9dace-7ead-4e6c-a78f-4cd7a5780c8d": inclusao_pedidos_raizen, # Pedidos Raizen
244
+ "153a7bf9-8cab-41fd-b6d3-63d881ac1cf9": importacao_extratos,
245
+ "80345c74-29af-4a6a-8438-86061acf2531": importacao_extratos_748,
246
+ "e8ca47cf-c49b-437c-9028-50bcfa5fe021": extracao_dados_nielsen,
247
+
203
248
  }
204
249
 
205
250
 
@@ -23,6 +23,8 @@ from worker_automate_hub.tasks.task_definitions import task_definitions
23
23
  from worker_automate_hub.utils.logger import logger
24
24
  from worker_automate_hub.utils.toast import show_toast
25
25
  from worker_automate_hub.utils.util import capture_and_send_screenshot
26
+ import asyncio
27
+ from worker_automate_hub.api.rpa_fila_service import burn_queue
26
28
 
27
29
  console = Console()
28
30
 
@@ -52,6 +54,15 @@ async def perform_task(task: RpaProcessoEntradaDTO):
52
54
  historico: RpaHistorico = await create_store_historico(
53
55
  task, processo, RpaHistoricoStatusEnum.Processando
54
56
  )
57
+ i = 0
58
+ while i < 10:
59
+ try:
60
+ await burn_queue(task.uuidFila)
61
+ break
62
+ except:
63
+ i += 1
64
+ await asyncio.sleep(5)
65
+ pass
55
66
  try:
56
67
  if task_uuid in task_definitions:
57
68
  # Executar a task