Skip to main content

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

Input Parameters

ParameterTypeRequiredDescription
SalesOrderNoString(25)YesExternal code of the order
BranchNoString(25)YesExternal code of the branch
CustomerNoString(25)YesExternal code of the customer
CustomerAuxiliaryNoString(25)NoAuxiliary external code of the customer
SellerNoString(25)YesExternal code of the seller
SalesOrderDateDataHoraYesOrder date
DeliveryDateDataHoraYesDelivery date
RegisterDateDataHoraYesOrder entry date
FreightTypeFreightTypeYesEnumerator with possible values for freight type: ftShipper (CIF) or ftRemittee (FOB)
FreightValueFloatNoFreight value
DeliveryAddressAddressInfoNoObject containing the delivery address information of the order
BillingAddressAddressInfoNoObject containing the billing address information of the order
SalesOrderTypeNoString(25)NoExternal code of the order type
LoadNoString(25)NoExternal code of the order load
InspectionGroupNoString(25)NoExternal code of the inspection group
DistributionCenterNoString(25)NoExternal code of the load distribution center
EnteredUserNoString(25)NoExternal code of the user who entered the order
LogisticsTypeNoString(25)NoExternal code of the logistics type
NotesString(2000)NoOrder notes
InvoiceNotesString(2000)NoInvoice notes of the order
SalesOrderKindSalesOrderKindNoEnumerator with possible values for sales order type (kind): skNormal (Normal), skDiverse (Diverse) or skDirectSale (Direct Sale)
ValidateSellerByUserBooleanNoFlag indicating that the seller external code parameter will be validated by the user code
UsesDeliveryDeviceBooleanNoFlag indicating that the order uses a delivery device
OverwriteIfExistsBooleanNoFlag indicating that data should be overwritten if the record already exists
ItemListAddSalesOrderItemListNoList of sales order items
Note
  • The ItemList parameter is required when the order is not of type Diverse, that is, when the SalesOrderKind parameter is different from skDiverse.
  • The SalesOrderTypeNo parameter is required when the order is not of type Diverse, that is, when the SalesOrderKind parameter is different from skDiverse.
  • The FreightValue parameter, which corresponds to the freight value, should only be provided for orders whose freight type is CIF, that is, when the FreightType parameter equals ftShipper.
  • When the SalesOrderKind parameter is not provided, the default value skNormal will be considered.
  • For the DeliveryAddress and BillingAddress parameters, 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

ParameterTypeRequiredDescription
ItemNoString(25)NoExternal code of the sales order item
ProductNoString(25)NoProduct code
ProductionCodeString(10)NoProduct code in production
UnitValueFloatNoUnit value
PackageQtyIntegerNoQuantity of packages of boxes ordered
QtyIntegerNoQuantity of boxes ordered
WeightFloatNoOrdered weight
TotalValueFloatNoTotal value
ShelflifeLimitBeginDateDataHoraNoInitial date for production date restriction
ShelflifeLimitFinalDateDataHoraNoFinal date for production date restriction
ShelfLifePercentageFloatNoAcceptable shelf life percentage for the sales order item
AllowPricingBelowSalesPriceBooleanNoFlag indicating if the order item can be sold with a value below the sales price
Note
  • The PackageQty parameter must be provided when the Qty or Weight fields are not filled in the request.
  • The Qty parameter must be provided when the PackageQty or Weight fields are not filled in the request.
  • The Weight parameter must be provided when the PackageQty or Qty fields are not filled in the request.

Return

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard WebService response information in method execution
SalesOrderCodeIntegerYesInternal 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

CodeMessage
ASO‑001The provided External Sales Order Code parameter (SalesOrderNo) already exists!
ASO‑002The current status of the informed load ([linked load status]) is not available. The load status must be "Open" or "Blocked"!
ASO‑003The informed load is a grouped load and cannot be linked to a sales order!
ASO‑004The 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 TypeExample URL
POST{{url_base}}/PostDeleteSalesOrder
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostDeleteSalesOrder"

Input Parameters

ParameterTypeRequiredDescription
SalesOrderNoString(25)YesExternal code of the sales order
BranchNoString(25)YesExternal code of the branch
ErrorIfNotFoundBooleanNoReturns error if the informed order does not exist in the database

Return

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

CodeMessage
DSO‑001The current status of the informed sales order ("[value sent in request]") does not allow modification/deletion!
DSO‑002The current status of the sales order load ("[value sent in request]") does not allow order modification/deletion!
DSO‑003The informed sales order cannot be modified/deleted, as there are already dispatched identifications!
DSO‑004"[Specific error message related to customer credits]"