# Fortnox\WarehouseProductionOrderApi



All URIs are relative to https://api.fortnox.se, except if the operation defines another base path.

| Method | HTTP request | Description |
| ------------- | ------------- | ------------- |
| [**create10()**](WarehouseProductionOrderApi.md#create10) | **POST** /api/warehouse/productionorders-v1 | Create a new production order |
| [**get16()**](WarehouseProductionOrderApi.md#get16) | **GET** /api/warehouse/productionorders-v1/{id} | Get Production Order document |
| [**getAll8()**](WarehouseProductionOrderApi.md#getAll8) | **GET** /api/warehouse/productionorders-v1 | List production orders |
| [**getRequiredProductionParts()**](WarehouseProductionOrderApi.md#getRequiredProductionParts) | **GET** /api/warehouse/productionorders-v1/billofmaterials/{itemId} | Get the package items (Bill Of Materials, BOMs) for a production article |
| [**release7()**](WarehouseProductionOrderApi.md#release7) | **PUT** /api/warehouse/productionorders-v1/release/{id} | Release a production order document |
| [**update5()**](WarehouseProductionOrderApi.md#update5) | **PUT** /api/warehouse/productionorders-v1/{id} | Update a production order |
| [**updateNote2()**](WarehouseProductionOrderApi.md#updateNote2) | **PATCH** /api/warehouse/productionorders-v1/{id} | Update the note of a production order |
| [**voidProductionOrder()**](WarehouseProductionOrderApi.md#voidProductionOrder) | **PUT** /api/warehouse/productionorders-v1/void/{id} | Void a production order |


## `create10()`

```php
create10($production_order): \Fortnox\Model\WarehouseProductionOrder
```

Create a new production order

<p>  Set <code>itemId</code> to the item to be produced.  <p>  Set <code>quantity</code> to number of units to produce.  <p>  Set <code>startDate</code> to production start state.  <p>  ProductionState is set to <code>reserved</code> by default.  It can also be <code>registered</code>. Then no reservations  will be made (no quantities will be assigned to the <code>packageItems</code> yet).  <p>  Setting <code>outboundStockPointId</code> (where the <code>packageItems</code>  will be taken from), and <code>inboundStockPointId</code> (where the  produced item will be put) is mandatory multiple stockpoints has been activated  in the warehouse settings.  <p>  Before the document is released, the <code>productionDate</code> must be set.  <p>  The <code>packageItems</code> to include is easiest to get by calling  the method <code>getRequiredProductionParts</code>.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$production_order = new \Fortnox\Model\WarehouseProductionOrder(); // \Fortnox\Model\WarehouseProductionOrder | the production order to create <code>ProductionOrder</code>

try {
    $result = $apiInstance->create10($production_order);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->create10: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **production_order** | [**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)| the production order to create &lt;code&gt;ProductionOrder&lt;/code&gt; | [optional] |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `get16()`

```php
get16($id): \Fortnox\Model\WarehouseProductionOrder
```

Get Production Order document

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$id = 56; // int | Production Order document id.

try {
    $result = $apiInstance->get16($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->get16: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **id** | **int**| Production Order document id. | |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `getAll8()`

```php
getAll8($state, $item_id): \Fortnox\Model\WarehouseProductionOrder
```

List production orders

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$state = 'state_example'; // string | Include only production orders with the given state.               Allowed states: all, incomplete, delayed, completed, voided.               (Default is incomplete)
$item_id = 'item_id_example'; // string | Include only production orders with the given production item.

try {
    $result = $apiInstance->getAll8($state, $item_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->getAll8: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **state** | **string**| Include only production orders with the given state.               Allowed states: all, incomplete, delayed, completed, voided.               (Default is incomplete) | [optional] |
| **item_id** | **string**| Include only production orders with the given production item. | [optional] |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `getRequiredProductionParts()`

```php
getRequiredProductionParts($item_id, $id, $quantity): \Fortnox\Model\WarehousePackageItem
```

Get the package items (Bill Of Materials, BOMs) for a production article

<p>  If no parameters are supplied, the <code>totalQuantityRequired</code> for producing 1 unit is returned.  <p>  Query parameter <code>quantity</code> can optionally be supplied, which will  calculate <code>totalQuantityRequired</code>.  <p>  If query parameter <code>id</code> is supplied, it will get the quantity from that  Production Order (the <code>quantity</code> query parameter is ignored if <code>id</code>  is included).

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$item_id = 'item_id_example'; // string | Production Article id
$id = 56; // int | the id of the production order (optional)
$quantity = 'quantity_example'; // string | the quantity of the production order (assumed 1 if left empty)

try {
    $result = $apiInstance->getRequiredProductionParts($item_id, $id, $quantity);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->getRequiredProductionParts: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **item_id** | **string**| Production Article id | |
| **id** | **int**| the id of the production order (optional) | [optional] |
| **quantity** | **string**| the quantity of the production order (assumed 1 if left empty) | [optional] |

### Return type

[**\Fortnox\Model\WarehousePackageItem**](../Model/WarehousePackageItem.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `release7()`

```php
release7($id): \Fortnox\Model\WarehouseProductionOrder
```

Release a production order document

<p>  The document will be locked and bookkept.  <p>  The following error codes might be thrown:   <dl>   <dt>PRODUCTION_DATE_IS_EMPTY</dt>     <dd>Production date cannot be empty.</dd>   <dt>CANNOT_RELEASE_AFTER_CURRENT_DATE</dt>     <dd>Document date cannot be in the future.</dd>   <dt>DOCUMENT_IS_VOIDED</dt>     <dd> The document has been voided and can no longer be modified.</dd>   <dt>DOCUMENT_IS_RELEASED</dt>     <dd>The document has already been released and can no longer be modified.</dd>   <dt>DOCUMENT_NOT_FULLY_RESERVED</dt>     <dd>The documents package items (BOMs, Bill Of Materials) has not been fully reserved     (reserved quantity is not equal to total required quantity for one or more package item).</dd>   </dl>

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$id = 56; // int | Production Order document id.

try {
    $result = $apiInstance->release7($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->release7: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **id** | **int**| Production Order document id. | |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `update5()`

```php
update5($id, $production_order): \Fortnox\Model\WarehouseProductionOrder
```

Update a production order

<p>  Note that you must submit the full Production Order document  when updating.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$id = 56; // int | Production Order document id.
$production_order = new \Fortnox\Model\WarehouseProductionOrder(); // \Fortnox\Model\WarehouseProductionOrder | the production order data see <code>ProductionOrder</code>

try {
    $result = $apiInstance->update5($id, $production_order);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->update5: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **id** | **int**| Production Order document id. | |
| **production_order** | [**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)| the production order data see &lt;code&gt;ProductionOrder&lt;/code&gt; | [optional] |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `updateNote2()`

```php
updateNote2($id, $production_order_patch): \Fortnox\Model\WarehouseProductionOrder
```

Update the note of a production order

<p>  When a Production Order has been released it is locked.  However, the <code>note</code> field can still be updated using this endpoint.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$id = 56; // int | Production Order document id.
$production_order_patch = new \Fortnox\Model\WarehouseProductionOrderPatch(); // \Fortnox\Model\WarehouseProductionOrderPatch | contains data to be patched onto the production order

try {
    $result = $apiInstance->updateNote2($id, $production_order_patch);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->updateNote2: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **id** | **int**| Production Order document id. | |
| **production_order_patch** | [**\Fortnox\Model\WarehouseProductionOrderPatch**](../Model/WarehouseProductionOrderPatch.md)| contains data to be patched onto the production order | [optional] |

### Return type

[**\Fortnox\Model\WarehouseProductionOrder**](../Model/WarehouseProductionOrder.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `voidProductionOrder()`

```php
voidProductionOrder($id, $force)
```

Void a production order

<p>  A released production order might have connected outbounds, and can only be force voided.  Note that a force void operation might cause a negative stock.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Fortnox\Api\WarehouseProductionOrderApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$id = 56; // int | Production Order document id.
$force = True; // bool | true to force void a released document, default false

try {
    $apiInstance->voidProductionOrder($id, $force);
} catch (Exception $e) {
    echo 'Exception when calling WarehouseProductionOrderApi->voidProductionOrder: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

| Name | Type | Description  | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **id** | **int**| Production Order document id. | |
| **force** | **bool**| true to force void a released document, default false | [optional] |

### Return type

void (empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)
