Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Janblack07/OxygenDispatch/llms.txt

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

Batches are the entry point for all medical gas cylinders in OxygenDispatch. When a supplier delivers a shipment of cylinders, you create a batch to record the event — capturing the supplier identity, voucher documents, sanitary data, and the date cylinders were received. All individual tank units in the system trace back to the batch they arrived in, making batches the root of the full inventory audit trail.

What is a batch?

A batch represents a single supplier shipment. It is the parent record for every tank unit generated from that delivery. The following data is held at the batch level:
FieldDescription
batch_numberA unique identifier for this shipment (e.g. LOTE-2026-001)
document_numberThe order number, delivery note, or remission document for this shipment
supplier_nameThe name of the supplying company
supplier_codeThe supplier’s internal or registry code
voucher_typeThe type of fiscal voucher (e.g. invoice, note)
voucher_numberThe number printed on the fiscal voucher
voucher_dateThe date the voucher was issued
received_atThe date and time the batch was physically received
sanitary_registryA reference sanitary registry code for this shipment
manufactured_atThe manufacture date recorded on the delivery
notesFree-text notes about this shipment (no length limit)
expires_atThe expiry date recorded at the batch level
A batch may optionally reference a gas_type and a capacity as referential catalog links. Actual gas type and capacity on individual cylinders are determined by the product selected when generating tanks.

Creating a batch

Submit a POST /batches request using the form fields below. All nullable fields are optional — you can register a minimal batch with only batch_number and received_at and fill in the rest later via PUT /batches/{batch}.
batch_number
string
required
A unique human-readable identifier for this batch. Maximum 100 characters. Must not already exist in the batches table.
received_at
date
required
The date (or date-time) the shipment was received at the facility. Accepts any format parseable by PHP’s strtotime.
gas_type_id
integer
Optional reference to a gas type catalog entry (gas_types.id). Used for filtering and reporting at the batch level.
capacity_id
integer
Optional reference to a cylinder capacity catalog entry (cylinder_capacities.id).
notes
string
Free-text notes about this shipment — inspection observations, delivery conditions, or any other contextual information. No maximum length enforced.
document_number
string
The delivery note, order, or remission number. Maximum 100 characters.
supplier_name
string
Full legal name of the supplying company. Maximum 200 characters.
supplier_code
string
The supplier’s internal or government-issued code. Maximum 100 characters.
voucher_type
string
Type of fiscal voucher accompanying the shipment (e.g. Factura, Boleta, Guía). Maximum 50 characters.
voucher_number
string
The number printed on the fiscal voucher. Maximum 100 characters.
voucher_date
date
The date the voucher was issued.
sanitary_registry
string
Sanitary registry reference code for this shipment. Maximum 100 characters.
manufactured_at
date
Manufacture date as recorded on the delivery documentation.
expires_at
date
Batch-level expiry date. Individual tank units each carry their own expires_at set at generation time.
On success, you are redirected to GET /batches/{batch} — the batch detail page.

Generating tank units

Once a batch is created, you can generate the individual cylinder records that belong to it. Submit a POST /batches/{batch}/generate-tanks request to bulk-create serialized tank units.
quantity
integer
required
Number of tanks to generate. Must be between 1 and 5000 inclusive.
product_id
integer
required
The catalog product (catalog_products.id) each generated tank will be linked to. Gas type and capacity are resolved from the product — not entered separately.
expires_at
date
required
Expiry date to assign to every generated tank unit. Must be today or a future date and must not exceed 50 years from today.
serial_prefix
string
A short alphanumeric prefix for the serial numbers. Maximum 10 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed (regex ^[A-Za-z0-9_-]+$). Defaults to OXI if omitted.

Serial number format

Each generated tank receives a serial number composed of the prefix and a zero-padded 6-digit counter, separated by a hyphen:
PREFIX-000001
PREFIX-000002
PREFIX-000003
For example, with the default prefix OXI:
OXI-000001
OXI-000002
OXI-000003
The counter is derived from the highest existing serial_number for that prefix in the database, incremented inside a database transaction with lockForUpdate() to prevent duplicate serials under concurrent requests.

Fixed initial state

Regardless of any other data, every tank generated through this endpoint is always placed into the following initial state:
AttributeFixed value
warehouse_areaRecepción
technical_statusPendiente
These values are resolved by the server at generation time. They cannot be overridden from the form. Each new tank also receives an ENTRADA inventory movement automatically.
The warehouse area named exactly “Recepción” and the technical status named exactly “Pendiente” must exist in their respective catalogs before you attempt to generate tanks. If either is missing, the entire batch generation will be aborted and an error message will be returned. Create both entries in the catalog settings before your first intake.

Filtering and searching batches

The batch list at GET /batches supports the following query string parameters to narrow results. All filters are combinable and are applied with AND logic. Results are paginated at 15 per page.
ParameterTypeBehaviour
qstringPartial match on batch_number OR document_number (case-insensitive LIKE)
gas_type_idintegerExact match on the batch’s linked gas type
capacity_idintegerExact match on the batch’s linked cylinder capacity
Example:
GET /batches?q=LOTE-2026&gas_type_id=1

Batch detail page

GET /batches/{batch} loads the full detail view for a single batch, eager-loading all related data. The page displays:
  • The batch’s gas type and cylinder capacity (from catalog references)
  • All associated tank units, each showing:
    • The linked catalog product and its capacity
    • Current warehouse area
    • Current technical status
  • Quick-action forms for generating additional tanks and managing existing units
From this page you can also launch the generate-tanks form for the batch, add more cylinders to an existing batch at any time.

Build docs developers (and LLMs) love