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.

fix(batches): a bulk release puts each supplier on the PO its first batch created, across batches and slices

aashu308ab822cc40
diff --git a/.claude/rules/table-infinite-scroll.md b/.claude/rules/table-infinite-scroll.md
index e5928b109f..605627a84e 100644
--- a/.claude/rules/table-infinite-scroll.md
+++ b/.claude/rules/table-infinite-scroll.md
@@ -313,9 +313,11 @@ A bulk route that gets `allMatching` in place of ids calls
6. Steps per slice: each reads `idsPerStep` ids (default 1,000; Jobs Release
25, Batches Release 10, Batches Dissolve 100) and runs the action 100 ids
per call (`BULK_CHUNK_SIZE`). Each call gets the `carry` the call before
- it returned and returns the next one. Jobs Release carries the PO each
- supplier went on, so a later slice adds to the PO an earlier slice made
- (`bulkReleaseStartingPurchaseOrders`) instead of refusing the job.
+ it returned and returns the next one. Jobs Release and Batches Release
+ carry the PO each supplier went on, so a later slice adds to the PO an
+ earlier slice made (`bulkReleaseStartingPurchaseOrders`) instead of
+ refusing the job or batch. Inside one call, `releaseBatches` passes the
+ same map from batch to batch (`carriedPurchaseOrders`).
7. Step `notify` sends `NotificationEvent.TableBulkAction` with the counts
in the title: done, skipped, failed. Its event id
(`table-bulk-action:{id}:done`) stops a second send on a retry.
diff --git a/apps/erp/app/modules/production/AGENTS.md b/apps/erp/app/modules/production/AGENTS.md
index 5488d34eff..79f2447946 100644
--- a/apps/erp/app/modules/production/AGENTS.md
+++ b/apps/erp/app/modules/production/AGENTS.md
@@ -110,7 +110,7 @@ pnpm --filter erp test
- `getJob` / `getJobs` / `getJobMethodTree` / `getJobMethodTreeArray` — job reads with method hierarchy
- `releaseJobs` (`production.server.ts`, published as `production_releaseJobs`) — the one release operation: the job page's Release dialog (`x+/job+/$jobId.release.tsx`, through `useJobRelease`), the jobs table's bulk **Release Jobs** (`x+/job+/release.tsx`, `path.to.bulkReleaseJob`), the planning page's Release (`useJobPlanningRelease`) and the API/MCP all run it. Per selected job: a job that is not Draft/Planned is listed in `skipped`; the dialog's supplier picks (`supplierProcessByOperationId`) are saved on the operations first (`stampSupplierChoices`, validated: the operation belongs to the jobs, the supplier process to its process); then `getJobReleaseReadiness` once for the selection (every read through `fetchAllByIds`, pinned by `test/job-release-readiness.test.ts`) and `jobReleaseProblems` per job — nothing to make, manufacturing blocked, an assembly with no operations, an outside operation without a supplier, a Make to Asset job that cannot complete to its asset (`makeToAssetReleaseError`), and, when no `purchaseOrdersBySupplierId` was sent, a supplier with Draft POs to choose from. A job with a problem is named in `failed`; the rest go through `releaseCheckedJobs` one by one on a shared supplier→PO map (a supplier's first new PO is reused), then `runLocationSchedule` runs once per location AFTER every status flip. Returns `{ released, warnings, failed, skipped, scheduled }`; a job released whose POs failed is in `released` and `warnings`. Pinned by `test/release-jobs.test.ts`. More than 25 selected jobs, or "every matching job" (up to 2,000), go to the background `table-bulk-action` job instead (`x+/job+/release.tsx`): it releases slices of 25 through `releaseCheckedJobs` (`utils/production-bulk-actions.server.ts`, a system context on behalf of the user) and carries the supplier→PO map from one slice to the next, so later jobs go on the PO an earlier slice made.
- `releaseCheckedJobs` (`production.server.ts`, unpublished) — the step every release shares, for jobs already checked: recalc, MRP (a failure is logged and never blocks), the guarded Ready flip (`updateJobStatus(..., { fromStatuses: ["Draft", "Planned"] })` returns `updated: false` when someone cancelled or released the job during the recalc/MRP, so the release stops; pinned by `test/job-status-guard.test.ts`), outside-operation POs, `releasedDate` (a failed write is reported, since nothing else writes it). Returns `releasedJobIds`, the PO map and a `failure`.
-- `releaseBatches` (`production.server.ts`, published as `production_releaseBatches`) — releases Planned batches: member jobs through `releaseBatchMemberJobs` (all-or-nothing on `jobReleaseProblems`), then `releaseJobOperationBatch`, then `notifyScheduleInputsChanged`. Used by the batch drawer (`batching.update` release intent) and the batches table's bulk Release (`production+/batches.release.tsx`). `updateJobStatus` and `releaseJobOperationBatch` are NOT published: each alone skips what release does.
+- `releaseBatches` (`production.server.ts`, published as `production_releaseBatches`) — releases Planned batches: member jobs through `releaseBatchMemberJobs` (all-or-nothing on `jobReleaseProblems`), then `releaseJobOperationBatch`, then `notifyScheduleInputsChanged`. One supplier→PO map runs through the batches of a call, so a supplier's outside operations from every batch go on the PO the first batch created; with no PO choice, a supplier with a Draft PO that is not this release's own refuses the batch. `carriedPurchaseOrders` passes the map in from an earlier call and the result returns it: the background Batches Release carries it from slice to slice, as Jobs Release does. Used by the batch drawer (`batching.update` release intent) and the batches table's bulk Release (`production+/batches.release.tsx`). `updateJobStatus` and `releaseJobOperationBatch` are NOT published: each alone skips what release does.
- **Every path to Ready.** Each refuses a job that fails `jobReleaseProblems`, which includes strict backflush lines with no storage unit (`materialsWithoutStorageUnit` from `getJobReleaseReadiness`):
| Path | Checks |
diff --git a/apps/erp/app/modules/production/production.server.ts b/apps/erp/app/modules/production/production.server.ts
index 6cc3a61acf..1eed13e96a 100644
--- a/apps/erp/app/modules/production/production.server.ts
+++ b/apps/erp/app/modules/production/production.server.ts
@@ -100,7 +100,10 @@ import {
import type { JobStatus } from "./production.service";
import * as service from "./production.service";
import * as utils from "./production.utils";
-import { jobReleaseProblems } from "./ui/Jobs/job-release-logic";
+import {
+ bulkReleaseStartingPurchaseOrders,
+ jobReleaseProblems
+} from "./ui/Jobs/job-release-logic";
const logger = getLogger("erp", "production");
@@ -942,16 +945,24 @@ export const completeJob = defineServiceFn({
* `purchaseOrdersBySupplierId` is the planner's PO choice from the Release
* dialog; unattended callers (bulk release) send none, and a batch that needs
* a choice — a supplier with Draft POs to pick from — is refused so the
- * planner can release it from its dialog.
+ * planner can release it from its dialog. An unattended release of several
+ * batches passes `carriedPurchaseOrders`, the PO each supplier went on in an
+ * earlier batch of the same release: that supplier stays on it instead of
+ * being refused (`bulkReleaseStartingPurchaseOrders`). The PO map is
+ * returned for the next batch.
*/
export const releaseBatchMemberJobs = defineServiceFn({
input: z.object({
jobIds: z.array(z.string()),
- purchaseOrdersBySupplierId: z.record(z.string(), z.string()).optional()
+ purchaseOrdersBySupplierId: z.record(z.string(), z.string()).optional(),
+ carriedPurchaseOrders: z.record(z.string(), z.string()).optional()
}),
permission: { update: "production" },
- async run(ctx, { jobIds, purchaseOrdersBySupplierId }) {
+ async run(
+ ctx,
+ { jobIds, purchaseOrdersBySupplierId, carriedPurchaseOrders }
+ ) {
const client = ctx.asCaller.supabase;
const companyId = ctx.company.id;
@@ -971,7 +982,12 @@ export const releaseBatchMemberJobs = defineServiceFn({
const toRelease = (jobs.data ?? [])
.filter((job) => job.status === "Draft" || job.status === "Planned")
.map((job) => job.id);
- if (toRelease.length === 0) return { releasedJobIds: [] as string[] };
+ if (toRelease.length === 0) {
+ return {
+ releasedJobIds: [] as string[],
+ purchaseOrdersBySupplierId: {} as Record<string, string>
+ };
+ }
const readiness = await service.getJobReleaseReadiness(
client,
@@ -996,36 +1012,45 @@ export const releaseBatchMemberJobs = defineServiceFn({
);
}
- if (
- !purchaseOrdersBySupplierId &&
- readiness.data.suppliers.some((s) => s.draftPurchaseOrders.length > 0)
- ) {
- return ctx.error(
- "rule",
- "Outside operations need a purchase order choice — open the batch to release it"
+ let purchaseOrders: Record<string, string>;
+ if (purchaseOrdersBySupplierId) {
+ // Only a Draft PO of that supplier is a valid target; anything else is "new".
+ purchaseOrders = Object.fromEntries(
+ readiness.data.suppliers.map((supplier) => {
+ const picked = purchaseOrdersBySupplierId[supplier.supplierId];
+ return [
+ supplier.supplierId,
+ picked &&
+ supplier.draftPurchaseOrders.some((po) => po.id === picked)
+ ? picked
+ : "new"
+ ];
+ })
);
+ } else {
+ const starting = bulkReleaseStartingPurchaseOrders(
+ readiness.data.suppliers,
+ carriedPurchaseOrders
+ );
+ if (starting.suppliersToChoose.size > 0) {
+ return ctx.error(
+ "rule",
+ "Outside operations need a purchase order choice — open the batch to release it"
+ );
+ }
+ purchaseOrders = starting.purchaseOrders;
}
- // Only a Draft PO of that supplier is a valid target; anything else is "new".
- const purchaseOrders = Object.fromEntries(
- readiness.data.suppliers.map((supplier) => {
- const picked = purchaseOrdersBySupplierId?.[supplier.supplierId];
- return [
- supplier.supplierId,
- picked && supplier.draftPurchaseOrders.some((po) => po.id === picked)
- ? picked
- : "new"
- ];
- })
- );
-
const released = await releaseCheckedJobs(ctx, {
jobIds: toRelease,
purchaseOrdersBySupplierId: purchaseOrders
});
if (released.error) return released.error;
if (released.data.failure) return released.data.failure;
- return { releasedJobIds: released.data.releasedJobIds };
+ return {
+ releasedJobIds: released.data.releasedJobIds,
+ purchaseOrdersBySupplierId: released.data.purchaseOrdersBySupplierId
+ };
}
});
@@ -1039,18 +1064,27 @@ export const releaseBatchMemberJobs = defineServiceFn({
* batch on the floor, then tell the scheduler. A batch that is not Planned is
* listed in `skipped`. `purchaseOrdersBySupplierId` is the release dialog's
* choice; without one, a batch whose suppliers have Draft purchase orders is
- * refused.
+ * refused, except for the PO this release itself made: a supplier's
+ * outside operations from every batch go on the one PO the first batch
+ * created. `carriedPurchaseOrders` names the POs an earlier call of the same
+ * release made; the result returns the map for the next call.
+ *
+ * @param carriedPurchaseOrders - The PO each supplier went on in an earlier call of the same release, as that call returned it
*
* @mcp
*/
export const releaseBatches = defineServiceFn({
input: z.object({
batchIds: z.array(z.string()).min(1),
- purchaseOrdersBySupplierId: z.record(z.string(), z.string()).optional()
+ purchaseOrdersBySupplierId: z.record(z.string(), z.string()).optional(),
+ carriedPurchaseOrders: z.record(z.string(), z.string()).optional()
}),
permission: { update: "production" },
- async run(ctx, { batchIds, purchaseOrdersBySupplierId }) {
+ async run(
+ ctx,
+ { batchIds, purchaseOrdersBySupplierId, carriedPurchaseOrders }
+ ) {
const client = ctx.asCaller.supabase;
const companyId = ctx.company.id;
const ids = [...new Set(batchIds)];
@@ -1079,7 +1113,19 @@ export const releaseBatches = defineServiceFn({
});
return false;
});
- if (planned.length === 0) return { released: [], failed, skipped };
+ // The PO each supplier went on so far: a "new" PO the first batch
+ // creates is the one the batches after it use.
+ const purchaseOrders = {
+ ...(purchaseOrdersBySupplierId ?? carriedPurchaseOrders)
+ };
+ if (planned.length === 0) {
+ return {
+ released: [],
+ failed,
+ skipped,
+ purchaseOrdersBySupplierId: purchaseOrders
+ };
+ }
const members = await client
.from("jobOperation")
@@ -1106,12 +1152,15 @@ export const releaseBatches = defineServiceFn({
const ref = { batchId: batch.id, readableId: batch.readableId };
const jobs = await releaseBatchMemberJobs(ctx, {
jobIds: (jobIdsByBatch[batch.id] ?? []).map((op) => op.jobId),
- purchaseOrdersBySupplierId
+ ...(purchaseOrdersBySupplierId
+ ? { purchaseOrdersBySupplierId: purchaseOrders }
+ : { carriedPurchaseOrders: purchaseOrders })
});
if (jobs.error) {
failed.push({ ...ref, message: jobs.error.message });
continue;
}
+ Object.assign(purchaseOrders, jobs.data.purchaseOrdersBySupplierId);
const result = await service.releaseJobOperationBatch(
client,
@@ -1140,7 +1189,12 @@ export const releaseBatches = defineServiceFn({
released.push(ref);
}
- return { released, failed, skipped };
+ return {
+ released,
+ failed,
+ skipped,
+ purchaseOrdersBySupplierId: purchaseOrders
+ };
}
});
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 4f86c1d366..0a5b57730a 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
@@ -818,7 +818,7 @@
{"name":"production_reassignAssemblyComponents","classification":"DESTRUCTIVE","schema":"71d135315dea","response":"3797626bd17e","permission":"production:update","paginates":false},
{"name":"production_recalculateJobRequirements","classification":"WRITE","schema":"7f8214d1083f","response":"9e056a59d695","permission":"production:update","paginates":false},
{"name":"production_reconvertAssemblyModel","classification":"DESTRUCTIVE","schema":"3797626bd17e","response":"277f7d872d8c","permission":"production:update","paginates":false},
- {"name":"production_releaseBatches","classification":"WRITE","schema":"cdc90750ed35","response":"3c7bc982eae0","permission":"production:update","paginates":false},
+ {"name":"production_releaseBatches","classification":"WRITE","schema":"b6b41ae3a2b7","response":"340a1cb28ff4","permission":"production:update","paginates":false},
{"name":"production_releaseJobs","classification":"WRITE","schema":"9d50f93189c8","response":"9655f6ea4d0d","permission":"production:update","paginates":false},
{"name":"production_reopenJob","classification":"WRITE","schema":"4999bd4be598","response":"64aaffa78287","permission":"production:update","paginates":false},
{"name":"production_reopenProductionPlanningActions","classification":"WRITE","schema":"8c0c1ffe0fab","response":"2a69a1e7d58b","permission":"production:update","paginates":false},
diff --git a/apps/erp/app/utils/production-bulk-actions.server.ts b/apps/erp/app/utils/production-bulk-actions.server.ts
index ada486e1cc..9135a67d54 100644
--- a/apps/erp/app/utils/production-bulk-actions.server.ts
+++ b/apps/erp/app/utils/production-bulk-actions.server.ts
@@ -218,20 +218,47 @@ export type BulkBatchResult =
}
| { success: false; message: string };
+export type BulkReleaseBatchesResult =
+ | (Extract<BulkBatchResult, { success: true }> & {
+ /** The PO each supplier's outside operations went on. The next slice
+ * of the same release takes it. */
+ purchaseOrdersBySupplierId: Record<string, string>;
+ })
+ | { success: false; message: string };
+
/**
* Releases the Planned batches (`releaseBatches`): a batch whose member jobs
* fail their checks, or that has a PO to choose, is reported in `failed`
* while the rest still release. Any other status is skipped.
+ *
+ * `purchaseOrdersBySupplierId` is the map the previous slice returned: a
+ * supplier keeps the PO an earlier batch of this release created instead of
+ * being asked to choose.
*/
export async function bulkReleaseBatches(
ctx: ServiceContext,
- { batchIds }: { batchIds: string[] }
-): Promise<BulkBatchResult> {
+ {
+ batchIds,
+ purchaseOrdersBySupplierId = {}
+ }: {
+ batchIds: string[];
+ purchaseOrdersBySupplierId?: Record<string, string>;
+ }
+): Promise<BulkReleaseBatchesResult> {
const ids = [...new Set(batchIds.filter(Boolean))];
if (ids.length === 0) {
- return { success: true, done: 0, failed: [], skipped: 0 };
+ return {
+ success: true,
+ done: 0,
+ failed: [],
+ skipped: 0,
+ purchaseOrdersBySupplierId
+ };
}
- const result = await releaseBatches(ctx, { batchIds: ids });
+ const result = await releaseBatches(ctx, {
+ batchIds: ids,
+ carriedPurchaseOrders: purchaseOrdersBySupplierId
+ });
if (result.error) {
logger.error("Failed to release batches", {
companyId: ctx.company.id,
@@ -246,7 +273,8 @@ export async function bulkReleaseBatches(
readableId,
message
})),
- skipped: result.data.skipped.length
+ skipped: result.data.skipped.length,
+ purchaseOrdersBySupplierId: result.data.purchaseOrdersBySupplierId
};
}
diff --git a/apps/erp/app/utils/table-jobs.server.ts b/apps/erp/app/utils/table-jobs.server.ts
index b226b5dafc..b840fe043e 100644
--- a/apps/erp/app/utils/table-jobs.server.ts
+++ b/apps/erp/app/utils/table-jobs.server.ts
@@ -164,7 +164,8 @@ type BulkActionRun = (
carry?: TableBulkActionCarry
) => Promise<TableBulkActionResult>;
-/** The supplier → PO map a Jobs Release chunk carries to the next one. */
+/** The supplier → PO map a Jobs or Batches Release chunk carries to the
+ * next one. */
function carriedPurchaseOrders(
carry: TableBulkActionCarry | undefined
): Record<string, string> {
@@ -266,16 +267,18 @@ const BULK_ACTION_RUNS: Record<TableBulkActionKey, BulkActionRun> = {
failed: result.failed
};
},
- "batches.release": async (ids, _params, context) => {
+ "batches.release": async (ids, _params, context, carry) => {
const result = await bulkReleaseBatches(await jobServiceContext(context), {
- batchIds: ids
+ batchIds: ids,
+ purchaseOrdersBySupplierId: carriedPurchaseOrders(carry)
});
if (!result.success) throw new Error(result.message);
return {
done: result.done,
skipped: result.skipped,
failed: result.failed.length,
- ...problemLines(result.failed)
+ ...problemLines(result.failed),
+ carry: { purchaseOrdersBySupplierId: result.purchaseOrdersBySupplierId }
};
},
"batches.dissolve": async (ids, _params, context) => {
diff --git a/apps/erp/test/release-jobs.test.ts b/apps/erp/test/release-jobs.test.ts
index c77849dcf2..c3d5aa6138 100644
--- a/apps/erp/test/release-jobs.test.ts
+++ b/apps/erp/test/release-jobs.test.ts
@@ -520,4 +520,78 @@ describe("releaseBatches", () => {
expect(data?.failed.map((ref) => ref.batchId)).toEqual(["b3"]);
expect(events).not.toContain("batch:b3");
});
+
+ describe("a supplier's purchase order", () => {
+ const draft = { id: "po-1", purchaseOrderId: "PO1" };
+ // Each batch reads its suppliers after the batches before it released:
+ // the PO the first one created is a Draft by the time the second reads.
+ const readinessAfterFirstPo = () => {
+ let calls = 0;
+ vi.mocked(getJobReleaseReadiness).mockImplementation(
+ async (_client, jobIds) =>
+ ({
+ data: {
+ jobs: jobIds.map((id) => ready(id)),
+ suppliers: [
+ {
+ supplierId: "s1",
+ draftPurchaseOrders: calls++ === 0 ? [] : [draft]
+ }
+ ]
+ },
+ error: null
+ }) as any
+ );
+ };
+ // The PO map each purchase-order posting got, copied when it ran: the
+ // release keeps adding to the same object.
+ let creates: Record<string, string>[] = [];
+ const createdPo = (created: Record<string, string>) =>
+ postings({
+ create: async (input) => {
+ creates.push({ ...input.purchaseOrdersBySupplierId });
+ return {
+ data: { purchaseOrderIdsBySupplierId: created },
+ error: null
+ };
+ }
+ });
+ beforeEach(() => {
+ creates = [];
+ invoke.mockImplementation(createdPo({}));
+ });
+
+ it("is the one the first batch created, for every batch after it", async () => {
+ readinessAfterFirstPo();
+ invoke.mockImplementation(createdPo({ s1: "po-1" }));
+ const { data } = await release(["b1", "b3"]);
+ expect(data?.released.map((ref) => ref.batchId)).toEqual(["b1", "b3"]);
+ expect(creates).toEqual([{ s1: "new" }, { s1: "po-1" }]);
+ expect(data?.purchaseOrdersBySupplierId).toEqual({ s1: "po-1" });
+ });
+
+ it("is the one an earlier call of the same release carried", async () => {
+ readiness([ready("j3")], [{ supplierId: "s1", draftPurchaseOrders: [draft] }]);
+ const { data } = await releaseBatches(
+ contextFor(database(tables()).client),
+ { batchIds: ["b3"], carriedPurchaseOrders: { s1: "po-1" } }
+ );
+ expect(data?.released.map((ref) => ref.batchId)).toEqual(["b3"]);
+ expect(creates).toEqual([{ s1: "po-1" }]);
+ });
+
+ it("needs a choice when the Draft is not this release's own", async () => {
+ readiness([ready("j3")], [{ supplierId: "s1", draftPurchaseOrders: [draft] }]);
+ const { data } = await release(["b3"]);
+ expect(data?.failed).toEqual([
+ {
+ batchId: "b3",
+ readableId: "BAT3",
+ message:
+ "Outside operations need a purchase order choice — open the batch to release it"
+ }
+ ]);
+ expect(creates).toEqual([]);
+ });
+ });
});
diff --git a/docs/content/docs/reference/batching.mdx b/docs/content/docs/reference/batching.mdx
index 399bca0ff8..aa0674e889 100644
--- a/docs/content/docs/reference/batching.mdx
+++ b/docs/content/docs/reference/batching.mdx
@@ -133,7 +133,7 @@ Lot planning (migration `20260918094217_batch-output-lot-at-creation.sql`): `job
Compatibility: `producedItem` is the seventh entry in `BATCH_RULE_DIMENSIONS`, default `ignore`, resolved from the job's item readable id on both the client fold and the posting's `assertMaterialCompatible`. Batch completion completes member JOBS too: `sync_finish_job_operation`'s status gate admits Draft/Planned jobs when the Done operation carries a `jobOperationBatchId` (migration `20260916155634_batch-completion-completes-draft-jobs.sql`) — a Draft job's op can only reach Done through a released batch, so the run genuinely happened; the job's receipt posts before the route's merge, which is why a merged lot's on-hand equals its full quantity. Serial-tracked members are unchanged by all of the above — batch mode still disables tracked activity for them.
-Key refusal strings (posting): "The process is not batchable"; "Operation {id} is already in a batch"; "Operation {id} has already started"; "Operations with recorded production events cannot be batched"; "These operations can't share a batch — the {dims} must match on this process"; "Cannot add operations to a batch with status {status}"; "The batch has already started — complete it instead"; "Cannot remove operations: production has been recorded. Complete the batch instead."; "Cannot change the work center: production has been recorded."; "Only a planned batch can be released"; "Cannot release an empty batch"; "Only an active batch can be unreleased"; "Cannot dissolve: production has been recorded. Complete the batch instead — member jobs then proceed independently."; "Every operation is excluded — dissolve the batch instead of completing it"; "Operation {id} was included when completion started — retry with the recorded values; corrections happen after completion."; "Quantities were already recorded for this batch ({detail}). Retry with the recorded values; corrections happen after completion."; "One or more operations were already claimed by another batch — refresh and try again"; "Pick of {n} exceeds the batch's remaining requirement of {m}"; "No member operation still requires this item"; "Batch is already completed"; "Operation {id} produces a batch-tracked item — its output lot is required"; "Operation {id} produces a batch-tracked item — its batch number is required"; "Only lots of the same item can be merged"; "At least two lots are required to merge"; "Lot {readableId} is not available to merge"; "Lot {readableId} has no quantity to merge"; "No mergeable output lots" (ERP mergeOutputs, when server-side derivation finds nothing); "A combined output needs its lot number"; "Lot number {n} is used twice — give each job its own, or combine them into one lot"; "Only operations that produce a batch-tracked item can combine into one lot"; "Lots of different items can't combine into one lot" (create/add lot planning). Batch release (ERP `releaseBatchMemberJobs`): "Fix these jobs before releasing: {jobId}: no operations on {assemblies}; {jobId}: manufacturing is blocked; {jobId}: choose a supplier for {operation} on the job; {jobId}: {operation} has no supplier" (an outside operation's supplier is its own supplier process, else its process's only supplier — a process with several needs the choice made on the job's own Release); "Outside operations need a purchase order choice — open the batch to release it" (bulk release only, when a supplier has Draft POs to choose from); "Failed to create purchase orders for job {id}". Job release route: "Assign an operation to each assembly before releasing: {assemblies}". MES gates: "This operation is part of a batch that has not been released to the floor"; "This operation's job has not been released to the floor". Builder add-mode: "Only a planned or active batch can take more operations". Scheduling conflict: "{Batch} has no estimated time — add setup, labor, or machine time to its operations to schedule it".
+Key refusal strings (posting): "The process is not batchable"; "Operation {id} is already in a batch"; "Operation {id} has already started"; "Operations with recorded production events cannot be batched"; "These operations can't share a batch — the {dims} must match on this process"; "Cannot add operations to a batch with status {status}"; "The batch has already started — complete it instead"; "Cannot remove operations: production has been recorded. Complete the batch instead."; "Cannot change the work center: production has been recorded."; "Only a planned batch can be released"; "Cannot release an empty batch"; "Only an active batch can be unreleased"; "Cannot dissolve: production has been recorded. Complete the batch instead — member jobs then proceed independently."; "Every operation is excluded — dissolve the batch instead of completing it"; "Operation {id} was included when completion started — retry with the recorded values; corrections happen after completion."; "Quantities were already recorded for this batch ({detail}). Retry with the recorded values; corrections happen after completion."; "One or more operations were already claimed by another batch — refresh and try again"; "Pick of {n} exceeds the batch's remaining requirement of {m}"; "No member operation still requires this item"; "Batch is already completed"; "Operation {id} produces a batch-tracked item — its output lot is required"; "Operation {id} produces a batch-tracked item — its batch number is required"; "Only lots of the same item can be merged"; "At least two lots are required to merge"; "Lot {readableId} is not available to merge"; "Lot {readableId} has no quantity to merge"; "No mergeable output lots" (ERP mergeOutputs, when server-side derivation finds nothing); "A combined output needs its lot number"; "Lot number {n} is used twice — give each job its own, or combine them into one lot"; "Only operations that produce a batch-tracked item can combine into one lot"; "Lots of different items can't combine into one lot" (create/add lot planning). Batch release (ERP `releaseBatchMemberJobs`): "Fix these jobs before releasing: {jobId}: no operations on {assemblies}; {jobId}: manufacturing is blocked; {jobId}: choose a supplier for {operation} on the job; {jobId}: {operation} has no supplier" (an outside operation's supplier is its own supplier process, else its process's only supplier — a process with several needs the choice made on the job's own Release); "Outside operations need a purchase order choice — open the batch to release it" (bulk release only, when a supplier has Draft POs to choose from and none of them is the PO an earlier batch of the same release created); "Failed to create purchase orders for job {id}". Job release route: "Assign an operation to each assembly before releasing: {assemblies}". MES gates: "This operation is part of a batch that has not been released to the floor"; "This operation's job has not been released to the floor". Builder add-mode: "Only a planned or active batch can take more operations". Scheduling conflict: "{Batch} has no estimated time — add setup, labor, or machine time to its operations to schedule it".
### The batch card is missing from the operations board / MES
Planned batches are invisible outside the Batches list and the builder: the board and the floor only surface Active ("Released") and Completing batches. Release it.