Repository navigation
feat: add production targets and first-pass yield - #380
Merged
Merged
Conversation
…scrap/FPY settings, first-pass yield - ProductionTargets service: per-line OEE target = planning_efficiency_pct (100 = unset -> OeeBand::GREEN_AT_LEAST), plant target weighted by each line's planned minutes in the shift (committed scheduled operations, or the order's planned window when it has none; intervals clipped and merged). - FirstPassYieldService: batches whose first-ever quality check passed / batches first checked in the window; null without checks or with the quality module off. - Settings -> System -> Production: "Production targets" card (admin only, own route + Form Request) for max scrap rate and min first-pass yield, showing the current shift's FPY and plant OEE target. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The dashboard rebuild needs targets for OEE, scrap and first-pass yield (FPY), but none existed: the 85% OEE target was a hard-coded constant and FPY was not calculated anywhere.
ProductionTargetsservice: the OEE target per line, and a plant-wide target weighted by planned working time.FirstPassYieldService: FPY for a time window, optionally for one line.Why
The scrap and FPY targets have to be configurable per plant. The OEE target should follow how the planner actually schedules, so it reuses the line's planning efficiency instead of adding a second number to maintain.
OEE target.
planning_efficiency_pctwhen that is below 100. The default of 100 means "not set" and falls back toOeeBand::GREEN_AT_LEAST(85).OeeBandthresholds andOeeGaugeare unchanged.FPY definition. I checked the data model first (
QualityCheck.all_passed, several periodic checks per batch, re-checks after rework). I chose:null, not 0% or 100%. The quality module being disabled also returnsnull.[from, to), so shifts that cross midnight work.How it was verified
Laravel tests added:
Feature/Dashboard/ProductionTargetsTest:Feature/Quality/FirstPassYieldServiceTest:null;null;Feature/Web/ProductionTargetsSettingsTest:Click-through demo recorded by an independent QA agent on a fresh instance. The demo video will be added in a follow-up comment.
Review notes
system_settingstable, and missing or out-of-range stored values fall back to the defaults.POST /settings/production-targets(Admin only).en.jsonandpl.json, and a CHANGELOG entry.OeeBand,OeeGauge,ShiftMonitorService,OeeCalculationService, the mobile admin dashboard API and the shared synced collections.tests/e2e/demo/cez-f6a10c67.spec.ts, next to the existing demo specs.Open items from code review (none are blockers; none fixed):
ProductionTargets.php:86: scheduled operations of finished or cancelled orders still count toward a line's planned minutes, becausewhereHas('workOrder')only excludes deleted orders. Restrict it toWorkOrder::ACTIVE_STATUSES, as the order-level query below it does.FirstPassYieldService.php:71-78: finding each batch's first check loads all checks of the batches seen in the window. This is fine at current volumes. A SQLMIN(checked_at)per batch would keep the work proportional to the number of batches.SettingsController.php:219:productionTargetsPayload()runs the FPY and planned-minutes queries on every Settings → System load, whichever tab is open. Load it lazily (Inertia::optional) for the Production tab only.🤖 Generated with Claude Code