Restrict the Reservation setting to zero on sales changes

 

[ExtensionOf(classStr(PdsShelfLifeMovUpdConfirmDialogFactory))]

final public class rsmPdsShelfLifeMovUpdConfirmDialogFactory_Class_Extension

{

    public PdsShelfLifeIMovUpdConfirmDialog createConfirmDialogFromLineAndField(

        Common  _orderLineBuffer,

        FieldId _fieldNumberChanged,

        boolean _isContextServerBound)

    {

        PdsShelfLifeIMovUpdConfirmDialog instance = next createConfirmDialogFromLineAndField(_orderLineBuffer, _fieldNumberChanged, _isContextServerBound);

        PdsShelfLifeIMovUpdConfirmDialog createdInstance;

        SalesLine salesLine;

        boolean hasAutoReservation;

        boolean canGeneratePrompt;

 

        switch (_orderLineBuffer.TableId)

        {

            case tableNum(SalesLine):

                salesLine = _orderLineBuffer as SalesLine;

                hasAutoReservation = salesLine.Reservation == ItemReservation::Automatic;

                if(!this.canGeneratePrompt(_isContextServerBound, _orderLineBuffer))

                {

                    if(salesLine.rsmHasValidBatchReservation())

                    {

                        instance.parmIsRecordMarked(true);

                    }

                }

                break;

        }

        return instance;

    }

 

}

 

This is the method added to the SalesLine extension

 

public boolean rsmHasValidBatchReservation()

{

    WHSOrderCommittedReservationAllView reservationView;

    InventDim inventDim;

 

    select firstonly RecId from reservationView

        where reservationView.CommittingOriginInventTransId == this.InventTransId

        join inventBatchId from inventDim

        where inventDim.inventDimId == reservationView.InventDimId

        && inventDim.inventBatchId != '';

 

    if(InventBatch::pdsCheckExpiryDate(inventDim.inventBatchId, this.ItemId, this.ShippingDateConfirmed))

    {

        return true;

    }

    return false;

}

Comments

Popular posts from this blog

Price disc agreement

Sample integration

Create ledger journals in D365FO using X++ + LedgerDimensionACType