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
@@ -388,7 +388,7 @@ async def entrada_de_notas_39(task: RpaProcessoEntradaDTO) -> RpaRetornoProcesso
388
388
  if recebimento_fisico:
389
389
  recebimento_fisico = nota["recebimentoFisico"].split(" ")
390
390
  pyautogui.write(recebimento_fisico[0])
391
- await worker_sleep(2)
391
+ await worker_sleep(5)
392
392
  except:
393
393
  console.print(
394
394
  f"A chave recebimentoFisico não está presente na config de entrada...\n"
@@ -7,7 +7,7 @@ import uuid
7
7
  import time
8
8
  import win32clipboard
9
9
  import difflib
10
-
10
+ import pyperclip
11
11
  import pyautogui
12
12
  import pytesseract
13
13
  from datetime import datetime, timedelta
@@ -582,7 +582,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
582
582
  await worker_sleep(2)
583
583
 
584
584
  observacoes_nota = nota.get("observacoes")
585
- pattern = rf"(\b{filialEmpresaOrigem}\d+)\s*-\s*TANQUE\s+(\d+)\s*[/-]\s*(\w+\s*\w*)\s*\((.*?)\)"
585
+ pattern = rf"(\b{filialEmpresaOrigem}\d+)\s*-\s*TANQUE\s+(\d+)\s*[/-]\s*(.+?)\s*\((.*?)\)"
586
586
 
587
587
  resultados_itens_ahead = re.findall(pattern, observacoes_nota)
588
588
 
@@ -595,6 +595,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
595
595
  if len(list_distribuicao_obs) > 0:
596
596
  console.print(f'Distribuição observação a serem processados: {list_distribuicao_obs}')
597
597
  index_tanque = 0
598
+ item_executado = '0'
598
599
  list_tanques_distribuidos = []
599
600
  send_keys("{TAB 2}", pause=0.1)
600
601
 
@@ -604,15 +605,34 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
604
605
  console.print(f"Tanque a ser distribuido: {info_distribuicao_obs}... \n")
605
606
  send_keys("^({HOME})")
606
607
  await worker_sleep(1)
607
- send_keys("{DOWN " + str(index_tanque) + "}", pause=0.1)
608
+ send_keys("{DOWN " + str(index_tanque) + "}", pause=0.5)
608
609
  await worker_sleep(1)
610
+ #Copiar e extrai o Seq Item XML
611
+ send_keys("^c")
612
+ copiado = pyperclip.paste()
613
+ linha = copiado.splitlines()[1]
614
+ colunas = linha.split("\t")
615
+ seq_item = colunas[0]
616
+ if seq_item != item_executado:
617
+ item_executado = seq_item
618
+ else:
619
+ while seq_item == item_executado:
620
+ console.print(f"===Item Executado: {item_executado}... \n")
621
+ console.print(f"===Linha copiada item: {seq_item}... \n")
622
+ send_keys("{DOWN}", pause=0.5)
623
+ index_tanque += 1
624
+ send_keys("^c")
625
+ copiado = pyperclip.paste()
626
+ linha = copiado.splitlines()[1]
627
+ colunas = linha.split("\t")
628
+ seq_item = colunas[0]
629
+
609
630
  send_keys("+{F10}")
610
- await worker_sleep(1)
631
+ await worker_sleep(2)
611
632
  send_keys("{DOWN 6}")
612
- await worker_sleep(1)
633
+ await worker_sleep(2)
613
634
  send_keys("{ENTER}")
614
635
  await worker_sleep(4)
615
-
616
636
 
617
637
  max_attempts = 5
618
638
  i = 0
@@ -621,7 +641,6 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
621
641
  if distribuir_item_window["IsOpened"] == True:
622
642
  app = Application().connect(title="Distribui Item Tanque")
623
643
  main_window = app["Distribui Item Tanque"]
624
-
625
644
  main_window.set_focus()
626
645
  break
627
646
  else:
@@ -646,10 +665,11 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
646
665
  center_y = (grid_rect.top + grid_rect.bottom) // 2
647
666
 
648
667
  pyautogui.click(center_x, center_y)
649
- await worker_sleep(1)
668
+ await worker_sleep(4)
650
669
  send_keys("^({HOME})")
651
- await worker_sleep(1)
670
+ await worker_sleep(4)
652
671
  send_keys("{LEFT 3}")
672
+ await worker_sleep(4)
653
673
 
654
674
  distribuiu_algo = False
655
675
  distribuicao_atual = []
@@ -658,14 +678,16 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
658
678
 
659
679
  while max_distribuicao <= 20:
660
680
  console.print(f"Tentativa: {max_distribuicao}... \n")
661
- await worker_sleep(1)
681
+ await worker_sleep(3)
662
682
  with pyautogui.hold('ctrl'):
663
683
  pyautogui.press('c')
664
684
 
665
- await worker_sleep(1)
685
+ await worker_sleep(3)
666
686
 
667
687
  with pyautogui.hold('ctrl'):
668
688
  pyautogui.press('c')
689
+
690
+ await worker_sleep(3)
669
691
 
670
692
  win32clipboard.OpenClipboard()
671
693
  line_almoxarifado_emsys = win32clipboard.GetClipboardData().strip()
@@ -692,11 +714,11 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
692
714
  quantidade_combustivel = re.findall(r'\((.*?)\)', second_info_distribuicao_obs)[0].replace('.', '')
693
715
 
694
716
  send_keys("{LEFT 3}")
695
- await worker_sleep(1)
717
+ await worker_sleep(2)
696
718
  send_keys("{RIGHT 3}")
697
719
 
698
720
  pyautogui.press('enter')
699
- await worker_sleep(1)
721
+ await worker_sleep(2)
700
722
  pyautogui.write(quantidade_combustivel)
701
723
  pyautogui.press('enter')
702
724
  list_tanques_distribuidos.append(second_info_distribuicao_obs)
@@ -822,6 +844,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
822
844
  except:
823
845
  console.print(f"Tela de distribuir item deve ter sido encerrada")
824
846
  finally:
847
+ await worker_sleep(10)
825
848
  i = i + 1
826
849
  await worker_sleep(2)
827
850
  else:
@@ -974,7 +997,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
974
997
  recebimento_fisico = datetime.strptime(recebimento_fisico, "%d/%m/%Y")
975
998
 
976
999
  #se a data do aceite no Ahead ultrapassar dois dias após a emissão da nota, deve-se colocar o vencimento para a mesma data do “Receb. Físico”/Aceite.
977
- if ((recebimento_fisico >= dt_emissao + timedelta(days=2)) and ("vibra" in nota.get("nomeFornecedor").lower() or "ipiranga" in nota.get("nomeFornecedor").lower() or "raizen" in nota.get("nomeFornecedor").lower() or "charru" in nota.get("nomeFornecedor").lower())):
1000
+ if ((recebimento_fisico >= dt_emissao + timedelta(days=2)) and ("vibra" in nota.get("nomeFornecedor").lower() or "ipiranga" in nota.get("nomeFornecedor").lower() or "raizen" in nota.get("nomeFornecedor").lower())): # or "charru" in nota.get("nomeFornecedor").lower())):
978
1001
  recebimento_fisico = recebimento_fisico.strftime("%d/%m/%Y")
979
1002
  console.print(f"Informando a data de vencimento, {recebimento_fisico}... \n")
980
1003
  vencimento = panel_TabParcelamento.child_window(
@@ -987,6 +1010,18 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
987
1010
  )
988
1011
  data_vencimento = nota.get("dataVencimento")
989
1012
  vencimento.set_edit_text(data_vencimento)
1013
+ elif "charru" in nota.get("nomeFornecedor").lower():
1014
+ vencimento = panel_TabParcelamento.child_window(
1015
+ class_name="TDBIEditDate"
1016
+ )
1017
+ data_vencimento = nota.get("dataEmissao")
1018
+ # Converte string para datetime
1019
+ data_dt = datetime.strptime(data_vencimento, "%d/%m/%Y")
1020
+ # Soma 30 dias
1021
+ data_dt_venc = data_dt + timedelta(days=30)
1022
+ # Converte de volta para string no mesmo formato
1023
+ data_vencimento = data_dt_venc.strftime("%d/%m/%Y")
1024
+ vencimento.set_edit_text(data_vencimento)
990
1025
  else:
991
1026
  #Senão adicionar 1 dia a emissao
992
1027
  dt_emissao = nota.get("dataEmissao")
@@ -1027,7 +1062,7 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
1027
1062
  console.print(f"Processo de incluir pagamento realizado com sucesso... \n")
1028
1063
  else:
1029
1064
  data_vencimento = ""
1030
- if "vibra" in nota.get("nomeFornecedor").lower() or "ipiranga" in nota.get("nomeFornecedor").lower() or "raizen" in nota.get("nomeFornecedor").lower() or "charru" in nota.get("nomeFornecedor").lower():
1065
+ if "vibra" in nota.get("nomeFornecedor").lower() or "ipiranga" in nota.get("nomeFornecedor").lower() or "raizen" in nota.get("nomeFornecedor").lower(): #or "charru" in nota.get("nomeFornecedor").lower():
1031
1066
  dt_emissao = nota.get("dataEmissao")
1032
1067
  dt_emissao = datetime.strptime(dt_emissao, "%d/%m/%Y")
1033
1068
  pattern = r"(\d{2}/\d{2}/\d{4})"
@@ -1042,9 +1077,21 @@ async def entrada_de_notas_9(task: RpaProcessoEntradaDTO) -> RpaRetornoProcessoD
1042
1077
  dt_emissao = dt_emissao + timedelta(days=1)
1043
1078
  dt_emissao = dt_emissao.strftime("%d/%m/%Y")
1044
1079
  data_vencimento = dt_emissao
1080
+ elif "charru" in nota.get("nomeFornecedor").lower():
1081
+ vencimento = panel_TabParcelamento.child_window(
1082
+ class_name="TDBIEditDate"
1083
+ )
1084
+ data_vencimento = nota.get("dataEmissao")
1085
+ # Converte string para datetime
1086
+ data_dt = datetime.strptime(data_vencimento, "%d/%m/%Y")
1087
+ # Soma 30 dias
1088
+ data_dt_venc = data_dt + timedelta(days=30)
1089
+ # Converte de volta para string no mesmo formato
1090
+ data_vencimento = data_dt_venc.strftime("%d/%m/%Y")
1091
+ # vencimento.set_edit_text(data_vencimento)
1092
+ vencimento.set_edit_text(data_vencimento)
1045
1093
  else:
1046
1094
  data_vencimento = nota.get("dataVencimento")
1047
-
1048
1095
  await worker_sleep(2)
1049
1096
  console.print(f"Removendo registro de parcelamento do pagamento... \n")
1050
1097
  btn_remove = panel_TabParcelamento.child_window(