Changeset 2355f98 in observatorio


Ignore:
Timestamp:
Oct 17, 2014, 1:28:54 PM (10 years ago)
Author:
eparedes <eparedes@…>
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.
Message:

Merge branch 'master' of https://miv.cenditel.gob.ve/cadenas/scm/git/observatorio

Location:
procesos
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • procesos/apps/geocadena/models.py

    r3c80bde r4ff752d  
    24122412    rif = models.CharField(max_length=10, null=True, help_text="Número de R.I.F. de la empresa a georeferenciar")
    24132413    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")
    24142415    icono = models.CharField(max_length=100, help_text="Ícono a utilizar para la georeferencia de la empresa")
    24152416    nivel = models.PositiveSmallIntegerField(max_length=20, null=True,
  • procesos/apps/geocadena/views.py

    ra68fbee r041076e  
    3131
    3232from sigesic.unidadecon.identifica.models import Unidad_Economica
     33from sigesic.unidadecon.nodosprodu.models import Subunidad_Economica
    3334from productores.models import Productor
    3435from cadenas.models import Directorio2005, Encuesta
     
    6970
    7071
    71 def getUE(rifGrafo):
     72def getUE(rifGrafo, planta=None):
    7273    """!
    7374    Función que permite obtener los datos de las Unidades Económicas a georeferenciar en el mapa
     
    8788    ue = []
    8889
    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):
    9097        ue = Unidad_Economica.objects.get(rif=rifGrafo)
    9198        if not ue.dir1 is None:
     
    133140    """
    134141    coordxy = []
     142    rif = ''
     143
    135144    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
    137151        try:
    138152            coordxy = estados[ue.parroquia_id[:2]]['mun'][ue.parroquia_id[:4]]['parr'][ue.parroquia_id[:6]]['coordxy']
     
    141155            #   se estimará su ubicación de acuerdo al codigo telefónico de área registrado en la base de datos
    142156            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)
    144158            codarea = ''
    145159            if ue.telefono1 and ue.telefono1.__len__() > 4 and ue.telefono1[1:2] != "4":
     
    172186
    173187    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)
    175189    else:
    176190        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])))
    178192
    179193    return coordxy
     
    537551    model = MarcaCadenaProduccion
    538552    properties = (
    539         "grafo_id", "nivel", "sentido", "icono", "rif", "nombre",
     553        "grafo_id", "nivel", "sentido", "icono", "rif", "nombre", "planta",
    540554        "produce", "consume", "estado", "municipio", "parroquia"
    541555    )
     
    590604                    if g.node_attr['label'][0] in ["J", "G", "V", "E", "P"]:
    591605                        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)
    593611
    594612                        if ue:
    595613                            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:
    603618                                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
    605627                                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
    607632
    608633                            coordxy = getCoordenadas(ue)
  • procesos/media/geocadena/js/cadena_productiva.js

    r609969a r96146a7  
    2525    fillColor: "#8aeeef",
    2626    strokeColor: "#32a8a9",
    27     labelYOffset: 13,
    28     label: "${label}"
     27    labelYOffset: 13
    2928});
    3029/// Establece las reglas de los estilos a mostrar en la capa y/o leyenda de conexiones de la cadena productiva
     
    111110        msg += "<td>" + feature.attributes['nombre'] + "</td>";
    112111        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        }
    113118        msg += "<tr>";
    114119        msg += "<td style='font-weight:bold'>Coordenadas</td>";
     
    155160    fillColor: "#8aeeef",
    156161    strokeColor: "#32a8a9",
    157     labelYOffset: 13,
    158     label: "${label}"
     162    labelYOffset: 13
    159163});
    160164/// Establece las reglas de los estilos a mostrar en la capa y/o leyenda de las Unidades Económicas de la cadena productiva
     
    237241        detalle += "<td>" + f.attributes.nombre + "</td>";
    238242        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>";
    240250        detalle += "<td style='font-weight:bold'>Nivel</td>";
    241251        if (typeof (f.attributes.nivel) != "undefined" && f.attributes.nivel != null) {
     
    245255            detalle += "<td>0</td>";
    246256        }
    247         detalle += "</tr>";
     257        detalle += "</tr>";*/
    248258        detalle += "<tr>";
    249259        detalle += "<td style='font-weight:bold'>Posición</td>";
     
    258268        }
    259269        detalle += "</tr>";
     270        detalle += "<tr><td colspan='2'>&#160;</td></tr>"; // Separación
    260271        detalle += "<tr>";
    261272        detalle += "<td style='font-weight:bold'>Estado</td>";
     
    286297        detalle += "</tr>";
    287298        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'>&#160;</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>";
    291305            detalle += "</tr>";
    292306        }
    293307        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'>&#160;</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>";
    297314            detalle += "</tr>";
    298315        }
Note: See TracChangeset for help on using the changeset viewer.