-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_retrabalho.py
35 lines (25 loc) · 912 Bytes
/
do_retrabalho.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Every second friday on the month, do this rpa for 'Retrabalho Confirmado' orders."""
from typing import TYPE_CHECKING
import pywintypes
import rich.console
from rich.console import Console
from python.src import sap
from python.src.retrabalhador import retrabalho
from python.src.sapador import down_sap
if TYPE_CHECKING:
import win32com.client
console: rich.console.Console = Console()
def do() -> None:
"""Do the retrabalho rpa."""
try:
# Always use the first session
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 = sap.choose_connection(0)
retrabalho("", session)
if __name__ == "__main__":
do()