# Plan Reservations

When you have a constraint that cannot be represented in ION via other methods as mentioned in this documentation, than as a last resort, use reservations to manually manipulate your results.

## Overview

If there are no reservations, Autoplan will allocate the first supply to the first demand. This should be the preferred approach because it will adjust your plan as supply and demand change, with no additional manual input required. However, at times, it may be useful to reserve supply for a specific plan. There may be certain constraints in your factory that necessitate a specific supply is used on a specific project.

When a plan reservation is in place, Autoplan will allocate that supply to demand from that plan and if there is no demand for that part on that plan, it will not be allocated.

See the video below for an example.

## Adding/updating plan reservations

Plan reservations can be added via the inventory interface. Plan reservations can be added via the "Planned for" column:

<figure><img src="/files/CTtO5tbkhmOxQjwLK5Db" alt=""><figcaption></figcaption></figure>

Clicking "Add Plan reservation" will bring up a modal with options to select the plan and quantity. The quantity will default to the inventory quantity.

<figure><img src="/files/6DJLCMw6xMtJsvTqVvQG" alt=""><figcaption><p>Creating a plan reservation</p></figcaption></figure>

Clicking on the column again allows for the plan reservation to be edited or deleted.

<figure><img src="/files/dxXqiyb6hmGrzyPrC8QY" alt=""><figcaption><p>Editing a plan reservation</p></figcaption></figure>

## API

Please see below for the different mutations and check out the video for more info.

```graphql
mutation CreatePlanReservation($input: CreatePlanReservationInput!) {
    createPlanReservation(input: $input) {
        planReservation {
            id
            partInventoryId
            planId
            quantity
        }
    }
}
```

```graphql
query GetPlanReservations($filters: PlanReservationsInputFilters, $sort: [PlanReservationSortEnum]) {
    planReservations(sort: $sort, filters: $filters) {
        edges {
            node {
                id
                plan {
                    id
                    name
                }
                partInventory {
                    id
                    lotNumber
                    part {
                        partNumber
                        description
                    }
                    runs {
                        id
                    }
                    serialNumber
                }
                quantity
            }
        }
        
    }
}
```

```graphql
mutation DeletePlanReservation($id: ID!, $etag: String!) {
    deletePlanReservation(id: $id, etag: $etag) {
        id
    }
}
```

The input for the deleting the plan reservation will take the following shape:

```graphql
{
    "id": <id>,
    "etag": <etag>
}
```

{% embed url="<https://www.loom.com/share/6dba7e3bfda341fbb36535221d1b24b1?sid=698a57fb-2068-4ddb-be7c-aaacebb81259>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.firstresonance.io/plans-and-autoplan/plan-reservations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
