Sales Order
Sales Order Registration
The PostAddSalesOrder endpoint is responsible for registering a sales order in the MIMS system and can be consulted on screen COM002.
How to register a sales order
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostAddSalesOrder |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddSalesOrder" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| SalesOrderNo | String(25) | Yes | External code of the order |
| BranchNo | String(25) | Yes | External code of the branch |
| CustomerNo | String(25) | Yes | External code of the customer |
| CustomerAuxiliaryNo | String(25) | No | Auxiliary external code of the customer |
| SellerNo | String(25) | Yes | External code of the seller |
| SalesOrderDate | DataHora | Yes | Order date |
| DeliveryDate | DataHora | Yes | Delivery date |
| RegisterDate | DataHora | Yes | Order entry date |
| FreightType | FreightType | Yes | Enumerator with possible values for freight type: ftShipper (CIF) or ftRemittee (FOB) |
| FreightValue | Float | No | Freight value |
| DeliveryAddress | AddressInfo | No | Object containing the delivery address information of the order |
| BillingAddress | AddressInfo | No | Object containing the billing address information of the order |
| SalesOrderTypeNo | String(25) | No | External code of the order type |
| LoadNo | String(25) | No | External code of the order load |
| InspectionGroupNo | String(25) | No | External code of the inspection group |
| DistributionCenterNo | String(25) | No | External code of the load distribution center |
| EnteredUserNo | String(25) | No | External code of the user who entered the order |
| LogisticsTypeNo | String(25) | No | External code of the logistics type |
| Notes | String(2000) | No | Order notes |
| InvoiceNotes | String(2000) | No | Invoice notes of the order |
| SalesOrderKind | SalesOrderKind | No | Enumerator with possible values for sales order type (kind): skNormal (Normal), skDiverse (Diverse) or skDirectSale (Direct Sale) |
| ValidateSellerByUser | Boolean | No | Flag indicating that the seller external code parameter will be validated by the user code |
| UsesDeliveryDevice | Boolean | No | Flag indicating that the order uses a delivery device |
| OverwriteIfExists | Boolean | No | Flag indicating that data should be overwritten if the record already exists |
| ItemList | AddSalesOrderItemList | No | List of sales order items |
Note
- The
ItemListparameter is required when the order is not of type Diverse, that is, when theSalesOrderKindparameter is different fromskDiverse. - The
SalesOrderTypeNoparameter is required when the order is not of type Diverse, that is, when theSalesOrderKindparameter is different fromskDiverse. - The
FreightValueparameter, which corresponds to the freight value, should only be provided for orders whose freight type is CIF, that is, when theFreightTypeparameter equalsftShipper. - When the
SalesOrderKindparameter is not provided, the default valueskNormalwill be considered. - For the
DeliveryAddressandBillingAddressparameters, the corresponding default customer address (delivery or billing) will be used if the respective parameter is not provided in the request.
📝 AddSalesOrderItemList Object
The AddSalesOrderItemList object represents a sales order item.
Input Parameters
Parameter Type Required Description ItemNo String(25) No External code of the sales order item ProductNo String(25) No Product code ProductionCode String(10) No Product code in production UnitValue Float No Unit value PackageQty Integer No Quantity of packages of boxes ordered Qty Integer No Quantity of boxes ordered Weight Float No Ordered weight TotalValue Float No Total value ShelflifeLimitBeginDate DataHora No Initial date for production date restriction ShelflifeLimitFinalDate DataHora No Final date for production date restriction ShelfLifePercentage Float No Acceptable shelf life percentage for the sales order item AllowPricingBelowSalesPrice Boolean No Flag indicating if the order item can be sold with a value below the sales price Note
- The
PackageQtyparameter must be provided when theQtyorWeightfields are not filled in the request.- The
Qtyparameter must be provided when thePackageQtyorWeightfields are not filled in the request.- The
Weightparameter must be provided when thePackageQtyorQtyfields are not filled in the request.
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information in method execution |
| SalesOrderCode | Integer | Yes | Internal sales order code generated in the MIMS system |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddSalesOrder"' \
--header 'Content-Type: application/json' \
--data '{
"SalesOrderNo": "9DOPUZ",
"BranchNo": "0102",
"CustomerNo": "24997",
"SellerNo": "001",
"SalesOrderDate": "2025-11-13T14:39:14",
"DeliveryDate": "2025-11-14T00:00:00",
"RegisterDate": "2025-11-13T23:50:49",
"FreightType": "ftShipper",
"DeliveryAddress": {
"Address": "R PASQUALE GALLUPI, 1455",
"District": "PARAISOPOLIS",
"ZIPCode": "05660000",
"City": "SAO PAULO",
"State": "SAO PAULO",
"StateInitials": "SP",
"Country": "BRASIL"
},
"BillingAddress": {
"Address": "R PASQUALE GALLUPI, 1455",
"District": "PARAISOPOLIS",
"ZIPCode": "05660000",
"City": "SAO PAULO",
"State": "SAO PAULO",
"StateInitials": "SP",
"Country": "BRASIL"
},
"SalesOrderKind": "skNormal",
"InspectionGroupNo": "01",
"ValidateSellerByUser": false,
"ItemList": [
{
"ItemNo": 23499334,
"ProductNo": "128270",
"Qty": 5,
"Weight": 100,
"TotalValue": 740,
"UnitValue": 7.4
},
{
"ItemNo": 23499335,
"ProductNo": "185493",
"Qty": 7,
"Weight": 140,
"TotalValue": 1470,
"UnitValue": 10.5
}
]
}'
Exemplo de Response
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"SalesOrderCode": 90015
}
🐞 Possible Errors
| Code | Message |
|---|---|
| ASO‑001 | The provided External Sales Order Code parameter (SalesOrderNo) already exists! |
| ASO‑002 | The current status of the informed load ([linked load status]) is not available. The load status must be "Open" or "Blocked"! |
| ASO‑003 | The informed load is a grouped load and cannot be linked to a sales order! |
| ASO‑004 | The item "[parameter description]" value ([value sent in request]) at index [[index code]] must have Quantity (Qty) or Weight (Weight) or Package Quantity (PackageQty) provided! |
Sales Order Deletion
The PostDeleteSalesOrder endpoint is responsible for executing the deletion of a sales order in the MIMS system.
How to delete a sales order
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostDeleteSalesOrder |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteSalesOrder" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| SalesOrderNo | String(25) | Yes | External code of the sales order |
| BranchNo | String(25) | Yes | External code of the branch |
| 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 in method execution |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteSalesOrder"' \
--header 'Content-Type: application/json' \
--data '{
"SalesOrderNo": "9DOPVS",
"BranchNo": "0102",
"ErrorIfNotFound": false
}'
Exemplo de Response
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
}
}
🐞 Possible Errors
| Code | Message |
|---|---|
| DSO‑001 | The current status of the informed sales order ("[value sent in request]") does not allow modification/deletion! |
| DSO‑002 | The current status of the sales order load ("[value sent in request]") does not allow order modification/deletion! |
| DSO‑003 | The informed sales order cannot be modified/deleted, as there are already dispatched identifications! |
| DSO‑004 | "[Specific error message related to customer credits]" |