# createStockAdjustment

## Overview

Creates a Stock Adjustment in DRAFT status. The header carries an `adjustmentType` (CORRECTION / SCRAP / BLOCK / UNBLOCK), a free-text `reasonCode`, and an `adjustmentDate` (optional — defaults to today). Each line carries `itemId`, `storageLocationId`, and a positive `quantity`; the type/direction determines the effect. For CORRECTION lines an `adjustmentDirection` (INCREASE / DECREASE) is applied to AVAILABLE stock; for SCRAP lines a `fromStockCategory` (AVAILABLE, default, or BLOCKED) selects which stock is written off. Line quantities are always positive and no real stock is touched at create time — nothing moves until the adjustment is confirmed.

## Modules Commands Used

- [inventory] createStockAdjustment

## Exception Handling

| Error Code | Description |
| --- | --- |
| INVENTORY_EMPTY_ADJUSTMENT_LINES | The adjustment has no lines. |
| INVENTORY_REASON_CODE_REQUIRED | No reason code was provided. |
| INVENTORY_ITEM_NOT_FOUND | A referenced item does not exist. |
| INVENTORY_ITEM_NOT_ACTIVE | A referenced item is inactive. |
| INVENTORY_STORAGE_LOCATION_NOT_FOUND | A referenced storage location does not exist. |
| INVENTORY_STORAGE_LOCATION_NOT_ACTIVE | A referenced storage location is inactive. |
| INVENTORY_INVALID_QUANTITY | A line quantity is not a positive value. |
| INVENTORY_INVALID_FROM_STOCK_CATEGORY | A line's `fromStockCategory` is not a valid source category. |
