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 |
| ExpirationDays | Integer | No | Number of days of the product validity |
| 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: mspInNatura (In Natura) or mspSazonado (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
- The product validity can be informed either by the
ValidityRuleNoparameter or by theExpirationDaysparameter; at least one of them must be informed. When both are sent,ValidityRuleNotakes precedence. WhenExpirationDaysis informed, the system looks for a validity rule registered in days with that same quantity and, when none is found, automatically registers a new rule with that number of days. - 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 ProductionStructureNo String(25) No External code of the default production structure the product can be produced in WarehouseNo String(25) No External code of the warehouse ClassifierGridNo String(25) No External code of the classifier grid UnitMeasurementNo String(25) No External code of the piece unit of measurement UnitMeasurementIndi
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 LabelTemplateCode Integer No Label Template 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 ControlsSecondaryMaterial
TraceabilityBoolean No Flag indicating that the product controls secondary material traceability PrimaryTare Float No Additional primary tare of the product in the branch UpdatePrimaryTare Boolean No Flag indicating that PrimaryTaremust be saved exactly as provided, including zeroOverwriteIfExists 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.- The
ProductionStructureNoparameter links the product to the production structure it can be produced in. The provided structure must belong to the branch provided inBranchNo.- In the parameter
ControlsSecondaryMaterialTraceability, when the request is a product modification and secondary material traceability control is already active in the branch, the system does not disable this control, even if the provided value isfalse. In other words, in a modification, this control can only be enabled through the API.- In the parameters
PrimaryTareandUpdatePrimaryTare, by default the primary tare is only saved when the provided value is greater than zero; otherwise, on a modification the current value is kept and on an insertion zero is saved. To save the value exactly as provided (including zero, to reset the tare), sendUpdatePrimaryTareastrue.
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": "mspInNatura",
"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",
"ProductionStructureNo": "EST001",
"ClassifierGridNo": "CLF001",
"WarehouseNo": "WH001",
"UnitMeasurementNo": "UND001",
"UnitMeasurementIndiUnitNo": "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,
"LabelTemplateCode": 1000,
"PreIdentificationLabelTemplateCode": 1001,
"PrimaryLabelTemplateCode": 1002,
"RegisterAgricultureMinistryCode": "REG1234567890",
"AgricultureMinistryName": "Ministério da Agricultura - Unidade Exemplo",
"IdentifiesType": "itOpticalReading",
"DispatchType": "dtAutomaticDispatching",
"OwnProduction": "opYes",
"IsInactive": false,
"IsTunnelControlDisabled": false,
"ControlsSecondaryMaterialTraceability": false,
"PrimaryTare": 0.05,
"UpdatePrimaryTare": 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])! |
| APR‑014 | The "ValidityRuleNo" and the "ExpirationDays" was not informed. Please provide at least one! |
| APR‑015 | The informed "ProductNo" ([value sent in request]) is already registered with another material and packaging and it has production registers, so it cannot be changed to the material ([value sent in request]) and the packaging ([value sent in request])! |
| APR‑016 | The informed "ProductionStructureNo" ([value sent in request]) belongs to another branch and cannot be linked to the product in the branch ([value sent in request])! |
| APR‑017 | The informed branch ([value sent in request]) does not have a registered slaughter unit, so the "ProductionStructureNo" ([value sent in request]) cannot be linked to the product! |