Products
The PostAddProduct endpoint is responsible for registering a new product in the MIMS system. The registration can be viewed on screens CAD022 and CAD223.
How to register a product
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostAddProduct |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddProduct" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ProductNo | String(25) | Yes | External code of the product |
| Name | String(60) | Yes | Product description |
| ReducedName | String(28) | Yes | Reduced product description |
| ProductionCode | String(10) | No | Product code in production |
| MaterialNo | String(25) | Yes | External code of the material |
| PackageNo | String(25) | Yes | External code of the package |
| FamilyNo | String(25) | Yes | External code of the product family |
| BrandNo | String(25) | Yes | External code of the brand |
| AnimalTypeNo | String(25) | Yes | External code of the animal type |
| IntegrationNo | String(25) | No | Product integration code |
| UnitMeasurementNo | String(25) | No | External code of the piece unit of measurement |
| BillingUnitMeasurementNo | String(25) | No | External code of the billing unit of measurement |
| ValidityRuleNo | String(25) | No | External code of the validity rule |
| LabelTemplateCode | Integer | No | Label template |
| PreIdentificationLabel TemplateCode | Integer | No | Pre-Identification label template |
| PrimaryLabelTemplateCode | Integer | No | Primary label template |
| Condition | ConditionProduct | Yes | Enumerator with possible values for Product Condition: cdFresh (Fresh), cdDeepChill (Chilled) or cdFrozen (Frozen) |
| Species | SpeciesProduct | Yes | Enumerator with possible values for Product Species: spcWhole (Whole), spcCut (Cut), spcGiblets (Giblets), spcByProduct (By-Product) or spcOther (Other) |
| RawMaterialState | RawMaterialStateProduct | Yes | Enumerator with possible values for Product State: stInNatura (In Natura) or stSazonado (Seasoned) |
| EAN13 | String(13) | No | EAN 13 code |
| EAN14 | String(14) | No | EAN 14 code |
| MaxTolerancePercentage | Float | No | Maximum tolerance percentage |
| MinTolerancePercentage | Float | No | Minimum tolerance percentage |
| AnimalsInPackageQty | Integer | No | Quantity of animals in package |
| ProductInPackageQty | Integer | No | Quantity of products in package |
| MaximumCapacity | Float | No | Maximum Capacity |
| AverageCapacity | Float | No | Average Capacity |
| MinimumCapacity | Float | No | Minimum Capacity |
| StandardCapacity | Float | No | Standard Capacity |
| ProductBranchList | ProductBranchList | Yes | Object containing product information by branch |
| OverwriteIfExists | Boolean | No | Flag indicating that data should be overwritten if the record already exists |
Note
- In the parameters
LabelTemplateCode,PreIdentificationLabelTemplateCodeandPrimaryLabelTemplateCode, we validate if the passed value is greater than 0 and check the existence only of labels that have a code greater than or equal to 1000, as these are the labels that have a record in the "VW_ETIQUETA" view. If the label is not registered, we generate the exception "The label "[value sent in request]" provided was not found!" - In the parameters
FamilyNo,BrandNoandAnimalTypeNo, when the request is a product modification and the provided value equals the standard integration text (defined in the StandardIntegration variable of the INI file), the system does not update the value of these fields. In these cases, the existing value in the product registration will be maintained. - Make sure that the parameters
ProductNo,MaterialNo,PackageNo,FamilyNo,BrandNo,AnimalTypeNoand other external codes are valid and not duplicated in the MIMS system.
📝 ProductBranchList Object
The ProductBranchList object represents a list of product information by branch.
Input Parameters
Parameters Type Required Description BranchNo String(25) Yes External code of the branch Name String(120) No Product description in the branch ProductionGroupNo String(25) No External code of the production group WarehouseNo String(25) No External code of the warehouse ClassifierGridNo String(25) No External code of the classifier grid StructureNo String(25) No External code of the analytical structure UnitMeasurementNo String(25) No External code of the piece unit of measurement UnitMeasurementIndividual
UnitNoString(25) No External code of the individual unit unit of measurement StockSequestrationDays Integer No Stock sequestration days ToleranceStandardDateDays Integer No Standard date tolerance days DefaultQuantityinPallet Integer No Default quantity of packages for pallet assembly UnidPartQty Integer No Quantity of pieces per unit AnimalsInPackageQty Integer No Quantity of animals in package ProductInPackageQty Integer No Quantity of products in package MinRawMaterialPercentage Float No Minimum raw material product percentage WeightToleranceUpon
GroupedWeighingPercentageFloat No Weight tolerance percentage in Grouped Weighing MaxTolerancePercentage Float No Maximum weight tolerance percentage MinTolerancePercentage Float No Minimum weight tolerance percentage PreIdentificationLabel
TemplateCodeInteger No Pre-Identification Label Template PrimaryLabelTemplateCode Integer No Primary Label Template RegisterAgricultureMinistryCode String(14) Yes Agriculture Ministry registration number AgricultureMinistryName String(180) Yes Description in Agriculture Ministry IdentifiesType IdentifiesType No Enumerator with possible values for Product Identification Type: itOpticalReading(Optical Reading) oritManualTyping(Manual Typing)DispatchType DispatchType Yes Enumerator with possible values for Product Dispatch Type: dtOpticalReading(Optical Reading),dtManualDispatching(Manual Dispatch),dtAutomaticDispatching(Automatic Dispatch) ordtInBulk(In Bulk)OwnProduction OwnProduction Yes Enumerator with possible values for Own Production: opYes(Yes),opNo(No) oropBoth(Both)IsInactive Boolean No Flag indicating that the product is inactive IsTunnelControlDisabled Boolean No Flag indicating that Tunnel Control is Inactive OverwriteIfExists Boolean No Flag indicating that data should be overwritten if the record already exists Note
- In the parameters
PreIdentificationLabelTemplateCodeandPrimaryLabelTemplateCode, we validate if the passed value is greater than 0 and check the existence only of labels that have a code greater than or equal to 1000, as these are the labels that have a record in the "VW_ETIQUETA" view. If the label is not registered, we generate the exception "The label "[value sent in request]" provided was not found!"- In the parameters
ClassifierGridNo,WarehouseNoandProductionGroupNo, when the request is a product modification and the provided value equals the standard integration text (defined in the StandardIntegration variable of the INI file), the system does not update the value of these fields. In these cases, the existing value in the product registration will be maintained.
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information in method execution |
| ProductCode | Integer | Yes | Internal product code generated in the MIMS system |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddProduct"' \
--header 'Content-Type: application/json' \
--data '{
"ProductNo": "PROD001",
"Name": "Nome do produto Teste",
"ReducedName": "Produto Teste",
"ProductionCode": "FRG001",
"MaterialNo": "MATE123",
"PackageNo": "EMBA123",
"FamilyNo": "FAMI123",
"BrandNo": "MARC123",
"AnimalTypeNo": "TPAVE123",
"IntegrationNo": "INT123456",
"UnitMeasurementNo": "UN",
"BillingUnitMeasurementNo": "UN",
"ValidityRuleNo": "VALI123",
"LabelTemplateCode": 5011,
"PreIdentificationLabelTemplateCode": 5014,
"PrimaryLabelTemplateCode": 5015,
"Condition": "cdFresh",
"Species": "spcCut",
"RawMaterialState": "stInNatura",
"EAN13": "1234567899874",
"EAN14": "12345678998745",
"MaxTolerancePercentage": 85,
"MinTolerancePercentage": 60,
"AnimalsInPackageQty": 10,
"ProductInPackageQty": 30,
"MaximumCapacity": 100,
"AverageCapacity": 50,
"MinimumCapacity": 20,
"StandardCapacity": 60,
"OverwriteIfExists": true,
"ProductBranchList":[
{
"BranchNo": "BR001",
"Name": "Produto Exemplo - Filial",
"ProductionGroupNo": "GRP001",
"ClassifierGridNo": "CLF001",
"WarehouseNo": "WH001",
"StructureNo": "STR001",
"UnitMeasurementNo": "UND001",
"UnitMeasurementIndividualUnitNo": "UNDIND001",
"StockSequestrationDays": 7,
"ToleranceStandardDateDays": 3,
"DefaultQuantityinPallet": 20,
"UnidPartQty": 10,
"AnimalsInPackageQty": 5,
"ProductInPackageQty": 50,
"MinRawMaterialPercentage": 1.5,
"WeightToleranceUponGroupedWeighingPercentage": 2.0,
"MaxTolerancePercentage": 4.0,
"MinTolerancePercentage": 1.0,
"PreIdentificationLabelTemplateCode": 1001,
"PrimaryLabelTemplateCode": 1002,
"RegisterAgricultureMinistryCode": "REG1234567890",
"AgricultureMinistryName": "Ministério da Agricultura - Unidade Exemplo",
"IdentifiesType": "itOpticalReading",
"DispatchType": "dtAutomaticDispatching",
"OwnProduction": "opYes",
"IsInactive": false,
"IsTunnelControlDisabled": false,
"OverwriteIfExists": true
}
]
}'
Response Example
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"ProductCode": 789
}
🐞 Possible Errors
| Code | Message |
|---|---|
| APR‑001 | The provided "External Product Code (ProductNo)" parameter already exists! |
| APR‑002 | The provided "LabelTemplateCode" label was not found! |
| APR‑002 | The provided "PreIdentificationLabelTemplateCode" label was not found! |
| APR‑002 | The provided "PrimaryLabelTemplateCode" label was not found! |
| APR‑002 | The provided "PreIdentificationLabelTemplateCode" label was not found! |
| APR‑003 | The "Standard Capacity (StandardCapacity)" parameter and the "Average Capacity (AverageCapacity)" parameter were not provided. Provide at least one! |
| APR‑004 | The Package "Standard Capacity (StandardCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter! |
| APR‑005 | The Package "Average Capacity (AverageCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter! |
| APR‑006 | The Package "Maximum Capacity (MaximumCapacity)" parameter cannot be less than the "Minimum Capacity (MinimumCapacity)" parameter! |
| APR‑007 | The Package "Standard Capacity (StandardCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter! |
| APR‑008 | The Package "Average Capacity (AverageCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter! |
| APR‑009 | The Package "Minimum Capacity (MinimumCapacity)" parameter cannot be greater than the "Maximum Capacity (MaximumCapacity)" parameter! |
| APR‑010 | The "Minimum Tolerance (MinimumTolerancePercentage)" parameter cannot be greater than the "Maximum Tolerance (MaximumTolerancePercentage)" parameter! |
| APR‑011 | The "Production Code (ProductionCode)" parameter exceeded the maximum size of "[Maximum number of characters allowed for the product production code]" characters! |
| APR‑012 | The "Production Code (ProductionCode)" parameter is already linked to another product! |
| APR‑013 | There is a product registration with package ([value sent in request]) and material ([value sent in request]) linked to another external product code ([found external product code])! |