Add machines with day-by-day work lists for job tasks
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
use App\Modules\Machines\Domain\Enums\CounterUnit;
|
||||
|
||||
/**
|
||||
* A machine counter with its latest reading (in thousandths of the unit),
|
||||
* read at "Y-m-d H:i" in the company's time zone.
|
||||
*/
|
||||
final readonly class CounterSummary
|
||||
{
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $name,
|
||||
public CounterUnit $unit,
|
||||
public ?int $readingMilli = null,
|
||||
public ?string $readAt = null,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A machine's planned work on a day: the number of rows and the tasks'
|
||||
* estimated hours together (in quarters of an hour).
|
||||
*/
|
||||
final readonly class DayLoad
|
||||
{
|
||||
public function __construct(
|
||||
public string $day,
|
||||
public int $rows,
|
||||
public int $estimatedQuarters,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A machine's details as entered. Counters without an id are new.
|
||||
*/
|
||||
final readonly class MachineData
|
||||
{
|
||||
/**
|
||||
* @param list<int> $serviceUnitIds
|
||||
* @param list<array{id: ?int, name: string, unit: string}> $counters
|
||||
*/
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $type,
|
||||
public ?string $description,
|
||||
public array $serviceUnitIds,
|
||||
public ?int $responsibleUserId,
|
||||
public array $counters = [],
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
use App\Modules\Machines\Domain\Enums\MachineType;
|
||||
|
||||
final readonly class MachineSummary
|
||||
{
|
||||
/**
|
||||
* @param list<int> $serviceUnitIds
|
||||
* @param list<string> $serviceUnitNames
|
||||
* @param list<CounterSummary> $counters
|
||||
*/
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $name,
|
||||
public MachineType $type,
|
||||
public ?string $description,
|
||||
public array $serviceUnitIds,
|
||||
public array $serviceUnitNames,
|
||||
public ?int $responsibleUserId,
|
||||
public ?string $responsibleName,
|
||||
public array $counters,
|
||||
public bool $isActive,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A job's task as a machine's work list shows it, read from the Jobs and
|
||||
* Catalog modules. $status and $priority are Jobs' enum keys; $priorityRank
|
||||
* orders priorities (higher first). $allowedServiceUnitIds are the service
|
||||
* units using stock whose machines may make the task: the task's work
|
||||
* type's unit, or for a shared work type the job's units.
|
||||
*/
|
||||
final readonly class MachineTaskInfo
|
||||
{
|
||||
/**
|
||||
* @param list<int> $allowedServiceUnitIds
|
||||
*/
|
||||
public function __construct(
|
||||
public int $taskId,
|
||||
public int $jobId,
|
||||
public string $jobNumber,
|
||||
public string $jobName,
|
||||
public string $customerName,
|
||||
public string $title,
|
||||
public ?string $description,
|
||||
public ?string $instructions,
|
||||
public string $status,
|
||||
public string $priority,
|
||||
public int $priorityRank,
|
||||
public ?string $dueOn,
|
||||
public ?string $plannedFrom,
|
||||
public ?string $plannedTo,
|
||||
public ?string $estimatedHours,
|
||||
public array $allowedServiceUnitIds,
|
||||
public bool $isDone,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Whether making the task on the day is outside its schedule or after
|
||||
* its due date (spec 19.4: shown as a note, not prevented).
|
||||
*/
|
||||
public function isOutsidePlan(string $day): bool
|
||||
{
|
||||
return ($this->plannedFrom !== null && $day < $this->plannedFrom)
|
||||
|| ($this->plannedTo !== null && $day > $this->plannedTo)
|
||||
|| ($this->dueOn !== null && $day > $this->dueOn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Application\DTOs;
|
||||
|
||||
/**
|
||||
* A row of a machine's work list: a task (with its details) or a step of
|
||||
* a quick sale order line. $plannedOn is Y-m-d; a late row was planned on
|
||||
* an earlier day and is still open.
|
||||
*/
|
||||
final readonly class QueueRow
|
||||
{
|
||||
public function __construct(
|
||||
public int $entryId,
|
||||
public int $machineId,
|
||||
public string $plannedOn,
|
||||
public int $position,
|
||||
public bool $isLate,
|
||||
public ?int $taskId,
|
||||
public ?int $orderLineId,
|
||||
public ?int $stepPosition,
|
||||
public ?MachineTaskInfo $task = null,
|
||||
) {}
|
||||
|
||||
public function isOrder(): bool
|
||||
{
|
||||
return $this->orderLineId !== null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user