Browse Source

v0.7.6 - mn2_rec - complete la recherche de doublons

omassot 6 years ago
parent
commit
770d2dac9d
4 changed files with 93 additions and 10 deletions
  1. 1 1
      core/constants.py
  2. 1 1
      metadata.txt
  3. 1 1
      schemas/mn1_rec.py
  4. 90 7
      schemas/mn2_rec.py

+ 1 - 1
core/constants.py

@@ -6,7 +6,7 @@
 '''
 from path import Path
 
-VERSION = "0.7.5"
+VERSION = "0.7.6"
 
 MAIN = Path(__file__).parent.parent.abspath()
 

+ 1 - 1
metadata.txt

@@ -3,7 +3,7 @@
 name = MnCheck
 qgisminimumversion = 3.4
 description = Contrôle des données FTTH format MN
-version = 0.7.4
+version = 0.7.6
 author = Manche Numérique 2019
 email = sig@manchenumerique.fr
 about = Auto-contrôle des livrables FTTH aux formats Manche Numérique

+ 1 - 1
schemas/mn1_rec.py

@@ -180,7 +180,7 @@ class Zapbo(QgsModel):
     crs = CRS
     bounding_box = (XMIN,YMIN,XMAX,YMAX)
     pk = "ID_ZAPBO"
-    schema = {'ID_ZAPBO': {'type': 'string', 'empty': False, 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE', 'PEC']}, 
+    schema = {'ID_ZAPBO': {'type': 'string', 'empty': False, 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE', 'PEC', 'BAI']}, 
               'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True}, 
               'STATUT': {'type': 'string', 'empty': False, 'allowed': ['APS', 'APD', 'EXE', 'REC']}}
     

+ 90 - 7
schemas/mn2_rec.py

@@ -200,7 +200,7 @@ class Zapbo(QgsModel):
     bounding_box = (XMIN,YMIN,XMAX,YMAX)
     pk = "ID_ZAPBO"
     required = False
-    schema = {'ID_ZAPBO': {'type': 'string', 'empty': False, 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE', 'PEC']}, 
+    schema = {'ID_ZAPBO': {'type': 'string', 'empty': False, 'maxlength': 30, 'contains_any_of': ['PBO', 'BPE', 'PEC', 'BAI']}, 
               'COMMENTAIR': {'type': 'string', 'maxlength': 254, 'empty': True}, 
               'STATUT': {'type': 'string', 'empty': False, 'allowed': STATUTS}}
     
@@ -367,15 +367,57 @@ class Mn2Checker(BaseChecker):
         Recherche d'éventuels doublons dans des champs qui supposent l'unicité
         """
         
+        # doublons dans AR_CODE
         tmp = []
-        for noeud in self.noeuds:
-            if not noeud.NO_NOM:
+        for artere in self.arteres:
+            if not artere.AR_CODE:
                 continue
-            if not noeud.NO_NOM in tmp:
-                tmp.append(noeud.NO_NOM)
+            if not artere.AR_CODE in tmp:
+                tmp.append(artere.AR_CODE)
             else:
-                self.log_error("Doublons dans le champs NO_NOM", item=noeud)
+                self.log_error("Doublons dans le champs AR_CODE", item=artere)
+        
+        # doublons dans AR_NOM
+        tmp = []
+        for artere in self.arteres:
+            if not artere.AR_NOM:
+                continue
+            if not artere.AR_NOM in tmp:
+                tmp.append(artere.AR_NOM)
+            else:
+                self.log_error("Doublons dans le champs AR_NOM", item=artere)
+        
+        # doublons dans CA_CODE
+        tmp = []
+        for cable in self.cables:
+            if not cable.CA_CODE:
+                continue
+            if not cable.CA_CODE in tmp:
+                tmp.append(cable.CA_CODE)
+            else:
+                self.log_error("Doublons dans le champs CA_CODE", item=cable)
+        
+        # doublons dans CA_NOM
+        tmp = []
+        for cable in self.cables:
+            if not cable.CA_NOM:
+                continue
+            if not cable.CA_NOM in tmp:
+                tmp.append(cable.CA_NOM)
+            else:
+                self.log_error("Doublons dans le champs CA_NOM", item=cable)
+        
+        # doublons dans EQ_CODE
+        tmp = []
+        for equipement in self.equipements:
+            if not equipement.EQ_CODE:
+                continue
+            if not equipement.EQ_CODE in tmp:
+                tmp.append(equipement.EQ_CODE)
+            else:
+                self.log_error("Doublons dans le champs EQ_CODE", item=equipement)
         
+        # doublons dans EQ_NOM
         tmp = []
         for equipement in self.equipements:
             if not equipement.EQ_NOM:
@@ -384,7 +426,48 @@ class Mn2Checker(BaseChecker):
                 tmp.append(equipement.EQ_NOM)
             else:
                 self.log_error("Doublons dans le champs EQ_NOM", item=equipement)
-                
+               
+        # doublons dans NO_CODE 
+        tmp = []
+        for noeud in self.noeuds:
+            if not noeud.NO_CODE:
+                continue
+            if not noeud.NO_CODE in tmp:
+                tmp.append(noeud.NO_CODE)
+            else:
+                self.log_error("Doublons dans le champs NO_CODE", item=noeud)
+               
+        # doublons dans NO_NOM
+        tmp = []
+        for noeud in self.noeuds:
+            if not noeud.NO_NOM:
+                continue
+            if not noeud.NO_NOM in tmp:
+                tmp.append(noeud.NO_NOM)
+            else:
+                self.log_error("Doublons dans le champs NO_NOM", item=noeud)
+               
+        # doublons dans TR_CODE
+        tmp = []
+        for tranchee in self.tranchees:
+            if not tranchee.TR_CODE:
+                continue
+            if not tranchee.TR_CODE in tmp:
+                tmp.append(tranchee.TR_CODE)
+            else:
+                self.log_error("Doublons dans le champs TR_CODE", item=tranchee)
+               
+        # doublons dans TR_NOM
+        tmp = []
+        for tranchee in self.tranchees:
+            if not tranchee.TR_NOM:
+                continue
+            if not tranchee.TR_NOM in tmp:
+                tmp.append(tranchee.TR_NOM)
+            else:
+                self.log_error("Doublons dans le champs TR_NOM", item=tranchee)
+
+        # doublons dans ID_ZAPBO
         tmp = []
         for zapbo in self.zapbos:
             if not zapbo.ID_ZAPBO: