Files
2026-11-26 17:11:54 +02:00

30 lines
1.1 KiB
PHP

<?php
namespace App\Modules\Sales\Infrastructure\Adapters;
use App\Modules\Machines\Application\Contracts\ProductionProcessQueries;
use App\Modules\Machines\Application\DTOs\ProductionStepSummary;
use App\Modules\Sales\Application\Contracts\ProductionProcesses;
use App\Modules\Sales\Domain\ValueObjects\OrderStep;
/**
* Production processes of products from the Machines module.
*/
class ProcessesFromMachines implements ProductionProcesses
{
public function __construct(private ProductionProcessQueries $processes) {}
public function stepsOf(array $productIds): array
{
return array_map(
fn (array $steps): array => array_map(fn (ProductionStepSummary $step): OrderStep => new OrderStep(
$step->machineId,
$step->durationQuarters,
$step->workTypeId,
array_map(fn (array $material): array => ['stockItemId' => $material['stockItemId'], 'quantityMilli' => $material['quantityMilli']], $step->materials),
), $steps),
$this->processes->processesOf($productIds),
);
}
}