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.
Step model slides — 3D models (STP → assembler → GLB) alongside pictures in BOP steps + MES assembly view
Context
The poc/mes-assembly-view branch gives BOP steps "slides" (reference pictures with captions/pins) authored in the ERP BOP editors and shown in the MES assembly view. The user wants (a) the assembler service integrated into the BOP step section for parts and jobs, and (b) the MES assembly view to show 3D models (.stp, plus other supported formats) alongside pictures per step — reversing the earlier "no 3D slides" non-goal in .ai/specs/implemented/2026-07-14-mes-execution-views.md §4.
Everything heavy already exists and is reused, not rebuilt:
modelUploadtable (modelPath, thumbnailPath, glbPath, graphPath, processingStatus, componentCount) +/api/model/uploadroute (inserts row, firesmodel-thumbnail).- Inngest
assembly-converttask → assemblerPOST /convert(STEP → GLB + graph.json inprivatebucket at{companyId}/models/{modelUploadId}/{jobId}/), gated byisAssemblerServiceHealthy()(apps/erp/app/modules/production/production.server.ts). ModelViewer(@carbon/react, online-3d-viewer + three) renders all ofsupportedModelTypes(packages/utils/src/file.ts) client-side, including step/stp, in both ERP and MES; MES preview proxy/file/preview/private/...already whitelists 3D types.- Slide system:
methodOperationStepSlide/jobOperationStepSlide/quoteOperationStepSlidetables;SlidesEditor.tsx+BillOfProcess.tsx(items) +JobBillOfProcess.tsx(jobs);operationStepSlideValidator(apps/erp/app/modules/shared/shared.models.ts); get-methodcopyStepSlides; MESgetJobOperationProcedure→AssemblyView.tsx.
Design
A slide becomes image XOR model:
- Add nullable
modelUploadId(FK →modelUploadON DELETE CASCADE) to the three slide tables; relaximagePathto nullable; CHECK at least one of the two is set. Annotations/pins remain image-only. - ERP step editors get "Add model" beside "Add slide": upload file to
{companyId}/models/{nanoid}.{ext}inprivate, createmodelUploadvia the existing/api/model/uploadaction, save slide withmodelUploadId. - Assembler integration: in the slide upsert actions (items + job tiers), when the attached model is STEP,
processingStatusisIdle, and the assembler is healthy →trigger("assembly-convert", { companyId, modelUploadId, userId }). Non-STEP formats skip conversion. - MES assembly view: slide carousel mixes pictures and models. Model slide thumbnail =
modelUpload.thumbnailPath(cube icon fallback); selected model slide renders<ModelViewer url={getPrivateUrl(glbPath ?? modelPath)} />— GLB when converted, raw model otherwise, so the feature degrades gracefully when the assembler is not deployed/running. - get-method copy carries
modelUploadIdverbatim (company-scoped row, same pattern asimagePath).
Tasks
- Migration
pnpm db:migrate:new step-model-slides: for each of the 3 slide tables — addmodelUploadIdTEXT NULL REFERENCESmodelUpload(id)ON DELETE CASCADE,imagePathDROP NOT NULL, CHECK (imagePathIS NOT NULL ORmodelUploadIdIS NOT NULL), index onmodelUploadId. Apply withpnpm db:migrate, thenpnpm run generate:types. - get-method (
packages/database/supabase/functions/get-method/index.ts):copyStepSlidesselect + insert carrymodelUploadId. - Validators (
apps/erp/app/modules/shared/shared.models.ts):operationStepSlideValidator—imagePathoptional,modelUploadIdoptional; slide services pass the new field through. - ERP routes: items + job
operation.step.slide.new.tsxacceptmodelUploadId; add STEP+Idle+healthy →trigger("assembly-convert", …)after upsert. - ERP UI:
SlidesEditor.tsxmodel-add input (acceptsupportedModelTypes) + model card (thumbnail/name, no Pin); wire upload flow inBillOfProcess.tsx(StepSlides + AttributesForm draft) andJobBillOfProcess.tsx. - MES:
operations.service.tsgetJobOperationProcedureembedsmodelUpload(id,name,modelPath,glbPath,thumbnailPath,processingStatus)on slides;AssemblyView.tsxrenders model slides viaModelViewer, keeps pins/zoom for image slides only. - Verify:
pnpm exec turbo run typecheck --filter=erp --filter=mes(+@carbon/database),pnpm run lint; browser-verify with dev stack if running.
Verification
- Typecheck ERP + MES + database; lint.
- Manual: in ERP part BOP editor add a
.stpmodel slide to a step → row inmethodOperationStepSlidewithmodelUploadId; with assembler up,modelUpload.processingStatus→ Processing → Success withglbPath. Get method to a job → job slide carries model. MES assembly view for that operation shows the model slide in the carousel and renders it in 3D; picture slides unchanged.
Status (2026-07-19)
All code tasks implemented. Verified: ERP and MES typechecks match the branch baseline exactly
(13 / 11 pre-existing errors — broken generated types.ts duplicate invoiceSettlement from the
origin merge, missing react-router +types artifacts, documents-package drift — none introduced
by this change); biome diagnostics identical to baseline. Spec §4 updated (non-goal reversed).
Completed 2026-07-20 (stack up): migrations applied + types regenerated (bridge-casts
removed), browser-verified end-to-end in the running ERP + MES. Follow-on work shipped in the
same branch: Assembly → BOP sync (20260720025847_assembly-bop-sync.sql,
syncAssemblyInstructionToOperation, "Sync to BOP" modal), step-aware AssemblyPlayer
playback in the MES assembly view (driven by the assemblyInstructionStepId marker), and the
BOP steps-source panel (AssemblyStepsSource) bridging Assembly operations to the assemblies
module. Still pending: pnpm lingui:extract for the two new translated strings
(Converting…, Failed to upload model) next time translations are filled.