> ## Documentation Index
> Fetch the complete documentation index at: https://agents.concierca.ch/llms.txt
> Use this file to discover all available pages before exploring further.

# Procurement Queue

> One row = one procurement decision per tracked SKU. Filter action_required=true for the order list.

## What it is

One row = one procurement decision per tracked SKU. Filter `action_required=true` for the order list.

Each row combines demand, current stock, open purchase orders, and lead times into a `procurement_status`:

| Status           | Meaning                                                                                                          |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `ORDER_OVERDUE`  | The last possible order date has passed and demand > 0 — a stock gap is already unavoidable                      |
| `ORDER_REQUIRED` | The order-by date is within the next 14 days and demand > 0                                                      |
| `WATCH`          | Coverage incl. open POs is below the risk window × watch factor, or a stock gap is projected — keep an eye on it |
| `HEALTHY`        | Nothing to do                                                                                                    |

The queue computes a recommendation for **every** row (`recommended_order_quantity`, MOQ/multiple-rounded from `raw_recommended_order_quantity`); only the status flags say "now". `include_in_next_shipment` is the ride-along flag: true when the row's order-by date falls inside its own replenishment window (lead time + buffer + safety), something needs to be ordered, and the row isn't blocked by data quality or lifecycle — so it rides along with the next shipment even if not yet urgent on its own. Data-freshness columns keep the agent from ordering on stale data.

## How it gets data

**Computed view** — derived automatically from [Products](/for-agents/data-model/products), [Product Demand](/for-agents/data-model/product-demand), [Purchase Order Lines](/for-agents/data-model/purchase-orders), and [Procurement Config](/for-agents/data-model/procurement-config). Read-only; no ingest endpoint.

## Fields

### Identity & stock

| Field                  | Label               | Type     | Description                                                                                                                |
| ---------------------- | ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| `sku`                  | SKU                 | text     | Variant SKU                                                                                                                |
| `product_name`         | Product             | text     | Variant title                                                                                                              |
| `product_id`           | Product (internal)  | text     | Joins to `products.id`                                                                                                     |
| `supplier_name`        | Supplier            | text     | Supplier of the variant                                                                                                    |
| `supplier_id`          | Supplier (internal) | text     | Joins to `suppliers.id`                                                                                                    |
| `product_family`       | Family (shop ID)    | text     | Source product-group id                                                                                                    |
| `product_family_label` | Family              | text     | Human-readable model family                                                                                                |
| `lifecycle_status`     | Lifecycle           | text     | Lifecycle stage — discontinued items are excluded from ordering                                                            |
| `stock_on_hand`        | Stock (shop)        | number   | Stock as reported by the shop                                                                                              |
| `quantity_available`   | Qty Available       | number   | Stock available for coverage math                                                                                          |
| `quantity_committed`   | Qty Committed       | number   | Paid but unshipped units (last `committed_cutoff_days` only). Display-only — deliberately kept out of every derived number |
| `inventory_synced_at`  | Inventory synced    | datetime | When stock was last synced                                                                                                 |
| `calculated_at`        | Calculated          | datetime | When the view was computed                                                                                                 |

### Demand (joined from Product Demand)

| Field                                                                      | Label               | Type   | Description                                                                                          |
| -------------------------------------------------------------------------- | ------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| `forecast_daily_demand`                                                    | Demand/day          | number | Planned demand per day — the rate all coverage math uses                                             |
| `weighted_daily_demand`                                                    | Weighted/day        | number | Weighted sales rate before seasonal/lifecycle factors                                                |
| `demand_status`                                                            | Demand status       | text   | How the rate was derived (`READY`, `LOW_HISTORY`, …) — the data-quality gate for autonomous ordering |
| `demand_confidence`                                                        | Demand confidence   | text   | `high` / `medium` / `low`                                                                            |
| `seasonal_multiplier`                                                      | Seasonal factor     | number | Season factor applied to planned demand                                                              |
| `coverage_window_factor`                                                   | Window factor       | number | Season factor averaged over the coverage window                                                      |
| `units_sold_28d` / `units_sold_30d` / `units_sold_90d` / `units_sold_180d` | Units 28/30/90/180d | number | Raw units sold in each window — the evidence behind the rate                                         |
| `trend_label`                                                              | Trend               | status | Family trend classification                                                                          |
| `momentum_pct`                                                             | Momentum %          | number | Family 28d vs. 90d rate, seasonally adjusted                                                         |
| `trend_confidence`                                                         | Trend confidence    | text   | Confidence of the trend classification                                                               |

### Coverage & timing

| Field                             | Label            | Type   | Description                                                                  |
| --------------------------------- | ---------------- | ------ | ---------------------------------------------------------------------------- |
| `days_of_stock`                   | Days of Stock    | number | Available stock ÷ planned demand/day                                         |
| `days_of_stock_including_open_po` | Cover incl. PO   | number | Coverage counting open PO quantities as if arrived                           |
| `projected_stockout_date`         | Empty on         | date   | Projected date stock reaches zero at the planned rate                        |
| `replenishment_risk_days`         | Risk Window (d)  | number | Lead time + buffer + safety — the window an order placed today must survive  |
| `latest_order_date`               | Order By         | date   | Last day an order can be placed so it still arrives before the projected gap |
| `days_to_latest_order`            | Days to order-by | number | Days until that last possible order date — the queue's urgency sort          |
| `stock_gap_days`                  | Stock Gap (days) | number | Projected days without stock before replenishment can arrive                 |
| `lead_time_days`                  | Lead time (d)    | number | Effective lead time (product override or supplier default)                   |
| `lead_time_buffer_days`           | Buffer (d)       | number | Effective buffer days                                                        |
| `safety_stock_days`               | Safety (d)       | number | Safety stock in days                                                         |
| `target_stock_days`               | Target cover (d) | number | Target coverage an order should restore                                      |

### Open supply (purchase orders)

| Field                           | Label           | Type   | Description                                                                 |
| ------------------------------- | --------------- | ------ | --------------------------------------------------------------------------- |
| `open_purchase_order_quantity`  | Open PO Qty     | number | Open units (`ordered − received`) on `ordered` / `partially_received` lines |
| `draft_purchase_order_quantity` | Draft qty       | number | Units sitting on draft PO lines — counted separately from committed supply  |
| `active_purchase_order_count`   | Active POs      | number | Number of open PO lines for the variant                                     |
| `next_expected_arrival_date`    | Next Arrival    | date   | Earliest expected PO arrival                                                |
| `latest_expected_arrival_date`  | Last arrival    | date   | Latest expected PO arrival                                                  |
| `days_until_next_arrival`       | Days to arrival | number | Days until the next PO arrival                                              |

### Recommendation & status

| Field                            | Label              | Type    | Description                                                                                                                  |
| -------------------------------- | ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `procurement_status`             | Status             | text    | `ORDER_OVERDUE` / `ORDER_REQUIRED` / `WATCH` / `HEALTHY` — see the status table above                                        |
| `action_required`                | Action Required    | boolean | True for `ORDER_OVERDUE` / `ORDER_REQUIRED` — the working-list filter                                                        |
| `raw_recommended_order_quantity` | Raw Rec. Qty       | number  | Recommendation before MOQ / multiple rounding: what the math actually wants                                                  |
| `recommended_order_quantity`     | Rec. Qty           | number  | Recommendation after rounding up to MOQ and to the order multiple — what to actually order                                   |
| `include_in_next_shipment`       | Take with shipment | boolean | Ride-along flag: order-by date falls inside the replenishment window — include in the next shipment even if not urgent alone |
| `minimum_order_quantity`         | MOQ                | number  | Minimum order quantity applied to the recommendation                                                                         |
| `order_multiple`                 | Multiple           | number  | Rounding multiple applied to the recommendation                                                                              |
| `procurement_paused_until`       | Paused until       | date    | Variant excluded from recommendations until this date                                                                        |

### Config & freshness inputs (API only)

Not registered as app columns, but returned by queries — the transparency inputs behind the status machine:

| Field                      | Type   | Description                                                                                                                   |
| -------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `committed_cutoff_days`    | number | Only paid-unshipped orders younger than this count toward `quantity_committed` (guards against stale never-fulfilled imports) |
| `watch_factor`             | number | Multiplier on the risk window that triggers `WATCH`                                                                           |
| `freshness_inventory_days` | number | Age of the last inventory sync in days                                                                                        |
| `freshness_sales_days`     | number | Age of the newest sales data in days                                                                                          |
| `freshness_po_days`        | number | Age of the last purchase-order update in days                                                                                 |

All columns are read-only. The view also carries `tenant_id` / `workspace_id` for tenant isolation — filtered automatically, never selected.

## Query it

```json theme={null}
{
  "method": "tools/call",
  "params": {
    "name": "data_query",
    "arguments": {
      "view_slug": "v_procurement_agent_queue",
      "filters": { "action_required": true },
      "select_fields": ["sku", "product_name", "procurement_status", "recommended_order_quantity", "latest_order_date", "supplier_name"],
      "sort_by": "days_to_latest_order",
      "sort_desc": false,
      "limit": 50
    }
  }
}
```
