Skip to main content

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 TypeExample URL
POST{{url_base}}/PostAddReturnOrder
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddReturnOrder"

Input Parameters

ParameterTypeRequiredDescription
ReturnOrderNoString(25)YesExternal return order code
BranchNoString(25)YesExternal branch code
SalesOrderNoString(25)NoExternal associated sales order code
LoadNoString(25)NoExternal load code
ReturnOrderReasonNoString(25)NoExternal return reason code
ReturnOrderTypeReturnOrderTypeYesEnumerator with possible values for Return Type: rtPartial (Partial), rtTotal (Total) or rtLeftovers (Load Leftovers)
ReturnOrderDateDataHoraYesReturn order date
RegisterDateDataHoraYesReturn order entry date
NotesString(2000)NoReturn order observations
ItemListAddReturnOrderItemListYesList of return order items
Observation
  • The SalesOrderNo parameter is required when the return order type (parameter ReturnOrderType) is rtPartial (Partial) or rtTotal (Total). For type rtLeftovers (Load Leftovers), this parameter is ignored.
  • The LoadNo parameter is required when the return order type (parameter ReturnOrderType) is rtLeftovers (Load Leftovers). For types rtPartial (Partial) or rtTotal (Total), this parameter is ignored.

📝 AddReturnOrderItemList Object

The AddReturnOrderItemList object represents a return order item.

Input Parameters

ParameterTypeRequiredDescription
ItemNoString(25)NoExternal return order item code
SalesOrderItemNoString(25)NoExternal sales order item code.
ProductNoString(25)YesExternal product code
ReturnOrderItemReasonNoString(25)NoExternal return reason code for the sales order item
UnitValueFloatNoUnit value
QtyIntegerNoQuantity of returned boxes
WeightFloatNoReturned weight
TotalValueFloatNoTotal value
Observation
  • The SalesOrderItemNo parameter is ignored when the return order type (parameter ReturnOrderType) is rtLeftovers (Load Leftovers).
  • The Qty parameter must be informed when the Weight parameter is not filled in the request and vice-versa.

Return

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard WebService response information on method execution
ReturnOrderCodeIntegerYesInternal 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

CodeMessage
ARO‑001The provided External Return Order Code parameter (ReturnOrderNo) already exists!
ARO‑002There is another unclosed Return for the same Sales Order. Operation not allowed!
ARO‑003There is another Total Return for the same Sales Order. Operation not allowed!
ARO‑004There is another partial return for the same Sales Order. Total Return creation not allowed!
ARO‑005The 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‑006The return order item "[parameter description]" value "[value sent in request]" at index [[index code]] must have Quantity "Qty" or Weight "Weight" informed!
ARO‑007The 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‑008The 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 TypeExample URL
POST{{url_base}}/PostDeleteReturnOrder
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteReturnOrder"

Input Parameters

ParameterTypeRequiredDescription
ReturnOrderNoString(25)YesExternal return order code
ErrorIfNotFoundBooleanNoReturns error if the informed order does not exist in the database

Return

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard 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

CodeMessage
DRO‑001The current status of the Return Order ([current return order status]) informed does not allow deletion!