Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

DIXF Generate Method

$
0
0

To generate barcode during the import of the Products I have added the following listing as a generated method to DMFInventItemBarcodeEntityClass.

The  problem is it always generates new line and never updates the previous ones.

Is there anyway to prevent it from generating anything at all or at least a way to update previous lines?

[DMFTargetTransformationAttribute(true),DMFTargetTransformationDescAttribute(""),
DMFTargetTransformationSequenceAttribute(4),DMFTargetTransFieldListAttribute([fieldStr(DMFInventItemBarcodeEntity,ItemBarCode)])]
public container generateBarCodes()
{
    container res;

    RetailBarcodeManagement retailBarcodeManagement;
    InventDimCombination    inventDimCombination;
    ItemBarCode             calculatedBarCode;
    RetailBarcodeMask       retailBarcodeMask;
    BarcodeSetup            barcodeSetup;
    RetailInventTable       retailInventTable;
    InventItemBarcode       inventItemBarcode;

    retailBarcodeManagement =new RetailBarcodeManagement();

        select firstOnly retailInventTable
        where retailInventTable.itemId == entity.itemId;

    select firstOnly inventDimCombination
        where inventDimCombination.RetailVariantId == entity.RetailVariantId
        &&    inventDimCombination.ItemId == entity.ItemId;

       barcodeSetup = BarcodeSetup::find(retailInventTable.barcodeSetupId);
       retailBarcodeMask = barcodeSetup.RetailBarcodeMask;

    if (!entity.RetailVariantId)
    {
       calculatedBarCode =retailBarcodeManagement.createBarcodeNoDim(retailBarcodeMask,entity.itemId,entity.UnitID,entity.itemId);
    }
    else
    {
       calculatedBarCode = retailBarcodeManagement.createBarcodeForItemVariant(retailBarcodeMask,inventDimCombination,entity.UnitID,entity.itemId);
    }

       inventItemBarcode.itemBarCode=calculatedBarCode;
       res = [inventItemBarcode.itemBarCode];

    return res;
}

Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>