Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat(production): bulk release batches + reorderable schedule columns (#1596)

Brad Barbin82125ce1eff9
diff --git a/apps/erp/app/modules/production/AGENTS.md b/apps/erp/app/modules/production/AGENTS.md
index 8fbe05f469..e308b8df46 100644
--- a/apps/erp/app/modules/production/AGENTS.md
+++ b/apps/erp/app/modules/production/AGENTS.md
@@ -10,7 +10,7 @@ Work orders (jobs), scheduling, routings (operations), bill of materials, proced
- **Job Material** — BOM line within a make method. Each has a `methodType` (Pull from Inventory, Purchase to Order, Make to Order) that drives procurement.
- **Production Event** — time tracking (Labor/Machine/Setup) against an operation.
- **Production Quantity** — output recording (Production/Scrap/Rework) against an operation with optional `scrapReason`.
-- **Operation Batch** (`jobOperationBatch`) — N job operations sharing one run on a **batchable process** (`process.batchable`: laser table, furnace, plating; `process.batchType` `Sequential`/`Simultaneous` = the s-batch/p-batch physics — serial queue vs parallel load — driving the batch's planned duration `setup(max) + Σ|max(run)` via `@carbon/utils` `batchDuration`). Jobs are never merged and the BOM is never modified; each member stays a first-class `jobOperation`. Time/cost split **proportional to `operationQuantity`**, materialized at completion as per-member `productionEvent` slices, so job costing/GL post per job with no special-casing. Status **`Planned → Active → Completing → Completed`** (no `Cancelled` — dissolve deletes a pre-start batch instead). `Planned` is the pre-floor state: composed in the builder from ANY live job's unstarted ops (the planner RPC no longer requires released jobs), fully editable (add/remove/work-center widened to Planned+Active pre-event), invisible to MES. **`Active` displays as "Released"** (exactly like job `Ready`); the `release` edge-fn intent (`Planned → Active`, requires ≥1 member — NO work center: the scheduler pre-pass auto-selects earliest-finish among the process's work centers and persists it to batch + members) puts members on the floor, and the ERP `batching.update` action first runs `recalculateJobRequirements` for member jobs still Draft/Planned (no MRP), then notifies the scheduler; `unrelease` (`Active → Planned`) is allowed only before the first production event. **Membership-handoff floor rule**: an op in a batch is floor-visible iff its BATCH is Released (`Active`/`Completing`) — even when its job is Draft/Planned; an op in no batch follows its JOB's release (the pre-batching rule — a released job's un-batched batchable op always remains runnable, never blocked; removing it from a batch is the escape hatch). Enforced in `get_active_job_operations_by_location`, MES `getOpenJobs`, AND server-side in the MES operation loader + start route (list visibility alone was the leak). **Scheduling**: a Released batch is ONE scheduling unit — the batch pre-pass (`packages/ee/src/planning/scheduling/batch-scheduler.ts`, run by `runLocationSchedule` before the per-job passes) writes a single coalesced `capacityReservation` tagged `jobOperationBatchId` (NOT NULL `operationId`/`jobId` anchored on the min member op), members pin to the window in the selector (generalized pinned-OSP path, no per-member reservation), downstream ops chain after the batch end, and the anchor comes from persisted predecessor forecasts (overruns flag a conflict and converge next wave); a batch whose open members all carry zero time standards still surfaces — a flagged 1h placeholder (`workHours` 0, never blocks) with a conflict naming the data gap, instead of silently vanishing from the reservation-driven forecast; Planned batches still schedule per-op. Completion is **two-phase and resumable** — Phase 1 (one txn) slices events + records quantities + flips `Active → Completing`; Phase 2 (idempotent, edge-fn-owned) issues each member's BOM, flips members `Done`, posts GL, then `Completing → Completed`. A Phase-2 failure leaves the batch `Completing` and re-invoking resumes (no double issue/GL). A retry MUST resubmit the quantities Phase 1 recorded — a changed quantity is rejected, not silently applied. Proportional split logic lives in `@carbon/utils` `batch-time-split` (Deno mirror under `supabase/functions/shared/`). Distinct from lot/batch tracking (`trackedEntity`/`batchNumber`). Mutations go through the `batch-operations` edge function (create/add/remove/update/dissolve/complete); payload record ids are re-read under `companyId` (`assertCompanyRecord` for location/work center) and the batch table's location/process/workCenter FKs are composite `(<col>, "companyId")` (`20260905132037_job-operation-batching.sql` (the consolidated branch migration)), so a cross-tenant id is refused by the fn AND rejected by the schema. Batch COMPOSITION happens ONLY in the batch builder (below) — the operations priority board's select-to-batch flow (checkboxes on cards, `BatchSelectionProvider`, the floating create bar, and the `BatchOpportunity` banner/column hints) was removed 2026-09-01 at Sid's direction, after the dedicated drag-and-drop batching board went the same way 2026-08-21. The board still SHOWS batches: each live batch collapses to one `BatchItemCard` in its work-center column (drag across columns reassigns the batch work center via `priorityBatchingUpdate`; Completing cards are read-only). The one composition surface — a guided **batch builder** — launches from the Batches list (`New Batch`) and an Active batch's drawer (`Add operations` → add-mode): a full-screen three-step drawer wizard (`ui/Batches/BatchBuilder.tsx`) that picks a location + batchable process (deep-linkable via `?location=&process=`; the last scope/view is remembered in localStorage), fetches candidates from `api/production/batchable-operations` (the revived `getBatchableOperations` RPC wrapper, enriched with each op's setup/labor/machine time, due date, and item thumbnail, plus per-work-center queue load and a hidden-ops count), and offers local search, a due-window quick filter (7/14/30d, due-date-sorted), a dynamic local-state "+ Filter" facet picker over the dimensions the candidates' BOMs actually contain (the material ITEM itself plus substance/grade/dimension/form/finish where populated — ANY BOM line matches ALL active facets; active facets render as removable/editable chips), two list views (polished table or group-by-material-signature sections with per-group select-all and setup-saving chips — a line's signature falls back to its BOM item's readable id when no normalized properties exist, so property-less BOMs still group by what they consume; an operation with NO op-linked BOM lines takes the JOB's unassigned (`jobOperationId IS NULL`) lines — BOMs are routinely authored without per-operation assignment, and without the fallback every such op read "No materials", emptied the facet picker, and degraded grouping to the produced item), a prominent scored suggestions banner at the top of the operations list — groups ranked by `rankSuggestions` (blended, normalised score: setup saved + due urgency + capacity fit + dimension specificity; each signature group is first split into due-date clusters no wider than `SUGGESTION_DUE_WINDOW_DAYS` = 7 via `splitByDueWindow`, so a suggestion never spans weeks — same material next month is next month's batch), each row a one-click apply with a reason chip (due now / fills a run); grouping uses `groupingKey` (material signature, falling back to the produced item for material-less assembly ops) while the mixed-materials warning uses the materials-only `materialSignature`, so the fallback never fakes a material clash. The pure logic (signatures, value sets, duration math, scoring) lives in `ui/Batches/batch-builder-logic.ts` — no JSX/lingui, unit-tested by `apps/erp/test/batch-suggestions.test.ts`, and a live preview (count · quantity · estimated run time, setup-saving + due-spread chips, plus a non-blocking "mixing materials" warning — material compatibility guides but never blocks, per the locked spec decision). Create-mode can attach a work center (picker shows each center's queue depth) and optional notes (additive `notes` field on the edge fn's create payload), and — instead of creating a duplicate — offers a searchable **"Add to batch"** footer popover (`AddToBatchButton`: a `Command` list over the compatible Active same-process batches from `deriveAddTargets`, each row `readableId · N ops`, on-select → the same `add` submit) rather than one button per batch, so it scales to hundreds of open batches. When the chosen work center has a `batchCapacity` set, a fill bar under the picker shows selected qty vs capacity ("fits in one run" / "over capacity — N loads") plus a `minimumBatchQuantity` met/short line — purely ADVISORY, Create never blocks (`resources.workCenter.batchCapacity`/`minimumBatchQuantity`). The scoped process's `batchRules` (`process.batchRules`, threaded through `getBatchableProcesses`) drives compatibility: the candidate signature/facets/mixed-material warning use every non-"ignore" dimension (default substance/grade/dimension, with the material item as a fallback for property-less BOMs), a "guide" mismatch versus the current selection shows a quiet amber tag on the row, and a "must" mismatch renders the row visible-but-LOCKED (grey lock tag, checkbox no-op, excluded from suggestions/select-all — clears when the selection empties). All resolution/enforcement is the shared `@carbon/utils` `batch-compatibility` module (`resolveBatchRules`/`mustViolations`); the client uses names and the edge fn uses ids through the same value-agnostic fold, so they always agree. The edge fn's `assertMaterialCompatible` re-checks the WHOLE membership (create: incoming set; add: existing members + incoming) after `assertEligible` and rejects a must-violating batch naming the dimension — the LOCK in the UI is advisory-fast; the edge fn is the real gate. It submits `create`/`add` to the same `batching.update` action + `batch-operations` edge fn — no new mutation path. Completion (MES modal → `complete`) can mark a member "not in this run" (`excluded`): it detaches back to the schedule un-run inside the Phase-1 txn instead of flipping Done; excluded members carry no quantities, all-excluded is rejected (dissolve instead), and a resume drops already-applied exclusions but rejects new ones. Batches LIST at `/x/production/batches` (nav: Production → Batches; `getJobOperationBatches` + `getJobOperationBatchMemberStats` + `getJobOperationBatchMembers`); rows are **expandable** (`renderExpandedRow`/`canExpandRow` on the shared `Table`, same mechanism as the ECO change-notices table) to reveal each member operation (job link, item thumbnail + readable id, completed/qty + scrap); clicking a batch opens a FULL-SIZE detail drawer (`ui/Batches/BatchDetailDrawer.tsx`): header meta (status/process/WC/location/created-by/notes), an enriched member table (thumbnails, completed/qty + scrap, status badges), and a Run card — per-type actual-vs-plan progress (plan = max member setup + Σ labor/machine, matching MES batch mode) with a pulsing timer-running badge and the batch's production-event history (`getJobOperationBatchWithMembers` + `getJobOperationBatchEvents`; completed batches show the per-member slices, which keep the batch tag). Deleting from ERP = the edge fn's `dissolve`: single via the `batches/delete/:batchId` ConfirmDelete route (destructive "Dissolve Batch" in the table's row context menu + a destructive Dissolve button on the detail drawer, Active only), and bulk via selectable rows → a "Dissolve N batches" bulk action posting the selected Active ids to the `batches/dissolve` route (one edge-fn dissolve per id; the server's per-batch refusal for started batches lands in the toast summary's `failed` list, the rest still dissolve), and a printable **batch list** serves at `/file/batch/:id.pdf` (`BatchListPDF` in `@carbon/documents`; menu entries on the batch card and MES batch chip). Job surfaces show live-batch membership: a Batches column on the jobs table (loader-side lookup), a badge on the `JobBillOfProcess` operation row (`jobOperationBatch` embed), and a chip on the MES job DAG node.
+- **Operation Batch** (`jobOperationBatch`) — N job operations sharing one run on a **batchable process** (`process.batchable`: laser table, furnace, plating; `process.batchType` `Sequential`/`Simultaneous` = the s-batch/p-batch physics — serial queue vs parallel load — driving the batch's planned duration `setup(max) + Σ|max(run)` via `@carbon/utils` `batchDuration`). Jobs are never merged and the BOM is never modified; each member stays a first-class `jobOperation`. Time/cost split **proportional to `operationQuantity`**, materialized at completion as per-member `productionEvent` slices, so job costing/GL post per job with no special-casing. Status **`Planned → Active → Completing → Completed`** (no `Cancelled` — dissolve deletes a pre-start batch instead). `Planned` is the pre-floor state: composed in the builder from ANY live job's unstarted ops (the planner RPC no longer requires released jobs), fully editable (add/remove/work-center widened to Planned+Active pre-event), invisible to MES. **`Active` displays as "Released"** (exactly like job `Ready`); the `release` edge-fn intent (`Planned → Active`, requires ≥1 member — NO work center: the scheduler pre-pass auto-selects earliest-finish among the process's work centers and persists it to batch + members) puts members on the floor, and the ERP `batching.update` action first runs `recalculateJobRequirements` for member jobs still Draft/Planned (no MRP), then notifies the scheduler; `unrelease` (`Active → Planned`) is allowed only before the first production event. **Membership-handoff floor rule**: an op in a batch is floor-visible iff its BATCH is Released (`Active`/`Completing`) — even when its job is Draft/Planned; an op in no batch follows its JOB's release (the pre-batching rule — a released job's un-batched batchable op always remains runnable, never blocked; removing it from a batch is the escape hatch). Enforced in `get_active_job_operations_by_location`, MES `getOpenJobs`, AND server-side in the MES operation loader + start route (list visibility alone was the leak). **Scheduling**: a Released batch is ONE scheduling unit — the batch pre-pass (`packages/ee/src/planning/scheduling/batch-scheduler.ts`, run by `runLocationSchedule` before the per-job passes) writes a single coalesced `capacityReservation` tagged `jobOperationBatchId` (NOT NULL `operationId`/`jobId` anchored on the min member op), members pin to the window in the selector (generalized pinned-OSP path, no per-member reservation), downstream ops chain after the batch end, and the anchor comes from persisted predecessor forecasts (overruns flag a conflict and converge next wave); a batch whose open members all carry zero time standards still surfaces — a flagged 1h placeholder (`workHours` 0, never blocks) with a conflict naming the data gap, instead of silently vanishing from the reservation-driven forecast; Planned batches still schedule per-op. Completion is **two-phase and resumable** — Phase 1 (one txn) slices events + records quantities + flips `Active → Completing`; Phase 2 (idempotent, edge-fn-owned) issues each member's BOM, flips members `Done`, posts GL, then `Completing → Completed`. A Phase-2 failure leaves the batch `Completing` and re-invoking resumes (no double issue/GL). A retry MUST resubmit the quantities Phase 1 recorded — a changed quantity is rejected, not silently applied. Proportional split logic lives in `@carbon/utils` `batch-time-split` (Deno mirror under `supabase/functions/shared/`). Distinct from lot/batch tracking (`trackedEntity`/`batchNumber`). Mutations go through the `batch-operations` edge function (create/add/remove/update/dissolve/complete); payload record ids are re-read under `companyId` (`assertCompanyRecord` for location/work center) and the batch table's location/process/workCenter FKs are composite `(<col>, "companyId")` (`20260905132037_job-operation-batching.sql` (the consolidated branch migration)), so a cross-tenant id is refused by the fn AND rejected by the schema. Batch COMPOSITION happens ONLY in the batch builder (below) — the operations priority board's select-to-batch flow (checkboxes on cards, `BatchSelectionProvider`, the floating create bar, and the `BatchOpportunity` banner/column hints) was removed 2026-09-01 at Sid's direction, after the dedicated drag-and-drop batching board went the same way 2026-08-21. The board still SHOWS batches: each live batch collapses to one `BatchItemCard` in its work-center column (drag across columns reassigns the batch work center via `priorityBatchingUpdate`; Completing cards are read-only). The one composition surface — a guided **batch builder** — launches from the Batches list (`New Batch`) and an Active batch's drawer (`Add operations` → add-mode): a full-screen three-step drawer wizard (`ui/Batches/BatchBuilder.tsx`) that picks a location + batchable process (deep-linkable via `?location=&process=`; the last scope/view is remembered in localStorage), fetches candidates from `api/production/batchable-operations` (the revived `getBatchableOperations` RPC wrapper, enriched with each op's setup/labor/machine time, due date, and item thumbnail, plus per-work-center queue load and a hidden-ops count), and offers local search, a due-window quick filter (7/14/30d, due-date-sorted), a dynamic local-state "+ Filter" facet picker over the dimensions the candidates' BOMs actually contain (the material ITEM itself plus substance/grade/dimension/form/finish where populated — ANY BOM line matches ALL active facets; active facets render as removable/editable chips), two list views (polished table or group-by-material-signature sections with per-group select-all and setup-saving chips — a line's signature falls back to its BOM item's readable id when no normalized properties exist, so property-less BOMs still group by what they consume; an operation with NO op-linked BOM lines takes the JOB's unassigned (`jobOperationId IS NULL`) lines — BOMs are routinely authored without per-operation assignment, and without the fallback every such op read "No materials", emptied the facet picker, and degraded grouping to the produced item), a prominent scored suggestions banner at the top of the operations list — groups ranked by `rankSuggestions` (blended, normalised score: setup saved + due urgency + capacity fit + dimension specificity; each signature group is first split into due-date clusters no wider than `SUGGESTION_DUE_WINDOW_DAYS` = 7 via `splitByDueWindow`, so a suggestion never spans weeks — same material next month is next month's batch), each row a one-click apply with a reason chip (due now / fills a run); grouping uses `groupingKey` (material signature, falling back to the produced item for material-less assembly ops) while the mixed-materials warning uses the materials-only `materialSignature`, so the fallback never fakes a material clash. The pure logic (signatures, value sets, duration math, scoring) lives in `ui/Batches/batch-builder-logic.ts` — no JSX/lingui, unit-tested by `apps/erp/test/batch-suggestions.test.ts`, and a live preview (count · quantity · estimated run time, setup-saving + due-spread chips, plus a non-blocking "mixing materials" warning — material compatibility guides but never blocks, per the locked spec decision). Create-mode can attach a work center (picker shows each center's queue depth) and optional notes (additive `notes` field on the edge fn's create payload), and — instead of creating a duplicate — offers a searchable **"Add to batch"** footer popover (`AddToBatchButton`: a `Command` list over the compatible Active same-process batches from `deriveAddTargets`, each row `readableId · N ops`, on-select → the same `add` submit) rather than one button per batch, so it scales to hundreds of open batches. When the chosen work center has a `batchCapacity` set, a fill bar under the picker shows selected qty vs capacity ("fits in one run" / "over capacity — N loads") plus a `minimumBatchQuantity` met/short line — purely ADVISORY, Create never blocks (`resources.workCenter.batchCapacity`/`minimumBatchQuantity`). The scoped process's `batchRules` (`process.batchRules`, threaded through `getBatchableProcesses`) drives compatibility: the candidate signature/facets/mixed-material warning use every non-"ignore" dimension (default substance/grade/dimension, with the material item as a fallback for property-less BOMs), a "guide" mismatch versus the current selection shows a quiet amber tag on the row, and a "must" mismatch renders the row visible-but-LOCKED (grey lock tag, checkbox no-op, excluded from suggestions/select-all — clears when the selection empties). All resolution/enforcement is the shared `@carbon/utils` `batch-compatibility` module (`resolveBatchRules`/`mustViolations`); the client uses names and the edge fn uses ids through the same value-agnostic fold, so they always agree. The edge fn's `assertMaterialCompatible` re-checks the WHOLE membership (create: incoming set; add: existing members + incoming) after `assertEligible` and rejects a must-violating batch naming the dimension — the LOCK in the UI is advisory-fast; the edge fn is the real gate. It submits `create`/`add` to the same `batching.update` action + `batch-operations` edge fn — no new mutation path. Completion (MES modal → `complete`) can mark a member "not in this run" (`excluded`): it detaches back to the schedule un-run inside the Phase-1 txn instead of flipping Done; excluded members carry no quantities, all-excluded is rejected (dissolve instead), and a resume drops already-applied exclusions but rejects new ones. Batches LIST at `/x/production/batches` (nav: Production → Batches; `getJobOperationBatches` + `getJobOperationBatchMemberStats` + `getJobOperationBatchMembers`); rows are **expandable** (`renderExpandedRow`/`canExpandRow` on the shared `Table`, same mechanism as the ECO change-notices table) to reveal each member operation (job link, item thumbnail + readable id, completed/qty + scrap); clicking a batch opens a FULL-SIZE detail drawer (`ui/Batches/BatchDetailDrawer.tsx`): header meta (status/process/WC/location/created-by/notes), an enriched member table (thumbnails, completed/qty + scrap, status badges), and a Run card — per-type actual-vs-plan progress (plan = max member setup + Σ labor/machine, matching MES batch mode) with a pulsing timer-running badge and the batch's production-event history (`getJobOperationBatchWithMembers` + `getJobOperationBatchEvents`; completed batches show the per-member slices, which keep the batch tag). The Batches list also bulk-RELEASES via selectable rows → a "Release N batches" bulk action posting the selected **Planned** ids to the `batches/release` route (one release per id, mirroring the single-batch `batching.update` release branch: recalc Draft/Planned member jobs → `releaseJobOperationBatch` → `notifyScheduleInputsChanged`; per-batch edge-fn refusals land in the toast summary's `failed` list, the rest still release; a non-Planned id from a stale selection is skipped). Deleting from ERP = the edge fn's `dissolve`: single via the `batches/delete/:batchId` ConfirmDelete route (destructive "Dissolve Batch" in the table's row context menu + a destructive Dissolve button on the detail drawer, Active only), and bulk via selectable rows → a "Dissolve N batches" bulk action posting the selected Active ids to the `batches/dissolve` route (one edge-fn dissolve per id; the server's per-batch refusal for started batches lands in the toast summary's `failed` list, the rest still dissolve), and a printable **batch list** serves at `/file/batch/:id.pdf` (`BatchListPDF` in `@carbon/documents`; menu entries on the batch card and MES batch chip). Job surfaces show live-batch membership: a Batches column on the jobs table (loader-side lookup), a badge on the `JobBillOfProcess` operation row (`jobOperationBatch` embed), and a chip on the MES job DAG node.
- **Procedure** — versioned work instructions linked to operations via `processId`. Statuses: Draft/Active/Archived.
- **Assembly Instructions** — 3D animated work instructions, available to all users. (Previously gated to Carbon-internal emails via `requireAssembliesInternal` / `useFlags().isInternal`; that gate was removed to ship publicly.) **Versioned** (Draft/Published/Archived) as **row-per-version**, not an in-place counter: sibling versions are grouped by a self-referential `assemblyInstruction.rootInstructionId` (NULL = "I am the root"; group root = `rootInstructionId ?? id`, siblings = `id = root OR rootInstructionId = root`). `copyAssemblyInstructionAsVersion` spins a new editable **Draft** as a perfect copy (`version = max+1`, deep-copies steps with `parentStepId` remapped + each step's materials/slides/tools). `activateAssemblyInstructionVersion` makes a version active: publishes it, **archives the prior Published sibling**, and repoints `jobOperation.assemblyInstructionId` from other group versions to it — but only for active operations (status ≠ Done/Canceled) on active jobs (`!isJobLocked`). Only Draft is editable; the header exposes a "Versions" switcher + Make Active / New Version. `updateAssemblyInstructionStatus` no longer bumps `version`. The **list** (`getAssemblyInstructions`) reads the `assemblyInstructions` **view** (not the base table): it collapses each group to its latest version (`WHERE version = MAX(version)` per `rootInstructionId ?? id`) and rolls every sibling into a `versions` jsonb array, mirroring the `procedures` view — the table shows a `Version N` subtitle on the name plus a "Versions" hover card. Migration `20260730153412_assembly-instructions-view.sql`.
- **Maintenance Dispatch** — reactive/scheduled repair for work centers with comments, events, items, and linked work centers.
diff --git a/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx b/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
index 7363bd2d8d..53fcb67357 100644
--- a/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
+++ b/apps/erp/app/modules/production/ui/Batches/BatchDetailDrawer.tsx
@@ -568,7 +568,7 @@ export function BatchDetailDrawer({
</div>
</DrawerBody>
- <DrawerFooter className="flex-shrink-0 border-t bg-card sm:justify-end items-center">
+ <DrawerFooter className="flex-shrink-0">
{/* Primary lifecycle actions only — secondary actions (print, view on
board) and the destructive Dissolve live in the header's ⋯ menu. */}
<HStack spacing={2}>
diff --git a/apps/erp/app/modules/production/ui/Batches/BatchesTable.tsx b/apps/erp/app/modules/production/ui/Batches/BatchesTable.tsx
index 444b933c9d..a01ccd2469 100644
--- a/apps/erp/app/modules/production/ui/Batches/BatchesTable.tsx
+++ b/apps/erp/app/modules/production/ui/Batches/BatchesTable.tsx
@@ -183,8 +183,43 @@ const BatchesTable = memo(({ data, count }: BatchesTableProps) => {
}
}, [dissolveFetcher.state, dissolveFetcher.data, t]);
+ // Bulk release for the selected rows — Planned batches only (release is the
+ // Planned → Active flip; Active/Completing/Completed batches are already on or
+ // off the floor). Posts the ids to the release action, which recalcs member
+ // jobs, releases each, and notifies the scheduler; we toast the summary.
+ const releaseBatchesFetcher = useFetcher<{
+ success?: boolean;
+ message?: string;
+ released?: number;
+ failed?: { readableId: string; message: string }[];
+ }>();
+ const wasReleasingBatches = useRef(false);
+ useEffect(() => {
+ if (releaseBatchesFetcher.state !== "idle") {
+ wasReleasingBatches.current = true;
+ return;
+ }
+ if (!wasReleasingBatches.current) return;
+ wasReleasingBatches.current = false;
+ const d = releaseBatchesFetcher.data;
+ if (!d) return;
+ if (d.success === false && d.message) {
+ toast.error(d.message);
+ return;
+ }
+ if (d.released) toast.success(t`Released ${d.released} batches`);
+ if (d.failed?.length) {
+ toast.error(
+ t`Could not release ${d.failed.length}: ${d.failed
+ .map((f) => f.readableId)
+ .join(", ")}`
+ );
+ }
+ }, [releaseBatchesFetcher.state, releaseBatchesFetcher.data, t]);
+
const renderActions = useCallback(
(selectedRows: JobOperationBatch[]) => {
+ const releasable = selectedRows.filter((r) => r.status === "Planned");
const dissolvable = selectedRows.filter(
(r) => r.status === "Planned" || r.status === "Active"
);
@@ -194,6 +229,22 @@ const BatchesTable = memo(({ data, count }: BatchesTableProps) => {
<Trans>Actions</Trans>
</DropdownMenuLabel>
<DropdownMenuSeparator />
+ <DropdownMenuItem
+ disabled={releasable.length === 0 || !canUpdate}
+ onClick={() =>
+ releaseBatchesFetcher.submit(
+ { batchIds: releasable.map((r) => r.id) },
+ {
+ method: "post",
+ action: path.to.releaseOperationBatches,
+ encType: "application/json"
+ }
+ )
+ }
+ >
+ <DropdownMenuIcon icon={<LuCirclePlay />} />
+ {t`Release ${releasable.length} batches`}
+ </DropdownMenuItem>
<DropdownMenuItem
destructive
disabled={dissolvable.length === 0 || !canUpdate}
@@ -214,7 +265,7 @@ const BatchesTable = memo(({ data, count }: BatchesTableProps) => {
</DropdownMenuContent>
);
},
- [canUpdate, dissolveFetcher, t]
+ [canUpdate, dissolveFetcher, releaseBatchesFetcher, t]
);
const customColumns =
diff --git a/apps/erp/app/modules/production/ui/Schedule/Kanban/Kanban.tsx b/apps/erp/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
index f7b75754fe..5758dc3406 100644
--- a/apps/erp/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
+++ b/apps/erp/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
@@ -27,14 +27,18 @@ import { BoardContainer, ColumnCard } from "./components/ColumnCard";
import { ItemCard } from "./components/ItemCard";
import { KanbanProvider } from "./context/KanbanContext";
import {
+ calculateFractionalPriority,
comparePriorityThenId,
createDragOrigin,
type DragOrigin,
type DragPreview,
getColumnPlacement,
- getItemPlacement,
+ getInsertionIndex,
+ getItemsInColumn,
+ getLogicalSlot,
isSamePlacement,
isSamePreview,
+ planColumnReorder,
resolveInsertionMarker
} from "./placement";
import type { Column, DisplaySettings, Item, Progress } from "./types";
@@ -151,13 +155,43 @@ function resolveDragPlacement(
return null;
}
- const placement = getItemPlacement(
- origin,
+ // Compute the slot directly rather than via getItemPlacement so the
+ // insertion marker still renders when the two neighbors share a priority
+ // (no fractional gap) — the drop renumbers the column, so the preview must
+ // not disappear just because the fast-path priority is unavailable.
+ const destinationColumnId = overItem.columnId;
+ const destinationItems = getItemsInColumn(
items,
- overItem.columnId,
- overItem.id
+ destinationColumnId,
+ origin.item.id
+ );
+ const sameColumn = origin.placement.columnId === destinationColumnId;
+ const insertionIndex = getInsertionIndex(
+ destinationItems,
+ overItem.id,
+ sameColumn,
+ origin.placement.slot.index
+ );
+ if (insertionIndex === null) return null;
+
+ const fractionalPriority = calculateFractionalPriority(
+ destinationItems[insertionIndex - 1]?.priority,
+ destinationItems[insertionIndex]?.priority
);
- return placement ? { ...placement, targetType: "item" } : null;
+ // The marker only needs the slot; the priority just has to be stable per
+ // slot so isSamePreview can dedupe. Fall back to the previous neighbor's
+ // priority (or the drag-start priority at the top of the column).
+ const priority =
+ fractionalPriority ??
+ destinationItems[insertionIndex - 1]?.priority ??
+ origin.placement.priority;
+
+ return {
+ columnId: destinationColumnId,
+ priority,
+ slot: getLogicalSlot(destinationItems, insertionIndex),
+ targetType: "item"
+ };
}
if (overData?.type === "column") {
@@ -181,6 +215,131 @@ function resolveDragPlacement(
return null;
}
+type DragCommit = {
+ columnId: string;
+ updates: { id: string; priority: number }[];
+};
+
+/**
+ * Resolves the priority writes a drop should persist. Unlike
+ * `resolveDragPlacement` (which drives the live insertion marker and gives up
+ * when the two neighbors have no numeric gap), this never abandons a valid drop
+ * over a priority collision: it falls back to renumbering the destination column
+ * so a fully equal-priority column — every op still at the default `1` because
+ * the scheduler has not sequenced them — can still be reordered. A no-op drop
+ * (dropped back in place, invalid/incompatible target) returns null.
+ */
+function resolveDragCommit(
+ origin: OperationDragOrigin,
+ over: Over | null,
+ items: readonly Item[],
+ itemsById: ReadonlyMap<string, Item>,
+ columnsById: ReadonlyMap<string, Column>
+): DragCommit | null {
+ if (
+ !over ||
+ over.disabled ||
+ !hasDraggableData(over) ||
+ !itemsById.has(origin.item.id)
+ ) {
+ return null;
+ }
+
+ const overId = String(over.id);
+ if (overId === origin.item.id) return null;
+
+ const overData = over.data.current;
+ if (overData?.type === "item") {
+ const overItem = itemsById.get(overId);
+ if (
+ !overItem ||
+ overData.item.id !== overId ||
+ overData.item.columnId !== overItem.columnId ||
+ !columnsById.has(overItem.columnId)
+ ) {
+ return null;
+ }
+
+ const destinationColumn = columnsById.get(overItem.columnId);
+ if (!destinationColumn?.type.includes(origin.item.columnType)) {
+ return null;
+ }
+
+ const destinationColumnId = overItem.columnId;
+ const destinationItems = getItemsInColumn(
+ items,
+ destinationColumnId,
+ origin.item.id
+ );
+ const sameColumn = origin.placement.columnId === destinationColumnId;
+ const insertionIndex = getInsertionIndex(
+ destinationItems,
+ overItem.id,
+ sameColumn,
+ origin.placement.slot.index
+ );
+ if (insertionIndex === null) return null;
+
+ const slot = getLogicalSlot(destinationItems, insertionIndex);
+ if (
+ isSamePlacement(origin.placement, {
+ columnId: destinationColumnId,
+ priority: origin.placement.priority,
+ slot
+ })
+ ) {
+ return null;
+ }
+
+ const fractionalPriority = calculateFractionalPriority(
+ destinationItems[insertionIndex - 1]?.priority,
+ destinationItems[insertionIndex]?.priority
+ );
+ const updates =
+ fractionalPriority === null
+ ? planColumnReorder(origin, items, destinationColumnId, insertionIndex)
+ : [{ id: origin.item.id, priority: fractionalPriority }];
+
+ return updates.length ? { columnId: destinationColumnId, updates } : null;
+ }
+
+ if (overData?.type === "column") {
+ if (
+ overData.column.id !== overId ||
+ !columnsById.has(overId) ||
+ overId === origin.placement.columnId
+ ) {
+ return null;
+ }
+
+ const destinationColumn = columnsById.get(overId);
+ if (!destinationColumn?.type.includes(origin.item.columnType)) {
+ return null;
+ }
+
+ const placement = getColumnPlacement(origin, items, overId);
+ if (placement) {
+ return {
+ columnId: overId,
+ updates: [{ id: origin.item.id, priority: placement.priority }]
+ };
+ }
+
+ // A background/empty-column drop whose origin priority collides with an
+ // existing card — renumber, appending the dragged op to the column's end.
+ const destinationItems = getItemsInColumn(items, overId, origin.item.id);
+ const updates = planColumnReorder(
+ origin,
+ items,
+ overId,
+ destinationItems.length
+ );
+ return updates.length ? { columnId: overId, updates } : null;
+ }
+
+ return null;
+}
+
const Kanban = ({
columns,
items: initialItems,
@@ -554,7 +713,11 @@ const Kanban = ({
origin &&
isOriginItemDrag(active, origin)
) {
- const placement = resolveDragPlacement(
+ // Resolve the actual priority writes. A pure reorder needs a single
+ // fractional priority; a collision (e.g. an unsequenced column where every
+ // card still sits at the default priority) renumbers the whole column, so
+ // several cards move at once.
+ const commit = resolveDragCommit(
origin,
over,
items,
@@ -562,43 +725,68 @@ const Kanban = ({
columnsById
);
- if (placement && !isSamePlacement(origin.placement, placement)) {
- if (isBatchItem(origin.item)) {
- // Dropping a batch on another work center reassigns the whole
- // batch (the edge fn writes the work center to every member).
- // Within-column reordering is a no-op: member priorities own the
- // batch card's position.
- if (placement.columnId !== origin.placement.columnId) {
- submit(
- {
- intent: "update",
- batchId: origin.item.batchId,
- workCenterId: placement.columnId
- },
- {
- method: "post",
- action: path.to.priorityBatchingUpdate,
- navigate: false,
- flushSync: true,
- fetcherKey: `item:${origin.item.id}`
- }
- );
- }
- } else {
+ if (commit) {
+ if (
+ isBatchItem(origin.item) &&
+ commit.columnId !== origin.placement.columnId
+ ) {
+ // A batch dropped on a DIFFERENT work center reassigns the whole batch
+ // (the edge fn writes the work center to every member) and reschedules;
+ // the priority renumber is left to the resulting replan wave.
submit(
{
- id: origin.item.id,
- columnId: placement.columnId,
- priority: placement.priority
+ intent: "update",
+ batchId: origin.item.batchId,
+ workCenterId: commit.columnId
},
{
method: "post",
- action: path.to.priorityOperationUpdate,
+ action: path.to.priorityBatchingUpdate,
navigate: false,
flushSync: true,
fetcherKey: `item:${origin.item.id}`
}
);
+ } else {
+ // Within-column reorder (or a non-batch cross-column move). Each
+ // renumbered card writes through its own endpoint: an operation writes
+ // its priority (+ work center), a batch card writes every member's
+ // priority so min(member) lands at the batch's new dispatch slot.
+ const flushSync = commit.updates.length === 1;
+ for (const update of commit.updates) {
+ const target = itemsById.get(update.id);
+ if (target && isBatchItem(target)) {
+ submit(
+ {
+ intent: "reprioritize",
+ batchId: target.batchId,
+ priority: update.priority
+ },
+ {
+ method: "post",
+ action: path.to.priorityBatchingUpdate,
+ navigate: false,
+ flushSync,
+ fetcherKey: `item:${update.id}`
+ }
+ );
+ } else {
+ submit(
+ {
+ id: update.id,
+ columnId: commit.columnId,
+ priority: update.priority
+ },
+ {
+ method: "post",
+ action: path.to.priorityOperationUpdate,
+ navigate: false,
+ flushSync,
+ fetcherKey: `item:${update.id}`
+ }
+ );
+ }
+ }
}
}
}
@@ -671,7 +859,23 @@ function usePendingItems() {
columnId: String(fetcher.formData.get("workCenterId"))
}));
- return [...operationMoves, ...batchMoves];
+ // A within-column batch reorder in flight: the card's board priority is
+ // min(member priority), which the reprioritize action sets to a single value,
+ // so mirror that value onto the card until the loader revalidates.
+ const batchReprioritizes = fetchers
+ .filter((fetcher): fetcher is PendingItem => {
+ return (
+ fetcher.formAction === path.to.priorityBatchingUpdate &&
+ fetcher.formData?.get("intent") === "reprioritize" &&
+ fetcher.formData?.has("priority")
+ );
+ })
+ .map((fetcher) => ({
+ id: `batch:${String(fetcher.formData.get("batchId"))}`,
+ priority: Number(fetcher.formData.get("priority"))
+ }));
+
+ return [...operationMoves, ...batchMoves, ...batchReprioritizes];
}
export default Kanban;
diff --git a/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.test.ts b/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.test.ts
index 6490019580..b901079132 100644
--- a/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.test.ts
+++ b/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.test.ts
@@ -6,6 +6,7 @@ import {
getColumnPlacement,
getItemPlacement,
isSamePlacement,
+ planColumnReorder,
resolveInsertionMarker
} from "./placement";
@@ -201,6 +202,43 @@ describe("placement", () => {
).toBe(true);
});
+ it("renumbers an all-equal-priority column so a reorder can land", () => {
+ // Every op still at the default priority 1 (scheduler has not sequenced
+ // them) — the fractional path finds no gap, so the drop renumbers instead.
+ const items = [item("a", 1), item("b", 1), item("c", 1)];
+ const origin = createDragOrigin(items, item("a", 1));
+
+ // Drop "a" at the bottom of its own column.
+ expect(planColumnReorder(origin!, items, "a", 2)).toEqual([
+ { id: "c", priority: 2 },
+ { id: "a", priority: 3 }
+ ]);
+
+ // Drop "a" between "b" and "c" (order becomes b, a, c).
+ expect(planColumnReorder(origin!, items, "a", 1)).toEqual([
+ { id: "a", priority: 2 },
+ { id: "c", priority: 3 }
+ ]);
+ });
+
+ it("only writes the siblings whose priority actually shifts", () => {
+ const items = [
+ item("a", 1),
+ item("b", 1, "b"),
+ item("c", 2, "b"),
+ item("d", 3, "b")
+ ];
+ const origin = createDragOrigin(items, item("a", 1));
+
+ // Cross-column drop of "a" into slot 1 of column "b": "b" keeps priority 1,
+ // the rest shift down by one.
+ expect(planColumnReorder(origin!, items, "b", 1)).toEqual([
+ { id: "a", priority: 2 },
+ { id: "c", priority: 3 },
+ { id: "d", priority: 4 }
+ ]);
+ });
+
it("resolves before and after insertion markers", () => {
expect(
resolveInsertionMarker({
diff --git a/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.ts b/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.ts
index 7c531d6eae..84753cb0f2 100644
--- a/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.ts
+++ b/apps/erp/app/modules/production/ui/Schedule/Kanban/placement.ts
@@ -216,6 +216,54 @@ export function getColumnPlacement<T extends PrioritizedItem>(
};
}
+/**
+ * Renumber a destination column with the dragged item inserted at
+ * `insertionIndex`, assigning evenly spaced integer priorities in display order.
+ *
+ * The fractional single-op path (`calculateFractionalPriority`) can only place a
+ * card when its two new neighbors have a numeric gap between them. Operations
+ * default to `priority = 1` until the finite scheduler sequences them, so a
+ * column of unsequenced ops is entirely equal-priority — no gap anywhere, and
+ * every drop is silently rejected. Renumbering restores a strict order in one
+ * pass; returning only the ops whose priority actually changes keeps an
+ * already-spaced column cheap (a single write) while a collided/defaulted column
+ * self-heals into `1..N` spacing on its first reorder.
+ */
+export function planColumnReorder<T extends PrioritizedItem>(
+ origin: DragOrigin<T>,
+ items: readonly T[],
+ destinationColumnId: string,
+ insertionIndex: number
+): { id: string; priority: number }[] {
+ const destinationItems = getItemsInColumn(
+ items,
+ destinationColumnId,
+ origin.item.id
+ );
+ const index = Math.max(0, Math.min(insertionIndex, destinationItems.length));
+ const orderedIds = [
+ ...destinationItems.slice(0, index).map((item) => item.id),
+ origin.item.id,
+ ...destinationItems.slice(index).map((item) => item.id)
+ ];
+
+ const currentPriority = new Map(
+ destinationItems.map((item) => [item.id, item.priority])
+ );
+
+ const updates: { id: string; priority: number }[] = [];
+ orderedIds.forEach((id, position) => {
+ const priority = position + 1;
+ // The dragged op always moves columns and/or slot, so it always writes; a
+ // sibling only writes when its priority genuinely shifts.
+ if (id === origin.item.id || currentPriority.get(id) !== priority) {
+ updates.push({ id, priority });
+ }
+ });
+
+ return updates;
+}
+
export function isSamePlacement(
origin: DragPlacement,
placement: DragPlacement
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
index 59b1ecf08e..47ef05fea4 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json
@@ -201,7 +201,7 @@
{"name":"inventory_getKanban","classification":"READ","paramCount":1,"schema":"369f807bc840","response":"a54d43903486","injectAuth":"companyId","permission":"inventory:view"},
{"name":"inventory_getKanbans","classification":"READ","paramCount":2,"schema":"68cb4a73d5a9","response":"1e5027ab2d56","injectAuth":"companyId","permission":"inventory:view"},
{"name":"inventory_getPickingList","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"227255936b96","injectAuth":"companyId","permission":"inventory:view"},
- {"name":"inventory_getPickingListAvailability","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"76dd65f99f2a","injectAuth":"companyId","permission":"inventory:view"},
+ {"name":"inventory_getPickingListAvailability","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"d8bb760d2850","injectAuth":"companyId","permission":"inventory:view"},
{"name":"inventory_getPickingListLine","classification":"READ","paramCount":1,"schema":"063a6777d378","response":"b51ad23d436f","injectAuth":"companyId","permission":"inventory:view"},
{"name":"inventory_getPickingListLines","classification":"READ","paramCount":1,"schema":"0a4ec3e7319b","response":"cc66c1b66f31","injectAuth":"companyId","permission":"inventory:view"},
{"name":"inventory_getPickingListLineTrackedEntities","classification":"READ","paramCount":1,"schema":"063a6777d378","response":"51dd622ce168","injectAuth":"companyId","permission":"inventory:view"},
@@ -392,7 +392,7 @@
{"name":"items_findChangeNoticesForItem","classification":"READ","paramCount":2,"schema":"bdfe8d67fc22","response":"e0196d4b0041","injectAuth":"companyId","permission":"parts:view"},
{"name":"items_findOtherOpenChangeNoticesForItem","classification":"READ","paramCount":2,"schema":"8a1da983320d","response":"e0196d4b0041","injectAuth":"companyId","permission":"parts:view"},
{"name":"items_getBomHasShelfLifeManagedInput","classification":"READ","paramCount":1,"schema":"623ca47a6c74","response":"7cb541e84f22","injectAuth":"companyId","permission":"parts:view"},
- {"name":"items_getBomItemAttributes","classification":"READ","paramCount":1,"schema":"c4ca22fd1816","response":"76dd65f99f2a","injectAuth":"companyId","permission":"parts:view"},
+ {"name":"items_getBomItemAttributes","classification":"READ","paramCount":1,"schema":"c4ca22fd1816","response":"d8bb760d2850","injectAuth":"companyId","permission":"parts:view"},
{"name":"items_getChangeNotice","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"09c0b464284c","injectAuth":"companyId","permission":"parts:view"},
{"name":"items_getChangeNoticeActions","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"949f86b5cda3","injectAuth":"companyId","permission":"parts:view"},
{"name":"items_getChangeNoticeAffectedItems","classification":"READ","paramCount":1,"schema":"29578070edb2","response":"5483e69d7515","injectAuth":"companyId","permission":"parts:view"},
@@ -767,11 +767,11 @@
{"name":"production_insertJob","classification":"WRITE","paramCount":2,"schema":"096204f059d8","response":"ad63dfd9d877","injectAuth":"companyId+createdBy+updatedBy","permission":"production:create"},
{"name":"production_invalidateAssemblyModelCache","classification":"DESTRUCTIVE","paramCount":1,"schema":"277f7d872d8c","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:update"},
{"name":"production_issueMaterial","classification":"WRITE","paramCount":7,"schema":"0408bd8c9bde","response":"none","injectAuth":"companyId","permission":"production:update"},
- {"name":"production_maxToolQuantityByItem","classification":"WRITE","paramCount":1,"schema":"8b9e90037b9a","response":"76dd65f99f2a","injectAuth":"companyId","permission":"production:update"},
+ {"name":"production_maxToolQuantityByItem","classification":"WRITE","paramCount":1,"schema":"8b9e90037b9a","response":"d8bb760d2850","injectAuth":"companyId","permission":"production:update"},
{"name":"production_movePeopleAssignment","classification":"DESTRUCTIVE","paramCount":2,"schema":"a726aa587ccc","response":"fe5e1dc03da5","injectAuth":"companyId+updatedBy","permission":"production:update"},
{"name":"production_movePeopleWeek","classification":"DESTRUCTIVE","paramCount":5,"schema":"fec8ebf1add4","response":"3badaa1686e8","injectAuth":"companyId+updatedBy","permission":"production:update"},
{"name":"production_notifyScheduleInputsChanged","classification":"WRITE","paramCount":3,"schema":"de0d8dcb6949","response":"none","injectAuth":"companyId","permission":"production:update"},
- {"name":"production_planAssemblyStepMarkerSync","classification":"WRITE","paramCount":2,"schema":"f32958f213ae","response":"12ec7edd981d","injectAuth":"companyId","permission":"production:update"},
+ {"name":"production_planAssemblyStepMarkerSync","classification":"WRITE","paramCount":2,"schema":"f32958f213ae","response":"bec53722aec4","injectAuth":"companyId","permission":"production:update"},
{"name":"production_pullJobMaterialMakeMethod","classification":"WRITE","paramCount":2,"schema":"e27f48bbab4c","response":"bcde375ebd4c","injectAuth":"companyId","permission":"production:update"},
{"name":"production_reassignAssemblyStepComponents","classification":"DESTRUCTIVE","paramCount":4,"schema":"99f3d689165d","response":"none","injectAuth":"companyId","permission":"production:update"},
{"name":"production_recalculateJobMakeMethodRequirements","classification":"WRITE","paramCount":1,"schema":"3797626bd17e","response":"none","injectAuth":"companyId+updatedBy","permission":"production:update"},
diff --git a/apps/erp/app/routes/x+/priority+/batching.update.tsx b/apps/erp/app/routes/x+/priority+/batching.update.tsx
index 44b4ce2414..dec79fad7e 100644
--- a/apps/erp/app/routes/x+/priority+/batching.update.tsx
+++ b/apps/erp/app/routes/x+/priority+/batching.update.tsx
@@ -66,6 +66,54 @@ export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData();
const intent = formData.get("intent");
+ if (intent === "reprioritize") {
+ // Within-column reorder of a batch card. The card's board position is
+ // min(member priority), so moving the batch means writing every member's
+ // priority to the batch's new dispatch slot. Like operations.update, this
+ // only re-sequences the manual dispatch order — it does NOT reschedule.
+ const batchId = String(formData.get("batchId") ?? "");
+ const priority = Number(formData.get("priority"));
+
+ if (!batchId || !Number.isFinite(priority)) {
+ return { success: false, message: "Invalid batch reprioritize request" };
+ }
+
+ const batch = await client
+ .from("jobOperationBatch")
+ .select("id, companyId, status")
+ .eq("id", batchId)
+ .eq("companyId", companyId)
+ .maybeSingle();
+
+ if (
+ batch.error ||
+ batch.data === null ||
+ batch.data.companyId !== companyId ||
+ // Completing/Completed batches are read-only on the board.
+ batch.data.status === "Completing" ||
+ batch.data.status === "Completed"
+ ) {
+ return { success: false, message: "Batch unavailable" };
+ }
+
+ const { error } = await client
+ .from("jobOperation")
+ .update({
+ priority,
+ updatedBy: userId,
+ updatedAt: new Date().toISOString()
+ })
+ .eq("jobOperationBatchId", batchId)
+ .eq("companyId", companyId)
+ .not("status", "in", "(Done,Canceled)");
+
+ if (error) {
+ return { success: false, message: error.message };
+ }
+
+ return { success: true };
+ }
+
if (intent === "create") {
const validation = await validator(
createJobOperationBatchValidator
diff --git a/apps/erp/app/routes/x+/production+/batches.release.tsx b/apps/erp/app/routes/x+/production+/batches.release.tsx
new file mode 100644
index 0000000000..ffa059733f
--- /dev/null
+++ b/apps/erp/app/routes/x+/production+/batches.release.tsx
@@ -0,0 +1,145 @@
+import { assertIsPost } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { getCarbonServiceRole } from "@carbon/auth/client.server";
+import type { Database } from "@carbon/database";
+import type { SupabaseClient } from "@supabase/supabase-js";
+import type { ActionFunctionArgs } from "react-router";
+import {
+ notifyScheduleInputsChanged,
+ recalculateJobRequirements,
+ releaseJobOperationBatch
+} from "~/modules/production";
+import { getEdgeFunctionErrorMessage } from "~/utils/error";
+
+// Releasing a batch can pull a Draft/Planned job's operation onto the floor, so
+// refresh those jobs' requirements first — the same safety recalc job release
+// and the single-batch `batching.update` action perform (no MRP). Returns an
+// error message, or null when every recalc succeeded.
+async function recalculateUnreleasedMemberJobs(
+ client: SupabaseClient<Database>,
+ jobIds: string[],
+ companyId: string,
+ userId: string
+): Promise<string | null> {
+ const uniqueJobIds = [...new Set(jobIds)];
+ if (uniqueJobIds.length === 0) return null;
+
+ const jobs = await client
+ .from("job")
+ .select("id, status")
+ .in("id", uniqueJobIds)
+ .eq("companyId", companyId);
+ if (jobs.error) {
+ return "Failed to load the batch's jobs";
+ }
+
+ const serviceRole = getCarbonServiceRole();
+ for (const job of jobs.data ?? []) {
+ if (job.status === "Draft" || job.status === "Planned") {
+ const recalc = await recalculateJobRequirements(serviceRole, {
+ id: job.id,
+ companyId,
+ userId
+ });
+ if (recalc.error) {
+ return `Failed to recalculate requirements for job ${job.id}`;
+ }
+ }
+ }
+ return null;
+}
+
+// Bulk release — one release per selected Planned batch. Each is independent:
+// a batch the edge fn refuses (no members, already recorded production) is
+// reported in `failed` while the rest still release. Only Planned batches are
+// released — the caller filters, and any non-Planned id is refused here too so a
+// stale selection can't flip an Active/Completing batch. Fetcher-driven; the
+// table toasts the summary and the loader revalidates.
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, companyId, userId } = await requirePermissions(request, {
+ update: "production"
+ });
+
+ const { batchIds } = (await request.json()) as { batchIds?: string[] };
+ const ids = [...new Set((batchIds ?? []).filter(Boolean))];
+ if (ids.length === 0) {
+ return { success: false, message: "No batches selected" };
+ }
+
+ // Resolve readable ids + status + work center up front: failures name the
+ // batch (not its nanoid), we only release Planned batches, and the notify
+ // needs the work center.
+ const rows = await client
+ .from("jobOperationBatch")
+ .select("id, readableId, status, workCenterId")
+ .in("id", ids)
+ .eq("companyId", companyId);
+ if (rows.error) {
+ return { success: false, message: "Failed to load the selected batches" };
+ }
+ const batchById = new Map((rows.data ?? []).map((r) => [r.id, r] as const));
+
+ let released = 0;
+ const failed: { readableId: string; message: string }[] = [];
+ for (const batchId of ids) {
+ const batch = batchById.get(batchId);
+ if (!batch || batch.status !== "Planned") {
+ // Silently skip a stale selection — nothing was released, nothing failed.
+ continue;
+ }
+
+ const members = await client
+ .from("jobOperation")
+ .select("jobId")
+ .eq("jobOperationBatchId", batchId)
+ .eq("companyId", companyId);
+ if (members.error) {
+ failed.push({
+ readableId: batch.readableId,
+ message: "Failed to load the batch members"
+ });
+ continue;
+ }
+
+ // Requirements refresh BEFORE the flip (mirrors job release's ordering); a
+ // failure stops this batch's release rather than dispatching stale BOMs.
+ const recalcError = await recalculateUnreleasedMemberJobs(
+ client,
+ (members.data ?? []).map((op) => op.jobId),
+ companyId,
+ userId
+ );
+ if (recalcError) {
+ failed.push({ readableId: batch.readableId, message: recalcError });
+ continue;
+ }
+
+ const result = await releaseJobOperationBatch(client, {
+ batchId,
+ companyId,
+ userId
+ });
+ if (result.error) {
+ failed.push({
+ readableId: batch.readableId,
+ message: await getEdgeFunctionErrorMessage(
+ result.error,
+ "Failed to release"
+ )
+ });
+ continue;
+ }
+
+ // After the status flip is persisted — the wave must see the new state.
+ await notifyScheduleInputsChanged(
+ companyId,
+ "work-center",
+ "batch released",
+ batch.workCenterId ?? undefined
+ );
+ released += 1;
+ }
+
+ return { success: true, released, failed };
+}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 43f60e4b12..55e50eb773 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -1931,6 +1931,7 @@ export const path = {
receivables: `${x}/invoicing/receivables`,
receivablesAdjust: `${x}/invoicing/receivables/adjust`,
refreshSession: "/refresh-session",
+ releaseOperationBatches: `${x}/production/batches/release`,
repeatDepreciationRun: (id: string) =>
generatePath(`${x}/depreciation-run/${id}/repeat`),
reports: `${x}/accounting/reports`,
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index de6e83c3b0..e2e8557b9d 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -24661,10 +24661,10 @@ export default {
$ref: "#/parameters/rowFilter.process.batchable"
},
{
- $ref: "#/parameters/rowFilter.process.batchRules"
+ $ref: "#/parameters/rowFilter.process.batchType"
},
{
- $ref: "#/parameters/rowFilter.process.batchType"
+ $ref: "#/parameters/rowFilter.process.batchRules"
},
{
$ref: "#/parameters/select"
@@ -24771,10 +24771,10 @@ export default {
$ref: "#/parameters/rowFilter.process.batchable"
},
{
- $ref: "#/parameters/rowFilter.process.batchRules"
+ $ref: "#/parameters/rowFilter.process.batchType"
},
{
- $ref: "#/parameters/rowFilter.process.batchType"
+ $ref: "#/parameters/rowFilter.process.batchRules"
},
{
$ref: "#/parameters/preferReturn"
@@ -24835,10 +24835,10 @@ export default {
$ref: "#/parameters/rowFilter.process.batchable"
},
{
- $ref: "#/parameters/rowFilter.process.batchRules"
+ $ref: "#/parameters/rowFilter.process.batchType"
},
{
- $ref: "#/parameters/rowFilter.process.batchType"
+ $ref: "#/parameters/rowFilter.process.batchRules"
},
{
$ref: "#/parameters/body.process"
@@ -67201,10 +67201,10 @@ export default {
$ref: "#/parameters/rowFilter.processes.batchable"
},
{
- $ref: "#/parameters/rowFilter.processes.batchRules"
+ $ref: "#/parameters/rowFilter.processes.batchType"
},
{
- $ref: "#/parameters/rowFilter.processes.batchType"
+ $ref: "#/parameters/rowFilter.processes.batchRules"
},
{
$ref: "#/parameters/rowFilter.processes.workCenters"
@@ -112668,16 +112668,16 @@ export default {
format: "boolean",
type: "boolean"
},
- batchRules: {
- description:
- "Per-dimension batch compatibility levels (must|guide|ignore); NULL = defaults (substance/grade/dimension guide, form/finish/item ignore).",
- format: "jsonb"
- },
batchType: {
default: "Sequential",
enum: ["Sequential", "Simultaneous"],
format: 'public."batchType"',
type: "string"
+ },
+ batchRules: {
+ description:
+ "Per-dimension batch compatibility levels (must|guide|ignore); NULL = defaults (substance/grade/dimension guide, form/finish/item ignore).",
+ format: "jsonb"
}
},
type: "object"
@@ -132609,14 +132609,14 @@ export default {
format: "boolean",
type: "boolean"
},
- batchRules: {
- format: "jsonb"
- },
batchType: {
enum: ["Sequential", "Simultaneous"],
format: 'public."batchType"',
type: "string"
},
+ batchRules: {
+ format: "jsonb"
+ },
workCenters: {
format: "text[]",
items: {
@@ -156514,16 +156514,16 @@ export default {
in: "query",
type: "string"
},
- "rowFilter.process.batchRules": {
- name: "batchRules",
- description:
- "Per-dimension batch compatibility levels (must|guide|ignore); NULL = defaults (substance/grade/dimension guide, form/finish/item ignore).",
+ "rowFilter.process.batchType": {
+ name: "batchType",
required: false,
in: "query",
type: "string"
},
- "rowFilter.process.batchType": {
- name: "batchType",
+ "rowFilter.process.batchRules": {
+ name: "batchRules",
+ description:
+ "Per-dimension batch compatibility levels (must|guide|ignore); NULL = defaults (substance/grade/dimension guide, form/finish/item ignore).",
required: false,
in: "query",
type: "string"
@@ -178644,14 +178644,14 @@ export default {
in: "query",
type: "string"
},
- "rowFilter.processes.batchRules": {
- name: "batchRules",
+ "rowFilter.processes.batchType": {
+ name: "batchType",
required: false,
in: "query",
type: "string"
},
- "rowFilter.processes.batchType": {
- name: "batchType",
+ "rowFilter.processes.batchRules": {
+ name: "batchRules",
required: false,
in: "query",
type: "string"
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 475057bc01..a0c2561330 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -68662,14 +68662,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -70327,14 +70327,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -73754,7 +73754,7 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -73768,7 +73768,7 @@ export type Database = {
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["shipmentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 475057bc01..a0c2561330 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -68662,14 +68662,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -70327,14 +70327,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -73754,7 +73754,7 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -73768,7 +73768,7 @@ export type Database = {
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["shipmentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 3269c2e6c7..f82f6c626b 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Konnte Regionsbild nicht für die Analyse vorbereiten"
msgid "Could not read the document: {0}"
msgstr "Dokument konnte nicht gelesen werden: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Konnte nicht gespeichert werden"
@@ -13332,6 +13337,10 @@ msgstr "Relative Zeitleiste · Daten müssen noch bestätigt werden"
msgid "Release"
msgstr "Freigeben"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Los freigeben"
@@ -13350,6 +13359,10 @@ msgstr "Auftrag freigeben"
msgid "Released"
msgstr "Freigegeben"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Freigabedatum"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 3182ce5e13..2fe9c427b8 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Could not prepare region image for analysis"
msgid "Could not read the document: {0}"
msgstr "Could not read the document: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr "Could not release {0}: {1}"
+
msgid "Could not save"
msgstr "Could not save"
@@ -13332,6 +13337,10 @@ msgstr "Relative timeline · dates to be confirmed"
msgid "Release"
msgstr "Release"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr "Release {0} batches"
+
msgid "Release Batch"
msgstr "Release Batch"
@@ -13350,6 +13359,10 @@ msgstr "Release Job"
msgid "Released"
msgstr "Released"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr "Released {0} batches"
+
msgid "Released date"
msgstr "Released date"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 561a73d13a..13ab7f314a 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -4244,6 +4244,11 @@ msgstr "No se pudo preparar la imagen de la región para el análisis"
msgid "Could not read the document: {0}"
msgstr "No se pudo leer el documento: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "No se pudo guardar"
@@ -13332,6 +13337,10 @@ msgstr "Cronograma relativo · fechas por confirmar"
msgid "Release"
msgstr "Liberar"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Liberar lote de producción"
@@ -13350,6 +13359,10 @@ msgstr "Liberar Trabajo"
msgid "Released"
msgstr "Liberado"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Fecha de liberación"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index fd84d2b9c4..9f933830f2 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Impossible de préparer l'image de la région pour l'analyse"
msgid "Could not read the document: {0}"
msgstr "Impossible de lire le document : {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "N'a pas pu enregistrer"
@@ -13332,6 +13337,10 @@ msgstr "Chronologie relative · dates à confirmer"
msgid "Release"
msgstr "Lancer"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Lancer le lot de production"
@@ -13350,6 +13359,10 @@ msgstr "Lancer le travail"
msgid "Released"
msgstr "Libéré"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Date de libération"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 32aa267ef0..b41c9e8fce 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -4244,6 +4244,11 @@ msgstr "विश्लेषण के लिए क्षेत्र छव
msgid "Could not read the document: {0}"
msgstr "दस्तावेज़ नहीं पढ़ा जा सका: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "सहेज नहीं सके"
@@ -13332,6 +13337,10 @@ msgstr "सापेक्ष समयरेखा · तारीखें प
msgid "Release"
msgstr "जारी करें"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "बैच जारी करें"
@@ -13350,6 +13359,10 @@ msgstr "जॉब जारी करें"
msgid "Released"
msgstr "जारी किया गया"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "जारी की गई तारीख"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index 28cf16a216..0dcee44ede 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Impossibile preparare l'immagine della regione per l'analisi"
msgid "Could not read the document: {0}"
msgstr "Non è stato possibile leggere il documento: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Impossibile salvare"
@@ -13332,6 +13337,10 @@ msgstr "Cronologia relativa · date da confermare"
msgid "Release"
msgstr "Rilascio"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Rilascia lotto"
@@ -13350,6 +13359,10 @@ msgstr "Rilascia Commessa"
msgid "Released"
msgstr "Rilasciato"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Data di rilascio"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index bfa26e1882..b9531bcaef 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -4244,6 +4244,11 @@ msgstr "分析用の領域画像を準備できませんでした"
msgid "Could not read the document: {0}"
msgstr "文書が読み込めません: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "保存できませんでした"
@@ -13332,6 +13337,10 @@ msgstr "相対的なタイムライン · 確認待ちの日付"
msgid "Release"
msgstr "リリース"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "バッチをリリース"
@@ -13350,6 +13359,10 @@ msgstr "ジョブをリリース"
msgid "Released"
msgstr "リリース済み"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "リリース日"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 78edb590ce..6bc969cd67 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -4244,6 +4244,11 @@ msgstr "분석을 위한 영역 이미지를 준비할 수 없습니다"
msgid "Could not read the document: {0}"
msgstr "문서를 읽을 수 없습니다: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "저장할 수 없습니다"
@@ -13332,6 +13337,10 @@ msgstr "상대적 일정 · 확인할 날짜"
msgid "Release"
msgstr "릴리스"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "배치 릴리스"
@@ -13350,6 +13359,10 @@ msgstr "작업 지시 릴리스"
msgid "Released"
msgstr "릴리즈됨"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "출시일"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 3355603783..4dba2b6362 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Nie można przygotować obrazu regionu do analizy"
msgid "Could not read the document: {0}"
msgstr "Nie można odczytać dokumentu: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Nie można było zapisać"
@@ -13332,6 +13337,10 @@ msgstr "Względna oś czasu · daty do potwierdzenia"
msgid "Release"
msgstr "Zwolnienie"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Zwolnij partię produkcyjną"
@@ -13350,6 +13359,10 @@ msgstr "Zwolnij zadanie"
msgid "Released"
msgstr "Wydane"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Data wydania"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index bd8eabd65e..6630295476 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Não foi possível preparar a imagem da região para análise"
msgid "Could not read the document: {0}"
msgstr "Não foi possível ler o documento: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Não foi possível salvar"
@@ -13332,6 +13337,10 @@ msgstr "Cronograma relativo · datas a confirmar"
msgid "Release"
msgstr "Liberação"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Liberar lote de produção"
@@ -13350,6 +13359,10 @@ msgstr "Liberar Trabalho"
msgid "Released"
msgstr "Liberado"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Data de lançamento"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 9c079a0765..fd3d95ab92 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Не удалось подготовить изображение рег
msgid "Could not read the document: {0}"
msgstr "Не удалось прочитать документ: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Не удалось сохранить"
@@ -13332,6 +13337,10 @@ msgstr "Относительная шкала времени · даты буд
msgid "Release"
msgstr "Запустить в работу"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Запустить серию в работу"
@@ -13350,6 +13359,10 @@ msgstr "Запустить производственный заказ в раб
msgid "Released"
msgstr "Выпущено"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Дата выпуска"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 060af59aed..b69bef36c5 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -4244,6 +4244,11 @@ msgstr "Bölge görüntüsü analiz için hazırlanamadı"
msgid "Could not read the document: {0}"
msgstr "Belge okunamadı: {0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "Kaydedilemedi"
@@ -13332,6 +13337,10 @@ msgstr "Göreceli zaman çizelgesi · tarihler onaylanacak"
msgid "Release"
msgstr "Serbest Bırakma"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "Partiyi Serbest Bırak"
@@ -13350,6 +13359,10 @@ msgstr "İş emrini serbest bırak"
msgid "Released"
msgstr "Yayınlandı"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "Yayın tarihi"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 86b7a70b85..6e22b4bd1b 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -4244,6 +4244,11 @@ msgstr "无法准备区域图像以进行分析"
msgid "Could not read the document: {0}"
msgstr "无法读取文件:{0}"
+#. placeholder {0}: d.failed.length
+#. placeholder {1}: d.failed .map((f) => f.readableId) .join(", ")
+msgid "Could not release {0}: {1}"
+msgstr ""
+
msgid "Could not save"
msgstr "无法保存"
@@ -13332,6 +13337,10 @@ msgstr "相对时间表·待确认的日期"
msgid "Release"
msgstr "下达"
+#. placeholder {0}: releasable.length
+msgid "Release {0} batches"
+msgstr ""
+
msgid "Release Batch"
msgstr "下达生产批次"
@@ -13350,6 +13359,10 @@ msgstr "下达工单"
msgid "Released"
msgstr "已下达"
+#. placeholder {0}: d.released
+msgid "Released {0} batches"
+msgstr ""
+
msgid "Released date"
msgstr "下达日期"