Overview
The Parts Catalog (Catálogo de Números de Parte - CatNP) stores part information including cost per unit, weight, and descriptions. This data is used for automatic cost calculation when registering scrap.
When scanning a barcode, the system automatically looks up the part in this catalog and fills in Material, Weight, and Cost fields.
Endpoints
List All Parts
GET - List All
GET - Get by ID
curl -X GET http://localhost:3001/api/catalogs/catnp \
-H "Authorization: Bearer YOUR_TOKEN"
Create Part
curl -X POST http://localhost:3001/api/catalogs/catnp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"NP": "12345678",
"MATERIAL": "Conector A1 - 16 Pines",
"PESO": 0.25,
"COSTO": 2.45,
"TIPO": "Conector",
"DESCRIPCION": "Conector automotriz resistente al calor",
"activo": 1
}'
Update Part
curl -X PUT http://localhost:3001/api/catalogs/catnp/1 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"COSTO": 2.75}'
Delete Part (Soft)
curl -X DELETE http://localhost:3001/api/catalogs/catnp/1 \
-H "Authorization: Bearer YOUR_TOKEN"
Data Structure
Part number (typically 8-12 digits)
Material or part description
Weight per unit in kilograms
Part type or category (e.g., “Conector”, “Arnés”, “Terminal”)
Status: 1 = active, 0 = inactive
Response Example
[
{
"ID" : 1 ,
"NP" : "12345678" ,
"MATERIAL" : "Conector A1 - 16 Pines" ,
"PESO" : 0.25 ,
"COSTO" : 2.45 ,
"TIPO" : "Conector" ,
"DESCRIPCION" : "Conector automotriz resistente al calor" ,
"activo" : 1
},
{
"ID" : 2 ,
"NP" : "87654321" ,
"MATERIAL" : "Arnés Principal 2.5m" ,
"PESO" : 1.2 ,
"COSTO" : 15.75 ,
"TIPO" : "Arnés" ,
"DESCRIPCION" : "Arnés principal con 24 circuitos" ,
"activo" : 1
}
]
TypeScript Interface
export interface CatNP {
ID : number ;
NP : string ;
MATERIAL : string ;
PESO : number ;
COSTO : number ;
TIPO ?: string ;
DESCRIPCION ?: string ;
activo : number ;
}
Barcode Scanner Integration
When a barcode is scanned in the scrap registration form, the system:
Searches for the part number in the CatNP catalog
If found, auto-fills:
MATERIAL field with the part description
PESO field with the unit weight
COSTO field with the unit cost
The user then enters the quantity to calculate total cost
Cost Calculation: Total cost = Unit cost (COSTO) × Quantity (TOTAL_PZAS)
Permissions
View All authenticated users
Create/Edit admin, calidad roles only
Import/Export
Parts can be imported in bulk via CSV upload. The CSV should have columns: NP, MATERIAL, PESO, COSTO, TIPO, DESCRIPCION
Common Use Cases
Search for Part by Number
const findPartByNumber = ( partNumber , catalog ) => {
return catalog . find ( part =>
part . NP === partNumber && part . activo === 1
);
};
// Usage
const scannedPart = findPartByNumber ( '12345678' , catnpCatalog );
if ( scannedPart ) {
form . setValues ({
MATERIAL: scannedPart . MATERIAL ,
PESO: scannedPart . PESO ,
COSTO: scannedPart . COSTO
});
}
Calculate Total Cost
const calculateTotalCost = ( partCost , quantity ) => {
return parseFloat ( partCost ) * parseInt ( quantity );
};
// Usage
const unitCost = 2.45 ; // from catalog
const quantity = 150 ; // from user input
const totalCost = calculateTotalCost ( unitCost , quantity ); // 367.50