Friday, June 22, 2018

Production picking list reservation through X++

Reserve without changing dimension.
 dtProdBOMReserve(Args _args)   
 {   
   prodJournalBOM prodJournalBOM;
   InventUpd_Reservation reservation;   
   ;   

   select * from prodJournalBOM    
    where prodJournalBOM.RecId == 5637695365;   

   movement = InventMovement::construct(prodJournalBOM);   
   reserveQuantity = prodJournalBOM.BOMConsump - abs(movement.transIdSum().reserved());  
   if(reserveQuantity)
   {
     reservation = InventUpd_Reservation::newMovement(movement,-reserveQuantity,true);   
     reservation.updateNow();  
   } 
   info('Reserved.');   
  }   

Reserve for specific dimension.


static void dtProdBOMReserveWithDim(Args _args)  
 {  
   prodJournalBOM prodJournalBOM;;  
   InventDim InventDim;  
   InventUpd_Reservation reservation;  
   ;  
   select * from prodJournalBOM  
     where prodJournalBOM.RecId == 5637695365;  

   //Update dimension
   inventDim = prodJournalBOM.inventDim();  
   inventDim.wMSLocationId = '12420301';  

   movement = InventMovement::construct(prodJournalBOM);  

   reserveQuantity = prodJournalBOM.BOMConsump - abs(movement.transIdSum().reserved()); 
 
   if(reserveQuantity)
   {
     reservation = InventUpd_Reservation::newInventDim(movement,inventDim, -reserveQuantity,false);  
     reservation.updateNow();  
   }

   info('Reserved.');  
 }  

No comments:

Post a Comment

Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now