-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
314 lines (259 loc) · 11.5 KB
/
main.py
File metadata and controls
314 lines (259 loc) · 11.5 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# Classes
class Warehouse():
def __init__(self, name):
self.name = name
class Electronics(Warehouse):
def __init__(self, name, quantity, price, brand, category, manufacturing_place, warranty_period):
self.name = name
self.quantity = quantity
self.price = price
self.brand = brand
self.manufacturing_place = manufacturing_place
self.category = category
self.warranty_period = warranty_period
def AddProduct(self):
print("\n", self.name, "Current Quantity:", self.quantity)
print("----------------------------")
quantity = int(input("How many units do you want to add? "))
self.quantity = self.quantity + quantity
def RemoveProduct(self):
print("\n", self.name, "Current Quantity:", self.quantity)
print("----------------------------")
quantity = int(input("How many units do you want to remove? "))
self.quantity = self.quantity - quantity
def UpdateInfo(self):
print("\n----------------------------")
print("What do you want to update? ")
print("1: Product Name :", self.name)
print("2: Product Quantity :", self.quantity)
print("3: Product Price :", self.price)
print("4: Product Manufacturing Place:", self.manufacturing_place)
print("5: Product Brand :", self.brand)
print("6: Product Category :", self.category)
print("7: Product Warranty Period :", self.warranty_period)
choice = int(input("Enter the value you want to change: "))
if choice == 1:
self.name = (input("Enter Product Name: "))
elif choice == 2:
self.quantity = int(input("Enter Product Quantity: "))
elif choice == 3:
self.price = int(input("Enter Product Price: "))
elif choice == 4:
self.manufacturing_place = (input("Enter Product Manufacturing Place: "))
elif choice == 5:
self.brand = (input("Enter Product Brand: "))
elif choice == 6:
self.category = int(input("Enter Product Category: "))
elif choice == 7:
self.warranty_period = int(input("Enter Product Warranty Period: "))
else:
print("Please enter a valid value!\n")
def ProductInfo(self):
print("\n" + self.name, "Product information")
print("-----------------------")
print("Quantity :", self.quantity, "Units")
print("Price :", self.price, "₺")
print("Brand :", self.brand)
print("Category :", self.category)
print("Manufacturing Place :", self.manufacturing_place)
print("Warranty Period :", self.warranty_period, "Years")
class Organic(Warehouse):
def __init__(self, name, quantity, price, category, manufacturing_place, shelf_life,):
self.name = name
self.quantity = quantity
self.price = price
self.manufacturing_place = manufacturing_place
self.category = category
self.shelf_life = shelf_life
def AddProduct(self):
print("\n", self.name, "Current Quantity:", self.quantity)
print("----------------------------")
quantity = int(input("How many units do you want to add? "))
self.quantity = self.quantity + quantity
def RemoveProduct(self):
print("\n", self.name, "Current quantity:", self.quantity)
print("----------------------------")
quantity = int(input("How many units do you want to remove? "))
self.quantity = self.quantity - quantity
def UpdateInfo(self):
print("\n----------------------------")
print("What do you want to update? ")
print("1: Product Name :", self.name)
print("2: Product Quantity :", self.quantity)
print("3: Product Price :", self.price)
print("4: Product Manufacturing Place:", self.manufacturing_place)
print("5: Product Category :", self.category)
print("6: Product Shelf Life :", self.shelf_life)
choice = int(input("Enter the value you want to change: "))
if choice == 1:
self.name = (input("Enter Product Name: "))
elif choice == 2:
self.quantity = int(input("Enter Product Quantity: "))
elif choice == 3:
self.price = int(input("Enter Product Price: "))
elif choice == 4:
self.manufacturing_place = (input("Enter Product Manufacturing Place: "))
elif choice == 5:
self.category = int(input("Enter Product Category: "))
elif choice == 6:
self.shelf_life = int(input("Enter Product Shelf Life: "))
else:
print("Please enter a valid value!\n")
def ProductInfo(self):
print("\n" + self.name, "Product information")
print("---------------------------------")
print("Quantity (Kg) :", self.quantity, "Kg")
print("Price :", self.price, "₺")
print("Category :", self.category)
print("Manufacturing Place :", self.manufacturing_place)
print("Shelf Life (Month) :", self.shelf_life, "Month")
# Objects
phone = Electronics("Iphone 14 Pro", 120, 35000, "Iphone", "Phone", "USA", 2027)
tablet = Electronics("Samsung Tab 7", 400, 4000, "Samsung", "Tablet", "TAIWAN", 2025)
laptop = Electronics("MSI G63", 320, 45000, "MSI", "Computer", "CHINA", 2025)
headphones = Electronics("Abingo BT30NC", 200, 560, "Abingo", "Peripherals", "CHINA", 2024)
mouse = Electronics("Logitech G102", 400, 220, "Logitech", "Peripherals", "SWEDEN", 2024)
keyboard = Electronics("Logitech G203", 800, 350, "Logitech", "Peripherals", "FRANCE", 2024)
electronicsList = [phone, tablet, laptop, headphones, mouse, keyboard]
#
apple = Organic("Apple", 1000, 12, "Fruit", "Amasya/Turkey", 2)
pear = Organic("Pear", 600, 14, "Fruit", "Mugla/Turkey", 2)
banana = Organic("Banana", 400, 22, "Fruit", "Mumbai/India", 4)
tomato = Organic("Tomato", 6000, 20, "Vegetable", "Rotterdam/The Netherlands", 3)
carrot = Organic("Carrot", 1000, 25, "Vegetable", "Kars/Turkey", 5)
cucumber = Organic("Cucumber", 3000, 14, "Vegetable", "Bursa/Turkey", 6)
organicList = [apple, pear, banana, tomato, carrot, cucumber]
#Functions
def AddProduct(list):
index = 1
print("\n-----------------------------------------------")
for i in list:
print(index, i.name)
print("Current Quantity:", i.quantity)
print("-----------------------------------------------")
index += 1
user_input = int(input("Enter Product Number: "))
if user_input == 0:
print("\n> Please enter a valid value!\n")
else:
try:
list[user_input-1].AddProduct()
except:
print("\n> Please enter a valid value!\n")
def RemoveProduct(list):
index = 1
print("\n-----------------------------------------------")
for i in list:
print(index, i.name)
print("Current Quantity:", i.quantity)
print("-----------------------------------------------")
index += 1
user_input = int(input("Enter Product Number: "))
if user_input == 0:
print("\n> Please enter a valid value!\n")
else:
try:
list[user_input-1].RemoveProduct()
except:
print("\n> Please enter a valid value!\n")
def UpdateInfo(list):
index = 1
print("\n-----------------------------------------------")
for i in list:
print(index, i.name)
print("-----------------------------------------------")
index += 1
user_input = int(input("Enter Product Number: "))
if user_input == 0:
print("\n> Please enter a valid value!\n")
else:
try:
list[user_input-1].UpdateInfo()
except:
print("\n> Please enter a valid value!\n")
# Main Loop
while True:
print("\n------------------------------------------------")
print(" Warehouse Control and Automation System ")
print("------------------------------------------------")
print("> 1- Electronics Warehouse")
print("> 2- Organic Products Hall")
print("> 3- About")
print("> 0- Exit\n")
main_page = int(input("Enter Page Number: "))
# Exit
if main_page == 0:
print("\nExited Warehouse.")
break
# Electronics Warehouse
elif main_page == 1:
while True:
print("\n------------------------------------------------")
print(" Electronics Warehouse ")
print("------------------------------------------------")
print("> 1- View All Products")
print("> 2- Add Product")
print("> 3- Remove Product")
print("> 4- Update Product Information")
print("> 0- Exit\n")
electronics_page = int(input("Enter Page Number: "))
if electronics_page == 0:
print("\nReturned to Main Page.")
break
# View All Products
elif electronics_page == 1:
for i in electronicsList:
i.ProductInfo()
# Add Product
elif electronics_page == 2:
AddProduct(electronicsList)
# Remove Product
elif electronics_page == 3:
RemoveProduct(electronicsList)
# Update Product
elif electronics_page == 4:
UpdateInfo(electronicsList)
# Error
else:
print("\n> Please enter a valid value!\n")
# Organic Products Hall
elif main_page == 2:
while True:
print("\n------------------------------------------------")
print(" Organic Products Hall ")
print("------------------------------------------------")
print("> 1- View All Products")
print("> 2- Add Product")
print("> 3- Remove Product")
print("> 4- Update Product Information")
print("> 0- Exit\n")
organic_page = int(input("Enter Page Number: "))
if organic_page == 0:
print("\nReturned to Main Page.")
break
# View All Products
elif organic_page == 1:
for i in organicList:
i.ProductInfo()
# Add Product
elif organic_page == 2:
AddProduct(organicList)
# Remove Product
elif organic_page == 3:
RemoveProduct(organicList)
# Update Product
elif organic_page == 4:
UpdateInfo(organicList)
# Error
else:
print("\n> Please enter a valid value!\n")
# About
elif main_page == 3:
print("\n------------------------")
print("Developers: Eren Elagöz\n")
print("Warehouse Management Automation, a text-based warehouse management system that you can integrate for many different products")
print("It has a screen where you can update stock on products, reduce, increase, and update product information.")
print("An automation system that has both electronics and organic warehouses at the same time\n")
# Error
else:
print("\n> Please enter a valid value!\n")