Tuesday, January 24, 2012

Ax 2012 Barcode: EAN 128


Code 128 is a very high-density barcode symbology. It is used for alphanumeric or numeric-only barcodes. It can encode all 128 characters of ASCII.
This documentation will take you through the following activities –

  • Setting up barcode
  • Assign barcode with a released product.
  • Job to get a encode few information and get a human readable barcode to be used.
  • Use this barcode in item arrival journal to fetch the encoded information.

Setting barcode:
Go to Organization Administration – Setup – Bar codes.
Open the “bar codes” form.


- Specify a barcode setup name and description
- In the fast tab, General, specify type of the barcode type
- Font and size required to print the barcode
- Length of the barcode.

Assign barcode with a released product:
 After this setup is completed, Go to “Product Information Management” – Common form area and open  the “Released product” list form.

Click on the tab page , “Manage inventory”, Select an item and click on the link “Bar codes”. This will open the form for Item barcode setup.
Here, the item “10000” is selected.


In the item barcode setup form, Item “10000” with inventory dimension size “01”  is configured for bar code.


















This is “General” tab page of the item barcode setup.

Job to get a encode few information and get a human readable barcode to be used.
Now we will develop a  job to encode the following information-
  • Item Id
  •  Qty.


static void Dip_Barcode(Args _args)
{
    ItemId                      itemID = "10000";
    EcoResItemSizeName          inventSizeId = "01";


    InventDim                   inventDim;

    InventItemBarcode           inventItemBarcode;
    BarcodeSetup                barcodeSetup;
    BarcodeEAN128               barcodeEAN128;
    BarcodeEAN128AIDataValue    strValue;
  
    //Method to remove brackets from the human readbale bar code
    BarcodeEAN128AIDataValue removeParentheses(BarcodeEAN128AIDataValue _str)
    {
        int pos;
        ;

        do
        {
            if (pos)
                _str = strDel(_str,pos,1);

            pos = strFind(_str,"(",1,strLen(_str));
            if (!pos)
                pos = strFind(_str,")",1,strLen(_str));
        }while(pos);

        return _str;
    }
    ;

    inventDim.InventSizeId = inventSizeId;
    inventDim = InventDim::findDim(inventDim);
    //info(strFmt('%1',inventDim.inventDimId));

    inventItemBarcode = InventItemBarcode::findItem(itemID,inventDim.inventDimId,true,true);
    //info(strFmt('%1',inventItemBarcode.barcodeSetupId));

    barcodeSetup = BarcodeSetup::find(inventItemBarcode.barcodeSetupId);
    //info(strFmt('%1',barcodeSetup.barcodeType));


    barcodeEAN128 = BarcodeEAN128::construct();
    barcodeEAN128.itemId(true,itemID); //encoding item id
    barcodeEAN128.qty(true,35.99); //encoding quantity
    barcodeEAN128.encode();

    info(strFmt('%1',barcodeEAN128.barcodeStr()));
    info(strFmt('%1',barcodeEAN128.barcodeStrHR())); //printing human reabable barcode
    strValue = removeParentheses(barcodeEAN128.barcodeStrHR()); //removing parentheses from human readable barcode
    info(strFmt('%1',strValue)); //This value will be used in the Item Arriavl Journal line to fetch the encoded information in the journal line.

}

Run the above job – The output info log will appear as follows –




















Copy the human readable code without parentheses -  01100003035.99

Use this barcode in item arrival journal to fetch the encoded information.
Now, In the module, “Inventory and Warehouse Management” area pane , In Journal of Item Arrival, open the form “Item arrival”.






















Go to lines from Item arrival journal as highlighted.

Paste the human readable barcode in the field “EAN128/USS128” and press enter.

After pressing enter, automatically the information will be decoded and decoded information will be filled up in the appropriate fields.



Here the fields which is automatically filled up are –
  • Item Id
  • Size (inventory dimensions)
  • Quantity
   Thanks for reading !!!

1 comment:

  1. Great article!
    I found this one also useful:
    http://ax.docentric.com/barcodes-microsoft-dynamics-ax/

    ReplyDelete