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.

Part Inventory

Description

id

Unique identifier for a Part Inventory object

serialNumber

Required if part is serial tracked. Must be unique per part, meaning another inventory object with the same part relation cannot have a matching serial number. Can be optionally autogerenated.

lotNumber

Required if part is lot tracked. Can be optionally autogerenated.

location

Location inventory object is stored

part

Part that this inventory object is an instance of

unitOfMeasure

How quantity of this inventory object is measured

quantity

Amount of inventory present

runs

Runs related to this inventory object

installed

True if all quantity are attached to ABOM items, else False

kitted

True if all quantity are kitted to runs, else false

Inventory Tracking Types:

Tracking Type

serial

Any inventory with a serial number, has the serial tracking type. It can also have a lot tracking number in addition. Serialized inventory objects can only have a quantity of 0 or 1.

lot

Any inventory object with a lot number and no serial number is a lot tracked. Lot tracked items must have a quantity greater than or equal to 0.

untracked

If a part inventory has neither a serial or lot number than it is an untracked item. There are no quantity restrictions on an untracked part.

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.

Part Kits

Description

id

Unique identifier for a Part Kit object

run

Run which inventory objects are kitted too

partInventories

Inventory objects with additional field issuedQuantity which identifies that quantity of the inventory which is allocated to thhe 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