This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user