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 c9901f4c
authored
2024-06-18 09:42:55 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Corrijo detalles de reporte
1 parent
c14a4c26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
61 deletions
main.py
static/src/pdf2.js
templates/form.html
main.py
View file @
c9901f4
...
...
@@ -273,7 +273,7 @@ def gotoadmin(s, r):
r
[
'header'
][
'cp'
]
=
cp
.
get_attribute
(
"innerText"
)
.
split
(
":"
)[
1
]
.
strip
()
return
r
######################Cambio DBA ruido
def
readdata
(
s
,
r
):
reach
=
lambda
id
:
lambda
s
:
s
.
readInput
(
s
.
find
(
s
.
By
.
ID
,
id
)
)
...
...
static/src/pdf2.js
View file @
c9901f4
...
...
@@ -7,7 +7,7 @@ class PDF2 {
/** Coordinate container that occupies the whole page **/
this
.
A4
=
new
Div
(
new
Vector
(
0
,
0
),
new
Vector
(
595
,
842
)
new
Vector
(
842
,
595
)
);
this
.
containerSize
=
86
;
...
...
@@ -16,6 +16,7 @@ class PDF2 {
"type"
:
"normal"
,
"size"
:
10
};
this
.
Dominio
=
""
}
...
...
@@ -26,13 +27,15 @@ class PDF2 {
* They all return a coordinate "pointer" to draw.
*/
const
pdfthis
=
this
;
console
.
log
(
data
)
const
functionMapping
=
[
(
pointer
,
data
)
=>
pdfthis
.
headerToPDF
(
pointer
,
data
[
'header'
]),
(
pointer
,
data
)
=>
pdfthis
.
alineadorToPDF
(
pointer
,
data
[
'alineador'
]),
(
pointer
,
data
)
=>
pdfthis
.
suspensionToPDF
(
pointer
,
data
[
'suspension'
]),
(
pointer
,
data
)
=>
pdfthis
.
frenosToPDF
(
pointer
,
data
[
'frenos'
]),
(
pointer
,
data
)
=>
pdfthis
.
traseroToPDF
(
pointer
,
data
[
'trasero'
]),
(
pointer
,
data
)
=>
pdfthis
.
gaseshumosToPDF
(
pointer
,
data
[
'gaseshumos'
])
(
pointer
,
data
)
=>
pdfthis
.
gaseshumosToPDF
(
pointer
,
data
[
'gaseshumos'
]),
(
pointer
,
data
)
=>
pdfthis
.
ruidoToPDF
(
pointer
,
data
[
'gaseshumos'
])
];
/**
...
...
@@ -46,33 +49,48 @@ class PDF2 {
return
this
.
A4
;
}
todosValoresIguales
(
obj
)
{
// Obtener todos los valores del objeto en un array
const
valores
=
Object
.
values
(
obj
);
// Verificar si todos los valores son iguales
for
(
let
i
=
1
;
i
<
valores
.
length
;
i
++
)
{
if
(
valores
[
i
]
!==
valores
[
0
])
{
return
true
;
// Al menos un valor es diferente
}
}
return
false
;
// Todos los valores son iguales
}
headerToPDF
(
pointer
,
data
)
{
const
header
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
header
.
addRelativeChildren
([
new
Text
(
"Dominio: "
+
data
[
'patente'
],
new
Vector
(
Pos
.
beg_margin
,
Pos
.
third
),
this
.
font
),
new
Text
(
"Ingeniero: "
+
data
[
'ingeniero'
],
new
Vector
(
Pos
.
quarter
+
4
,
Pos
.
third
),
this
.
font
),
new
Text
(
"Fecha y hora "
+
data
[
'fecha'
]
+
" "
+
data
[
'hora'
],
new
Vector
(
Pos
.
third
+
30
,
Pos
.
third
),
this
.
font
)
]);
//
const header = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
this
.
Dominio
=
data
[
'patente'
].
toUpperCase
()
//
header.addRelativeChildren([
//
new Text("Dominio: " + data['patente'], new Vector(Pos.beg_margin , Pos.third), this.font),
//
new Text("Ingeniero: " + data['ingeniero'], new Vector(Pos.quarter + 4, Pos.third), this.font),
//
new Text("Fecha y hora " + data['fecha'] + " " + data['hora'], new Vector(Pos.third + 30, Pos.third), this.font)
//
]);
return
pointer
.
addxy
(
0
,
3
);
//return pointer.addxy(0, 3);
return
pointer
}
alineadorToPDF
(
pointer
,
data
)
{
const
alineador
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
,
new
Vector
(
Pos
.
end
,
5
)));
//
const alineador = this.A4.addRelativeChild(new Div(pointer, new Vector(Pos.end, 5)));
alineador
.
addRelativeChildren
([
new
Text
(
"Resultado Pruebas en Banco de Alineador al Paso"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
third
),
this
.
font
),
//
alineador.addRelativeChildren([
//
new Text("Resultado Pruebas en Banco de Alineador al Paso", new Vector(Pos.beg_margin + 2, Pos.third), this.font),
new
Text
(
"Eje Delantero"
,
new
Vector
(
Pos
.
beg_margin
+
2
,
Pos
.
two_thirds
),
this
.
font
),
//
new Text("Eje Delantero", new Vector(Pos.beg_margin + 2, Pos.two_thirds), this.font),
new
Text
(
data
[
'eje_delantero'
],
new
Vector
(
Pos
.
quarter
,
Pos
.
two_thirds
),
this
.
font
)
]);
//
new Text(data['eje_delantero'], new Vector(Pos.quarter, Pos.two_thirds), this.font)
//
]);
return
pointer
.
addxy
(
0
,
5
);
//return pointer.addxy(0, 5);
return
pointer
}
suspensionToPDF
(
pointer
,
data
)
{
...
...
@@ -87,9 +105,9 @@ class PDF2 {
]);
const
table
=
(
container
,
eje
,
RI
,
peso
,
RD
)
=>
{
container
.
addRelativeChildren
([
new
Text
(
`Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
`
${
this
.
Dominio
}
-
Resultado Pruebas en Banco de Suspensión - Eje
${
eje
}
`
,
new
Vector
(
0
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Rendimiento Izquierdo"
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
),
this
.
font
),
...
...
@@ -133,38 +151,30 @@ class PDF2 {
const
table
=
(
container
,
eje
,
FI
,
RI
,
OI
,
peso
,
FD
,
RD
,
OD
)
=>
{
container
.
addRelativeChildren
([
new
Text
(
`Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
FI
}
`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
),
this
.
font
),
new
Text
(
`
${
RI
}
`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
`
${
OI
}
`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
peso
}
`
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
FD
}
`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
),
this
.
font
),
new
Text
(
`
${
RD
}
`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
`
${
OD
}
`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
)
]);
if
(
FI
===
RI
===
OI
===
peso
===
FD
===
RD
===
OD
)
{
console
.
log
(
eje
)
}
else
{
container
.
addRelativeChildren
([
new
Text
(
`
${
this
.
Dominio
}
- Diagnóstico de Frenos - Eje
${
eje
}
`
,
new
Vector
(
Pos
.
beg
,
Pos
.
beg_margin
+
10
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
FI
}
KN`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Res.Rodadura IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
middle
),
this
.
font
),
new
Text
(
`
${
RI
}
Kg`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Ovalidad IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
`
${
OI
}
`
,
new
Vector
(
Pos
.
beg_margin
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
),
new
Text
(
"Peso del Eje"
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
middle
),
this
.
font
),
new
Text
(
`
${
peso
}
Kg`
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Diferencia "
,
new
Vector
(
Pos
.
middle
-
10
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
peso
}
%`
,
new
Vector
(
Pos
.
middle
-
5
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Fuerza DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
quarter
),
this
.
font
),
new
Text
(
`
${
FD
}
KN`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
quarter
+
10
),
this
.
font
),
new
Text
(
"Res.Rodadura DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
middle
),
this
.
font
),
new
Text
(
`
${
RD
}
Kg`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
middle
+
10
),
this
.
font
),
new
Text
(
"Ovalidad DE"
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
three_quarters
),
this
.
font
),
new
Text
(
`
${
OD
}
`
,
new
Vector
(
Pos
.
three_quarters
+
3
,
Pos
.
three_quarters
+
10
),
this
.
font
)
]);
}
};
for
(
let
i
=
0
;
i
<
ejes
.
length
;
i
++
)
{
...
...
@@ -190,7 +200,7 @@ class PDF2 {
trasero
.
addRelativeChildren
([
new
Text
(
"Diagnóstico de Frenos - Eje Trasero - Frenos de Mano"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
`
${
this
.
Dominio
}
- Diagnóstico de Frenos - Eje Trasero - Frenos de Mano`
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
,
),
this
.
font
),
new
Text
(
"Fuerza IZ"
,
new
Vector
(
Pos
.
beg_margin
,
Pos
.
two_thirds
),
this
.
font
),
...
...
@@ -211,9 +221,9 @@ class PDF2 {
gaseshumos
.
addRelativeChildren
([
new
Text
(
"Resultado Analizador de Gases"
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
),
this
.
font
),
new
Text
(
`
${
this
.
Dominio
}
- Resultado Analizador de Gases`
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
),
this
.
font
),
new
Text
(
"Resultado Analizador de Humos"
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
),
this
.
font
),
new
Text
(
`
${
this
.
Dominio
}
- Resultado Analizador de Humos`
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
),
this
.
font
),
new
Text
(
`CO
${
data
[
'co'
]}
% HC
${
data
[
'hc'
]}
ppm`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
),
this
.
font
),
...
...
@@ -223,4 +233,25 @@ class PDF2 {
return
pointer
.
addxy
(
0
,
9
);
}
ruidoToPDF
(
pointer
,
data
)
{
const
gaseshumos
=
this
.
A4
.
addRelativeChild
(
new
Div
(
pointer
.
addxy
(
Pos
.
beg_margin
+
2
,
0
),
new
Vector
(
this
.
containerSize
,
9
)));
gaseshumos
.
addRelativeChildren
([
new
Text
(
`
${
this
.
Dominio
}
- Resultado Analizador Ruido`
,
new
Vector
(
Pos
.
beg
,
Pos
.
third
),
this
.
font
),
new
Text
(
""
,
new
Vector
(
Pos
.
two_thirds
,
Pos
.
third
),
this
.
font
),
new
Text
(
`
${
data
[
'co'
]}
dba`
,
new
Vector
(
Pos
.
beg
,
Pos
.
two_thirds
),
this
.
font
),
new
Text
(
""
,
new
Vector
(
Pos
.
three_quarters
,
Pos
.
two_thirds
),
this
.
font
)
]);
return
pointer
.
addxy
(
0
,
9
);
}
}
\ No newline at end of file
templates/form.html
View file @
c9901f4
<html
lang=
"en"
>
<html
lang=
"es"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
...
...
@@ -11,8 +12,9 @@
<script
src=
"{{ url_for('static', filename = 'src/pdf3.js') }}"
></script>
<script
src=
"{{ url_for('static', filename = 'src/forms.js') }}"
></script>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename = 'styles/general.css') }}"
>
<!--INCLUIMOS LA FUENTE
-->
<!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>
Pruebas de Alineamiento
</title>
</head>
<body>
...
...
@@ -98,9 +100,9 @@
Eficacia estic.
<input
sub=
"frenos"
type=
"text"
id=
"rf_servicio_eficacia_estatica"
name=
"rf_servicio_eficacia_estatica"
value=
"---"
>
<br>
<h1>
Freno Estacionamiento
</h1>
Fuerza Izquierda
<input
sub=
"trasero"
type=
"text"
name=
"fuerza_izquierda"
id=
"fuerza_izquierda_freno_mano"
>
Fuerza Izquierda
<input
sub=
"trasero"
type=
"text"
name=
"fuerza_izquierda"
id=
"
2
fuerza_izquierda_freno_mano"
>
<br>
Fuerza Derecha
<input
sub=
"trasero"
type=
"text"
name=
"fuerza_derecha"
id=
"fuerza_derecha_freno_mano"
>
Fuerza Derecha
<input
sub=
"trasero"
type=
"text"
name=
"fuerza_derecha"
id=
"
2
fuerza_derecha_freno_mano"
>
<br>
Diferencia
<input
sub=
"frenos"
type=
"text"
id=
"diferencia_freno_mano"
name=
"diferencia_freno_mano"
value=
"---"
readonly
>
<br>
...
...
@@ -125,6 +127,9 @@
<br>
HC
<input
sub=
"gaseshumos"
type=
"text"
name=
"hc"
>
<br>
<h1>
Ruido
</h1>
dbA
<input
sub=
"ruido"
type=
"text"
name=
"ruido_dba"
id=
"ruido_dba_id"
>
<br>
<br>
<br>
Por defecto:
<input
type=
"text"
name=
"defecto"
value=
"---"
>
...
...
@@ -136,7 +141,7 @@
"window.open(
compile(
(new PDF2()).pdf( collectToConvert() ),
new jsPDF('
portrait
', 'pt', 'a4')
new jsPDF('
landscape
', 'pt', 'a4')
)
.output('bloburl')
)"
;
...
...
@@ -219,7 +224,7 @@
<span
class =
"X"
>
x
<span>
</div>
</div>
<
script
src=
"{{ url_for('static', filename = 'src/report.js') }}"
></script
>
<
!--<script src="{{ url_for('static', filename = 'src/report.js') }}"></script>--
>
</body>
</html>
\ No newline at end of file
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