Tuesday, January 17, 2023

Code to conditionally block quality order creation

[ExtensionOf(classstr(InventQualityManagementCreate))]

public final class xyzInventQualityManagementCreate_Extension

{

  protected boolean canCreateQualityOrderForAnyQuantity(inventQualityOrderTable  _inventQualityOrderTable)

  {

    boolean ret;

    ret = next canCreateQualityOrderForAnyQuantity(_inventQualityOrderTable);

    Common checkTable = referenceType.parmBuffer();


    if(tableNum(PurchLine) == checkTable.tableId)

    {

      PurchLine purchlineLoc = checkTable as PurchLine;



      PurchTable purchTable = PurchTable::find(purchlineLoc.PurchId);


      if(purchTable.isInterCompanyOrder())

      {

          WMSJournalTable wmsJournalTable;

          WMSJournalTrans wmsJournalTrans;



          select  firstonly  wmsJournalTrans  

            where wmsJournalTrans.inventTransId   == purchlineLoc.InventTransId

              && wmsJournalTrans.inventTransType == inventTransType::Purch;



        if(wmsJournalTrans.CPLBlockQualityOrder == NoYes::Yes)

        {

          ret = false;

        }

      }

    }

    return  ret;

  }

}

No comments:

Post a Comment

Build Explained

Useful Blogs. https://axtechsolutions.blogspot.com/2018/08/performing-builds-in-d365.html https://community.dynamics.com/blogs/post/?postid=...