74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Inventory\Application\Contracts;
|
|
|
|
use App\Modules\Inventory\Application\DTOs\StockGroupSummary;
|
|
use App\Modules\Inventory\Application\DTOs\StockItemSummary;
|
|
use App\Modules\Inventory\Application\DTOs\StockMovementSummary;
|
|
use App\Modules\Inventory\Application\DTOs\TaskMaterialSuggestion;
|
|
|
|
/**
|
|
* Reads stock items, groups and movements. Other modules (machines, quick
|
|
* sales, jobs' task material) read stock through this contract.
|
|
*/
|
|
interface StockQueries
|
|
{
|
|
/**
|
|
* @return list<StockGroupSummary> In order.
|
|
*/
|
|
public function groups(bool $includeInactive = true): array;
|
|
|
|
/**
|
|
* Items in group order and then by name. $search matches parts of the
|
|
* name or code regardless of case and Finnish letters.
|
|
*
|
|
* @return list<StockItemSummary>
|
|
*/
|
|
public function items(?string $search = null, ?int $groupId = null, bool $onlyReorder = false, bool $includeInactive = false): array;
|
|
|
|
public function findItem(int $id): ?StockItemSummary;
|
|
|
|
/**
|
|
* @param list<int> $ids
|
|
* @return array<int, StockItemSummary> By id.
|
|
*/
|
|
public function itemsByIds(array $ids): array;
|
|
|
|
/**
|
|
* The item's movements, newest first, with the balance after each.
|
|
*
|
|
* @return list<StockMovementSummary>
|
|
*/
|
|
public function movementsOf(int $itemId, int $limit = 200): array;
|
|
|
|
public function findMovement(int $id): ?StockMovementSummary;
|
|
|
|
/**
|
|
* Material recorded on a task: its use, write-offs and their reversals,
|
|
* newest first. The balance after each is not set (0).
|
|
*
|
|
* @return list<StockMovementSummary>
|
|
*/
|
|
public function taskMovements(int $taskId): array;
|
|
|
|
/**
|
|
* @return list<TaskMaterialSuggestion>
|
|
*/
|
|
public function taskSuggestions(int $taskId): array;
|
|
|
|
/**
|
|
* Items used most often on the machine in the last 90 days, then the
|
|
* ones used most recently, for the machine console (spec 19.6).
|
|
*
|
|
* @return array{frequent: list<int>, recent: list<int>}
|
|
*/
|
|
public function machineFavourites(int $machineId, int $limit = 8): array;
|
|
|
|
/**
|
|
* The private-disk path of the item's image or its thumbnail.
|
|
*/
|
|
public function imagePathOf(int $itemId, bool $thumbnail): ?string;
|
|
}
|