Materials
The PostAddMaterial endpoint is responsible for registering a new material in the MIMS system. The registration can be viewed on screen CAD021.
How to register a material
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostAddMaterial |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddMaterial" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| BranchNo | String(25) | Yes | External branch code |
| MaterialNo | String(25) | Yes | External material code |
| MaterialName | String(60) | Yes | Material name |
| ShortName | String(20) | No | Short material name |
| UnitMeasurement | String(2) | Yes | Material unit of measurement |
| MaterialTypeNo | String(25) | Yes | External material type code |
| CategoryNo | String(25) | Yes | External material category code |
| SubcategoryNo | String(25) | Yes | External material subcategory code |
| GroupNo | String(25) | Yes | External material group code |
| OriginNo | String(25) | Yes | External material origin code |
| ClassificationNo | String(25) | Yes | External material classification code |
| TreatmentNo | String(25) | Yes | External material treatment code |
| WarehouseNo | String(25) | Yes | External material warehouse code |
| AnimalTypeNo | String(25) | No | External bird type code |
| GrossWeight | Float | No | Material gross weight |
| NetWeight | Float | No | Material net weight |
| RegisterDate | DataHora | Yes | Record inclusion date |
| UpdateDate | DataHora | No | Record update date |
| EAN | String(26) | No | Material EAN code |
| LOF | Boolean | No | LOF mandatory |
| LastBuyDate | DataHora | No | Material last purchase date |
| ComplementaryType | String(2) | No | Complementary type |
| ANVISAMedicineCode | String(13) | No | ANVISA medicine code |
| ANVISAExemptionReason | String(255) | No | ANVISA exemption reason |
| Observations | String(2000) | No | Observations |
| MaterialLength | Float | No | Material length |
| MaterialHeight | Float | No | Material height |
| MaterialWidth | Float | No | Material width |
| MovingAverageCost | Float | No | Moving Average Cost |
| ValidityDays | Integer | No | Validity in days |
| MaximumPrice | Float | No | Maximum consumer price |
| AveragePrice | Float | No | Replacement price |
| LastPrice | Float | No | Last price |
| Produced | Boolean | No | Flag indicating whether the material is produced or not |
| Acquired | Boolean | No | Flag indicating whether the material is acquired or not |
| Inventory | Boolean | No | Flag indicating whether Material stock is controlled or not |
| ShelfLife | Boolean | No | Flag indicating whether Material validity is controlled or not |
| Animal | Boolean | No | Flag indicating whether the Material is a live Animal or not |
| WeightEntry | Boolean | No | Flag indicating whether the Material is weighed at entry or not |
| Active | Boolean | No | Flag indicating whether the material is Active or not |
| TemporarilyBlock | Boolean | No | Flag indicating whether the Material is temporarily blocked |
| Traceability | Boolean | No | Flag indicating whether Secondary Material traceability is controlled |
| TraceabilityLot | TraceabilityLotType | No | Enumerator with possible values for Material Traceability Lot Type: ttSupplierLot (Supplier Lot), ttClientLot (Client Lot) or ttBothLot (Both) |
| OverwriteIfExists | Boolean | No | Flag indicating that data should be overwritten if the record already exists |
Observation
- For parameters
MaterialTypeNo,CategoryNo,SubcategoryNo,GroupNo,OriginNo,ClassificationNo,TreatmentNo,WarehouseNoandAnimalTypeNo, when the request is a material change and the informed value is equal to the standard integration text (defined in the StandardIntegration variable in the INI file), the system does not update the value of these fields. In these cases, the value already existing in the material registration will be maintained.
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information in method execution |
| MaterialCode | Integer | Yes | Internal Material code generated in the MIMS system |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddMaterial"' \
--header 'Content-Type: application/json' \
--data '{
"BranchNo": "101",
"MaterialNo": "1",
"MaterialName": "Example Material",
"ShortName": "Mat Test",
"UnitMeasurement": "UN",
"MaterialTypeNo": "MATT5874",
"CategoryNo": "INT",
"SubcategoryNo": "INT",
"GroupNo": "INT",
"OriginNo": "INT",
"ClassificationNo": "INT",
"TreatmentNo": "INT",
"WarehouseNo": "INT",
"Produced": true,
"Acquired": true,
"Inventory": true,
"ShelfLife": true,
"GrossWeight": 12.5,
"NetWeight": 10.0,
"Animal": true,
"WeightEntry": true,
"Active": true,
"AnimalTypeNo": "INT",
"Traceability": true,
"TraceabilityLot": "ttSupplierLot",
"RegisterDate": "2023-11-10",
"UpdateDate": "2023-11-16",
"TemporarilyBlock": false,
"EAN": "7891234567890",
"LOF": false,
"LastBuyDate": "2023-11-10",
"ComplementaryType": "02",
"ANVISAMedicineCode": "123456789",
"ANVISAExemptionReason": "ANVISA Exemption Reason Test",
"Observations": "Test Observation",
"MaterialLength": 10,
"MaterialHeight": 20,
"MaterialWidth": 30,
"MovingAverageCost": 35.50,
"ValidityDays": 40,
"MaximumPrice": 45.60,
"AveragePrice": 50.70,
"LastPrice": 60.80,
"OverwriteIfExists": true
}'
Response Example
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"MaterialCode": 1023
}
🐞 Possible Errors
| Code | Message |
|---|---|
| AMA‑001 | The informed "MaterialNo" already exists! |