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

Reindexing Dynamis AX database

Below script will create job to re-index and update statistics of dynamics ax database. In script below fill factor is used as 30%, revie...