← The Machine Room · Case file 006: Manufacturing Operations & Margin Control Launched March 2026 · Sheet 1 of 9
Case file: Manufacturing Operations & Margin Control, HVAC duct manufacturing Drawing no. AH-CS-006

An order, its cutting plan, the stock it used and its invoice sat in four separate records. The system tied all four to a single record for each production job.

A production-control system for a prefabricated HVAC duct factory, built alongside the factory’s ERP (SAP), its cutting software and the Smartsheet workspace its staff already used. It went from first commit to launch in 75 days, after the production manager, the production engineer and supervisors tested it on real cutting files.

Customer order → production job → cutting plan
→ materials → margin decision → delivery → invoice

Launched on 23 March 2026
after field tests on real cutting files
75 days
From the first commit, 7 January 2026,
to launch on 23 March 2026 Verified
Drawn byAbu Huraira Mukhtar
RoleLead, sole developer
Build window2026-01 to launch, 2026-03
How long75 days, first commit to launch
Factory3 CNC machines, 2 shifts
OrganisationWithheld; UAE duct factory
StatusLaunched after field tests
SourceLaunch records and source code
Sheet 2 of 9: In briefThe case in four parts

01 · The short version

The problem
Orders, cutting plans, stock and invoices lived in four places. A job could be cut beyond its order, use more material than planned, or leave the gate before it was billed, and it could stay hidden until the books were reconciled.
What I built
One record for each production job, from the customer’s order to the invoice, with a check at each hand-off from order to delivery. The production manager signed off each job’s margin before a delivery order was issued.
How it went
75 days from first commit to launch in March 2026. The production manager, the production engineer and supervisors tested it on real cutting files, and factory users were trained and onboarded.
What you’d get
The same method in your operation: follow one order through every hand-off and put a check, with an owner, where money can leak. The first version goes on the tools your team already uses.
Sheet 3 of 9: Field notesThe before-state

02 · Value leaked at four hand-offs

The study started on the factory floor: how the production engineer and supervisors worked, how cutting plans were produced, how stores issued material, how dispatch happened and where billing could lose track.

Four risks came out of it. A delivery could leave the gate without a delivery order behind it. Delivered work could wait weeks for an invoice, because customers were billed fortnightly or monthly while material costs were booked as the material was used. Stock could read three ways, in the spreadsheets, in SAP and in the bin. And a job could be cut beyond what the customer had ordered.

The gaps sat in the hand-offs between order entry, engineering, stores and billing, so the fix had to follow one job through all four. Before this project, control depended on Excel, paper, email and local experience, and a problem could stay hidden until the next reconciliation.

General notes
1. Factory: 3 CNC machines, 2 shifts, about 70 production staff and 5 supervisors
2. Factory output was about 1,200 m² of duct a day, with enough orders in hand
3. Earlier Smartsheet dashboards, from February 2025, gave visibility without checks
4. Organisation withheld: detail available in interview
ORDER · WHAT WAS SOLD THE FLOOR · CUT THE GATE · TRUCKS INVOICE · BILLED CUT BEYOND THE ORDER NO DELIVERY ORDER SHIPPED, NOT INVOICED RECONCILED BY HAND, AFTER THE FACT SHEETS 131.0 · SAP 126.2 · BIN 118.4 · THREE COUNTS OF ONE MATERIAL ORDER · WHAT WAS SOLD THE FLOOR · CUT THE GATE · TRUCKS INVOICE · BILLED CUT BEYOND THE ORDER NO DELIVERY ORDER SHIPPED, NOT INVOICED RECONCILED BY HAND, AFTER THE FACT SHEETS 131.0 · SAP 126.2 · BIN 118.4 · THREE COUNTS OF ONE MATERIAL
Fig. 1: The four leaks, as found on the floorCounts illustrative
Sheet 4 of 9: Before and afterOn the floor

03 · A check where money leaked

Each leak got a check at the hand-off where it happened, and the calls that involved money stayed with people.

Hand-offBeforeWith the system
Order → cuttingCutting could run past what the customer orderedA job that would take the order past its remaining balance was refused, with the reason
Engineering → floorThe cutting plan would have been typed in againThe cutting software’s file was read directly, with nothing re-typed
Stores → floorMaterial was pulled as needed and reconciled laterMaterial was reserved for each job and shift, with a stock check; actual use was recorded against the job and over-use was flagged
Floor → deliveryMargin was a planning figure, corrected after the factThe production manager approved each job’s margin from actual use before a delivery order
Delivery → invoiceUnbilled work surfaced when the books were reconciledEach delivery order was logged against its job with the SAP number and the signed delivery note, so billing could see what had left the gate
What the floor sawCards the launched system sent in Microsoft Teams, redrawn with fictional figures
SAP material conflictFacsimile

These materials have more than one SAP code in the catalogue. Choose the code to use for order ORD-0412.

OrderORD-0412
CustomerNorthline (fictional)
Conflicts2 materials
Aluminium tapeAL-TAPE-01 · aluminium tape
Panel fittingsFIT-02 · fittings
Approve overridesUse defaults
1. A material choice. When a material on an order matched more than one SAP code, the system asked which one to use.
Tag T-0187: margin checkFacsimile
Revenue: billed area48,300
Material: recorded use−31,960
Production: fixed rate per m²−12,285
Gross margin8.4%: below target
Suggested area adjustment+4.1%
Proceed to DOHold
2. The margin check. Once use was recorded, the production manager saw the job’s margin and could proceed to a delivery order, with or without an area adjustment, or hold.
Delivery order approved: DO-0187Facsimile

Margin approved. Create the delivery order in SAP with these details, then submit the SAP DO number through the form.

TagT-0187
Billed area628.5 m²
Billed value50,280
Manager adjustment+4.1%
Gross margin12.0%
Material lines9 + 2 accessories
  1. Create the delivery order in SAP
  2. Open the prefilled delivery log
  3. Add the SAP DO number and the signed delivery note
Submit delivery log
3. The delivery order. After the sign-off, the job’s delivery details arrived ready to enter in SAP, with a prefilled form for the signed paperwork.
Sheet 5 of 9: Approval plateWhat the launch rested on

04 · Launched after field tests

75 daysFrom the first commit to launch on 23 March 2026, after a study of the factory floorVerified
4 checksBetween order and delivery: order cover, a stock check on reservation, usage variance and the manager’s margin sign-offVerified
4 formsWhere all data entry happened. The team viewed up to 13 sheets; the workspace’s other 19 were auxiliary, kept by the system and never shown to staffVerified
Field-testedBefore launch, by the production manager, the production engineer and supervisors, on real cutting files, in the Smartsheet workspace they already used

How I’d start in your operation

I’d start by tracing one order through engineering, stores, production, dispatch and billing.

That shows where information is typed twice, which decisions need a check, and what each person needs to see to act. The first version goes on the tools your team already uses; a proper database comes in when the workarounds start to cost more than they save. The scope follows your actual process and constraints.

Discuss a system like this
Sheet 6 of 9: General arrangement, as launchedDrawing 006-A

05 · How the first build worked

The launched system kept Smartsheet as the screen factory staff already knew and moved every rule into 22 Python Azure Functions. Three of them form a webhook adapter that queues each change on Azure Service Bus, and a dispatcher routes it to the function that handles it.

A tag, the record for one production job, came in against its customer order and was refused if it would take the order past its remaining balance. The nesting file was uploaded against the tag, and a parser turned the cutting software’s spreadsheet export into material lines mapped to SAP codes, so nobody re-typed a bill of materials. Material was then reserved for a date and a shift, consumption was recorded against the reservation, and the production manager approved the margin before a delivery order was generated.

SAP stayed the accounting record throughout. The factory had legacy SAP project orders still open alongside production orders introduced around December 2025, so the design had to handle both.

Meeting staff in the tool they knew meant the code supplied what a spreadsheet lacks. Smartsheet has no transactions, no foreign keys and no row locks, so the code brought its own equivalents: a manifest that maps logical sheet names to fixed IDs, deterministic keys for safe retries, type coercion for numbers and a queue-based lock around consumption submissions and approvals.

As launched
22 Azure Functions, all Python Verified
Smartsheet as the interface; Power Automate for triggers and notices; SharePoint for files
32 sheets: 13 shared with staff to view (3 of them with the manager only), 4 behind data-entry forms, 15 internal Verified
State changes written to a user action log; rule breaks to an exception log with an SLA due date
Stock reservations held for 24 hours, per material and shift
As launched, 23 March 2026
PLATFORM LIMITS · NO TRANSACTIONS · NO FOREIGN KEYS · NO ROW LOCKS SMARTSHEET · 32 SHEETS · 13 SHARED WITH STAFF ID MANIFEST LOGICAL NAMES → FIXED IDS RENAMES DO NOT BREAK CODE WEBHOOK ADAPTER ANSWERS FAST, LOGS EACH EVENT, DROPS REPEATS SERVICE BUS QUEUE RETRIES WITH BACKOFF, THEN DEAD-LETTER DISPATCHER ID-ROUTED 18 FUNCTIONS ALL RULES IN CODE, NONE IN SHEET FORMULAS MARGIN CARD → PM PROCEED TO DO / HOLD SAP · ACCOUNTING RECORD BLOB · NESTING OUTPUTS STATE CHANGES → USER ACTION LOG · RULE VIOLATIONS → EXCEPTION LOG, SLA-TRACKED PLATFORM LIMITS · NO TRANSACTIONS · NO FOREIGN KEYS · NO ROW LOCKS SMARTSHEET · 32 SHEETS · 13 SHARED WITH STAFF ID MANIFEST LOGICAL NAMES → FIXED IDS RENAMES DO NOT BREAK CODE WEBHOOK ADAPTER ANSWERS FAST, LOGS EACH EVENT, DROPS REPEATS SERVICE BUS QUEUE RETRIES WITH BACKOFF, THEN DEAD-LETTER DISPATCHER ID-ROUTED 18 FUNCTIONS ALL RULES IN CODE, NONE IN SHEET FORMULAS MARGIN CARD → PM PROCEED TO DO / HOLD SAP · ACCOUNTING RECORD BLOB · NESTING OUTPUTS STATE CHANGES → USER ACTION LOG · RULE VIOLATIONS → EXCEPTION LOG, SLA-TRACKED
Fig. 2: The launched system’s general arrangementEvent path: webhook → queue → dispatcher
Detail B, see fig. 2, the nesting parser

Engineering data, reused

The nesting software already knew what each tag needed. Its spreadsheet export has merged cells and floating headers, so the parser finds labelled anchors, reads each component and material line from fixed offsets, and maps each line to a canonical material and an SAP code, sending any it cannot match to review.

Chose to read the export exactly as the cutting software writes it, because asking supervisors to re-enter a bill of materials that already existed would invite typing errors and resistance on the floor. Cost: a parser to maintain against the vendor’s format. Gained: a bill of materials on every tag with nothing re-typed.
Sheet 7 of 9: Section A-A, the next versionDrawing 006-B: cut through the ledger

06 · The ledger cannot be edited

In May 2026 I rebuilt the same model on PostgreSQL as its next version, so its controls would rest on database guarantees once the spreadsheet workarounds began to cost more than they saved.

The rewrite carried the launched system’s rules across, each one kept, changed or dropped with a logged reason, and replaced the workarounds with database guarantees: transactions, foreign keys, row locks and constraints. Its core modules were built through invoicing, with 929 tests passing in the recorded run of 6 May 2026; the section below uses synthetic data.

ORDER · TAG NEST · PARSE ALLOCATE CONSUME · GM% DO · INVOICE ONE REAL NESTING FILE → 44 PIECE LINES → MATERIALS → SAP CODES INVENTORY_TXN · APPEND-ONLY LEDGER UPDATE, DELETE REVOKED AT THE DB ROLE ID TYPE SAP CODE QTY · SQM REFERENCE ACTOR SNAPSHOT FLOOR SAP-104 +1,240.000 SAP SNAPSHOT · 05-04 system@ducts TXN-0201 ALLOCATE SAP-104 −120.000 ALLOC-0042 · 24 H system@ducts TXN-0202 PICK SAP-104 −120.000 ALLOC-0042 storekeep@ducts TXN-0203 ISSUE SAP-104 −118.000 CONS-0017 supervisor@ducts TXN-0204 ADJUST SAP-104 −3.000 MANUAL ADJUSTMENT storekeep@ducts ROWS APPENDED SINCE THE SNAPSHOT · NONE EDITED 0 1 3 4 NO ROW WAS EDITED · THE CORRECTION IS A NEW SIGNED ROW ONE TAG'S LIFE · INTAKE → INVOICE · EVERY MATERIAL MOVEMENT A SIGNED, ACTOR-STAMPED ROW
ORDER · TAG NEST · PARSE ALLOCATE CONSUME · GM% DO · INVOICE ONE REAL NESTING FILE → 44 PIECE LINES → MATERIALS → SAP CODES INVENTORY_TXN · APPEND-ONLY LEDGER UPDATE, DELETE REVOKED AT THE DB ROLE ID TYPE SAP CODE QTY · SQM REFERENCE ACTOR SNAPSHOT FLOOR SAP-104 +1,240.000 SAP SNAPSHOT · 05-04 system@ducts TXN-0201 ALLOCATE SAP-104 −120.000 ALLOC-0042 · 24 H system@ducts TXN-0202 PICK SAP-104 −120.000 ALLOC-0042 storekeep@ducts TXN-0203 ISSUE SAP-104 −118.000 CONS-0017 supervisor@ducts TXN-0204 ADJUST SAP-104 −3.000 MANUAL ADJUSTMENT storekeep@ducts ROWS APPENDED SINCE THE SNAPSHOT · NONE EDITED 0 1 3 4 NO ROW WAS EDITED · THE CORRECTION IS A NEW SIGNED ROW ONE TAG'S LIFE · INTAKE → INVOICE · EVERY MATERIAL MOVEMENT A SIGNED, ACTOR-STAMPED ROW
Fig. 3: Section A-A, the ledger, accretingSpecimen data is synthetic; the schema is real
Beat 1: commercial cover first

1Intake

No tag is accepted without cover. A tag that would take its order line past the remaining balance, beyond a small tolerance, is refused with the reason, so the fourth leak is controlled at intake.

Beat 2: the parser, reused

2Parse

The launched system’s parser, already used on real nesting exports, is wrapped in its own FastAPI service. One real nesting file parses to 44 piece lines, 25 of them non-straight, and tests pin both counts; the materials derived from those pieces are mapped to canonical materials and SAP codes.

Beat 3: allocate, signed

3Allocate

Every resolved code writes an ALLOCATE row to the ledger: quantity signed negative, actor stamped, reserved for 24 hours. Running allocation twice changes nothing, because a UNIQUE index makes it idempotent.

Beat 4: consume, decide, dispatch

4Consume

The storekeeper’s pick writes a PICK row. The consumption form opens prefilled with what was allocated; the supervisor edits only the differences, variance bands flag what drifted, and the actual quantity lands as an ISSUE row. The manager then reviews the margin, with an adjustment spread over non-straight pieces only, and approves, rejects or holds. A delivery order can only be raised against an approved margin, and it then needs a gate pass, a dispatch scan and a proof-of-delivery photo.

Beat 5: the correction is the point

5Correct

Suppose a bin recount finds three square metres fewer than the ledger shows. In a spreadsheet someone would edit the cell. Here UPDATE and DELETE are revoked at the database role, so a correction can only arrive as a new signed ADJUST row, and the balance is derived from the rows again. The application cannot rewrite history.

Detail D, module boundaries

Boundaries a commit hook checks

Twelve modules, each owning its Postgres schema. A module’s public surface is its api.ts and its Zod contract, other modules may not import its internals, and durable messages go through an outbox.

Chose a modular monolith with boundaries checked by an import-graph walker that fails the commit on undeclared edges or cycles (12 modules, 32 declared edges, 0 violations at the 6 May 2026 checkpoint), because that discipline costs less than running microservices and keeps later extraction open. Cost: boundary overhead from day one. Revisit when one module needs its own service.
Detail E, least privilege

Four roles, four blast radii

The app connects as a role that can write business rows but can never UPDATE or DELETE the ledger, and cannot change the schema. Migrations, analytics and backups each have their own role and login.

Chose four Postgres roles over a single superuser because a leaked connection string should not be able to drop the database. Cost: four credentials to manage. Gained: the append-only rule lives in the role model itself.
Sheet 8 of 9: Revision historyTwo builds, one table

07 · Caught in testing, made permanent

Each row is a problem caught in testing or review, in one of the two builds, and settled at its cause.

In the launched system the fixes hardened the event path around the platform. In the rewrite, acceptance testing and audit sweeps found the rest, and most became standing checks: a parity audit, tests that pin band edges and concurrency tests. Each row traces to a commit or a logged decision.

Rev.
Build, date
What we found
What changed
Trace
A
First build
2026-01
EventsPower Automate could not receive Smartsheet’s EU-region webhooks, which arrive at least once, expect an answer within seconds and fire on every cell edit.
An adapter in frontThe adapter answers at once, keeps only row and attachment events, logs every event ID in SQL to drop repeats, and queues the rest on Service Bus for the dispatcher.
Commit 957f3d0
B
First build
2026-03
Margin suggestionThe card’s suggested area adjustment was worked out on the billable area, accessories included, but applied to the production area only, so accepting it missed the target margin.
One base for bothThe suggestion is worked out on the production area it is applied to, so accepting it reaches the target margin.
Commit 9d3b548
C
Rewrite plan
2026-04
CostingRe-deriving the fixed cost per square metre from its components found a sum error in the migration plan’s draft constant.
Derive, then seedThe constant was recomputed from its components and the verified breakdown seeded into the rewrite’s cost table, before any margin code used it.
ADR-008
D
Rewrite
2026-05
ParityThe first nesting stream stored only about 30% of the fields the launched system kept for each parse. An automated review pass scored it 4.8 of 5 and still missed it; acceptance testing caught it.
Automate the checkA legacy-parity audit: every field listed in a stream’s spec must be stored, derived, delegated or dropped with a logged decision, and the audit fails on a violation. Four specs, 0 violations at the last run.
ADR-054
E
Rewrite
2026-05
ConcurrencyNested transactions quietly opened a second database connection, so cross-module writes could interleave mid-transaction.
Savepoint, one connectionNested transaction contexts became savepoints on the same connection, and cross-module concurrency tests were written to cover the fix.
Commit 3844615

Most of these became checks that no longer depend on anyone remembering to look. Sixty-three logged decisions and 46 documented gotchas keep each later change safe.

Discipline: the rewrite
63 decisions and 46 gotchas logged
Parity: 4 specs, 0 violations
Variance bands: every edge pinned in tests
Engineering recordChecked in both repositories
22Python Azure Functions in the launched system: 18 for the workflow, a dispatcher and a three-function webhook adapterVerified
44Piece lines read from one real nesting file with nothing re-typed, 25 of them non-straight, pinned in the parser’s testsVerified
929Rewrite tests passing of 1,178 in the recorded run of 6 May 2026; the other 249 need a test databaseVerified
0Boundary violations across the rewrite’s 12 modules and 32 declared edges at the same checkpointVerified
0Violations across four hand-written parity specs mapping legacy fields to stored, derived, delegated or dropped with a reasonVerified
Sheet 9 of 9: Close-outFor your operation

08 · What a version for your operation adds

The launched system ran in the Smartsheet workspace the factory already used, with every rule in code, and the people who ran the floor tested it end to end on real cutting files.

Its PostgreSQL version was built through invoicing as the next step, carrying the same rules onto database guarantees. A version for your operation starts from the same method, a check with an owner wherever money can leak, and adds what your floor and your finance team need.

Scope
Factory: 3 CNC machines, 2 shifts
Tested by: the production manager, engineer and supervisors
Launched: 23 March 2026
Next version: built through invoicing
Row
Part
As launched
Your version adds
A
Margin
Signed off from actual useThe production manager approved each job’s margin before a delivery order was issued
Your targetsYour margin targets and sign-off levels, reviewed with your finance team
B
Billing
Logged with its paperworkEach delivery order recorded against its job, with the SAP number and the signed delivery note
An unbilled alertA warning when a delivery is still uninvoiced three days after its delivery order
C
Stock
Reserved and recordedMaterial reserved for each job and shift, with actual use recorded against the job
A stock ledgerEvery movement an appended, signed row, so a correction never edits history
D
Results
A full trailEvery state change in a user action log, and rule breaks in an exception log with a due date
DashboardsWaste, unbilled work and stock accuracy, measured from the first month
E
Systems
Built around the tools in placeSmartsheet as the screen staff knew, SAP as the accounting record, the cutting software’s own export
Your systemsYour ERP and your cutting software, read where they already live
Discuss a system like this
Drawn & built by
Abu Huraira Mukhtar, sole developer, 2026
A. H. M.
Sheet 9 of 9
End of case file 006
The Drawing Office: after hours

When stock, deliveries and invoices disagree, follow one unit of work through every hand-off.

If your team finds the gaps at month end, in stock that counts three ways or in deliveries the paperwork never saw, the fix starts with an accurate drawing of the process you already run. Bring it.

Contact me Back to the Machine Room