|
|
@@ -15,7 +15,7 @@ import sys
|
|
|
from path import Path # @UnusedImport
|
|
|
|
|
|
from core import logconf
|
|
|
-from core.model import Model
|
|
|
+from core.model import CsvModel, Model
|
|
|
from core.pde import ControlesDb, AnalytiqueDb, mk_workdir, CommunDb
|
|
|
|
|
|
|
|
|
@@ -33,6 +33,29 @@ logconf.start("ctrl2analytique", logging.DEBUG)
|
|
|
|
|
|
##-----------------------------------------------
|
|
|
|
|
|
+
|
|
|
+class Affaire(CsvModel):
|
|
|
+ """ Modèle de données d'une affaire Analytique """
|
|
|
+ _FIELDS = ["strLiaisonControle", "strMOeId", "strCommneId", "strLieux",
|
|
|
+ "strEntrepriseId", "strMOId", "dtmCommande", "Ref", "blnMarche",
|
|
|
+ "dblMarche", "intTypeContrat", "strCT", "strTypeId", "intCoefFG", "strSituation",
|
|
|
+ "lngChantierId", "bytCommandeId"]
|
|
|
+
|
|
|
+class Interv(CsvModel):
|
|
|
+ """ Modèle de données d'une intervention de contrôle réseaux """
|
|
|
+ _FIELDS = ["strEquipeId", "strEnginId", "strRapportId", "strTypeInterventionId",
|
|
|
+ "strCatégorieInterventionId", "dblquantite", "strunite", "dtmIntervention",
|
|
|
+ "dtmDureeIntervention", "strLiaisonControle", "strArticleId", "intPeriode",
|
|
|
+ "remarques", "strgrandeur1", "strgrandeur2", "strgrandeur3",
|
|
|
+ "strcaracteristique1", "strcaracteristique2", "strcaracteristique3",
|
|
|
+ "strunite1", "strunite2", "strunite3", "dtmImportation", "strTest", "LienAff",
|
|
|
+ "lngChantierId", "bytCommandeId", "bytIntervId"
|
|
|
+ ]
|
|
|
+
|
|
|
+class Tarification(Model):
|
|
|
+ """ Modèle de donnée d'une ligne de tarification """
|
|
|
+ pass
|
|
|
+
|
|
|
# ######### INITIALISATION ##########
|
|
|
logger.info("Initialisation...")
|
|
|
|
|
|
@@ -60,14 +83,6 @@ for file in (affaires_file, intervs_file):
|
|
|
logger.debug("Supprime le fichier %s", file)
|
|
|
file.remove()
|
|
|
|
|
|
-class Affaire(Model):
|
|
|
- """ Modèle de données d'une affaire Analytique """
|
|
|
- _FIELDS = ["strLiaisonControle", "strMOeId", "strCommneId", "strLieux",
|
|
|
- "strEntrepriseId", "strMOId", "dtmCommande", "Ref", "blnMarche",
|
|
|
- "dblMarche", "intTypeContrat", "strCT", "strTypeId",
|
|
|
- "intCoefFG", "strSituation",
|
|
|
- "lngChantierId", "bytCommandeId"]
|
|
|
-
|
|
|
def get_type_id(lngChantierId, bytCommandeId):
|
|
|
""" Recupère le type de chantier.
|
|
|
'ZP': Chantier de contrôle d'étanchéité
|
|
|
@@ -150,18 +165,6 @@ logger.info("> {} affaires ajoutées au fichier".format(compteur))
|
|
|
|
|
|
# Importe les interventions de contrôle du compactage dans le fichier intervs.csv
|
|
|
|
|
|
-class Interv(Model):
|
|
|
- """ Modèle de données d'une intervention de contrôle réseaux """
|
|
|
- _FIELDS = ["strEquipeId", "strEnginId", "strRapportId", "strTypeInterventionId",
|
|
|
- "strCatégorieInterventionId", "dblquantite", "strunite", "dtmIntervention",
|
|
|
- "dtmDureeIntervention", "strLiaisonControle", "strArticleId", "intPeriode",
|
|
|
- "remarques", "strgrandeur1", "strgrandeur2", "strgrandeur3",
|
|
|
- "strcaracteristique1", "strcaracteristique2", "strcaracteristique3",
|
|
|
- "strunite1", "strunite2", "strunite3",
|
|
|
- "dtmImportation", "strTest", "LienAff",
|
|
|
- "lngChantierId", "bytCommandeId", "bytIntervId"
|
|
|
- ]
|
|
|
-
|
|
|
def engin_existe(strEnginId):
|
|
|
""" retourne True si le code de l'engin existe dans la table tbl_Engin """
|
|
|
return analytique_db.exists("SELECT strEnginId FROM tbl_Engin WHERE strEnginId='{}'".format(strEnginId))
|
|
|
@@ -503,11 +506,6 @@ with open(intervs_file) as f:
|
|
|
interv = Interv.from_csv(line)
|
|
|
intervs.append(interv)
|
|
|
|
|
|
-class Tarification(Model):
|
|
|
- """ Modèle de donnée d'une ligne de tarification """
|
|
|
- _FIELDS = ["DblAffaireId", "strRapportId", "strArticleId", "dblQuantite", "strUnite",
|
|
|
- "dtmDebut", "dtmFin", "bytPeriode", "dblPrixUnitaire", "dblPrixTotal", "strStatut"]
|
|
|
-
|
|
|
|
|
|
# On insère les affaires, interventions dans Analytique, et on génère la ou les lignes de tarification associées
|
|
|
|