ApiDoc BACKEND

Inventory extends Model

Table of Contents

Constants

MINUS  = 'minus'
PLUS  = 'plus'

Properties

$mat_type  : mixed
$qty  : mixed
$uuid  : mixed

Methods

checkAvailablekMaterialStock()  : mixed
Desc: Verifica disponibilidad de stock de materiales para el modelo a construir.
checkAvailableStockProducts()  : array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>
Desc: Solicita ver cómo quedaría el stock al quitar elementos de éste.
checkStock()  : mixed
comparePOListAndBuild()  : array{plus: array{uuid: string, qty: int}[], minus: array{uuid: string, qty: int}[]}
Desc: Compara el listado actual de la orden con el anterior para determinar si se agrega (suma) un elemento o se quita (resta) del stock.
comparePOListAndCheckAvailable()  : array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>
Desc: Compara el listado actual de la orden con el anterior para determinar si hay stock en existencia.
comparePOModelListAndBuild()  : mixed
comparePOModelListAndCheckAvailable()  : mixed
rules()  : array<string|int, mixed>
Desc: Reglas de validación.
scenarios()  : array<string|int, mixed>
updateMaterials()  : mixed
updateProducts()  : mixed
Desc: Actualiza el inventario en base a una lista.
sendNotification()  : bool

Constants

Properties

Methods

checkAvailablekMaterialStock()

Desc: Verifica disponibilidad de stock de materiales para el modelo a construir.

public static checkAvailablekMaterialStock(array<string|int, array{uuid: string, mat_type: string, qty: int}> $items) : mixed

Note: El array tendrá que llegar dada el tipado mencionado en el parámetro.

Parameters
$items : array<string|int, array{uuid: string, mat_type: string, qty: int}>

checkAvailableStockProducts()

Desc: Solicita ver cómo quedaría el stock al quitar elementos de éste.

public static checkAvailableStockProducts(array<string|int, Inventory$items) : array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>

Note: Regresa el resultado en un listado con las cantidades restadas pero NO guardadas. SOLO es informativa para evitar vender productos que no tienen stock.

Date: 2025-10-08, Version: v0.2509.26

Example: n/a

Parameters
$items : array<string|int, Inventory>
Tags
throws
Exception
Return values
array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>

checkStock()

public static checkStock() : mixed

comparePOListAndBuild()

Desc: Compara el listado actual de la orden con el anterior para determinar si se agrega (suma) un elemento o se quita (resta) del stock.

public static comparePOListAndBuild(array<string|int, ProductOrderDetail$currentList, array<string|int, ProductOrderDetail$prevList) : array{plus: array{uuid: string, qty: int}[], minus: array{uuid: string, qty: int}[]}

Notes: Los elementos nuevos que no aparezcan en la lista anterior se agregan al array de plus. SOLO funciona para productos.

Date: 2025-10-08, Version: v0.2509.26

Parameters
$currentList : array<string|int, ProductOrderDetail>

De la orden actual (Rev 1+)

$prevList : array<string|int, ProductOrderDetail>

De la orden anterior

Return values
array{plus: array{uuid: string, qty: int}[], minus: array{uuid: string, qty: int}[]}

comparePOListAndCheckAvailable()

Desc: Compara el listado actual de la orden con el anterior para determinar si hay stock en existencia.

public static comparePOListAndCheckAvailable(array<string|int, ProductOrderDetail$currentList, array<string|int, ProductOrderDetail$prevList) : array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>

Notes: n/a

Date: 2025-10-08, Version: v0.2509.26

Parameters
$currentList : array<string|int, ProductOrderDetail>

De la orden actual (Sin confirmar)

$prevList : array<string|int, ProductOrderDetail>

De la orden anterior

Return values
array<string|int, array{uuid: string, current_stock: int, qty: int, new_stock: int}>

comparePOModelListAndCheckAvailable()

public static comparePOModelListAndCheckAvailable(array<string|int, mixed> $currentList, array<string|int, mixed> $prevList) : mixed
Parameters
$currentList : array<string|int, mixed>
$prevList : array<string|int, mixed>

scenarios()

public scenarios() : array<string|int, mixed>
Return values
array<string|int, mixed>

updateMaterials()

public static updateMaterials(array<string|int, Inventory$items[, string $operation = self::MINUS ]) : mixed
Parameters
$items : array<string|int, Inventory>
$operation : string = self::MINUS
Tags
throws
ServerErrorHttpException

Ejecucion fallida

updateProducts()

Desc: Actualiza el inventario en base a una lista.

public static updateProducts(array<string|int, Inventory$items[, string $operation = self::MINUS ]) : mixed

Notes: Por defecto toda la lista se resta a menos que se indique en el parametro de operation que es una suma

Parameters
$items : array<string|int, Inventory>
$operation : string = self::MINUS

"minus" or "plus"

Tags
throws
ServerErrorHttpException

Ejecucion fallida

sendNotification()

private static sendNotification(array<string|int, array{product_id: int, product_name: string, stock: int, min_stock: int, title: string, message: string, type: string, alert_type: string, item_type: string}> $items, string $email) : bool
Parameters
$items : array<string|int, array{product_id: int, product_name: string, stock: int, min_stock: int, title: string, message: string, type: string, alert_type: string, item_type: string}>
$email : string
Return values
bool

        
On this page

Search results