Inventory Counts
Inventory counts (stock validation) with two-phase finalisation.
📄️ Get inventory count by ID
Returns a single inventory count, including line detail (counted vs calculated quantities) and references to the generated stock adjustments when finalised. The response carries a strong `ETag` header with the current version.
📄️ Update inventory count (DRAFT only)
Replaces the editable fields of a DRAFT inventory count. The `warehouseId` cannot be changed; if `lines` is supplied, the line set is fully replaced and the calculated quantities are recomputed against the current stock. Send the `If-Match` header with the current ETag for optimistic concurrency control.
📄️ Delete inventory count (DRAFT only)
Deletes a DRAFT inventory count. A FINALIZED count cannot be deleted; create a compensating `inventory-entry`/`inventory-exit` instead.
📄️ List inventory counts
Returns a paginated list of inventory counts. Combine with `filter=stockBalanced==true` (or `false`) to narrow by lifecycle status.
📄️ Create inventory count
Creates a draft inventory count. The server runs the `agruparYCalcularDiferencias` step and returns the computed differences without moving stock. Set `finalize=true` to commit the count immediately in the same transaction (requires `CUADRAR_STOCK`).
📄️ Finalize inventory count
Confirms a DRAFT inventory count and generates the resulting stock adjustments (entry for positive deltas, exit for negative ones). Returns the count with `status = FINALIZED` and the populated `stockAdjustments` references. Idempotency is explicit: calling finalize on an already FINALIZED count returns 409.