-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathap_proc.py
132 lines (117 loc) · 4.13 KB
/
ap_proc.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import os
import sys
from utility.check_daily_report import check_daily_report
from utility.clean_desktop import clean_desktop
from utility.mif_soerf_check import mif_soerf_check
from scripts.pm_emails import pm_emails
from scripts.pm_status import pm_status
from scripts.am_emails import am_emails
from scripts.am_status import am_status
from scripts.mif_soerf import mif_soerf
from scripts.requests import get_requests
from scripts.reconcile_pce import reconcile_pce
from scripts.proc_sap_data import proc_sap_data
from scripts.sap_data import get_sap_data
from scripts.single_sap_data import single_sap_data
from utils.helpers import use_logger, clear
from utils.startup import check_process_files
use_logger()
check_process_files()
if sys.argv[1] in ["test"]:
server = False
if sys.argv[1] in ["prod", "server"]:
server = True
else:
server = False
table_names = ["mara", "marc", "mvke", "ausp", "mlan", "price", "gts", "sales_text"]
clear()
def get_menu_choice():
def print_menu(): # Your menu design here
print(20 * "-", "AP MM EXTENSION PROCESS", 20 * "-")
print("1) Get current requests")
print("2) Generate MIF / SOERF requests")
print("3) Update Material Statuses pre MM")
print("4) Generate AM Price & PCE requests")
print(70 * "-")
print("5) Reconcile PCE / Update ORG Source")
print("6) Update Material Statuses post MM Extension")
print("7) Generate PM CCC, Localization & GTS Requests")
print(70 * "-")
print("8) DATA: Download SAP Data")
print("9) DATA: Bring SAP Data")
print(70 * "-")
print("10) UTILITY: Clean working folder & archive request files")
print("11) UTILITY: Check for MIF/SOERF submitted")
print("12) UTILITY: Check for daily report uploaded to Sharepoint Rep")
print("13) UTILITY: Open SAP Instance")
print("14) UTILITY: Open AP LOG file")
print(70 * "-")
print("tbl) UTILITY: SAP data from table")
print(70 * "-")
print("U) Update program")
print("X) Close program")
print(70 * "=")
loop = True
while loop: # While loop which will keep going until loop = False
print_menu() # Displays menu
choice = input("Choose procedure to run: ")
print("\n")
if choice == "1":
get_requests(server)
clear()
elif choice == "2":
mif_soerf(server)
clear()
elif choice == "3":
am_status(server)
clear()
elif choice == "4":
am_emails(server)
clear()
elif choice == "5":
reconcile_pce(server)
clear()
elif choice == "6":
pm_status(server)
clear()
elif choice == "7":
pm_emails(server)
clear()
elif choice == "8":
get_sap_data(server)
clear()
elif choice == "9":
proc_sap_data(server)
clear()
elif choice == "10":
clean_desktop(server)
clear()
elif choice == "11":
mif_soerf_check(server)
clear()
elif choice == "12":
check_daily_report(server)
clear()
elif choice == "13":
os.system(r"C:\RA-Apps\AP-Proc\sap\sap.ahk")
clear()
elif choice == "14":
os.system(r"C:\RA-Apps\AP-Proc\sap\log.ahk")
clear()
elif choice == "u" or choice == "U":
os.system("git pull")
clear()
elif choice == "u" or choice == "U":
os.system("git pull")
clear()
elif choice == "x" or choice == "X":
loop = False
break
elif choice in table_names:
print(choice)
single_sap_data(choice)
clear()
else:
input("Wrong menu selection. Enter any key to try again...")
clear()
print(get_menu_choice())