Changeset 2355f98 in observatorio
- Timestamp:
- Oct 17, 2014, 1:28:54 PM (10 years ago)
- Branches:
- master
- Children:
- 5353e56
- Parents:
- 0d419db (diff), c3faca2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- procesos
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
procesos/apps/geocadena/models.py
r3c80bde r4ff752d 2412 2412 rif = models.CharField(max_length=10, null=True, help_text="Número de R.I.F. de la empresa a georeferenciar") 2413 2413 nombre = models.CharField(max_length=100, null=True, help_text="Nombre de la empresa a georeferenciar") 2414 planta = models.CharField(max_length=100, null=True, help_text="Nombre de la planta a georeferenciar") 2414 2415 icono = models.CharField(max_length=100, help_text="Ícono a utilizar para la georeferencia de la empresa") 2415 2416 nivel = models.PositiveSmallIntegerField(max_length=20, null=True, -
procesos/apps/geocadena/views.py
ra68fbee r041076e 31 31 32 32 from sigesic.unidadecon.identifica.models import Unidad_Economica 33 from sigesic.unidadecon.nodosprodu.models import Subunidad_Economica 33 34 from productores.models import Productor 34 35 from cadenas.models import Directorio2005, Encuesta … … 69 70 70 71 71 def getUE(rifGrafo ):72 def getUE(rifGrafo, planta=None): 72 73 """! 73 74 Función que permite obtener los datos de las Unidades Económicas a georeferenciar en el mapa … … 87 88 ue = [] 88 89 89 if Unidad_Economica.objects.filter(rif=rifGrafo): 90 if Subunidad_Economica.objects.filter(ue_rif__rif=rifGrafo, tipo_subunidad='Pl', nombre=planta): 91 try: 92 ue = Subunidad_Economica.objects.get(ue_rif__rif=rifGrafo, tipo_subunidad='Pl', nombre=planta) 93 except Exception, e: 94 # En caso de que existan más de una planta con el mismo nombre se obtiene solo una de ellas 95 ue = Subunidad_Economica.objects.filter(ue_rif__rif=rifGrafo, nombre=planta)[0] 96 elif Unidad_Economica.objects.filter(rif=rifGrafo): 90 97 ue = Unidad_Economica.objects.get(rif=rifGrafo) 91 98 if not ue.dir1 is None: … … 133 140 """ 134 141 coordxy = [] 142 rif = '' 143 135 144 if ue: 136 logger.info("Inicio del proceso para la obtención de coordenadas de la Unidad Económica [%s]" % ue.rif) 145 try: 146 rif = ue.rif 147 except AttributeError: 148 rif = ue.ue_rif 149 logger.info("Inicio del proceso para la obtención de coordenadas de la Unidad Económica [%s]" % rif) 150 137 151 try: 138 152 coordxy = estados[ue.parroquia_id[:2]]['mun'][ue.parroquia_id[:4]]['parr'][ue.parroquia_id[:6]]['coordxy'] … … 141 155 # se estimará su ubicación de acuerdo al codigo telefónico de área registrado en la base de datos 142 156 logger.warning("No fue posible establecer una ubicación parroquial para la Unidad Económica [%s]. Se " 143 "procede a determinar su ubicación mediante el código de área telefónico." % ue.rif)157 "procede a determinar su ubicación mediante el código de área telefónico." % rif) 144 158 codarea = '' 145 159 if ue.telefono1 and ue.telefono1.__len__() > 4 and ue.telefono1[1:2] != "4": … … 172 186 173 187 if not coordxy: 174 logger.warning("No fue posible establecer una coordenada geográfica para la Unidad Económica [%s]" % ue.rif)188 logger.warning("No fue posible establecer una coordenada geográfica para la Unidad Económica [%s]" % rif) 175 189 else: 176 190 logger.info("Se establecio la coordenada geográfica para la Unidad Económica [%s] en Longitud (%s) y Latitud " 177 "(%s)" % ( ue.rif, str(coordxy[0]), str(coordxy[1])))191 "(%s)" % (rif, str(coordxy[0]), str(coordxy[1]))) 178 192 179 193 return coordxy … … 537 551 model = MarcaCadenaProduccion 538 552 properties = ( 539 "grafo_id", "nivel", "sentido", "icono", "rif", "nombre", 553 "grafo_id", "nivel", "sentido", "icono", "rif", "nombre", "planta", 540 554 "produce", "consume", "estado", "municipio", "parroquia" 541 555 ) … … 590 604 if g.node_attr['label'][0] in ["J", "G", "V", "E", "P"]: 591 605 rif = g.node_attr['label'][:10] 592 ue = getUE(rif) 606 planta = None 607 if g.node_attr['label'].rfind("Planta =") > 0: 608 planta = g.node_attr['label'][g.node_attr['label'].rfind("=") + 1:].strip() 609 610 ue = getUE(rif, planta) 593 611 594 612 if ue: 595 613 dict_cadena['rif'] = rif 596 try: 597 if ue.nombre is not None and ue.nombre != "NO INDICA": 598 dict_cadena['nombre'] = ue.nombre 599 else: 600 dict_cadena['nombre'] = ue.razon_social 601 602 except AttributeError: 614 if planta: 615 dict_cadena['nombre'] = ue.ue_rif.nombre 616 dict_cadena['planta'] = planta 617 else: 603 618 try: 604 dict_cadena['nombre'] = ue.nombreestablecimiento 619 try: 620 if ue.nombre is not None and ue.nombre != "NO INDICA": 621 dict_cadena['nombre'] = ue.nombre 622 else: 623 dict_cadena['nombre'] = ue.razon_social 624 except Exception, e: 625 dict_cadena['nombre'] = ue 626 605 627 except AttributeError: 606 dict_cadena['nombre'] = ue.nombre_comercial 628 try: 629 dict_cadena['nombre'] = ue.nombreestablecimiento 630 except AttributeError: 631 dict_cadena['nombre'] = ue.nombre_comercial 607 632 608 633 coordxy = getCoordenadas(ue) -
procesos/media/geocadena/js/cadena_productiva.js
r609969a r96146a7 25 25 fillColor: "#8aeeef", 26 26 strokeColor: "#32a8a9", 27 labelYOffset: 13, 28 label: "${label}" 27 labelYOffset: 13 29 28 }); 30 29 /// Establece las reglas de los estilos a mostrar en la capa y/o leyenda de conexiones de la cadena productiva … … 111 110 msg += "<td>" + feature.attributes['nombre'] + "</td>"; 112 111 msg += "<tr>"; 112 if (typeof (feature.attributes['planta']) != "undefined" && feature.attributes['planta'] != null) { 113 msg += "<tr>"; 114 msg += "<td style='font-weight:bold'>Planta</td>"; 115 msg += "<td>" + feature.attributes['planta'] + "</td>"; 116 msg += "</tr>"; 117 } 113 118 msg += "<tr>"; 114 119 msg += "<td style='font-weight:bold'>Coordenadas</td>"; … … 155 160 fillColor: "#8aeeef", 156 161 strokeColor: "#32a8a9", 157 labelYOffset: 13, 158 label: "${label}" 162 labelYOffset: 13 159 163 }); 160 164 /// Establece las reglas de los estilos a mostrar en la capa y/o leyenda de las Unidades Económicas de la cadena productiva … … 237 241 detalle += "<td>" + f.attributes.nombre + "</td>"; 238 242 detalle += "</tr>"; 239 detalle += "<tr>"; 243 if (typeof (f.attributes.planta) != "undefined" && f.attributes.planta != null) { 244 detalle += "<tr>"; 245 detalle += "<td style='font-weight:bold'>Planta</td>"; 246 detalle += "<td>" + f.attributes.planta + "</td>"; 247 detalle += "</tr>"; 248 } 249 /*detalle += "<tr>"; 240 250 detalle += "<td style='font-weight:bold'>Nivel</td>"; 241 251 if (typeof (f.attributes.nivel) != "undefined" && f.attributes.nivel != null) { … … 245 255 detalle += "<td>0</td>"; 246 256 } 247 detalle += "</tr>"; 257 detalle += "</tr>";*/ 248 258 detalle += "<tr>"; 249 259 detalle += "<td style='font-weight:bold'>Posición</td>"; … … 258 268 } 259 269 detalle += "</tr>"; 270 detalle += "<tr><td colspan='2'> </td></tr>"; // Separación 260 271 detalle += "<tr>"; 261 272 detalle += "<td style='font-weight:bold'>Estado</td>"; … … 286 297 detalle += "</tr>"; 287 298 if (typeof (f.attributes.consume) != "undefined" && f.attributes.consume != null) { 288 detalle += "<tr>"; 289 detalle += "<td style='font-weight:bold'>Consume</td>"; 290 detalle += "<td>" + f.attributes.consume + "</td>"; 299 detalle += "<tr><td colspan='2'> </td></tr>"; // Separación 300 detalle += "<tr>"; 301 detalle += "<td style='font-weight:bold' colspan='2'>Consume</td>"; 302 detalle += "</tr>"; 303 detalle += "<tr>"; 304 detalle += "<td colspan='2'>" + f.attributes.consume + "</td>"; 291 305 detalle += "</tr>"; 292 306 } 293 307 if (typeof (f.attributes.produce) != "undefined" && f.attributes.produce != null) { 294 detalle += "<tr>"; 295 detalle += "<td style='font-weight:bold'>Produce</td>"; 296 detalle += "<td>" + f.attributes.produce + "</td>"; 308 detalle += "<tr><td colspan='2'> </td></tr>"; // Separación 309 detalle += "<tr>"; 310 detalle += "<td style='font-weight:bold' colspan='2'>Produce</td>"; 311 detalle += "</tr>"; 312 detalle += "<tr>"; 313 detalle += "<td colspan='2'>" + f.attributes.produce + "</td>"; 297 314 detalle += "</tr>"; 298 315 }
Note: See TracChangeset
for help on using the changeset viewer.