Track machine counters and maintenance with counter and time intervals
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -6,7 +6,9 @@ use App\Modules\Catalog\Infrastructure\Persistence\Eloquent\WorkTypeModel;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\CustomerJobModel;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Eloquent\TaskModel;
|
||||
use App\Modules\Machines\Application\UseCases\MachineWorkList;
|
||||
use App\Modules\Machines\Infrastructure\Persistence\Eloquent\MachineCounterModel;
|
||||
use App\Modules\Machines\Infrastructure\Persistence\Eloquent\MachineModel;
|
||||
use App\Modules\Machines\Infrastructure\Persistence\Eloquent\MaintenanceItemModel;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -30,6 +32,12 @@ beforeEach(function () {
|
||||
'description' => 'Kaksi kappaletta',
|
||||
]);
|
||||
app(MachineWorkList::class)->planTask($this->task->id, $this->machine->id, null);
|
||||
|
||||
$counter = MachineCounterModel::query()->create(['machine_id' => $this->machine->id, 'name' => 'Tulosteet', 'unit' => 'piece', 'sort_order' => 1]);
|
||||
MaintenanceItemModel::query()->create([
|
||||
'machine_id' => $this->machine->id, 'name' => 'Pään puhdistus', 'machine_counter_id' => $counter->id, 'interval_milli' => 1_000_000,
|
||||
'period' => 'day', 'period_count' => 1, 'starts_on' => now()->subDays(2)->toDateString(), 'warning_percent' => 90,
|
||||
]);
|
||||
});
|
||||
|
||||
it('has no accessibility issues on the machine pages', function (string $page, string $device, string $colorScheme) {
|
||||
@@ -38,6 +46,7 @@ it('has no accessibility issues on the machine pages', function (string $page, s
|
||||
'show' => route('machines.show', $this->machine->id),
|
||||
'form' => route('machines.edit', $this->machine->id),
|
||||
'job' => route('jobs.show', $this->job->id).'#task-'.$this->task->id,
|
||||
'maintenance' => route('machines.maintenance.create', $this->machine->id),
|
||||
};
|
||||
|
||||
$visit = visit($url);
|
||||
@@ -47,7 +56,7 @@ it('has no accessibility issues on the machine pages', function (string $page, s
|
||||
$visit->assertSee($page === 'form' ? __('machines.form.edit_title') : 'Suurkuvatulostin')
|
||||
->assertNoJavaScriptErrors()
|
||||
->assertNoAccessibilityIssues(level: 2);
|
||||
})->with(['index', 'show', 'form', 'job'])->with([
|
||||
})->with(['index', 'show', 'form', 'job', 'maintenance'])->with([
|
||||
'desktop, light' => ['desktop', 'light'],
|
||||
'desktop, dark' => ['desktop', 'dark'],
|
||||
'mobile, light' => ['mobile', 'light'],
|
||||
@@ -64,3 +73,14 @@ it('moves a task to another machine with the keyboard from the work list', funct
|
||||
->assertSee('Tehtävä siirretty koneen Tarraleikkuri työlistalle')
|
||||
->assertDontSee('Kiiltävä laminointi');
|
||||
});
|
||||
|
||||
it('records maintenance done with the keyboard', function () {
|
||||
visit(route('machines.show', $this->machine->id))
|
||||
->assertSee('Huolto myöhässä')
|
||||
->click(__('machines.maintenance.done'))
|
||||
->fill('#record-note', 'Puhdistettu')
|
||||
->click(__('machines.maintenance.confirm_done'))
|
||||
->assertSee('Huolto Pään puhdistus kirjattu.')
|
||||
->assertSee('Kunnossa')
|
||||
->assertNoAccessibilityIssues(level: 2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user