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:
2026-11-26 17:11:54 +02:00
co-authored by Claude Sonnet 5.5
parent 920fecdeb2
commit 38b8075a9c
58 changed files with 3435 additions and 26 deletions
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Modules\Sales\Application\Contracts;
/**
* Records the stock used in making quick sale orders, through the
* Inventory module. Recording never stops production: a failure returns
* false.
*/
interface OrderMaterials
{
public function use(int $stockItemId, int $quantityMilli, int $orderLineId, ?int $machineId, int $userId): bool;
/**
* Records stock spoiled in production (e.g. a reprint) as a write-off.
*/
public function writeOff(int $stockItemId, int $quantityMilli, int $orderLineId, ?int $machineId, int $userId, string $reason): bool;
}
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Modules\Sales\Application\Contracts;
use App\Modules\Sales\Domain\ValueObjects\OrderStep;
/**
* The production processes of consumer products (spec 19.7), read from the
* Machines module.
*/
interface ProductionProcesses
{
/**
* @param list<int> $productIds
* @return array<int, list<OrderStep>> By product id; products without a process are left out.
*/
public function stepsOf(array $productIds): array;
}
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace App\Modules\Sales\Application\Contracts;
use DateTimeImmutable;
/**
* Puts the steps of quick sale order lines on machines' work lists and
* takes them off, through the Machines module.
*/
interface ProductionQueue
{
/**
* Puts the line's step on the machine's list for the day, with the
* customer waiting rows first.
*/
public function enqueue(int $orderLineId, int $stepPosition, int $machineId, DateTimeImmutable $day): void;
/**
* Closes the line's open row as made.
*/
public function complete(int $orderLineId, int $userId): void;
/**
* Takes the line's open row off its machine's list.
*/
public function remove(int $orderLineId): void;
}
@@ -19,4 +19,10 @@ interface QuickSaleHours
* day's hours are already approved or would pass 24 hours.
*/
public function book(int $sellerId, DateTimeImmutable $day, int $workTypeId, int $quarters, int $saleId): bool;
/**
* Books the hours of a quick sale order's production step on the user
* who completed it, like book(); the note names the pickup number.
*/
public function bookForOrder(int $userId, DateTimeImmutable $day, int $workTypeId, int $quarters, int $pickupNumber): bool;
}
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Modules\Sales\Application\Contracts;
use App\Modules\Sales\Application\DTOs\OrderLineSummary;
use App\Modules\Sales\Application\DTOs\OrderSummary;
/**
* Reads quick sale orders. The Machines module reads order lines for the
* machine console through this contract.
*/
interface QuickSaleOrderQueries
{
/**
* Orders being made or waiting to be paid, and paid ones still being
* made, oldest first.
*
* @return list<OrderSummary>
*/
public function openOrders(): array;
public function findOrder(int $id): ?OrderSummary;
/**
* @param list<int> $lineIds
* @return array<int, OrderLineSummary> By line id.
*/
public function lines(array $lineIds): array;
/**
* How many orders are not yet paid (cancelled ones left out).
*/
public function unpaidCount(): int;
}