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;  
   }  

sabato 21 luglio 2018

D365 Process Inbound ASN


We create two purchase orders having the following structure:

 

  • Purchase order: 00000375 -- Vendor: 1001 - Acme Office Supplies
    • Itemid: A0001, Quantity: 100 pcs
  • Purchase order: 00000348 -- Vendor: 1001 - Acme Office Supplies
    • Itemid: A0001, Quantity: 600 pcs
    • Itemid: P0004, Quantity: 300 ea, Batch: BN0001

 

We import the following file into AX in order to populate the ASN Inbound tables.

 

<?xml version="1.0" encoding="utf-8"?>

<Document>

  <WHSInboundLoadHeaderEntity TractorNumber="0000101">

    <WHSInboundShipmentHeaderEntity VendorShipmentId="VendASN_01" VendorAddressCountryRegionId = "USA" VendorAddressStreet = "123 Coffee Street" VendorAddressStateId = "WA" VendorAddressCity = "Redmond" VendorAddressZipCode = "98052">

      <WHSInboundLoadPackingStructureEntity LICENSEPLATENUMBER="LP_ASN_001">

        <WHSInboundLoadPackingStructureLineEntity PURCHASEORDERNUMBER="00000347" ITEMNUMBER="A0001" QUANTITY="100" UNITSYMBOL="pcs" />

      </WHSInboundLoadPackingStructureEntity>

    </WHSInboundShipmentHeaderEntity>

    <WHSInboundShipmentHeaderEntity VendorShipmentId="VendASN_02" VendorAddressCountryRegionId = "USA" VendorAddressStreet = "123 Coffee Street" VendorAddressStateId = "WA" VendorAddressCity = "Redmond" VendorAddressZipCode = "98052">

      <WHSInboundLoadPackingStructureEntity LICENSEPLATENUMBER="LP_ASN_001">

        <WHSInboundLoadPackingStructureLineEntity PURCHASEORDERNUMBER="00000348" ITEMNUMBER="A0001" QUANTITY="200" UNITSYMBOL="pcs"  />

        <WHSInboundLoadPackingStructureLineEntity PURCHASEORDERNUMBER="00000348" ITEMNUMBER="P0004" QUANTITY="300" UNITSYMBOL="ea" ITEMBATCHNUMBER="BN0001" />

      </WHSInboundLoadPackingStructureEntity>

      <WHSInboundLoadPackingStructureEntity LICENSEPLATENUMBER="LP_ASN_002">

        <WHSInboundLoadPackingStructureCaseEntity LICENSEPLATENUMBER="LP_ASN_002_C01">

          <WHSInboundLoadPackingStructureCaseLineEntity PURCHASEORDERNUMBER="00000348" ITEMNUMBER="A0001" QUANTITY="400" UNITSYMBOL="ea"  />

        </WHSInboundLoadPackingStructureCaseEntity>

      </WHSInboundLoadPackingStructureEntity>

    </WHSInboundShipmentHeaderEntity>

  </WHSInboundLoadHeaderEntity>

</Document>

 

We use the data entity "Inbound ASN" of type "XML-Attribute".



Once we import the xml file automatically the system will generate LOAD and SHIPMENTS according to the purchase orders previously created (as reported below).

 

In the meanwhile AX has also generated the packing structure related to the specific load that is visible clicking on the button "Packing structure".



Once we have followed the whole process above we can start to manage the item arrivals using the WHS terminal. In order to do it we have used the function "Mixed license plate receiving".



At the end of the process we can register the product receipt for the specific load.


 

venerdì 13 luglio 2018

D365 Electronic signature

D365 Electronic signature


Nella form electronic signature parameters è impostato il messaggio da visualizzare in fase di conferma.

Viene impostato l'electronic signature requirements su l'approvazione della BOM version.
Sono impostati alcuni reason codes di electronic signature.

Impostiamo il certificato sull'utente in linea.
Definiamo una password 5 maiuscole, 5 minuscole, 2 numeri.


Approviamo una BOM version, inseriamo un commento.


Viene richiesta la password utente.

Inserita la password, l'update è eseguito!!

mercoledì 11 luglio 2018

D365 - Warehouse and transportation management overview


Warehouse and transportation management
Warehouse management is based on the following elements:

·        Loads: An outbound load is a single shipment or group of shipments shipped from a warehouse location to a customer or intermediate location. You can create an outbound load from a sales order or transfer order automatically or manually.

An inbound load is a single shipment or group of shipments shipped from and external warehouse to an internal one. You can create an inbound load from purchase order manually.

 

·        Shipments: A shipment is a collection of sales / purchase order lines, heading to the same address in one load. A single load may have multiple shipments. E.g. a sales order with two lines, each going to a different destination will result in creation of two shipments, belonging to the same load.

 

·        Waves: A wave is a collection of shipments and it will allow the generation of works in order to move items in warehouse.

 

·        Work: For each wave we can have more than one work in which the steps for moving items are defined, we can have more steps for each item.

 

We can distinguish two different processes:

·        Issue process
·        Receipt process

In detail the process is composed by the following elements linked in the following way.

Transportation module structure
 
·        Issue process

·         Receipt process



Transportation management is based on the following functions / forms:

·        Route break: this function manage the breaks for transport pricing

·        Route rate: this function is made by some tables and it manages the transport prices

·        Route: this function shows the route plan and the pricing planned for it.

giovedì 23 novembre 2017

AX 2012 - Dynamics 365 - Recuperare il testo di un'etichetta in base alla lingua passata come parametro

Molto spesso può essere utile recuperare il testo di un'etichetta in una data lingua passata come parametro:

 SysLabel::labelId2String(literalstr("@SYS67"), "it");  

mercoledì 4 ottobre 2017

AX 2012 - Cancellare una dimensione da una default dimension

Con questo semplice job possiamo "blankare" una dimensione su una default dimension:

 static void DeleteDimension(Args _args)  
 {  
   DimensionAttributeValueSetStorage  dimStorage;  
   VendTable              vendTable = vendTable::find("CS000331");  
   Name                dimensionNameToBlank = "GAAP"; //Nome delle dimensione da blankare  
   ;  
   ttsBegin;  
   dimStorage = DimensionAttributeValueSetStorage::find(vendTable.DefaultDimension);  
   dimStorage.removeDimensionAttribute(DimensionAttribute::findByName(dimensionNameToBlank).RecId);  
   vendTable.DefaultDimension = dimStorage.save();  
   vendTable.doUpdate();  
   ttsCommit;  
 }  



mercoledì 9 agosto 2017

AX 2009 - Creazione di un ordine pianificato in X++

Questo metodo aggiunto alla tabella ReqPO consente di creare un ordine pianificato via codice.
Ho preso come riferimento quello che lo standard fà quì:

\Classes\ReqCalc\covCreatePlannedOrder()

 server void CONcreatePlannedOrderFromJFlex(  
   InventLocationId  _fromInventLocationId  = '',  
   InventLocationId  _toInventLocationId   = ''  
   )  
 {  
   ReqCalcExplodePo  reqCalcExplodePo;  
   ReqTrans      reqTransPo;  
   ReqTrans      transferDemand;  
   InventDim      inventDimDemand;  
   ReqPlanData     reqPlanData;  
   InventDim      inventDim;  
   inventSite     inventSite;  
   InventDimGroupId  dimGroupId;  
   ;  
   inventDim.InventSiteId = (select firstonly SiteId from inventSite).siteId;  
   inventDim = InventDim::findOrCreate(inventDim);  
   this.ReqPlanId     = cONJFLEXParameters.ReqPlanId;  
   this.RefType      = ReqPO::reqPoType2ReqRefType(ReqPoType::Purch);  
   this.ReqDateDlv     = today();  
   this.initFromItemId("lillilor");  
   this.Qty        = 10;  
   this.VendId       = "lillilor";  
   dimGroupId = InventTable::find("lillilor").DimGroupId;  
   inventDim.clearNotCovPrDim(dimGroupId);  
   if (! this.validateWrite())  
     throw Exception::Error;  
   ttsbegin;  
   this.initPurchQty();  
   reqPlanData = ReqPlanData::newReqPlanId(this.ReqPlanId);  
   this.RefId = NumberSeq::newGetNumFromCode(reqPlanData.sequencePlannedOrder()).num();  
   this.CovInventDimId = InventDim::findOrCreate(inventDim).InventDimId;  
   /*  
     Must BOM and Route be created  
   */  
   if (this.RefType == ReqRefType::BOMPlannedOrder)  
   {  
     if (reqPlanData.mustTransBeExploded(this.reqSetupDim(),this))  
       this.setBOMCreated( this.ItemBomId  ? true : false);  
     if (reqPlanData.mustTransBeScheduled(this.reqSetupDim(),this))  
       this.setRouteCreated(this.ItemRouteId ? true : false);  
   }  
   this.insert();  
   reqTransPo.ReqDateDlvOrig   = this.ReqDateDlv;  
   reqTransPo.Level       = this.reqSetup().itemLevel();  
   reqTransPo.insertFromReqPo(this,false,reqPlanData);  
   if (this.RefType == ReqRefType::BOMPlannedOrder || this.RefType == ReqRefType::TransferPlannedOrder)  
   {  
     if (this.RefType == ReqRefType::TransferPlannedOrder)  
     {  
       transferDemand = reqTransPo.reqTransTransferDemand(true);  
       if (transferDemand.RecId)  
       {  
         inventDimDemand = transferDemand.inventDim();  
         inventDimDemand.InventLocationId  = _fromInventLocationId;  
         inventDimDemand.initFromInventLocation(inventDimDemand.inventLocation(), dimGroupId);  
         transferDemand.CovInventDimId    = InventDim::findOrCreate(inventDimDemand).InventDimId;  
         transferDemand.update();  
       }  
     }  
     reqCalcExplodePo = ReqCalcExplode::newReqTrans(reqTransPo,null);  
     reqCalcExplodePo.run();  
     reqCalcExplodePo.refreshUpdatedReqPo(this);  
   }  
   ttscommit;  
 }  

Riferimeti:

https://community.dynamics.com/ax/f/33/t/136809