Part Inventory and Kitting

This section describes using the API to create and manage part inventory, as well as add parts to kits, and then move them back to inventory to repeat the assembly process.

Inventory

Parts can be tracked by either serial or lot numbers. They can also be untracked with just their quantities. Here we will introduce Part Inventory, which can be used to hold information about a part and set it up, so it can be tracked in runs and aBOM construction. The following documentation will go through how to create part inventory objects and issue those parts to part kits for allocating inventory to runs. To tie it all up we will demonstrate how to move new or unused parts into inventory.

Inventory Tracking Types:

Query Part Inventories

The queries below specify how to list part inventories by a filter or get a specific inventory object.

query PartInventories($filters: PartInventoriesInputFilters) {
    partInventories(sort: $sort, filters: $filters) {
        edges{
            node {
                id cost quantity usageType
                part { partNumber }
                location { id }
            }
        }
    }
}

Query part inventory objects

Create Part Inventories

Executing the below mutation with the first inputs creates a part inventory object for the serial part with part id 1. Executing the mutation again with the second input creates an inventory object for the lot tracked part with of part id 2. No quantity was specified, so the inventory object will have a quantity of 0. Serial and lot number can also be autogenerated using the last set of inputs when creating a part inventory object.

mutation CreatePartInventory($input: CreatePartInventoryInput!) {
    createPartInventory(input: $input) {
        partInventory {
            id quantity cost usageType createdById
            trackingType locationId supplierId _etag
        }
    }
}

Mutation to create part inventory for a part item.

Updating inventory items

Almost all the fields associated with a inventory object can be altered except for it's relation to the part of which it is an instance. All of the validations regarding quantity and tracking type that are enforced on inventory creation are also enforced on update. Returns the newly updated part inventory object.

mutation UpdatePartInventory($input: UpdatePartInventoryInput!) {
    updatePartInventory(input: $input) {
        partInventory {
            id quantity cost locationId serialNumber lotNumber
        }
    }
}

Mutation to update a part inventory.

Delete Part Inventories

A part inventory object can be deleted using the following mutation. Returns the ID of the deleted part inventory object.

mutation DeletePartInventory($id: ID!, $etag: String!) {
    deletePartInventory(id: $id, etag: $etag) {
        id
    }
}

Mutation to delete part inventory.

Issuing parts to runs

Part Kits

Part Kits allow you to allocate specific parts and quantities for a run. To create a part kit, you must already have a run. See the Runs mutations for that.

To remove the parts from inventory and attach them to the run in which they will be consumed we use a Part Kit object. Below we create that part kit and attach it to a run.

mutation CreatePartKit($input: CreatePartKitInput!) {
    createPartKit(input: $input) {
        partKit {
            id run { id title }
        }
    }
}

Mutation to create a kit of parts.

Issuing inventory to kits

To move the parts from inventory into the part kit we will use the issueItemToKit mutation. Whether a part is serial-tracked, lot-tracked, or not tracked, we simply reference its partInventoryId and, when the item is not serial-tracked, the quantity we want to issue to that particular kit.

mutation IssueItemToKit($input: InventoryToKitInput!) {
    issueItemToKit(input: $input) {
        partInventoryId {
            id serialNumber partKits { id }
            partsInventory { id quantity }
        }
    }
}

Mutation to issue a serialized part to a part kit.

Issuing serials, lots, or untracked parts are very similar and, in fact, use the same mutation,issueItemToKit. When parts are issued to kits, the kit will show the quantity of that required part fulfilled as issuedQuantity . The quantity is decremented from the original inventory object.

Moving parts back to Inventory

Once a part is built (serial-tracked), it should be moved back to inventory for use on a higher-level assembly. To do so, use the moveItemToInventory mutation.

mutation MoveItemToInventory($input: InventoryToKitInput!) {
    moveItemToInventory(input: $input) {
        partInventory {
           id quantity partId serialNumber lotNumber 
           location { name } partKits { id }
        }
    }
}

Mutation to move a part into inventory.

Quantity is included in the case that a lot-tracked or untracked inventory item with more than quantity 1 needs to moved back to inventory, but not the full amount of originally issued inventory. Therefore, you must include the quantity that you are moving back to inventory.

Query Part Kits

query PartKits($filters: PartKitsInputFilters) {
    partKits(sort: $sort, filters: $filters) {
        edges{
            node {
                id
                run { id }
                partInventories { id issuedQuantity }
            }
        }
    }
}

Query part kits

Last updated