> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs-shaunak-branch.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Spare Parts Management

# ## Spare Parts

**Spare Parts** management supports forecasting, optimization, and availability of critical replacement parts for asset maintenance.\
It connects real-world **work orders**, **inventory levels**, and **procurement** to **ML-driven demand forecasts**.

## Spare Parts Overview

```mermaid
classDiagram
    class WorkOrder {
      +partsList: map<string, int>
      +partsListInventory: map<string, int>
      +updateWorkOrderPartsForecast()
      +getPartsList()
      +getProjectedInventory()
    }

    class InventorySeries {
      +itemFacility: string
      +treatment: string enum AggOp
      +forecasts: [WorkOrderPartsForecast]
      +unitConstraint: Unit
      +partNumber: string
      +supplier: string
      +cost: double
      +name: string
    }

    class InventoryMeasurement {
      +quantity: number
    }

    class InventoryStats {
      +avgDailyUsage: double
      +currentStock: number
      +avgLeadTime: double
      +reorderLevel: number
      +reorderQty: number
      +daysOnHand: number
      +dohOverLeadTimeRatio: double
    }

    class PurchaseOrderStats {
      +numberOfReorders: number
    }

    class PurchaserOrderLine {
    }

    class PurchaserOrderLineReceipt {
    }

    WorkOrder --> InventorySeries
    InventorySeries --> InventoryMeasurement
    InventorySeries --> PurchaserOrderLine
    PurchaserOrderLine --> PurchaserOrderLineReceipt
    InventorySeries --> InventoryStats
    InventorySeries --> PurchaseOrderStats
```

## Key Types and Relationships

| Type                        | Description                                                                                  |
| :-------------------------- | :------------------------------------------------------------------------------------------- |
| `WorkOrder`                 | Contains information about parts required for a maintenance task and their inventory status. |
| `InventorySeries`           | Tracks stock and forecasted demand for each spare part across facilities.                    |
| `InventoryMeasurement`      | Point-in-time snapshot of inventory levels for parts.                                        |
| `InventoryStats`            | Aggregated statistics for inventory management, like daily usage and lead time.              |
| `PurchaseOrderStats`        | Metrics related to procurement cycles and reordering efficiency.                             |
| `PurchaserOrderLine`        | Individual line item in a purchase order for a part.                                         |
| `PurchaserOrderLineReceipt` | Receipt confirmation for parts delivered from purchase orders.                               |

## Core Concepts

* **Work Order Parts Forecasting:**
  * For any given `WorkOrder`, parts demand can be **forecasted** and **projected** using current and historical data.

* **Inventory Forecasting:**
  * `InventorySeries` maintains time-series forecasts for stock depletion.
  * Predicts when reordering will be needed.

* **Reorder Optimization:**
  * `InventoryStats` helps compute:
    * **Reorder Level:** Minimum stock before triggering an order.
    * **Days on Hand:** How long existing stock will last.
    * **Lead Time:** Time from placing to receiving an order.

* **Procurement Tracking:**
  * Links between `PurchaserOrderLine`, `PurchaseOrderStats`, and `PurchaserOrderLineReceipt` ensure visibility from order to receipt.

* **Cross-Facility Aggregation:**
  * Spare parts data can be rolled up across **multiple facilities** to manage regional stock levels intelligently.

## Example Spare Parts Lifecycle

| Step                    | Description                                                                    |
| :---------------------- | :----------------------------------------------------------------------------- |
| 1. Part Forecasting     | Predict demand for parts from upcoming or planned work orders.                 |
| 2. Inventory Evaluation | Check current stock using `InventoryMeasurement` and `InventoryStats`.         |
| 3. Reorder Triggering   | When stock falls below reorder level, initiate purchase orders.                |
| 4. Purchase and Receipt | Track parts delivery via `PurchaserOrderLine` and `PurchaserOrderLineReceipt`. |
| 5. Stock Update         | Update inventory once parts are received and reconcile against forecasts.      |
