Skip to content

Commit

Permalink
Merge branch 'release/0.1.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
hyslan committed Aug 8, 2024
2 parents a57b09e + 1a5ee14 commit 110fbe4
Show file tree
Hide file tree
Showing 86 changed files with 9,051 additions and 471 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ sheets/estoque_4600056089.XLSX
/target

# Exclude SAP shortcut
*.sap
*.sap

# Ignore live tests
live_tests.ipynb

# Skip environments variables
*.env
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Hyslan Silva Cruz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file renamed src/chromedriver.exe → chromedriver.exe
Binary file not shown.
12 changes: 6 additions & 6 deletions do_retrabalho.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
import pywintypes
import rich.console
from rich.console import Console
import src.sap as sap
from src.sapador import down_sap
from src.retrabalhador import retrabalho
import python.src.sap as sap
from python.src.sapador import down_sap
from python.src.retrabalhador import retrabalho

console: rich.console.Console = Console()


def do() -> None:
try:
# Always use the first session
session: win32com.client.CDispatch = sap.escolher_sessao(0)
session: win32com.client.CDispatch = sap.choose_connection(0)
# pylint: disable=E1101
except pywintypes.com_error:
console.print("[bold cyan] Ops! o SAP Gui não está aberto.")
console.print(
"[bold cyan] Executando o SAP GUI\n Por favor aguarde...")
down_sap()
session: win32com.client.CDispatch = sap.escolher_sessao(0)
session: win32com.client.CDispatch = sap.choose_connection(0)

retrabalho("",session)
retrabalho("", session)


if __name__ == '__main__':
Expand Down
8,334 changes: 8,334 additions & 0 deletions docs/THIRD_PARTY_NOTICES.chromedriver

Large diffs are not rendered by default.

Binary file added docs/sap_gui_scripting_api_761.pdf
Binary file not shown.
65 changes: 38 additions & 27 deletions src/main.py → main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Sistema Val: programa de valoração automática não assistida, Author: Hyslan Silva Cruz"""
# main.py
# Bibliotecas
import time
import argparse
import os
import datetime
Expand All @@ -11,16 +12,16 @@
import win32com.client
from dotenv import load_dotenv
from rich.console import Console
import src.sap as sap
from src import sql_view
from src.core import val
from src.avatar import val_avatar
from src.face_the_gandalf import you_cant_pass
from src.etl import extract_from_sql, pendentes_excel, pendentes_csv
from src.desvalorador import desvalorador
from src.retrabalhador import retrabalho
from src.osn3 import pertencedor
from src.sapador import down_sap
import python.src.sap as sap
from python.src import sql_view
from python.src.core import val
from python.src.avatar import val_avatar
from python.src.face_the_gandalf import you_cant_pass
from python.src.etl import extract_from_sql, pendentes_excel, pendentes_csv
from python.src.desvalorador import desvalorador
from python.src.retrabalhador import retrabalho
from python.src.osn3 import pertencedor
from python.src.sapador import down_sap


def main(args=None) -> None:
Expand All @@ -30,7 +31,7 @@ def main(args=None) -> None:
description="Sistema de valoração automática não "
"assistida.",
epilog="Author: Hyslan Silva Cruz")
parser.add_argument('-s', '--session',
parser.add_argument('-s', '--session', # It's a connection not Session
type=int, default=0,
help='Número da sessão do SAP a ser utilizada.')
parser.add_argument('-o', '--option',
Expand Down Expand Up @@ -81,16 +82,20 @@ def main(args=None) -> None:
you_cant_pass('video')
return

# * Conexão ao SAP
try:
session: win32com.client.CDispatch = sap.escolher_sessao(
console.print(
"[i cyan] Conectando ao SAP GUI e obtendo token de acesso...")
token = down_sap()
session: win32com.client.CDispatch = sap.choose_connection(
args.session)
# pylint: disable=E1101
except pywintypes.com_error:
console.print("[bold cyan] Ops! o SAP Gui não está aberto.")
console.print(
"[bold cyan] Executando o SAP GUI\n Por favor aguarde...")
down_sap()
session: win32com.client.CDispatch = sap.escolher_sessao(
token = down_sap()
time.sleep(10)
session: win32com.client.CDispatch = sap.choose_connection(
args.session)

try:
Expand All @@ -107,8 +112,9 @@ def main(args=None) -> None:
case "4":
pendentes_list: np.ndarray = extract_from_sql(
args.contrato)
ordem, validador = val(
pendentes_list, session, args.contrato, args.revalorar)
validador = val(
pendentes_list, session, args.contrato, args.revalorar,
token, args.session)
case "5":
tses_existentes = sql_view.Sql("", "")
console.print("\n", tses_existentes.show_tses(),
Expand All @@ -119,8 +125,9 @@ def main(args=None) -> None:
pendentes = sql_view.Sql(ordem="", cod_tse=lista_tse)
pendentes_array: np.ndarray = pendentes.tse_escolhida(
args.contrato)
ordem, validador = val(
pendentes_array, session, args.contrato, args.revalorar)
validador = val(
pendentes_array, session, args.contrato, args.revalorar,
token, args.session)
case "6":
tses_existentes = sql_view.Sql("", "")
console.print("\n", tses_existentes.show_tses(),
Expand All @@ -130,17 +137,19 @@ def main(args=None) -> None:
pendentes = sql_view.Sql(ordem="", cod_tse=tse_expec)
pendentes_array: np.ndarray = pendentes.tse_expecifica(
args.contrato)
ordem, validador = val(
pendentes_array, session, args.contrato, args.revalorar)
validador = val(
pendentes_array, session, args.contrato, args.revalorar,
token, args.session)
case "7":
ordem_expec = input(
"- Val: Digite o Nº da Ordem, por favor.\n"
)
mun = input("Digite o Nº do Município.\n")
pendentes_array: np.ndarray = np.array(
[[ordem_expec, mun]])
ordem, validador = val(
pendentes_array, session, args.contrato, args.revalorar
validador = val(
pendentes_array, session, args.contrato, args.revalorar,
token, args.session
)
case "8":
ask = input("é csv?")
Expand All @@ -149,14 +158,16 @@ def main(args=None) -> None:
else:
planilha = pendentes_excel()

ordem, validador = val(
planilha, session, args.contrato, args.revalorar)
validador = val(
planilha, session, args.contrato, args.revalorar,
token, args.session)
case "9":
pendentes = sql_view.Sql("", "")
pendentes_array = pendentes.familia(
args.family, args.contrato)
ordem, validador = val(
pendentes_array, session, args.contrato, args.revalorar
validador = val(
pendentes_array, session, args.contrato, args.revalorar,
token, args.session
)

except (TypeError, ValueError) as erro:
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 110fbe4

Please sign in to comment.