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