AlmondTill/G3N API

buildStock

mutation · in the family Inventory operations

What it does

Assemble kits — consume component stock to produce finished kit stock, per the kit’s recipe.

Build kits from component stock. The named II must be active + kit-TYPED; the BOM must be non-empty and within the 49-component transaction bound; every component variant active + its II existing at the same facility. Consuming below zero is allowed + stamps overcommitted per leg. Movements thread NO revision; a raced concurrent movement is retryable CONFLICT/REVISION_STALE. Requires the unrestricted capability.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Inventory operations — Receiving, counting, transferring and moving stock.

Roles that may call it:

What happens

One all-or-nothing transaction: components go down, the built kit goes up, value carries over exactly.

Careful

Consumes real component stock — un-building is its own operation (break), not an undo.

Arguments

NameTypeRequiredNotes
inputBuildStockInput BuildStockInput!yesBuild-input for buildStock: quantity = the kits produced; every live component edge consumes edgeQty x quantity from on_hand at the same facility (on_hand to on_hand only).

Returns

StockAssembly StockAssembly! — An assembly movement outcome: the KIT leg + the component legs of the ONE transaction, in recipe order. The entry movement types (build_consume | build_produce | break_consume | break_produce) carry direction.

Example request

graphql
mutation ExampleBuildStock($input: BuildStockInput!) {
  buildStock(input: $input) {
    kit {
      inventoryItem {
        id
        sysId
        type
        caption
        status
        parentId
        rootId
        createdAt
        updatedAt
        revisionNum
        revision
        logicalFacilityId
        styleType
        controlClass
        onHandQty
        reservedQty
        inTransitQty
        damagedQty
        heldQty
        onOrderQty
        availableQty
      }
    }
  }
}

Variables:

json
{
  "input": {
    "inventoryItemId": "01900000-0000-7000-8000-ab0d13b80000",
    "quantity": "2",
    "caption": "Blue jeans"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "buildStock": {
      "kit": {
        "inventoryItem": {
          "id": "01900000-0000-7000-8000-ab0d13b80000",
          "sysId": "IV-EXMP-0000-000F",
          "type": "InventoryItem",
          "caption": "Blue jeans",
          "status": "active",
          "parentId": "01900000-0000-7000-8000-8433b0260000",
          "rootId": "01900000-0000-7000-8000-a1295a650000",
          "createdAt": "2027-01-31T00:00:00.000Z",
          "updatedAt": "2027-01-31T00:00:00.000Z",
          "revisionNum": 1,
          "revision": "01900000-0000-7000-8000-53c6eea90000",
          "logicalFacilityId": "01900000-0000-7000-8000-10c08c590000",
          "styleType": "<style type>",
          "controlClass": "<control class>",
          "onHandQty": "<on hand qty>",
          "reservedQty": "<reserved qty>",
          "inTransitQty": "<in transit qty>",
          "damagedQty": "<damaged qty>",
          "heldQty": "<held qty>",
          "onOrderQty": "<on order qty>",
          "availableQty": "<available qty>"
        }
      }
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in