82) Validation on the lifeCycleState

 [ExtensionOf(classStr(EntAssetLifecycleStateUpdate_WorkOrderTable))]

final class AvaEntAssetLifecycleStateUpdate_WorkOrderTable_Extension

{

    

    protected void validateState(EntAssetWorkOrderTable _workOrderTable)

    {

        next validateState(_workOrderTable);


        if (workOrderLifecycleState.AvaValidateTransferOrderReceived)

        {

            this.avaValidateTransferOrder(_workOrderTable, workOrderLifecycleState.AvaValidateTransferOrderReceivedInfoType);

        }

    }


    protected void avaValidateTransferOrder(EntAssetWorkOrderTable _workOrderTable, EntAssetInfoType _infoType)

    {

        boolean errorFound = false;


        void showInfo(str _info)

        {

            switch (_infoType)

            {

                case EntAssetInfoType::Information:

                    info(_info);

                    break;

                case EntAssetInfoType::Warning:

                    warning(_info);

                    break;

                case EntAssetInfoType::Error:

                    error(_info);

                    errorFound = true;

                    break;

            }

        }

        if(_workOrderTable.AvaTransferStatus == AvaWorkOrderTransferStatus::Pending || _workOrderTable.AvaTransferStatus == AvaWorkOrderTransferStatus::Shipped)

        {

            showInfo(strFmt("@AvaTransMountain:AvaUnableToProcessWorkOrderState_ErrorMsg", _workOrderTable.AvaTransferStatus));

        }


        if (errorFound)

        {

            throw error("@SYS18447");

        }


    }


    /// <summary>

    /// Passing the value in class AvaEntAssetChecklistUtill with the table refernce  of EntAssetWorkOrderLineChecklistHeader, EntAssetWorkOrderLine.

    /// </summary>

    protected void processChecklist(EntAssetWorkOrderRecID _woRecID)

    {

        EntAssetWorkOrderLine                 workOrderLine;

        EntAssetWorkOrderLineChecklistHeader  checklistHeader;

        EntAssetWorkOrderLineChecklist        wolChecklist;

       

        while select RecId, Object from workOrderLine

            where workOrderLine.WorkOrder == _woRecID

        join checklistHeader

            where checklistHeader.WorkOrderLine == workOrderLine.RecId

             

        {

            AvaEntAssetChecklistUtill::processChecklist(checklistHeader, workOrderLine);

        }


        next processChecklist(_woRecID);

      

    }


}

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++