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.

While a Technical Reception captures the shipment-level compliance checklist, a tank technical review is the per-unit decision that determines whether each individual cylinder is cleared for active inventory or quarantined for return. Every cylinder that arrived under a given document number must pass through this step before it can be dispatched to a patient or facility. Reviews are always performed in the context of the parent TechnicalReception record, ensuring a clear audit trail linking each cylinder’s outcome back to the formal reception form.

Overview

Tank reviews are accessed at:
GET /technical-receptions/{technicalReception}/tank-reviews
The page displays all TankUnit records whose associated batch shares the same document_number as the reception — not just tanks from a single batch, but every cylinder that arrived under that order. Alongside the paginated tank list (50 per page, ordered by serial number), the view exposes a live summary of the review state:
KeyDescription
totalTotal number of tank units under this document number
pendingUnits with technical_status = Pendiente
approvedUnits with technical_status = Aprobado
rejectedUnits with technical_status = Rechazado
reviewedapproved + rejected (units that have received a decision)
progressround((reviewed / total) × 100) — percentage complete

Review actions

All review operations post to:
POST /technical-receptions/{technicalReception}/tank-reviews/process
The action field controls which operation is performed.
Mark one or more specific cylinders as approved.
action
string
required
Must be approve.
tank_ids[]
array
required
Array of UUIDs identifying the tank units to approve. At least one ID is required. Every ID must exist in the tank_units table and must belong to a batch whose document_number matches the reception.
What happens on approval:For each selected tank unit, inside a single DB::transaction:
  1. technical_status_id is updated to the Aprobado catalog entry.
  2. warehouse_area_id is updated to the Productos aprobados area.
  3. A TankTechnicalReview record is created with result = approved.
  4. An InventoryMovement of type CAMBIO_ESTADO_TECNICO is recorded, capturing the previous area, the new area, the document number as reference_document, and a human-readable note: "Revisión técnica aprobada. Estado técnico: {previous} → Aprobado.".
On success, the user is redirected back to the tank reviews index with a count message, e.g. "2 tanque(s) aprobado(s) y trasladado(s) al área de Productos aprobados.".

TankTechnicalReview record

Every approval or rejection creates exactly one TankTechnicalReview row. The table schema is:
FieldTypeNotes
tank_unit_idUUIDForeign key → tank_units.id, cascades on delete
technical_reception_idbigintForeign key → technical_receptions.id, set null on delete
resultstring(20)approved or rejected
anomaly_typestring(120)Populated only on rejections
observationtextOptional extended notes; populated only on rejections
reviewed_by_user_emailstring(150)Email of the authenticated user who performed the review
reviewed_atdatetimeTimestamp of the review decision
The model exposes two convenience methods:
$review->isApproved(); // true when result === 'approved'
$review->isRejected(); // true when result === 'rejected'
A TankUnit can have multiple TankTechnicalReview records over its lifetime (e.g. rejected, returned to supplier, received again under a new document number), but within a single reception each unit is reviewed exactly once.

Filtering the review list

GET /technical-receptions/{technicalReception}/tank-reviews
serial
string
Partial match on the cylinder’s serial field. Performs a LIKE "%{serial}%" search.
status
string
Filter by current technical status name. Accepted values: Pendiente, Aprobado, Rechazado. The filter resolves through the technicalStatus relationship, so it always reflects the current catalog values.
All query string parameters are preserved through pagination via withQueryString().
Only tanks with technical_status = Pendiente can be submitted for review. If any selected tank_id belongs to a cylinder that has already been approved or rejected, the service will throw a RuntimeException identifying the first offending serial: "El tanque {serial} ya fue revisado." The entire batch of IDs is rolled back — no partial updates occur.
The catalog entries “Aprobado”, “Rechazado” (in technical_statuses), “Productos aprobados”, and “Rechazos, devoluciones y retiro del mercado” (in warehouse_areas) must exist in the database before any review action is processed. If any of these entries is missing, the service throws a RuntimeException and the transaction is aborted. Ensure seeder data is complete before putting the review workflow into production.
All approve and reject operations — including bulk approval — are wrapped in DB::transaction(). Tank rows are fetched with lockForUpdate() before any mutation is applied, preventing concurrent requests from reviewing the same cylinder simultaneously. If two users attempt to review the same tank at the same moment, the second request will either block until the first commits or fail with a database-level lock error, ensuring data integrity is never compromised.

Build docs developers (and LLMs) love