Single transfer order received with muti lines in d 365 fo

 Today we have a requirement for received transfer order


public void ReceiveTransferOrder()

    {

        InventTransferParmTable inventTransferParmTable;

        InventTransferLine  inventTransferLine;


        ttsbegin;


        while select inventTransferLine

                 where inventTransferLine.TransferId == transferID

        {


            inventTransferParmTable.clear();

            inventTransferParmTable.initParmDefault();

            inventTransferParmTable.TransferId       = transferID;//_inventTransferLine.TransferId;

            inventTransferParmTable.UpdateType       = InventTransferUpdateType::Receive;

            //  inventTransferParmTable.ShipUpdateQty    = InventTransferShipUpdateQty::All;

            inventTransferParmTable.ReceiveUpdateQty = InventTransferReceiveUpdateQty::All;

            inventTransferParmTable.EditLines        = true;

       

            inventTransferParmTable.LineNum          = 1;

            inventTransferParmTable.JobStatus        = ParmJobStatus::Executed;

            inventTransferParmTable.ExecutedDateTime = DateTimeUtil::utcNow();

            inventTransferParmTable.PickUpdateQty    = InventTransferPickUpdateQty::ShipNow;

            // inventTransferParmTable.ExplodeLines     = true;


            InventTransferMultiReceive inventTransferMultiReceive = InventTransferMultiReceive::construct();

            inventTransferMultiReceive.init();

            inventTransferMultiReceive.parmCalledFromWMS(false);

            RunBaseMultiParm::initParm(inventTransferMultiReceive);


            inventTransferParmTable.ParmId = inventTransferMultiReceive.parmId();

        

            inventTransferParmTable.insert(false);

        

            InventTransferParmLine inventTransferParmLine;

           

            inventTransferParmLine.initFromInventTransferLine(inventTransferLine);

            inventTransferParmLine.ParmId               = inventTransferParmTable.ParmId;

            inventTransferParmLine.TransferId           = inventTransferLine.TransferId;

            inventTransferParmLine.InventTransId        = inventTransferLine.InventTransIdReceive;

            inventTransferParmLine.LineNum              = InventTransferParmTable::lastLineNum(inventTransferParmTable.ParmId) + 1;

            inventTransferParmLine.InventTransIdTransit = inventTransferLine.InventTransIdTransitFrom;

            inventTransferParmLine.QtyReceiveNow        = inventTransferLine.QtyRemainReceive;

            inventTransferParmLine.insert();

       


         

            // //now do the update

            inventTransferMultiReceive.runUpdate(inventTransferParmTable);

          

        }


        if(InventTransferTable::find(transferID).TransferStatus == InventTransferStatus::Received)

        {

            message = "Transfer order is Recevied";


            localOutput = strFmt("%1, %2",message,transferID);

            this.parmOutput(localOutput);

        }

        ttscommit;

    }

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++