Skip to main content

Overview

The Movements entity (Movimientos Técnicos) tracks all spare part transactions including entries, exits, sales, warranties, loans, and returns. Each movement represents a change in inventory.

MovimientoTecnico

Complete technical movement record with all related data.

Properties

id_movimientos_tecnicos
string
required
Unique identifier for the technical movement
id_localizacion
string
required
Location ID where the movement occurred
id_repuesto
string
required
Spare part involved in the movement
id_usuario_responsable
string
required
User ID of the person responsible for the movement
id_tecnico_asignado
string
required
Technician ID assigned to the movement
concepto
ConceptoMovimiento
required
Movement concept: 'salida' | 'ingreso' | 'venta' | 'garantia' | 'prestamo' | 'cotizacion' | 'devolucion'
tipo
TipoMovimiento
required
Movement type: 'ingreso' (entry) | 'salida' (exit) | 'venta' (sale)
cantidad
number
required
Quantity of spare parts in the movement
fecha
string
required
Movement timestamp (ISO 8601 format)
numero_orden
number
required
Associated work order number
descargada
boolean
required
Whether the movement has been downloaded/processed
created_at
string
required
Record creation timestamp
update_at
string
required
Last update timestamp
referencia
string
required
Spare part reference code
nombre_repuesto
string
required
Name of the spare part
url_imagen
string
required
URL to the spare part image
nombre_localizacion
string
required
Name of the location
nombre_responsable
string
required
Name of the responsible user
nombre_tecnico
string
required
Name of the assigned technician

Example

{
  "id_movimientos_tecnicos": "MOV-550e8400-e29b",
  "id_localizacion": "LOC-003",
  "id_repuesto": "RP-98765",
  "id_usuario_responsable": "USR-123",
  "id_tecnico_asignado": "TEC-456",
  "concepto": "salida",
  "tipo": "salida",
  "cantidad": 2,
  "fecha": "2026-03-04T11:30:00Z",
  "numero_orden": 2024567,
  "descargada": false,
  "created_at": "2026-03-04T11:30:15Z",
  "update_at": "2026-03-04T11:30:15Z",
  "referencia": "BRK-PAD-XL",
  "nombre_repuesto": "Brake Pad Set - Heavy Duty",
  "url_imagen": "https://example.com/images/brake-pad.jpg",
  "nombre_localizacion": "Taller Central",
  "nombre_responsable": "Ana Jiménez",
  "nombre_tecnico": "Roberto Díaz"
}

TipoMovimiento

Defines the direction of inventory change.
type TipoMovimiento = 'ingreso' | 'salida' | 'venta';
  • ingreso - Parts entering inventory (increases stock)
  • salida - Parts leaving inventory (decreases stock)
  • venta - Parts sold (decreases stock, generates revenue)

ConceptoMovimiento

Defines the reason or context for the movement.
type ConceptoMovimiento = 
  | 'salida'      // General exit
  | 'ingreso'     // General entry
  | 'venta'       // Sale transaction
  | 'garantia'    // Warranty claim
  | 'prestamo'    // Loan/temporary transfer
  | 'cotizacion'  // Quote/estimate
  | 'devolucion'; // Return

MovimientoEdicion

Simplified structure for editing movements, containing only editable fields.

Properties

id_movimientos_tecnicos
string
required
Movement identifier
id_repuesto
string
required
Spare part ID
repuesto_referencia
string
required
Part reference code
repuesto_nombre
string
required
Part name
id_tecnico_asignado
string
required
Assigned technician ID
tipo
TipoMovimiento
required
Movement type
concepto
ConceptoMovimiento
required
Movement concept
cantidad
number
required
Quantity
numero_orden
number
required
Work order number

TechnicalMovement

Alternative movement structure used in some parts of the application.

Properties

repuestos
SparePart[]
required
Array of spare parts involved in the movement
id_localizacion
string
Location ID
id_usuario_responsable
string
Responsible user ID
id_tecnico_asignado
string | null
Assigned technician ID
concepto
string
Movement concept
tipo
string
Movement type
numero_orden
string | null
Work order number (as string)
descargada
boolean
Downloaded status

MovementFilters

Filter parameters for querying movements.

Properties

page
number
required
Page number for pagination
pageSize
number
required
Number of items per page
technicianId
string
Filter by technician ID
startDate
string
Filter movements from this date (ISO 8601 format)
endDate
string
Filter movements until this date (ISO 8601 format)
orderNumber
string
Filter by work order number
concept
string
Filter by movement concept
downloaded
string
Filter by downloaded status (“true”, “false”, or “all”)

API Methods

getListMovements

Fetches paginated list of movements with comprehensive filtering.
import { getListMovements } from '@/entities/movimientos/api';

const result = await getListMovements({
  page: 1,
  pageSize: 20,
  technicianId: 'TEC-456',
  startDate: '2026-03-01',
  endDate: '2026-03-04',
  orderNumber: '2024',
  concept: 'salida',
  downloaded: 'false'
});

console.log(result.data); // Array of movements
console.log(result.count); // Total count
Source: src/entities/movimientos/api/index.ts:5 Query Details:
  • View: v_movimientos_detallados
  • Filter: Current user’s location
  • Ordering: fecha descending (newest first)
  • Pagination: Range-based with from/to offsets

Filtering Examples

// Get all movements for a specific technician
const techMovements = await getListMovements({
  page: 1,
  pageSize: 50,
  technicianId: 'TEC-789'
});

// Get warranty movements for last month
const lastMonth = new Date();
lastMonth.setMonth(lastMonth.getMonth() - 1);
const warranties = await getListMovements({
  page: 1,
  pageSize: 100,
  concept: 'garantia',
  startDate: lastMonth.toISOString().split('T')[0],
  endDate: new Date().toISOString().split('T')[0]
});

// Get undownloaded exits by order number
const pendingExits = await getListMovements({
  page: 1,
  pageSize: 25,
  concept: 'salida',
  downloaded: 'false',
  orderNumber: 'WO-2026'
});

Movement Concepts Explained

Salida (Exit)

Parts leaving inventory for general purposes, reducing stock.

Ingreso (Entry)

Parts entering inventory from suppliers or returns, increasing stock.

Venta (Sale)

Parts sold to customers, with revenue tracking.

Garantía (Warranty)

Defective parts being replaced under warranty claim.

Préstamo (Loan)

Temporary transfer to another location or technician.

Cotización (Quote)

Parts allocated for customer quote/estimate.

Devolución (Return)

Parts returned to inventory (from loan, unused from job, etc.).

Relationships

  • References: Spare Part via id_repuesto
  • Belongs to: Location via id_localizacion
  • Assigned to: User via id_usuario_responsable
  • Performed by: User via id_tecnico_asignado
  • Updates: Inventory stock levels
  • Created by: Requests when fulfilled
  • Created by: Guarantees when resolved

Build docs developers (and LLMs) love