Commit e7e708dd by Tu Nombre

Brancheo reportes en funcion de conbustible

1 parent 317d7672
...@@ -12,3 +12,5 @@ reporte_defecto = { ...@@ -12,3 +12,5 @@ reporte_defecto = {
"3":"/home/administrador/repo_laika_hgt/uploads/Reporte\ MAHA\ Vertical105_V04.docx", "3":"/home/administrador/repo_laika_hgt/uploads/Reporte\ MAHA\ Vertical105_V04.docx",
"2":"/home/administrador/repo_laika_hgt/uploads/CONPLAT\ liviano\ 2\ ejes\ CVA\ linea\ 1.docx" "2":"/home/administrador/repo_laika_hgt/uploads/CONPLAT\ liviano\ 2\ ejes\ CVA\ linea\ 1.docx"
} }
#"selvaro": "qwer0987"
\ No newline at end of file \ No newline at end of file
{
"1":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}
},
"2":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}},
"3":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}
}
}
{
"1":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}
},
"2":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}},
"3":{
"N1":{
"2":"",
"3":""
},
"M1":{
"2":"",
"3":""
},
"N2":{
"2":"",
"3":""
},
"M2":{
"2":"",
"3":""
},
"N3":{
"2":"",
"3":""
},
"M3":{
"2":"",
"3":""
},
"O1":{
"2":"",
"3":"",
"4":""
},
"O2":{
"2":"",
"3":"",
"4":""
},
"O3":{
"2":"",
"3":"",
"4":""
},
"O4":{
"2":"",
"3":"",
"4":""
},
"UP":{
"2":"",
"3":"",
"4":""
}
}
}
...@@ -75,7 +75,7 @@ def consulta_reporte(): ...@@ -75,7 +75,7 @@ def consulta_reporte():
tipo = request.json['tipo'] tipo = request.json['tipo']
ejes = request.json['cantidadEjes'] ejes = request.json['cantidadEjes']
combustible = request.json['conbustible'] combustible = request.json['conbustible']
return json.dumps({"reporte":Repo.BuscarReporteDefecto(linea,tipo,ejes)}) return json.dumps({"reporte":Repo.BuscarReporteDefecto(linea,tipo,ejes,combustible)})
@app.route('/historico') @app.route('/historico')
......
import json, configuracion import json, configuracion
def BuscarReporteDefecto(linea,tipo,cantidadEjes=2): def BuscarReporteDefecto(linea,tipo,cantidadEjes=2,combustible=""):
linea = str(linea) linea = str(linea)
cantidadEjes = str(cantidadEjes) cantidadEjes = str(cantidadEjes)
tipo = str(tipo).upper() tipo = str(tipo).upper()
with open("data/reportes.json", 'r') as f: combustible = combustible.upper().replace(" ","_")
print(f"reporte defecto linea: {linea}, tipo: {tipo}, ejes {cantidadEjes},combustible {combustible}")
with open(f"data/reportes{combustible}.json", 'r') as f:
data = json.load(f) data = json.load(f)
try: try:
rta = data[linea][tipo][cantidadEjes] rta = data[linea][tipo][cantidadEjes]
except: except:
print(f"reporte defecto linea: {linea}, tipo: {tipo}, ejes {cantidadEjes}")
rta = configuracion.reporte_defecto[cantidadEjes] rta = configuracion.reporte_defecto[cantidadEjes]
if rta in ["",False]: if rta in ["",False]:
rta = configuracion.reporte_defecto[cantidadEjes] rta = configuracion.reporte_defecto[cantidadEjes]
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!