Skip to content

Commit b789673

Browse files
Merge pull request #164 from Mes-Open/release/v0.16.0
Release v0.16.0
2 parents dfdd2c6 + de45142 commit b789673

1,144 files changed

Lines changed: 121652 additions & 15696 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Large diffs are not rendered by default.

backend/.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
; file: deps (@openmes/ui) must be symlinked, not copied, so the Vite
2+
; watcher sees live edits in packages/ui. npm 9.0–9.3 briefly flipped
3+
; this default — pin it explicitly.
4+
install-links=false

backend/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ WORKDIR /var/www/html
4242
# Copy application files
4343
COPY backend/ .
4444
COPY modules/ ./modules/
45+
# Workspace UI package — backend/package.json depends on it via `file:../packages/ui`,
46+
# which resolves to /var/www/packages/ui relative to this WORKDIR. Must be present
47+
# before `npm ci` or the `@openmes/ui` import fails to resolve during `npm run build`.
48+
COPY packages/ /var/www/packages/
4549

4650
# Install PHP dependencies
4751
RUN composer install --no-dev --optimize-autoloader --no-interaction
@@ -54,8 +58,8 @@ RUN ./vendor/bin/rr get-binary --location /var/www/html \
5458
# Install Node dependencies and build assets
5559
RUN npm ci && npm run build
5660

57-
# Clean up node_modules to reduce image size
58-
RUN rm -rf node_modules
61+
# Clean up node_modules + the build-only workspace sources to reduce image size
62+
RUN rm -rf node_modules /var/www/packages
5963

6064
# Copy entrypoint script
6165
COPY backend/docker-entrypoint.sh /usr/local/bin/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Services\Quality\QualityTriggerService;
6+
use Illuminate\Console\Command;
7+
8+
/**
9+
* Fires time-based quality-control triggers (every_n_minutes). Scheduled every
10+
* minute in routes/console.php; the service decides which in-progress batches
11+
* are due. Other trigger types fire synchronously from the production
12+
* lifecycle, so they don't need the scheduler.
13+
*/
14+
class FireDueQualityTriggersCommand extends Command
15+
{
16+
protected $signature = 'quality:fire-due-triggers';
17+
18+
protected $description = 'Create quality-control tasks for due time-based triggers';
19+
20+
public function handle(QualityTriggerService $service): int
21+
{
22+
$created = $service->fireDueTimeTriggers();
23+
24+
$this->info("Quality-control triggers fired: {$created} task(s) created.");
25+
26+
return self::SUCCESS;
27+
}
28+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\IssueAction;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\Log;
8+
9+
/**
10+
* Flags overdue corrective/preventive/containment actions (#11) — outstanding
11+
* (open/in_progress) actions whose due date has passed. Logs a warning per
12+
* overdue action (picked up by the security/ops log) and reports to the
13+
* console. Naturally idempotent: each run reports the current overdue set.
14+
*
15+
* Registered in the scheduler (routes/console.php) to run daily.
16+
*/
17+
class NotifyOverdueActions extends Command
18+
{
19+
protected $signature = 'quality:notify-overdue-actions';
20+
21+
protected $description = 'Flag overdue corrective/preventive actions on issues';
22+
23+
public function handle(): int
24+
{
25+
$actions = IssueAction::overdue()
26+
->with(['issue:id,title', 'assignedTo:id,name'])
27+
->orderBy('due_date')
28+
->get();
29+
30+
if ($actions->isEmpty()) {
31+
$this->info('No overdue actions.');
32+
33+
return self::SUCCESS;
34+
}
35+
36+
$rows = [];
37+
foreach ($actions as $action) {
38+
Log::warning('Issue action overdue', [
39+
'issue_action_id' => $action->id,
40+
'issue_id' => $action->issue_id,
41+
'due_date' => $action->due_date?->toDateString(),
42+
'assigned_to_id' => $action->assigned_to_id,
43+
]);
44+
45+
$rows[] = [
46+
$action->id,
47+
$action->issue?->title ?? "#{$action->issue_id}",
48+
$action->title,
49+
$action->due_date?->toDateString(),
50+
$action->assignedTo?->name ?? '',
51+
];
52+
}
53+
54+
$this->table(['Action', 'Issue', 'Title', 'Due', 'Assignee'], $rows);
55+
$this->warn($actions->count().' overdue action(s).');
56+
57+
return self::SUCCESS;
58+
}
59+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Database\Seeders\OeeAndDowntimeDemoSeeder;
6+
use Illuminate\Console\Command;
7+
8+
/**
9+
* Keeps a long-running demo's OEE report alive. The OEE page recomputes
10+
* today/yesterday from real DONE production, so once the demo's seeded
11+
* "today" ages, OEE decays into N/A. This re-runs the (fully idempotent)
12+
* demo seeder, which rolls production + OEE forward to the current day.
13+
*
14+
* Guarded by config('openmmes.demo_mode') so it never touches a real install.
15+
*/
16+
class RefreshDemoOeeCommand extends Command
17+
{
18+
protected $signature = 'demo:refresh-oee
19+
{--force : Run even when demo mode is disabled}';
20+
21+
protected $description = 'Roll demo OEE/production data forward to today so the report never shows N/A';
22+
23+
public function handle(): int
24+
{
25+
if (! config('openmmes.demo_mode') && ! $this->option('force')) {
26+
$this->warn('Demo mode is off (openmmes.demo_mode) — skipping. Pass --force to run anyway.');
27+
28+
return self::SUCCESS;
29+
}
30+
31+
$this->info('Refreshing demo OEE/production data for today…');
32+
33+
// The seeder is idempotent — updateOrCreate for OEE/downtime rows and a
34+
// skip for lines that already have DONE batches today — so a daily run
35+
// only rolls today/yesterday forward and never duplicates history.
36+
$this->callSilent('db:seed', [
37+
'--class' => OeeAndDowntimeDemoSeeder::class,
38+
'--force' => true,
39+
]);
40+
41+
$this->info('Demo OEE refreshed.');
42+
43+
return self::SUCCESS;
44+
}
45+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
/**
6+
* Disposition decision for a non-conforming issue (#11): what happens to the
7+
* affected material. `Pending` is the default until quality decides.
8+
*/
9+
enum IssueDisposition: string
10+
{
11+
case Pending = 'pending';
12+
case Scrap = 'scrap';
13+
case Rework = 'rework';
14+
case ReturnToSupplier = 'return_to_supplier';
15+
case UseAsIs = 'use_as_is';
16+
17+
public function label(): string
18+
{
19+
return match ($this) {
20+
self::Pending => __('Pending'),
21+
self::Scrap => __('Scrap'),
22+
self::Rework => __('Rework'),
23+
self::ReturnToSupplier => __('Return to supplier'),
24+
self::UseAsIs => __('Use as is'),
25+
};
26+
}
27+
28+
/** @return list<string> */
29+
public static function values(): array
30+
{
31+
return array_map(fn (self $c) => $c->value, self::cases());
32+
}
33+
}

0 commit comments

Comments
 (0)