gg!
This commit is contained in:
parent
952b215c0c
commit
2a1099c450
@ -20,7 +20,12 @@ class Borne:
|
||||
bornes = []
|
||||
@staticmethod
|
||||
def MajBornes():
|
||||
pass
|
||||
print(Borne.bornes)
|
||||
for b in Borne.bornes:
|
||||
b.MajBorne()
|
||||
|
||||
def MajBorne(self):
|
||||
self.__ui.lcdNumber.display(self.__parking.nbPlacesLibresParking)
|
||||
|
||||
def __init__(self, main, parking):
|
||||
self.__parking = parking
|
||||
@ -41,6 +46,7 @@ class Borne:
|
||||
self.__ui.btn_recuperer.clicked.connect(self.recuperer)
|
||||
|
||||
|
||||
|
||||
# Validator
|
||||
|
||||
|
||||
@ -50,6 +56,8 @@ class Borne:
|
||||
self.nonVoiture()
|
||||
self.showWindow()
|
||||
self.__ui.nomParking.setText("Borne " + str(len(self.bornes)+1) + " - Parking : " +parking.nom)
|
||||
Borne.bornes.append(self)
|
||||
Borne.MajBornes()
|
||||
|
||||
|
||||
def blockAll(self):
|
||||
@ -84,6 +92,7 @@ class Borne:
|
||||
self.__ui.lineEdit_id.setText("")
|
||||
self.__ui.numeroTicketLineEdit.setText("")
|
||||
self.__ui.labIdClient.setText("Non identifier")
|
||||
Borne.MajBornes()
|
||||
|
||||
def newVoiture(self):
|
||||
"""
|
||||
@ -105,13 +114,13 @@ class Borne:
|
||||
:return:
|
||||
"""
|
||||
try :
|
||||
self.__c = Client.get(self.__ui.lineEdit_id.text())
|
||||
self.__c = Client(self.__ui.lineEdit_id.text())
|
||||
self.__ui.label_aff.setText("Bonjour " + str(self.__c.nom) + " " + str(self.__c.prenom))
|
||||
self.__ui.labIdClient.setText("Vous étes identifier")
|
||||
self.__ui.box_id.setDisabled(True)
|
||||
self.__ui.box_service.setDisabled(False)
|
||||
self.__ui.btn_desabo.setDisabled(False)
|
||||
except IndexError :
|
||||
except Exception :
|
||||
self.__ui.label_aff.setText("Echec identification")
|
||||
self.__ui.labIdClient.setText("Non identifier")
|
||||
|
||||
@ -139,7 +148,6 @@ class Borne:
|
||||
str(self.__ui.prenomLineEdit.text()),
|
||||
"",
|
||||
TypeAbonnement.ABONNE)
|
||||
print(self.__c)
|
||||
self.__ui.label_aff.setText("Votre id membre est : " + self.__c.id)
|
||||
self.__ui.lineEdit_id.setText(self.__c.id)
|
||||
self.identification()
|
||||
@ -153,25 +161,25 @@ class Borne:
|
||||
if self.__c is None:
|
||||
p = self.__parking.recherchePlace(self.__v_actuel)
|
||||
if p is not None:
|
||||
id = Teleporteur.teleporterVoiture(self.__v_actuel, p)
|
||||
placement = Teleporteur.teleporterVoiture(self.__v_actuel, p)
|
||||
else:
|
||||
if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE:
|
||||
p = self.__parking.recherchePlace(self.__v_actuel)
|
||||
if p is not None :
|
||||
id = Teleporteur.teleporterVoiture(self.__v_actuel, p)
|
||||
placement = Teleporteur.teleporterVoiture(self.__v_actuel, p)
|
||||
if self.__ui.checkBox_Livraison_2.isChecked():
|
||||
Service(None, self.__c, p, TypeService.LIVRAISON)
|
||||
Service(None, self.__c, placement, TypeService.LIVRAISON)
|
||||
if self.__ui.checkBox_Entretien_2.isChecked():
|
||||
Service(None, self.__c, p, TypeService.ENTRETIEN)
|
||||
Service(None, self.__c, placement, TypeService.ENTRETIEN)
|
||||
if self.__ui.checkBox_Maintenance_2.isChecked():
|
||||
Service(None, self.__c, p, TypeService.MAINTENANCE)
|
||||
Service(None, self.__c, placement, TypeService.MAINTENANCE)
|
||||
else:
|
||||
Teleporteur.teleporterVoitureSuperAbonne(self.__v_actuel)
|
||||
if id is not None:
|
||||
placement = Teleporteur.teleporterVoitureSuperAbonne(self.__v_actuel, self.__parking)
|
||||
if placement is not None:
|
||||
self.nonVoiture()
|
||||
self.ticketDepot(id)
|
||||
self.ticketDepot(placement.id)
|
||||
else:
|
||||
self.__ui.label_aff.setText("Aucune Place Disponible Pour Votre Véhicule. Devenez Super Abonné!")
|
||||
self.__ui.label_aff.setText("Aucune Place Correspondante. Devenez Super Abonné!")
|
||||
|
||||
|
||||
def recuperer(self):
|
||||
|
@ -98,15 +98,19 @@ class Main:
|
||||
self.__ui.btn_borne.setDisabled(True)
|
||||
|
||||
#onglet Service
|
||||
for s in Service.serviceEnCours:
|
||||
if s.typeService == TypeService.LIVRAISON :
|
||||
self.__ui.comboBox_livraison.addItem(str(s.id))
|
||||
if s.typeService == TypeService.ENTRETIEN :
|
||||
self.__ui.comboBox_entretien.addItem(str(s.id))
|
||||
if s.typeService == TypeService.MAINTENANCE :
|
||||
self.__ui.comboBox_maintenance.addItem(str(s.id))
|
||||
self.__ui.comboBox_livraison.clear()
|
||||
self.__ui.comboBox_entretien.clear()
|
||||
self.__ui.comboBox_maintenance.clear()
|
||||
if self.__ui.comboBox.count() > 1:
|
||||
for s in Service.getAllEnCours(p[self.__ui.comboBox.currentIndex() - 1]):
|
||||
if s.typeService == TypeService.LIVRAISON :
|
||||
self.__ui.comboBox_livraison.addItem(str(s.id))
|
||||
if s.typeService == TypeService.ENTRETIEN :
|
||||
self.__ui.comboBox_entretien.addItem(str(s.id))
|
||||
if s.typeService == TypeService.MAINTENANCE :
|
||||
self.__ui.comboBox_maintenance.addItem(str(s.id))
|
||||
|
||||
#Onglet Stats
|
||||
#Onglet Stats
|
||||
|
||||
|
||||
def creerParking(self):
|
||||
@ -136,8 +140,8 @@ class Main:
|
||||
def afficherBornes(self):
|
||||
if self.__ui.comboBox.currentIndex() != 0:
|
||||
self.__view.hide()
|
||||
Borne.bornes.append(Borne(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1]))
|
||||
Borne.bornes.append(Borne(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1]))
|
||||
Borne(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1])
|
||||
Borne(self, Parking.getAllActif()[self.__ui.comboBox.currentIndex() - 1])
|
||||
|
||||
def nouveau(self):
|
||||
result = QtGui.QMessageBox.question(self.__view,
|
||||
|
@ -8,13 +8,13 @@ class Teleporteur:
|
||||
def teleporterVoiture(voiture, place):
|
||||
p = Placement(None,voiture, place)
|
||||
place.prendre()
|
||||
return p.id
|
||||
return p
|
||||
|
||||
@staticmethod
|
||||
def teleporterVoitureSuperAbonne(voiture, parking):
|
||||
place = parking.addPlaceSuperAbo()
|
||||
place = parking.addPlaceSuperAbo(parking)
|
||||
p = Placement(None, voiture, place)
|
||||
return p.id
|
||||
return p
|
||||
|
||||
@staticmethod
|
||||
def teleporterVersSortie(placement):
|
||||
|
@ -1,5 +1,3 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
import logging
|
||||
from logging.handlers import RotatingFileHandler
|
||||
|
||||
@ -50,7 +48,6 @@ class Log(object):
|
||||
"""
|
||||
Log Manager
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Define 3 differents log :
|
||||
|
@ -6,7 +6,7 @@ from src.m.connexionBDD import connexionBDD
|
||||
__author__ = 'sidya'
|
||||
|
||||
class Client:
|
||||
def __init__(self,id, nom, prenom, adresse, typeAbonnement):
|
||||
def __init__(self,id, nom=None, prenom=None, adresse=None, typeAbonnement=None):
|
||||
if id is None:
|
||||
self.__nom = nom
|
||||
self.__prenom = prenom
|
||||
|
@ -3,6 +3,11 @@ import string
|
||||
import time
|
||||
from src.m.Voiture import Voiture
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
from src.m.Voiture import Voiture
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
@ -101,10 +106,14 @@ class Place:
|
||||
self.__niveau = niveau
|
||||
self.__estLibre = estLibre
|
||||
self.__estSuperAbo = estSuperAbo
|
||||
if self.__typePlace is None:
|
||||
t = "NULL"
|
||||
else :
|
||||
t = self.__typePlace.id
|
||||
c = connexionBDD()
|
||||
c.execute("INSERT INTO place (idParking, idTypePlace, numero, estLibre, estSuperAbo) "
|
||||
"VALUES (?,?,?,?,?)",
|
||||
(self.__parking.id, self.__typePlace.id,
|
||||
(self.__parking.id, t,
|
||||
self.__numero, int(self.__estLibre), int(self.__estSuperAbo)))
|
||||
self.__id = c.lastId()
|
||||
c.seDeconnecter()
|
||||
@ -289,7 +298,7 @@ class Placement:
|
||||
id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
|
||||
range(random.randint(1, 10)))
|
||||
try:
|
||||
Placement.get(id)
|
||||
Placement(id)
|
||||
except IndexError:
|
||||
break
|
||||
c = connexionBDD()
|
||||
@ -304,8 +313,8 @@ class Placement:
|
||||
if row is None :
|
||||
raise IndexError("Invalid id")
|
||||
c.seDeconnecter()
|
||||
self.__voiture = row["voiture"]
|
||||
self.__place = row["place"]
|
||||
self.__voiture = Voiture(row["idVoiture"])
|
||||
self.__place = Place(row["idPlace"])
|
||||
self.__id = id
|
||||
self.__debut = debut
|
||||
self.__fin = fin
|
||||
|
@ -1,5 +1,5 @@
|
||||
import time
|
||||
from src.m import Client
|
||||
from src.m.Client import Client
|
||||
from src.m.Parking import Placement
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
@ -9,15 +9,16 @@ class Service:
|
||||
@staticmethod
|
||||
def getAllEnCours(parking):
|
||||
c = connexionBDD()
|
||||
r = c.execute("SELECT * FROM service WHERE dateRealisation = NULL "
|
||||
"AND idPlacement = (SELECT idPlacement FORM PLACEMENT WHERE "
|
||||
"idPlace = (SELECT idPlace FROM Place WHERE idParking '"+str(parking.id)+"'))")
|
||||
r = c.execute("SELECT * FROM service WHERE dateRealisation is NULL "
|
||||
"AND idPlacement IN (SELECT idPlacement FROM PLACEMENT WHERE "
|
||||
"idPlace IN (SELECT idPlace FROM Place WHERE idParking = '"+str(parking.id)+"'))")
|
||||
rows = r.fetchall()
|
||||
c.seDeconnecter()
|
||||
l =[]
|
||||
for row in rows:
|
||||
l.append(Service(row["idService"], Client.get(row["idClient"]), Placement.get(row["idPlacement"]),
|
||||
l.append(Service(row["idService"], Client(row["idClient"]), Placement(row["idPlacement"]),
|
||||
row["typeService"], row["dateDemande"], row["dateService"], row["dateRealisation"]))
|
||||
print("l = " + str(l))
|
||||
return l
|
||||
|
||||
def __init__(self, id, client= None, placement= None, typeService= None,
|
||||
@ -42,8 +43,8 @@ class Service:
|
||||
raise IndexError("Invalid id")
|
||||
c.seDeconnecter()
|
||||
self.__id = id
|
||||
self.__client = row["client"]
|
||||
self.__placement = row["placement"]
|
||||
self.__client = Client(row["idClient"])
|
||||
self.__placement = Placement(row["idPlacement"])
|
||||
self.__typeService = row["typeService"]
|
||||
self.__dateDemande = row["dateDemande"]
|
||||
self.__dateService = row["dateService"]
|
||||
|
@ -70,8 +70,8 @@ CREATE TABLE service (
|
||||
idPlacement VARCHAR(10),
|
||||
typeService INTEGER,
|
||||
dateDemande TIMESTAMP,
|
||||
dateService TIMESTAMP,
|
||||
dateRealisation TIMESTAMP
|
||||
dateService TIMESTAMP DEFAULT NULL,
|
||||
dateRealisation TIMESTAMP DEFAULT NULL,
|
||||
FOREIGN KEY (idClient) REFERENCES client(idClient),
|
||||
FOREIGN KEY (idPlacement) REFERENCES placement(idPlacement)
|
||||
);
|
@ -7,10 +7,8 @@ class MyQMainWindow(QtGui.QMainWindow):
|
||||
def closeEvent(self, event):
|
||||
result = QtGui.QMessageBox.question(self,
|
||||
"Confirmer Fermeture...",
|
||||
"Etes vous sur de vouloir quitter ?\n"
|
||||
"(Toute modification non enregistrée seras perdu)",
|
||||
"Etes vous sur de vouloir quitter ?",
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||
event.ignore()
|
||||
|
||||
if result == QtGui.QMessageBox.Yes:
|
||||
event.accept()
|
Reference in New Issue
Block a user