Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
Pruebas-RTO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 2015f266
authored
2024-07-31 15:20:58 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Carga rapida desde historico anda
1 parent
7f4842d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
6 deletions
main.py
protected_static/cargarapida.js
templates/form.html
main.py
View file @
2015f26
...
@@ -71,10 +71,11 @@ def protected_static(filename):
...
@@ -71,10 +71,11 @@ def protected_static(filename):
@app.route
(
'/reporte_doc'
,
methods
=
[
'POST'
])
@app.route
(
'/reporte_doc'
,
methods
=
[
'POST'
])
def
consulta_reporte
():
def
consulta_reporte
():
linea
=
request
.
json
[
'linea'
]
linea
=
request
.
json
[
'linea'
]
tipo
=
request
.
json
[
'tipo'
]
tipo
=
request
.
json
[
'tipo'
]
ejes
=
request
.
json
[
'cantidadEjes'
]
ejes
=
request
.
json
[
'cantidadEjes'
]
return
Repo
.
BuscarReporteDefecto
(
linea
,
tipo
,
ejes
)
combustible
=
request
.
json
[
'conbustible'
]
return
json
.
dumps
({
"reporte"
:
Repo
.
BuscarReporteDefecto
(
linea
,
tipo
,
ejes
)})
@app.route
(
'/historico'
)
@app.route
(
'/historico'
)
...
...
protected_static/cargarapida.js
View file @
2015f26
...
@@ -73,10 +73,82 @@ function llendoTentativo(data) {
...
@@ -73,10 +73,82 @@ function llendoTentativo(data) {
let
linea
=
JSON
.
parse
(
data
.
json_cent
);
let
linea
=
JSON
.
parse
(
data
.
json_cent
);
let
inspaccion
=
linea
.
rta
let
inspaccion
=
linea
.
rta
//console.log(inspaccion)
//console.log(inspaccion)
fillResults
(
inspaccion
)
fillResults
(
inspaccion
);
LLenarDatosAuxiliareas
(
data
,
inspaccion
)
};
};
}
}
function
LLenarDatosAuxiliareas
(
data
,
inspeccion
)
{
//console.log(data)
let
linea
=
JSON
.
parse
(
data
.
linea_excel
);
let
conbustible
=
"Gas Oil"
;
console
.
log
(
inspeccion
)
EscribirValores
(
'input[name="fecha"]'
,
formatDateToHuman
(
data
.
fecha
));
EscribirValores
(
'input[name="hora"]'
,
linea
.
fin
);
EscribirValores
(
'input[name="ingeniero"]'
,
inspeccion
.
header
.
ingeniero
);
EscribirValores
(
'input[name="linea_numero"]'
,
data
.
linea
);
EscribirValores
(
'input[name="vehiculo_tipo"]'
,
data
.
categoria
);
EscribirValores
(
'input[name="CodigoTaller"]'
,
linea
.
codigoTaller
);
EscribirValores
(
'input[name="peso_estatico"]'
,
inspeccion
.
frenos
.
pesoTotalFreno
);
//const ejes = document.querySelectorAll('input[name="cantidad_ejes"]');
if
(
inspeccion
.
gaseshumos
.
opacidad_logaritmica
===
"?"
){
conbustible
=
"Nafta"
;
};
EscribirValores
(
'input[name="conbustible"]'
,
conbustible
);
ReporteTipo
(
conbustible
,
data
.
linea
,
data
.
categoria
)
//const reporte = document.querySelectorAll('input[name="ReporteInspeccion"]');
}
function
ReporteTipo
(
conbustible
,
linea
,
categoria
)
{
let
ejes
=
getSelectedEjes
();
const
consulta
=
{
linea
:
linea
,
tipo
:
categoria
,
cantidadEjes
:
ejes
,
conbustible
:
conbustible
};
fetch
(
'/reporte_doc'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
consulta
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
EscribirValores
(
'input[name="ReporteInspeccion"]'
,
data
.
reporte
)
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
})
}
function
EscribirValores
(
query
,
valor
)
{
console
.
log
(
query
+
" "
+
valor
)
const
campo
=
document
.
querySelectorAll
(
query
);
campo
.
forEach
(
field
=>
{
field
.
value
=
valor
;
});
}
// Función para obtener el valor seleccionado del select
function
getSelectedEjes
()
{
// Selecciona el elemento select por su id
const
selectElement
=
document
.
getElementById
(
'cantidad_ejes'
);
// Obtiene el valor seleccionado
const
selectedValue
=
selectElement
.
value
;
// Retorna o utiliza el valor seleccionado
return
selectedValue
;
}
function
fillResults
(
results
)
{
function
fillResults
(
results
)
{
const
r
=
document
.
getElementById
(
"report"
)
const
r
=
document
.
getElementById
(
"report"
)
...
@@ -91,4 +163,12 @@ function fillResults(results) {
...
@@ -91,4 +163,12 @@ function fillResults(results) {
});
});
}
}
function
formatDateToHuman
(
dateString
)
{
// Dividir la fecha en año, mes y día
const
[
year
,
month
,
day
]
=
dateString
.
split
(
'-'
);
// Devolver la fecha en formato DD/MM/YYYY
return
`
${
day
}
/
${
month
}
/
${
year
}
`
;
}
templates/form.html
View file @
2015f26
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
<br>
<br>
Tipo
<input
sub=
"header"
type=
"text"
name=
"vehiculo_tipo"
>
Tipo
<input
sub=
"header"
type=
"text"
name=
"vehiculo_tipo"
>
<br>
<br>
Combustible
<input
sub=
"header"
type=
"text"
name=
"conbustible"
>
<br>
CodigoTaller
<input
sub=
"header"
type=
"text"
name=
"CodigoTaller"
readonly=
"1"
>
CodigoTaller
<input
sub=
"header"
type=
"text"
name=
"CodigoTaller"
readonly=
"1"
>
<br>
<br>
Reporte
<input
sub=
"header"
type=
"text"
name=
"ReporteInspeccion"
readonly=
"1"
>
Reporte
<input
sub=
"header"
type=
"text"
name=
"ReporteInspeccion"
readonly=
"1"
>
...
@@ -180,7 +182,7 @@
...
@@ -180,7 +182,7 @@
</div>
</div>
-->
-->
<div
class=
"PDFButtonContainerFixed"
style=
"bottom: 40%;"
>
<div
class=
"PDFButtonContainerFixed"
style=
"bottom: 40%;"
>
<a
href=
"/"
>
<a
href=
"/
historico
"
>
<button
class=
"PeligroButton"
style=
"bottom: 40%; display: {% if bypass %} none {% else %} block {% endif %};"
>
<button
class=
"PeligroButton"
style=
"bottom: 40%; display: {% if bypass %} none {% else %} block {% endif %};"
>
Volver
Volver
</button>
</button>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment