Recently I have came across a scenario; where client wants to search a barcode consist of Item+ Batch
Which was apparently a masked barcode i.e so we have item text field and a batch text field on the page, So client wants to use the same barcode value to be scanned twice for batch and item and appropriate value should be shown.
To cater this scenario I have researched and gone through very interesting and comprehensive blogs , mainly this one
But inseated of creating new processor class, I have updated the existing process class i.e.
First assuming the barcode has been setup for the item like below: i.e. Item+batch
First I added a new parmMethod for batch Id, for Item; parm method already exist in the class
‘InventInventItemSearchResult’. This is a small class that is returned from the search framework when matching data is found. Currently this class contains the following fields:
- Always filled in by the SearchProcessors when a matching item is found within AX
- Filled in when a matching variant is found for a GTIN/Barcode lookup
- Filled in when a matching variant is found for a GTIN lookup
So for batch data to be returned also, this class needs to added the parm method for batch.i.e
public InventBatchId parmBatchId(InventBatchId _batchId = batchId)
batchId = _batchId;
Once it is done, ‘newFromParams’ method of the same class need to be updated, which
Construct a <c>InventInventItemSearchResult</c> object based on the passed in data.
Coming back to the ‘InventInventItemSearchBarcode’’ class I have updated the ‘search’ method as below for batch id,
The code inventItemBarcode.invetDim().inventBatchId retrieves the batch id value stores in the inventitembarcode table. In the barcode setup of the form
This is the customized field ‘Batch number’ which I have added to this bar code form for the specific item.
Code in the ‘InventInventItemSearchBarcode’ class
Now the last part is the update in the ‘WHSRFControl Data’ class
WHSRFControlData::processData method the code calls WHSRFControlData::processControl for each of the controls on a form. This method contains specific processing logic for each of the different fields defined in the system. This enables common and consistent processing of fields by the framework each time they are used .
So here our code will be update for process Control method only.
That’s all for the code customization.
Let see now how it is working
- I create a purchase order with the item ‘000147_202’ and confirm that
- I logged in the portal
- Enter the work user and go to inbound port
- Then PO Receipt, like
- Then enter the Item number barcode which is basically the masked barcode i.e 000147_2021234
As soon I enter and press ok, this barcode get processed and correct item has been fetched and shown on the page and relevant information has also been retrieved
Similary for Batch Id for different item i.e 000160_2021234
Releavant Batch number has been fetch.
Note: For Batch number field to be available for the specific item number,
Storage dimension group, Tracking dimension group needs to be set.
And thats it, Hope it may help.