Overview
Retrieve scrap records grouped by production chain (cadena) to analyze which production lines are generating the most waste.
Authentication
Requires valid JWT token with view_area_reports or view_global_reports permission.
Authorization: Bearer <token>
Query Parameters
Start date filter (YYYY-MM-DD format or ISO datetime)
End date filter (YYYY-MM-DD format or ISO datetime)
Request Example
curl -X GET "http://localhost:3001/api/reports/by-cadena?fecha_inicio=2024-03-01&fecha_fin=2024-03-31" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
Returns an array of chain statistics ordered by cost (descending).
Production chain identifier (CADENA value)
Total scrap quantity for this chain
Total scrap cost for this chain
Response Example
[
{
"name": "GNT1",
"cantidad": 350,
"costo": 12450.75
},
{
"name": "HNS2",
"cantidad": 290,
"costo": 10230.50
},
{
"name": "WC3",
"cantidad": 245,
"costo": 8975.25
}
]
By Area
Scrap aggregated by area
By Shift
Scrap aggregated by shift