Return Order
Return Order Registration
The PostAddReturnOrder endpoint registers a new return order in the MIMS system and can be consulted through screen EXP027.
How to register a return order
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostAddReturnOrder |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddReturnOrder" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ReturnOrderNo | String(25) | Yes | External return order code |
| BranchNo | String(25) | Yes | External branch code |
| SalesOrderNo | String(25) | No | External associated sales order code |
| LoadNo | String(25) | No | External load code |
| ReturnOrderReasonNo | String(25) | No | External return reason code |
| ReturnOrderType | ReturnOrderType | Yes | Enumerator with possible values for Return Type: rtPartial (Partial), rtTotal (Total) or rtLeftovers (Load Leftovers) |
| ReturnOrderDate | DataHora | Yes | Return order date |
| RegisterDate | DataHora | Yes | Return order entry date |
| Notes | String(2000) | No | Return order observations |
| ItemList | AddReturnOrderItemList | Yes | List of return order items |
Observation
- The
SalesOrderNoparameter is required when the return order type (parameterReturnOrderType) isrtPartial(Partial) orrtTotal(Total). For typertLeftovers(Load Leftovers), this parameter is ignored. - The
LoadNoparameter is required when the return order type (parameterReturnOrderType) isrtLeftovers(Load Leftovers). For typesrtPartial(Partial) orrtTotal(Total), this parameter is ignored.
📝 AddReturnOrderItemList Object
The AddReturnOrderItemList object represents a return order item.
Input Parameters
Parameter Type Required Description ItemNo String(25) No External return order item code SalesOrderItemNo String(25) No External sales order item code. ProductNo String(25) Yes External product code ReturnOrderItemReasonNo String(25) No External return reason code for the sales order item UnitValue Float No Unit value Qty Integer No Quantity of returned boxes Weight Float No Returned weight TotalValue Float No Total value Observation
- The
SalesOrderItemNoparameter is ignored when the return order type (parameterReturnOrderType) isrtLeftovers(Load Leftovers).- The
Qtyparameter must be informed when theWeightparameter is not filled in the request and vice-versa.
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information on method execution |
| ReturnOrderCode | Integer | Yes | Internal return order code generated in the MIMS system |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddReturnOrder"' \
--header 'Content-Type: application/json' \
--data '{
"ReturnOrderNo": "RET123",
"SalesOrderNo": "SO456",
"BranchNo": "BR001",
"ReturnOrderDate": "2025-02-07T14:30:00Z",
"RegisterDate": "2025-02-07T15:00:00Z",
"ReturnOrderReasonNo": "REAS001",
"ReturnOrderType": "rtPartial",
"Notes": "Devolução por defeito no produto.",
"ItemList": [
{
"ItemNo": "3583",
"ProductNo": "PROD001",
"ReturnOrderItemReasonNo": "2",
"UnitValue": 25.50,
"Qty": 5,
"Weight": 10.0,
"TotalValue": 127.50
}
]
}'
Response Example
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"ReturnOrderCode": 789
}
🐞 Possible Errors
| Code | Message |
|---|---|
| ARO‑001 | The provided External Return Order Code parameter (ReturnOrderNo) already exists! |
| ARO‑002 | There is another unclosed Return for the same Sales Order. Operation not allowed! |
| ARO‑003 | There is another Total Return for the same Sales Order. Operation not allowed! |
| ARO‑004 | There is another partial return for the same Sales Order. Total Return creation not allowed! |
| ARO‑005 | The total of returned boxes for Product "[value sent in request]" cannot be greater than or equal to the number of dispatched boxes. Operation not allowed! |
| ARO‑006 | The return order item "[parameter description]" value "[value sent in request]" at index [[index code]] must have Quantity "Qty" or Weight "Weight" informed! |
| ARO‑007 | The product "[value sent in request]" informed in parameter "ProductNo" at index [[index code]] does not exist in sales order "[value sent in request]" informed in parameter "SalesOrderNo". The return cannot be performed! |
| ARO‑008 | The product "[value sent in request]" informed in parameter "ProductNo" at index [[index code]] does not exist in the sales order linked in load "[value sent in request]" informed in parameter "LoadNo". The return cannot be performed! |
Return Order Deletion
The PostDeleteReturnOrder endpoint is responsible for executing the deletion of a return order in the MIMS system.
How to delete a Return Order
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostDeleteReturnOrder |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteReturnOrder" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ReturnOrderNo | String(25) | Yes | External return order code |
| ErrorIfNotFound | Boolean | No | Returns error if the informed order does not exist in the database |
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information on method execution |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteReturnOrder"' \
--header 'Content-Type: application/json' \
--data '{
"ReturnOrderNo": "RET123",
"ErrorIfNotFound": false
}'
Response Example
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
}
}
🐞 Possible Errors
| Code | Message |
|---|---|
| DRO‑001 | The current status of the Return Order ([current return order status]) informed does not allow deletion! |