-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
453 lines (360 loc) · 15.8 KB
/
main.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
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
cupos = ["", "", "", "", "", "", "", ""]
productoCamion = ["", "", "", "", "", "", "", ""]
estado = ['', '', '', '', '', '', '', '']
auxProductoCamion = ""
auxEstado = ''
auxPatente = ""
auxPeso = 0
productos = ["", "", ""]
tara = [0, 0, 0, 0, 0, 0, 0, 0]
pesoBruto = [0, 0, 0, 0, 0, 0, 0, 0]
pesoNeto = [0, 0, 0, 0, 0, 0, 0, 0]
totalNeto = [0, 0, 0]
promedioNeto = [0, 0, 0]
menorPeso = [0, 0, 0]
mayorPeso = [0, 0, 0]
menorPatente = ["", "", ""]
mayorPatente = ["", "", ""]
camion = [0, 0, 0]
contadorCamiones = [0, 0, 0]
posicion = 0
punteroCamion = 0
camionesRecibidos = 0
def menuPrincipal():
print("\n\tPROGRAMA PRINCIPAL\n")
print("1- Administraciones")
print("2- Entrega de Cupos")
print("3- Recepcion")
print("4- Registrar Calidad")
print("5- Registrar Peso Bruto")
print("6- Registrar Descarga")
print("7- Registrar Tara")
print("8- Reportes")
print("0- FIN DEL PROGRAMA")
def administraciones():
opcion = ''
while(opcion != 'V'):
print("\n\tAdministraciones\n")
print("A- Titulares")
print("B- Productos")
print("C- Rubros")
print("D- Rubros x Producto")
print("E- Silos")
print("F- Sucursales")
print("G- Producto Por Titular")
print("V- Volver al Menu Principal")
opcion = input("Ingrese una opción: ")
if opcion == 'A':
print("Esta funcionalidad está en construcción")
elif opcion == 'B':
menuDeAdministraciones()
elif opcion == 'C':
print("Esta funcionalidad está en construcción")
elif opcion == 'D':
print("Esta funcionalidad está en construcción")
elif opcion == 'E':
print("Esta funcionalidad está en construcción")
elif opcion == 'F':
print("Esta funcionalidad está en construcción")
elif opcion == 'G':
print("Esta funcionalidad está en construcción")
def menuDeAdministraciones():
opcion = ''
while(opcion != 'V'):
print("\n")
print("A. Alta")
print("B. Baja")
print("C. Consulta")
print("M. Modificiación")
print("V. Volver al menú anterior")
opcion = input("Ingrese una opción: ")
if(opcion == 'A'):
print("Productos sugeridos trigo, soja, maiz, girasol y/o cebada\n")
for i in range(0,3):
if(productos[i] == ""):
print(i+1)
productos[i] = input("Producto: ")
else:
print("La posición", (i + 1), "esta ocupada con: ")
print(productos[i])
elif(opcion == 'B'):
print("Lista de productos\n")
print("A. ", productos[0], "\n")
print("B. ", productos[1], "\n")
print("C. ", productos[2], "\n")
opcion = input("¿Qué producto deseas eliminar?: ")
if(opcion == "A"):
productos[0] = ""
print("producto eliminado")
elif(opcion == "B"):
productos[1] = ""
print("producto eliminado")
elif(opcion == "C"):
productos[2] = ""
print("producto eliminado")
else:
print("Opción inválida")
elif(opcion == 'C'):
print("Lista de productos\n")
print("A. ", productos[0], "\n")
print("B. ", productos[1], "\n")
print("C. ", productos[2], "\n")
elif(opcion == 'M'):
print("Lista de productos\n")
print("A. ", productos[0], "\n")
print("B. ", productos[1], "\n")
print("C. ", productos[2], "\n")
opcion = input("¿Qué numero deseas modificar?: ")
if(opcion == "A"):
productos[0] = input("Ingrese el nuevo producto: ")
print("producto registrado")
elif(opcion == "B"):
productos[1] = input("Ingrese el nuevo producto: ")
print("producto registrado")
elif(opcion == "C"):
productos[2] = input("Ingrese el nuevo producto: ")
print("producto registrado")
else:
print("Opción inválida")
def entregaCupos():
print("\n\tEntrega de Cupos\n")
patente = ""
global posicion
while(patente != "V"):
patente = input("Ingese la patente (ó V. Volver): ")
if(largoPatente(patente) == True):
if(cupoLibre() == True):
if(cupoDuplicado(patente) == False):
cupos[posicion] = patente
estado[posicion] = 'P'
posicion = posicion + 1
print("\nSe asignadó exitosamente un cupo al camión #", patente, " y se actualizó su estado a Pendiente")
print("Cupos restantes ", (8 - posicion), "\n")
else:
print("Ésta patente ya posee un cupo")
else:
print("No quedan más cupos disponibles")
else:
print("Patente inválida, la patente debe estar compuesta por 6 ó 7 caracteres")
def cupoDuplicado(patente):
i = 0
busqueda = False
while(busqueda == False and i < 8):
if(patente == cupos[i]):
busqueda = True
i += 1
return busqueda
def cupoLibre():
if(posicion < 8 and cupos[posicion] == ""):
return True
else:
return False
def largoPatente(patente):
contador = 0
while(patente[contador:]):
contador += 1
if(contador >= 6 and contador <= 7):
return True
else:
return False
def recepcion():
print("\n\tRecepción\n")
patente = ""
global camionesRecibidos
while(patente != "V"):
patente = input("Ingrese la patente (ó V. para volver): ")
if(patente != "V"):
if(largoPatente(patente) == True):
if(cupoDuplicado(patente) == True):
if(estadoPendiente(patente) == True):
estado[punteroCamion] = 'E'
print("Se actualizó el estado de Pendiente a En Proceso")
camionesRecibidos += 1
else:
print("Éste camión no posee un cupo en estado Pendiente")
else:
print("Ésta patente no posee un cupo, vuelva a intenarlo ó adquiera un cupo")
else:
print("Patente inválida, la patente debe estar compuesta por 6 ó 7 caracteres")
def estadoPendiente(patente):
global punteroCamion
i = 0
punteroCamion = 0
while(i < 8):
if(patente == cupos[i]):
punteroCamion = i
if(estado[punteroCamion] == 'P'):
return True
i += 1
return False
def registrarCalidad():
print("Esta funcionalidad está en construcción")
def registrarPesoBruto():
print("\n\tRegistrar Peso Bruto\n")
patente = ""
while(patente != "V"):
patente = input("Ingrese la patente (ó V. para volver): ")
if(patente != "V"):
if(largoPatente(patente) == True):
if(cupoDuplicado(patente) == True):
if(estadoEnProceso(patente) == True):
if(pesoBrutoLibre() == True):
pesoBruto[punteroCamion] = int(input("Ingrese el peso bruto del camion: "))
print("Se registro el peso bruto del camion\n")
else:
print("Éste camión ya tiene un peso bruto registrado")
else:
print("Éste camión no posee un cupo en estado En Proceso")
else:
print("Ésta patente no posee un cupo, vuelva a intenarlo ó adquiera un cupo")
else:
print("Patente inválida, la patente debe estar compuesta por 6 ó 7 caracteres")
def estadoEnProceso(patente):
global punteroCamion
i = 0
punteroCamion = 0
while(i < 8):
if(patente == cupos[i]):
punteroCamion = i
if(estado[punteroCamion] == 'E'):
return True
i += 1
return False
def pesoBrutoLibre():
if(punteroCamion < 8 and pesoBruto[punteroCamion] == 0):
return True
else:
return False
def registrarDescarga():
print("Esta funcionalidad está en construcción")
def registrarTara():
print("\n\tRegistrar Tara\n")
patente = ""
while(patente != "V"):
patente = input("Ingrese la patente (ó V. para volver): ")
if(patente != "V"):
if(largoPatente(patente) == True):
if(cupoDuplicado(patente) == True):
if(estadoEnProceso(patente) == True):
if(pesoBrutoLibre() == False):
if(taraLibre() == True):
producto = ""
while(producto != productos[0] and producto != productos[1] and producto != productos[2]):
producto = input("Tipo de producto: ")
if(producto == productos[0]):
tara[punteroCamion] = int(input("Ingrese la tara del camion: "))
productoCamion[punteroCamion] = producto
contadorCamiones[0] += 1
pesoNeto[punteroCamion] = pesoBruto[punteroCamion] - tara[punteroCamion]
totalNeto[0] += pesoNeto[punteroCamion]
if(pesoNeto[punteroCamion] > mayorPeso[0]):
mayorPeso[0] = pesoNeto[punteroCamion]
mayorPatente[0] = patente
if(pesoNeto[punteroCamion] < menorPeso[0] or camion[0] == 0):
menorPeso[0] = pesoNeto[punteroCamion]
menorPatente[0] = patente
camion[0] = 1
elif(producto == productos[1]):
tara[punteroCamion] = int(input("Ingrese la tara del camion: "))
productoCamion[punteroCamion] = producto
contadorCamiones[1] += 1
pesoNeto[punteroCamion] = pesoBruto[punteroCamion] - tara[punteroCamion]
totalNeto[1] += pesoNeto[punteroCamion]
if(pesoNeto[punteroCamion] > mayorPeso[1]):
mayorPeso[1] = pesoNeto[punteroCamion]
mayorPatente[1] = patente
if(pesoNeto[punteroCamion] < menorPeso[1] or camion[1] == 0):
menorPeso[1] = pesoNeto[punteroCamion]
menorPatente[1] = patente
camion[1] = 1
elif(producto == productos[2]):
tara[punteroCamion] = int(input("Ingrese la tara del camion: "))
productoCamion[punteroCamion] = producto
contadorCamiones[2] += 1
pesoNeto[punteroCamion] = pesoBruto[punteroCamion] - tara[punteroCamion]
totalNeto[2] += pesoNeto[punteroCamion]
if(pesoNeto[punteroCamion] > mayorPeso[2]):
mayorPeso[2] = pesoNeto[punteroCamion]
mayorPatente[2] = patente
if(pesoNeto[punteroCamion] < menorPeso[2] or camion[2] == 0):
menorPeso[2] = pesoNeto[punteroCamion]
menorPatente[2] = patente
camion[2] = 1
else:
print("Producto no encontrado")
else:
print("Éste camión ya tiene una tara registrada")
else:
print("Éste camión no tiene un peso bruto registrado")
else:
print("Éste camión no posee un cupo en estado En Proceso")
else:
print("Ésta patente no posee un cupo, vuelva a intenarlo ó adquiera un cupo")
else:
print("Patente inválida, la patente debe estar compuesta por 6 ó 7 caracteres")
for i in range(0,3):
if(contadorCamiones[i] != 0):
promedioNeto[i] = totalNeto[i] / contadorCamiones[i]
def taraLibre():
if(punteroCamion < 8 and tara[punteroCamion] == 0):
return True
else:
return False
def reportes():
print("\tReportes\n")
opcion = ""
while(opcion != "V"):
print("Cantidad de cupos otorgados: ", posicion)
print("Cantidad total de camiones recibidos: ", camionesRecibidos)
for i in range(0,3):
print("Cantidad total de camiones de ", productos[i], ": ", contadorCamiones[i], "kg")
print("Peso neto total de ", productos[i], ": ", totalNeto[i], "kg")
print("Promedio del peso neto de ", productos[i], ": ", promedioNeto[i], "kg")
print("Camión con mayor peso neto de ", productos[i], ": ", mayorPatente[i], " ", mayorPeso[i], "kg")
print("Camión con menor peso neto de ", productos[i], ": ", menorPatente[i], " ", menorPeso[i], "kg")
print("_________________________________________________________")
print("Camiones ordenados por peso descendente: ")
ordenarPorPeso()
for i in range(0, 8):
print("Camion: ", cupos[i], " ", pesoNeto[i], " kg de ", productoCamion[i])
opcion = input("V. para volver: ")
def ordenarPorPeso():
for i in range(0,7):
for j in range(i + 1, 8):
if(pesoNeto[i] < pesoNeto[j]):
auxPeso = pesoNeto[i]
pesoNeto[i] = pesoNeto[j]
pesoNeto[j] = auxPeso
auxPatente = cupos[i]
cupos[i] = cupos[j]
cupos[j] = auxPatente
auxProductoCamion = productoCamion[i]
productoCamion[i] = productoCamion[j]
productoCamion[j] = auxProductoCamion
auxEstado = estado[i]
estado[i] = estado[j]
estado[j] = auxEstado
opcion = 1
while(opcion != 0):
menuPrincipal()
opcion = int(input("Ingrese una opción: "))
if opcion == 0:
print("Programa terminado")
elif opcion == 1:
administraciones()
elif opcion == 2:
entregaCupos()
elif opcion == 3:
recepcion()
elif opcion == 4:
registrarCalidad()
elif opcion == 5:
registrarPesoBruto()
elif opcion == 6:
registrarDescarga()
elif opcion == 7:
registrarTara()
elif opcion == 8:
reportes()
else:
print("Elija una opción válida.")