Basic new MVP with control tower fully functional

This commit is contained in:
Marcelo Dares
2025-12-31 01:17:13 +00:00
parent a369a69978
commit 363c9fbf4f
11 changed files with 284 additions and 577 deletions

View File

@@ -103,6 +103,8 @@ export async function POST(req: Request) {
orgId = machine.orgId;
const wo = body.activeWorkOrder ?? {};
const good = typeof wo.good === "number" ? wo.good : (typeof wo.goodParts === "number" ? wo.goodParts : null);
const scrap = typeof wo.scrap === "number" ? wo.scrap : (typeof wo.scrapParts === "number" ? wo.scrapParts : null)
const k = body.kpis ?? {};
const safeCycleTime =
typeof body.cycleTime === "number" && body.cycleTime > 0
@@ -128,8 +130,8 @@ export async function POST(req: Request) {
workOrderId: wo.id ? String(wo.id) : null,
sku: wo.sku ? String(wo.sku) : null,
target: typeof wo.target === "number" ? Math.trunc(wo.target) : null,
good: typeof wo.good === "number" ? Math.trunc(wo.good) : null,
scrap: typeof wo.scrap === "number" ? Math.trunc(wo.scrap) : null,
good: good != null ? Math.trunc(good) : null,
scrap: scrap != null ? Math.trunc(scrap) : null,
// Counters
cycleCount: typeof body.cycle_count === "number" ? body.cycle_count : null,