Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/DragonesMagicos/ferromax_v0.8/llms.txt

Use this file to discover all available pages before exploring further.

Ferromax ERP provides three distinct ways to change stock levels: direct goods receipt for quick single-item additions, the two-step remito workflow for multi-item supplier deliveries, and manual stock adjustments for corrections and write-offs. Every operation — regardless of which path is used — creates a MovimientoStock audit record so that the full history of every SKU is always traceable.

Direct Goods Receipt

The simplest way to add stock is a direct receipt, available at /recepcion. An ADMIN or EMPLEADO can register the arrival of a single product immediately, with no approval step required. Endpoint:
POST /api/recepcion
Authorization: Bearer <jwt>
Content-Type: application/json
The RecepcionRequest body:
{
  "productoId": 42,
  "cantidad": 10,
  "notas": "Remito N° 1234, proveedor EPSA"
}
FieldTypeRequiredDescription
productoIdLongInternal product ID
cantidadIntegerUnits to add to stock
notasStringFree-text note, max 500 chars (e.g. remito number)
On success the endpoint returns a RecepcionResponse (201 Created) with the product name, SKU, units received, previous stock, and new stock. The RecepcionPage.jsx UI shows these values in a confirmation panel with a “Recibir otro producto” button. The backend records the receiving employee’s ID from the JWT (empleadoId) so every receipt is attributed to its operator.

Remito Workflow

For multi-item supplier deliveries that require admin review before stock is updated, use the remito (delivery note) workflow, available at /remitos.
1

Employee creates a remito

Any ADMIN or EMPLEADO opens the Remitos page and creates a new remito. The frontend sends:
POST /api/recepciones-remito
Authorization: Bearer <jwt>
Content-Type: application/json
RecepcionRemitoRequest body:
{
  "proveedorId": 5,
  "numeroRemito": "R-00042",
  "notas": "Entrega parcial, faltan 3 ítems"
}
FieldTypeRequiredDescription
proveedorIdLongInternal supplier ID
numeroRemitoStringDelivery-note number from the supplier (max 100 chars)
notasStringFree-text note (max 500 chars)
The remito header is saved with status PENDIENTE. Individual product lines are linked to this remito later by including the returned id as recepcionRemitoId in each POST /api/recepcion call. The employee can view their own submitted remitos at GET /api/recepciones-remito/mis-recepciones.
2

Admin reviews pending remitos

An admin fetches all unconfirmed remitos:
GET /api/recepciones-remito/pendientes
Each row in RemitosPage.jsx shows the supplier name, remito number, creation date, employee who submitted it, item count, and an expandable item list. A Revisar button opens a modal with full item detail and optional admin notes.
3

Admin confirms or rejects

From the review modal the admin sends:
PATCH /api/recepciones-remito/{id}/confirmar
Authorization: Bearer <jwt>
Content-Type: application/json
{
  "aprobar": true,
  "notasAdmin": "Quantities verified against physical delivery"
}
Set aprobar: false to reject. The admin’s ID is extracted from the JWT and stored on the record.
4

Stock updates on confirmation

When aprobar: true, the service iterates over every item in the remito and increases the product’s stockActual by the specified quantity. A MovimientoStock record is created for each product, and if the new stock no longer triggers a low-stock threshold the associated AlertaStock is cleared. The remito status is updated to CONFIRMADO.
The full remito list (all statuses) is available at GET /api/recepciones-remito. Admins can also retrieve a single remito by ID at GET /api/recepciones-remito/{id}.

Manual Stock Adjustment

When stock needs to be corrected without a supplier receipt — inventory count discrepancies, breakage, theft, or returns — admins use the manual adjustment page at /ajuste-stock. Endpoint:
POST /api/ajustes-stock
Authorization: Bearer <jwt>  (ADMIN only)
Content-Type: application/json
AjusteStockRequest body:
public record AjusteStockRequest(
    Long    productoId,  // target product
    Integer cantidad,    // positive = stock increase, negative = decrease
    String  motivo       // required, max 500 chars
) {}
{
  "productoId": 17,
  "cantidad": -3,
  "motivo": "Inventory count discrepancy — 3 units unaccounted for"
}
The AjusteStockPage.jsx UI presents a product search field, toggle buttons for Entrada (+) and Salida (−), a quantity input, and a motivo textarea. It previews the resulting stock level before submission and blocks the request if the result would go negative. Adjustment history is paginated and available at:
GET /api/ajustes-stock?page=0&size=50
The response is a Spring Page<AjusteStockResponse> with fields including movimientoId, nombreProducto, sku, cantidad, stockAnterior, stockNuevo, motivo, fecha, and nombreAdmin.
Manual adjustments are irreversible. There is no undo operation — once confirmed, the quantity delta is written to the product’s stockActual and a MovimientoStock record is created. Always verify the product, direction (+ or −), and quantity before clicking Registrar ajuste.

Stock Alerts

Ferromax ERP automatically generates an AlertaStock record whenever a product’s stock falls at or below its configured stockMinimo threshold. This happens during:
  • A completed sale (via the POS or Tienda checkout)
  • A manual stock adjustment with a negative delta
Admins see unread alerts in the dashboard’s AlertaStockPanel. The count of products below their minimum is also surfaced in the productosStockCritico KPI card (DashboardDTO). A WebSocket event is broadcast to /topic/stock-update whenever a low-stock condition is triggered or resolved, so the dashboard panel updates in real time without a page refresh.

Movement Audit Trail

Every stock change in the system — regardless of origin — creates a MovimientoStock record with the following information:
FieldDescription
timestampOffsetDateTime of the change (Argentina TZ)
tipoMovimientoTipoMovimientoEnum — e.g. VENTA, RECEPCION, AJUSTE
cantidadSigned integer delta (positive = increase, negative = decrease)
stockAnteriorStock level before the change
stockNuevoStock level after the change
usuarioIdID of the user (cashier, employee, or admin) who triggered it
This trail provides a complete, tamper-resistant history for every SKU and is the source of truth for stock discrepancy investigations.

Build docs developers (and LLMs) love