giovedì 26 luglio 2018

AX 2012 - D365FO - Recuperare la risorsa collegata alla fase

Con questo job possiamo recuperare la risorsa primaria collegata alla fase:



partendo da prodRoute:

 public static WrkCtrId getWrkCtrId(ProdRoute _prodRoute)  
   {  
     RecId              recId;  
     WrkCtrId            wrkCtrGrpId;  
     ProdId             prodId;  
     WrkCtrActivityRequirementType  relationShipType;  
     WrkCtrActivityRequirement    wrkCtrActivityRequirement;  
       
       recId = _prodRoute.activityRequirementSet().RecId;  
   
       select WrkCtrActivityRequirement  
         where WrkCtrActivityRequirement.ActivityRequirementSet == recid;  
   
       if(WrkCtrActivityRequirement)  
       {  
         wrkCtrGrpId = WrkCtrActivityRequirement.requirementEdit();  
       }  
       
       return wrkCtrGrpId;  
   }  

oppure partendo da routeOpr:

 static WrkCtrActivityRequirementEdit getWrkCtrActivityRequirementEdit(RouteOpr _routeOpr)  
   {  
     wrkCtrActivityRequirement    wrkCtrActivityRequirement;  
     WrkCtrActivityRequirementEdit  WrkCtrActivityRequirementEdit;  
   
     select firstonly wrkCtrActivityRequirement  
       where wrkCtrActivityRequirement.ActivityRequirementSet == _routeOpr.activityRequirementSet().RecId;  
   
     if(wrkCtrActivityRequirement)  
     {  
       wrkCtrActivityRequirementEdit = wrkCtrActivityRequirement.requirementEdit();  
     }  
   
     return wrkCtrActivityRequirementEdit;  
   }  

Nessun commento:

Posta un commento