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.

feat: set status to paused when operation ends

Brad Barbin9605494b15fb
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
index 310c6449cf..72b55c581c 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
@@ -41,7 +41,7 @@ type ItemCardProps = {
} & DisplaySettings;
const cardVariants = cva(
- "bg-gradient-to-tl via-card to-card hover:to-muted/30 hover:via-muted/30",
+ "bg-gradient-to-bl via-card to-card hover:to-muted/30 hover:via-muted/30",
{
variants: {
dragging: {
diff --git a/packages/database/supabase/migrations/20241029021322_set-status-to-paused-on-stop.sql b/packages/database/supabase/migrations/20241029021322_set-status-to-paused-on-stop.sql
new file mode 100644
index 0000000000..0d3f2c5532
--- /dev/null
+++ b/packages/database/supabase/migrations/20241029021322_set-status-to-paused-on-stop.sql
@@ -0,0 +1,18 @@
+CREATE OR REPLACE FUNCTION update_job_operation_status_on_production_event_update()
+RETURNS TRIGGER AS $$
+BEGIN
+ -- Check if there are any active production events for this job operation
+ IF NOT EXISTS (
+ SELECT 1
+ FROM "productionEvent"
+ WHERE "jobOperationId" = NEW."jobOperationId"
+ AND "endTime" IS NULL
+ ) THEN
+ -- If no active events, set the status to 'Paused'
+ UPDATE "jobOperation"
+ SET "status" = 'Paused'
+ WHERE id = NEW."jobOperationId";
+ END IF;
+ RETURN NEW;
+END;
+$$ LANGUAGE plpgsql SECURITY DEFINER;
\ No newline at end of file