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(mes): unassigned-operation column, work-center titles, and an empty work centers display option

sidgaikwadb2a9c269d2ca
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
index ee4a393c9e..325846632c 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
@@ -1,5 +1,5 @@
{
- "generated": "2026-08-13T15:12:30.047Z",
+ "generated": "2026-08-13T20:56:02.935Z",
"totalTools": 1436,
"modules": 15,
"tools": [
diff --git a/apps/mes/app/routes/x+/assigned.tsx b/apps/mes/app/routes/x+/assigned.tsx
index d76d6f4ce4..1161c28039 100644
--- a/apps/mes/app/routes/x+/assigned.tsx
+++ b/apps/mes/app/routes/x+/assigned.tsx
@@ -6,14 +6,25 @@ import {
Heading,
Input,
LoadingBars,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
SidebarTrigger,
+ Switch,
ToggleGroup,
ToggleGroupItem,
- useLocalStorage
+ useLocalStorage,
+ VStack
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import { useMemo, useState } from "react";
-import { LuKanban, LuList, LuSearch, LuTriangleAlert } from "react-icons/lu";
+import {
+ LuKanban,
+ LuList,
+ LuSearch,
+ LuSettings2,
+ LuTriangleAlert
+} from "react-icons/lu";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData } from "react-router";
import { OperationsList } from "~/components";
@@ -22,7 +33,7 @@ import { Kanban } from "~/components/Kanban";
import { userContext } from "~/context";
import {
getJobOperationsAssignedToEmployee,
- getWorkCentersByLocation
+ getWorkCentersByCompany
} from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
@@ -34,18 +45,21 @@ export async function loader({ context, request }: LoaderFunctionArgs) {
const [operations, workCenters] = await Promise.all([
getJobOperationsAssignedToEmployee(serviceRole, userId, companyId),
- getWorkCentersByLocation(serviceRole, locationId)
+ getWorkCentersByCompany(serviceRole, companyId)
]);
return {
operations: operations?.data?.map(makeDurations) ?? [],
- workCenters: workCenters?.data ?? []
+ workCenters: workCenters?.data ?? [],
+ locationId
};
}
type AssignedView = "board" | "list";
const ASSIGNED_VIEW_KEY = "assigned-view";
+const EMPTY_WORK_CENTERS_KEY = "assigned-show-empty-work-centers";
+const UNASSIGNED_COLUMN_ID = "unassigned";
const displaySettings: DisplaySettings = {
emptyWorkCenters: false,
@@ -62,12 +76,17 @@ const displaySettings: DisplaySettings = {
export default function AssignedRoute() {
const { t } = useLingui();
- const { operations, workCenters } = useLoaderData<typeof loader>();
+ const { operations, workCenters, locationId } =
+ useLoaderData<typeof loader>();
const [searchTerm, setSearchTerm] = useState("");
const [view, setView] = useLocalStorage<AssignedView>(
ASSIGNED_VIEW_KEY,
"board"
);
+ const [showEmptyWorkCenters, setShowEmptyWorkCenters] = useLocalStorage(
+ EMPTY_WORK_CENTERS_KEY,
+ false
+ );
const filteredOperations = useMemo(() => {
if (!searchTerm) return operations;
@@ -83,19 +102,36 @@ export default function AssignedRoute() {
const { columns, items } = useMemo(() => {
const activeWorkCenterIds = new Set<string>();
- const workCenterIdsWithOperations = new Set<string>();
+ const columnWorkCenterIds = new Set<string>();
+ let hasUnassignedOperations = false;
+ let hasActiveUnassignedOperations = false;
for (const operation of filteredOperations) {
- if (!operation.workCenterId) continue;
- workCenterIdsWithOperations.add(operation.workCenterId);
- if (operation.operationStatus === "In Progress") {
- activeWorkCenterIds.add(operation.workCenterId);
+ const isActive = operation.operationStatus === "In Progress";
+ if (operation.workCenterId) {
+ columnWorkCenterIds.add(operation.workCenterId);
+ if (isActive) {
+ activeWorkCenterIds.add(operation.workCenterId);
+ }
+ } else {
+ hasUnassignedOperations = true;
+ if (isActive) {
+ hasActiveUnassignedOperations = true;
+ }
+ }
+ }
+
+ // By default only work centers with assigned operations become columns;
+ // the display setting adds the rest of the current location's work centers.
+ if (showEmptyWorkCenters) {
+ for (const workCenter of workCenters) {
+ if (workCenter.id && workCenter.locationId === locationId) {
+ columnWorkCenterIds.add(workCenter.id);
+ }
}
}
- // Only work centers with assigned operations become columns, so empty
- // work centers are always hidden on this board.
- const columns = Array.from(workCenterIdsWithOperations)
+ const columns: Column[] = Array.from(columnWorkCenterIds)
.map((workCenterId) => {
const workCenter = workCenters.find((wc) => wc.id === workCenterId);
return {
@@ -109,47 +145,54 @@ export default function AssignedRoute() {
workCenter?.blockingDispatchReadableId ?? undefined
};
})
- .sort((a, b) => a.title.localeCompare(b.title)) satisfies Column[];
-
- const items = filteredOperations
- .filter((operation) => Boolean(operation.workCenterId))
- .map((operation, index) => ({
- id: operation.id,
- assignee: operation.assignee,
- tags: operation.tags,
- columnId: operation.workCenterId,
- columnType: operation.processId,
- // the RPC orders by priority but does not return it
- priority: index,
- title: operation.jobReadableId,
- subtitle: operation.itemReadableId,
- description: operation.description,
- dueDate: operation.operationDueDate,
- duration:
- operation.setupDuration +
- Math.max(operation.laborDuration, operation.machineDuration),
- deadlineType: operation.jobDeadlineType,
- customerId: operation.jobCustomerId,
- operationQuantity: operation.operationQuantity,
- targetQuantity: operation.targetQuantity ?? operation.operationQuantity,
- jobReadableId: operation.jobReadableId,
- itemReadableId: operation.itemReadableId,
- itemDescription: operation.itemDescription,
- salesOrderReadableId: operation.salesOrderReadableId,
- salesOrderId: operation.salesOrderId,
- salesOrderLineId: operation.salesOrderLineId,
- status: operation.operationStatus,
- thumbnailPath: operation.thumbnailPath,
- quantity: operation.operationQuantity,
- quantityCompleted: operation.quantityComplete,
- quantityScrapped: operation.quantityScrapped,
- setupDuration: operation.setupDuration,
- laborDuration: operation.laborDuration,
- machineDuration: operation.machineDuration
- })) satisfies Item[];
+ .sort((a, b) => a.title.localeCompare(b.title));
+
+ if (hasUnassignedOperations) {
+ columns.push({
+ id: UNASSIGNED_COLUMN_ID,
+ title: t`No Work Center`,
+ type: [],
+ active: hasActiveUnassignedOperations
+ });
+ }
+
+ const items = filteredOperations.map((operation, index) => ({
+ id: operation.id,
+ assignee: operation.assignee,
+ tags: operation.tags,
+ columnId: operation.workCenterId ?? UNASSIGNED_COLUMN_ID,
+ columnType: operation.processId,
+ // the RPC orders by priority but does not return it
+ priority: index,
+ title: operation.jobReadableId,
+ subtitle: operation.itemReadableId,
+ description: operation.description,
+ dueDate: operation.operationDueDate,
+ duration:
+ operation.setupDuration +
+ Math.max(operation.laborDuration, operation.machineDuration),
+ deadlineType: operation.jobDeadlineType,
+ customerId: operation.jobCustomerId,
+ operationQuantity: operation.operationQuantity,
+ targetQuantity: operation.targetQuantity ?? operation.operationQuantity,
+ jobReadableId: operation.jobReadableId,
+ itemReadableId: operation.itemReadableId,
+ itemDescription: operation.itemDescription,
+ salesOrderReadableId: operation.salesOrderReadableId,
+ salesOrderId: operation.salesOrderId,
+ salesOrderLineId: operation.salesOrderLineId,
+ status: operation.operationStatus,
+ thumbnailPath: operation.thumbnailPath,
+ quantity: operation.operationQuantity,
+ quantityCompleted: operation.quantityComplete,
+ quantityScrapped: operation.quantityScrapped,
+ setupDuration: operation.setupDuration,
+ laborDuration: operation.laborDuration,
+ machineDuration: operation.machineDuration
+ })) satisfies Item[];
return { columns, items };
- }, [filteredOperations, workCenters]);
+ }, [filteredOperations, workCenters, showEmptyWorkCenters, locationId, t]);
return (
<div className="flex flex-col flex-1 min-w-0">
@@ -175,20 +218,48 @@ export default function AssignedRoute() {
className="pl-8"
/>
</div>
- <ToggleGroup
- type="single"
- value={view}
- onValueChange={(value) => {
- if (value) setView(value as AssignedView);
- }}
- >
- <ToggleGroupItem value="board" aria-label={t`Board view`}>
- <LuKanban />
- </ToggleGroupItem>
- <ToggleGroupItem value="list" aria-label={t`List view`}>
- <LuList />
- </ToggleGroupItem>
- </ToggleGroup>
+ <div className="flex items-center gap-2">
+ {view === "board" && (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ leftIcon={<LuSettings2 />}
+ variant="secondary"
+ className="border-dashed border-border"
+ >
+ <Trans>Display</Trans>
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-56">
+ <VStack>
+ <span className="text-xs font-medium text-muted-foreground">
+ <Trans>Columns</Trans>
+ </span>
+ <Switch
+ variant="small"
+ label={t`Empty work centers`}
+ checked={showEmptyWorkCenters}
+ onCheckedChange={setShowEmptyWorkCenters}
+ />
+ </VStack>
+ </PopoverContent>
+ </Popover>
+ )}
+ <ToggleGroup
+ type="single"
+ value={view}
+ onValueChange={(value) => {
+ if (value) setView(value as AssignedView);
+ }}
+ >
+ <ToggleGroupItem value="board" aria-label={t`Board view`}>
+ <LuKanban />
+ </ToggleGroupItem>
+ <ToggleGroupItem value="list" aria-label={t`List view`}>
+ <LuList />
+ </ToggleGroupItem>
+ </ToggleGroup>
+ </div>
</div>
</div>
</div>
diff --git a/apps/mes/app/services/operations.service.ts b/apps/mes/app/services/operations.service.ts
index 33c66910ff..ee70603ed7 100644
--- a/apps/mes/app/services/operations.service.ts
+++ b/apps/mes/app/services/operations.service.ts
@@ -1420,11 +1420,41 @@ export async function getWorkCentersByCompany(
client: SupabaseClient<Database>,
companyId: string
) {
- return client
- .from("workCenter")
- .select("*")
- .eq("companyId", companyId)
- .order("name", { ascending: true });
+ // Query both views and merge - workCenters has processes, workCentersWithBlockingStatus has blocking info
+ const [workCentersResult, blockingStatusResult] = await Promise.all([
+ client
+ .from("workCenters")
+ .select("*")
+ .eq("companyId", companyId)
+ .eq("active", true)
+ .order("name", { ascending: true }),
+ client
+ .from("workCentersWithBlockingStatus")
+ .select("id, isBlocked, blockingDispatchId, blockingDispatchReadableId")
+ .eq("companyId", companyId)
+ .eq("active", true)
+ ]);
+
+ if (workCentersResult.error) {
+ return workCentersResult;
+ }
+
+ const blockingStatusMap = new Map(
+ blockingStatusResult.data?.map((wc) => [wc.id, wc]) ?? []
+ );
+
+ const mergedData = workCentersResult.data?.map((wc) => {
+ const blockingStatus = blockingStatusMap.get(wc.id);
+ return {
+ ...wc,
+ isBlocked: blockingStatus?.isBlocked ?? false,
+ blockingDispatchId: blockingStatus?.blockingDispatchId ?? null,
+ blockingDispatchReadableId:
+ blockingStatus?.blockingDispatchReadableId ?? null
+ };
+ });
+
+ return { data: mergedData, error: null };
}
export async function insertAttributeRecord(
diff --git a/packages/locale/locales/de/mes.po b/packages/locale/locales/de/mes.po
index 4a00618c7a..17d4dacde0 100644
--- a/packages/locale/locales/de/mes.po
+++ b/packages/locale/locales/de/mes.po
@@ -865,6 +865,9 @@ msgstr "Keine Zeiteinträge für diese Woche"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Kein Lagerbestand für diesen Artikel ist erfasst. Sie können ihn trotzdem kommissionieren — der verfügbare Bestand wird negativ, bis die Inventur abgestimmt ist."
+msgid "No Work Center"
+msgstr "Kein Arbeitsplatz"
+
msgid "No work centers are blocked"
msgstr "Keine Arbeitsplätze sind blockiert"
diff --git a/packages/locale/locales/en/mes.po b/packages/locale/locales/en/mes.po
index f593c86a67..80029dc982 100644
--- a/packages/locale/locales/en/mes.po
+++ b/packages/locale/locales/en/mes.po
@@ -865,6 +865,9 @@ msgstr "No time entries for this week"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
+msgid "No Work Center"
+msgstr "No Work Center"
+
msgid "No work centers are blocked"
msgstr "No work centers are blocked"
diff --git a/packages/locale/locales/es/mes.po b/packages/locale/locales/es/mes.po
index d04b19997f..07792891a9 100644
--- a/packages/locale/locales/es/mes.po
+++ b/packages/locale/locales/es/mes.po
@@ -865,6 +865,9 @@ msgstr "No hay registros de tiempo para esta semana"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "No hay stock de almacén registrado para este artículo. Aún puedes recogerlo — el disponible se volverá negativo hasta que se reconcilie el recuento."
+msgid "No Work Center"
+msgstr "Sin centro de trabajo"
+
msgid "No work centers are blocked"
msgstr "No hay centros de trabajo bloqueados"
diff --git a/packages/locale/locales/fr/mes.po b/packages/locale/locales/fr/mes.po
index 1352a32128..1ec433189a 100644
--- a/packages/locale/locales/fr/mes.po
+++ b/packages/locale/locales/fr/mes.po
@@ -865,6 +865,9 @@ msgstr "Aucune saisie de temps pour cette semaine"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Aucun stock d'entrepôt n'est enregistré pour cet article. Vous pouvez toujours le prélever — le stock disponible deviendra négatif jusqu'à ce que le décompte soit rapproché."
+msgid "No Work Center"
+msgstr "Sans poste de travail"
+
msgid "No work centers are blocked"
msgstr "Aucun poste de travail n'est bloqué"
diff --git a/packages/locale/locales/hi/mes.po b/packages/locale/locales/hi/mes.po
index e226cd7f20..00daff15c1 100644
--- a/packages/locale/locales/hi/mes.po
+++ b/packages/locale/locales/hi/mes.po
@@ -865,6 +865,9 @@ msgstr "इस सप्ताह के लिए कोई समय प्र
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "इस आइटम के लिए कोई गोदाम स्टॉक रिकॉर्ड पर नहीं है। आप इसे अभी भी चुन सकते हैं — ऑन-हैंड नकारात्मक हो जाएगा जब तक गिनती समेकित नहीं हो जाती।"
+msgid "No Work Center"
+msgstr "कोई कार्य केंद्र नहीं"
+
msgid "No work centers are blocked"
msgstr "कोई कार्य केंद्र अवरुद्ध नहीं हैं"
diff --git a/packages/locale/locales/it/mes.po b/packages/locale/locales/it/mes.po
index 1c9a96f414..f428f16881 100644
--- a/packages/locale/locales/it/mes.po
+++ b/packages/locale/locales/it/mes.po
@@ -865,6 +865,9 @@ msgstr "Nessuna registrazione oraria per questa settimana"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Nessun stock di magazzino è registrato per questo articolo. Puoi comunque prelevarlo — la giacenza disponibile diventerà negativa fino al riconciliamento del conteggio."
+msgid "No Work Center"
+msgstr "Nessun centro di lavoro"
+
msgid "No work centers are blocked"
msgstr "Nessun centro di lavoro bloccato"
diff --git a/packages/locale/locales/ja/mes.po b/packages/locale/locales/ja/mes.po
index caa69ebc73..427e4f12d2 100644
--- a/packages/locale/locales/ja/mes.po
+++ b/packages/locale/locales/ja/mes.po
@@ -865,6 +865,9 @@ msgstr "今週のタイムエントリーはありません"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "このアイテムの倉庫在庫は記録されていません。それでも選択できます。在庫数が負になるまで、実在庫は負のままになります。"
+msgid "No Work Center"
+msgstr "作業区未設定"
+
msgid "No work centers are blocked"
msgstr "ブロックされているワークセンターはありません"
diff --git a/packages/locale/locales/ko/mes.po b/packages/locale/locales/ko/mes.po
index 07126e9307..82a21da558 100644
--- a/packages/locale/locales/ko/mes.po
+++ b/packages/locale/locales/ko/mes.po
@@ -865,6 +865,9 @@ msgstr "이번 주 시간 기록이 없습니다"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "이 품목에 대한 창고 재고 기록이 없습니다. 그래도 피킹할 수 있으며, 실사로 수량이 조정될 때까지 보유수량이 음수로 표시됩니다."
+msgid "No Work Center"
+msgstr "작업장 없음"
+
msgid "No work centers are blocked"
msgstr "차단된 작업장이 없습니다"
diff --git a/packages/locale/locales/pl/mes.po b/packages/locale/locales/pl/mes.po
index 01c0c91218..bec6fc89cd 100644
--- a/packages/locale/locales/pl/mes.po
+++ b/packages/locale/locales/pl/mes.po
@@ -865,6 +865,9 @@ msgstr "Brak wpisów czasu pracy w tym tygodniu"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Brak zapasu w magazynie dla tego artykułu. Możesz go mimo tego pobrać — dostępna ilość będzie ujemna do czasu uzgodnienia stanu."
+msgid "No Work Center"
+msgstr "Brak stanowiska roboczego"
+
msgid "No work centers are blocked"
msgstr "Żadne gniazda produkcyjne nie są zablokowane"
diff --git a/packages/locale/locales/pt/mes.po b/packages/locale/locales/pt/mes.po
index e68aaf470d..2bfe566182 100644
--- a/packages/locale/locales/pt/mes.po
+++ b/packages/locale/locales/pt/mes.po
@@ -865,6 +865,9 @@ msgstr "Nenhum registro de horas nesta semana"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Nenhum estoque de armazém está registrado para este item. Você ainda pode coletá-lo — o estoque disponível ficará negativo até que a contagem seja reconciliada."
+msgid "No Work Center"
+msgstr "Sem centro de trabalho"
+
msgid "No work centers are blocked"
msgstr "Nenhum centro de trabalho está bloqueado"
diff --git a/packages/locale/locales/ru/mes.po b/packages/locale/locales/ru/mes.po
index 2b6429cbaa..6d300e0326 100644
--- a/packages/locale/locales/ru/mes.po
+++ b/packages/locale/locales/ru/mes.po
@@ -865,6 +865,9 @@ msgstr "Нет записей учёта времени за эту неделю
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "На складе нет записей о наличии этого товара. Вы все равно можете его подобрать — количество в наличии станет отрицательным до тех пор, пока инвентаризация не будет согласована."
+msgid "No Work Center"
+msgstr "Без рабочего центра"
+
msgid "No work centers are blocked"
msgstr "Нет заблокированных рабочих центров"
diff --git a/packages/locale/locales/tr/mes.po b/packages/locale/locales/tr/mes.po
index 43ab4384e9..e2d78c6f77 100644
--- a/packages/locale/locales/tr/mes.po
+++ b/packages/locale/locales/tr/mes.po
@@ -865,6 +865,9 @@ msgstr "Bu hafta için zaman girişi yok"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "Bu ürün için depoda kayıtlı stok bulunmamaktadır. Sayım yeniden yapılana kadar eldeki stok negatif olabilir, ancak yine de alabilirsiniz."
+msgid "No Work Center"
+msgstr "İş merkezi yok"
+
msgid "No work centers are blocked"
msgstr "Bloke edilmiş iş merkezi yok"
diff --git a/packages/locale/locales/zh/mes.po b/packages/locale/locales/zh/mes.po
index 8a2ff067a4..708610d780 100644
--- a/packages/locale/locales/zh/mes.po
+++ b/packages/locale/locales/zh/mes.po
@@ -865,6 +865,9 @@ msgstr "本周无考勤记录"
msgid "No warehouse stock is on record for this item. You can still pick it — on-hand will go negative until the count is reconciled."
msgstr "此项目没有仓库库存记录。您仍然可以领取它——现有库存将变为负数,直到库存被核对。"
+msgid "No Work Center"
+msgstr "无工作中心"
+
msgid "No work centers are blocked"
msgstr "无工作中心被阻塞"