Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 69 Next »

Requirement

Android App version 1.5.9

Use this event to

Interrupt posting and add extra steps based on values already collected.

  • Add extra steps during posting of unplanned document types (interrupt posting to collect addtional steps)
  • Used for "conditional" steps i.e. when values from previously collected steps determines if the step are to be included
  • Posting are restarted (started over) when the additional steps have been collected on the mobile device
  • Events are executed every time posting starts over and can be used to chain even more steps.

Description

Collecting additonal values from new steps (created using this event) must go hand-in-hand with additonal customizations to handle such values:

Custom Registration Type

Standard Registration Type

  • When extending standard Mobile WMS adhoc registration types, values can usually be handled in 'OnAfterCreateItemJnlLine' or 'OnAfterCreateWhseJnlLine' events assiciated with the Registration Type (i.e. OnPostAdhocRegistrationOnUnplannedCount_OnAfterCreateItemJnlLine).
  • In some cases your required changes to standard adhoc posting functions may not be supported by existing events, including when errors are triggered in the standard Mobile WMS code prior to events being fired.
    I
    n such cases the relevant PostXXX-function from 'Mobile WMS Adhoc Registr.' may need to be cloned to a new custom Registration Type to be able to handle your values.
  • Cloning code should be avoided whenever possible. You are always welcome to raise a support ticket to request new events for standard Mobile WMS to help your customization needs.


See also: Return steps on Post


Template

    // [Template]
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps''', true, true)]
    local procedure OnPostAdhocRegistration_OnAddSteps(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
    begin
    end;

Example

Workflow for customization example below:






GetRegistrationConfiguration






PostAdhocRegistration






PostAdhocRegistration

Unplanned Count4 steps are returned from standard Mobile WMS code.

User scans a lotnumber currently unknown on inventory.
The customation example below  recognizes the Expiration Date is unknown for the collected lotnumber and adds an addtional fifth step (but do otherwise not process posting).
The customation example below recognizes the Expiration Date is  now known from a custom collected step, and exits to allow the posting code to process.The new collected ExpirationDate-step is unhandled in the customization example below. 

Collecting additonal values must go hand-in-hand with addtional customizations to handle such values.


    // [Example] Unplanned Count: Add additional step during posting to collect expiration date when counted lotnumber/serialnumber has an unknown expiration date (has not previously been on inventory)

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps''', true, true)]
    local procedure MyOnPostAdhocRegistration_OnAddSteps(_RegistrationType: Textvar _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
    var
        Location: Record Location;
        ItemTrackingMgt: Codeunit "Item Tracking Management";
        MobWmsAdhocReg: Codeunit "MOB WMS Adhoc Registr.";
        MobWmsToolbox: Codeunit "MOB WMS Toolbox";
        ItemNumber: Code[20];
        VariantCode: Code[20];
        LocationCode: Code[10];
        LotNo: Code[50];
        SerialNo: Code[50];
        RegisterSerialNumber: Boolean;
        RegisterLotNumber: Boolean;
        RegisterExpirationDate: Boolean;
        ExistingExpirationDate: Date;
        EntriesExist: Boolean;
    begin
        if _RegistrationType <> MobWmsToolbox."CONST::UnplannedCount"() then
            exit;

        if _RequestValues.HasValue('ExpirationDate'then
            exit;   // already collected, break to avoid adding the same new step indefinitely

        ItemNumber := _RequestValues.GetValue('Item', true);        // mandatory
        VariantCode := _RequestValues.GetValue('Variant', false);   // optional, only exists if item has associated variants
        LocationCode := _RequestValues.GetValue('Location', true);  // mandatory
        LotNo := _RequestValues.GetValue('LotNumber', false);       // optional, only used if RegisterExpirationDate is true
        SerialNo := _RequestValues.GetValue('SerialNumber', false)// optional, only used if RegisterExpirationDate is true

        MobWmsAdhocReg.DetermineNegAdjustItemTracking(ItemNumber, RegisterSerialNumber, RegisterLotNumber, RegisterExpirationDate);
        if not RegisterExpirationDate then
            exit;   // ItemTrackingCode."Man. Expir. Date Entry Reqd." = false

        // ExpirationDate is needed: Verify if an existing ExpirationDate can be derived from existing entries
        // The 'GetWhseExpirationDate' function used below will return if any entries exists for the lot number EVEN if such entries all has a blank expiration date or is closed
        Location.Get(LocationCode);
        EntriesExist := ItemTrackingMgt.GetWhseExpirationDate(
            ItemNumber,
            VariantCode,
            Location,
            LotNo,
            SerialNo,
            ExistingExpirationDate);

        if (ExistingExpirationDate <> 0D) or EntriesExist then
            exit;   // same break condition as 'GetWhseExpirationDate' used in standard posting code

        // Add the new 'ExpirationDate'-step
        _Steps.Create_DateStep_ExpirationDate(50000, ItemNumber);

        //
        // Additional changes:
        // 
        // Currently no events in codeunit "MOB WMS Adhoc Registr.".PostUnplannedCountRegistration() supports suppressing the error message concerning a missing expiration date
        // on entries when the journal line is created. In this case we will need to clone the code from 'PostUnplannedCountRegistration()' to a new adhoc RegistrationType and do
        // our changes to 'PostUnplannedCountRegistration()' in a copy of the code.
        //
        // However, cloning code should be avoided whenever possible. You are always welcome to raise a support ticket to have new events included in standard Mobile WMS to help
        // your customization needs.
        //
        // In most cases you should be able to use events:
        // * OnPostAdhocRegistrationOnXXX_OnAfterCreateWhseJnlLine(_RequestValues, TempWhseJnlLine)   or
        // * OnPostAdhocRegistrationOnXXX_OnAfterCreateItemJnlLine(_RequestValues, TempItemJnlLine)
        //
    end;



More examples

There are no items with the selected labels at this time.


Version History

Version

Changes

MOB5.26Introduced
  • No labels