veamo
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m6s

This commit is contained in:
2025-11-22 01:10:37 -06:00
parent 2500cb1181
commit 0bdb5013f7
6 changed files with 254 additions and 4 deletions

View File

@@ -134,7 +134,8 @@ RETURNS TABLE (
cantidad_kg NUMERIC,
operacion_id UUID,
operacion_tipo TEXT,
profundidad INTEGER
profundidad INTEGER,
parent_lote_id UUID
) AS $$
BEGIN
RETURN QUERY
@@ -147,7 +148,8 @@ BEGIN
l.cantidad_kg,
ol.operacion_id,
o.tipo AS operacion_tipo,
0 AS profundidad
0 AS profundidad,
NULL::UUID AS parent_lote_id
FROM lotes l
LEFT JOIN operacion_lotes ol ON ol.lote_id = l.id AND ol.rol = 'output'
LEFT JOIN operaciones o ON o.id = ol.operacion_id
@@ -163,7 +165,8 @@ BEGIN
l2.cantidad_kg,
ol2.operacion_id,
o2.tipo AS operacion_tipo,
t.profundidad + 1
t.profundidad + 1,
t.lote_id AS parent_lote_id
FROM trazabilidad t
JOIN operacion_lotes ol_in
ON ol_in.operacion_id = t.operacion_id