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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor: move components to individual routes
Brad Barbin26d628225ba9
diff --git a/apps/carbon/app/routes/x+/scheduling+/_layout.tsx b/apps/carbon/app/routes/x+/scheduling+/_layout.tsxnew file mode 100644index 0000000000..449c961b94--- /dev/null+++ b/apps/carbon/app/routes/x+/scheduling+/_layout.tsx@@ -0,0 +1,5 @@+import { Outlet } from "@remix-run/react";++export default function SchedulingRoute() {+ return <Outlet />;+}diff --git a/apps/carbon/app/routes/x+/scheduling+/index.tsx b/apps/carbon/app/routes/x+/scheduling+/kanban.tsxsimilarity index 100%rename from apps/carbon/app/routes/x+/scheduling+/index.tsxrename to apps/carbon/app/routes/x+/scheduling+/kanban.tsxdiff --git a/packages/database/supabase/functions/scheduler/index.ts b/packages/database/supabase/functions/scheduler/index.tsindex 487c0e4e74..58ee7b134b 100644--- a/packages/database/supabase/functions/scheduler/index.ts+++ b/packages/database/supabase/functions/scheduler/index.ts@@ -8,9 +8,10 @@ serve(async (req: Request) => {return new Response("ok", { headers: corsHeaders });}+ const loadBalancer = new LoadBalancer(workCenters);+try {// const client = getSupabaseServiceRole(req.headers.get("Authorization"));- const workCenterManager = new LoadBalancer(workCenters);const operationsByType = jobs.reduce((acc, job) => {job.operations.forEach((operation) => {@@ -37,19 +38,13 @@ serve(async (req: Request) => {const operationsWithWorkCenter: OperationWithWorkCenter[] = Object.values(sortedOperationsByType).flatMap((operations) =>- operations.map((operation) => {+ operations.map((operation, index) => {const { workCenterType } = operation;- const workCenter =- workCenterManager.getWorkCenterWithLeastWork(workCenterType);-- workCenterManager.addWorkToWorkCenter(- workCenterType,- workCenter.id,- operation.duration- );+ const workCenter = loadBalancer.get(workCenterType);+ loadBalancer.add(workCenterType, workCenter.id, operation.duration);- return { ...operation, workCenterId: workCenter.id };+ return { ...operation, workCenterId: workCenter.id, order: index };}));@@ -95,6 +90,7 @@ type Operation = {type OperationWithWorkCenter = Operation & {workCenterId: string;+ order: number;};function sortOperations(operations: Operation[]) {@@ -165,18 +161,14 @@ class LoadBalancer {}, {});}- public getWorkCenterWithLeastWork(workCenterType: string) {+ public get(workCenterType: string) {const workCenters = this.workCentersByType[workCenterType];return workCenters.reduce((minWorkCenter, workCenter) =>workCenter.duration < minWorkCenter.duration ? workCenter : minWorkCenter);}- public addWorkToWorkCenter(- workCenterType: string,- workCenterId: string,- duration: number- ) {+ public add(workCenterType: string, workCenterId: string, duration: number) {this.workCentersByType[workCenterType] = this.workCentersByType[workCenterType].map((workCenter) => {