Make quick sale products on machines as orders paid when ready
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?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),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user