put
https://app.fracttal.com/api/wo_resources_real_qty_used/
This web service lets you adjust the actual quantity used (real_qty_used) of an inventory resource in a work order task, independently of the delivered quantity. It works for both integrated and non-integrated warehouses, as long as the resource already has a registered delivery and the new value is less than or equal to the delivered quantity.
When the change is applied, the resource's total cost is recalculated as real_qty_used × unit cost. The delivered quantity, the unit cost and the warehouse stock are not modified.
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code_warehouse | text | Yes | Code of the warehouse from which the resource was delivered. |
code_item | text | Yes | Code of the item (spare part or tool) associated with the task resource. |
output_order | text | Yes | Number of the warehouse output order used to deliver the resource. |
real_qty_used | number | Yes | New actual quantity used. Must be greater than or equal to 0 and less than or equal to the delivered quantity. Decimals are accepted. |
Usage rules
- The resource must have a registered delivery (delivered quantity greater than
0).- The resource is identified by the combination of
code_warehouse,code_itemandoutput_order.- In integrated warehouses with the external-integration zero quantities option enabled, manual adjustment of the actual quantity used is not allowed and the request is rejected with
CHECK_WAREHOUSES_MODULE_CONFIGURATION. This validation takes precedence over the comparison against the delivered quantity.- If two requests on the same resource arrive at almost the same time, the last one processed prevails.
- The token must have edit permission on this service. Otherwise, the API responds with
401.
Output parameters
| Parameter | Type | Description |
|---|---|---|
success | boolean | true if the actual quantity used was updated successfully. |
message | text | Result code. 200 if the operation succeeded. |
data | array | null on success. On error, it contains an object with the ERROR field describing the cause. |
total | integer | 1 if the resource was updated. 0 on error. |
Errors
| Code | Cause |
|---|---|
400 | REAL_QTY_CANT_BE_MAJOR_THAN_DELIVERED_QTY: real_qty_used is negative or greater than the delivered quantity. |
400 | CHECK_WAREHOUSES_MODULE_CONFIGURATION: the warehouse is integrated and has the external-integration zero quantities option enabled. Check the Warehouses module configuration. |
404 | A required field is missing (code_warehouse, code_item, output_order or real_qty_used). |
404 | The indicated warehouse, item or output order does not exist, or the combination does not match a valid resource. |
404 | The resource has no reg |
