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 61 Next »

Use this event to

Interrupt posting process to create addtional steps based on already collected values.

  • Create addtional steps during posting for any unplanned (adhoc) functions.
  • Requires Android App 1.5.7 or newer

Description

During the posting request for an AdhocRegistration, the posting process can be interrupted and new steps returned to the mobile device in order to collect additional information. The Adhoc posting request is automatically executed again once such new steps have been collected, and will include collected values for those steps as well.

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

Handle collected values for your own custom Adhoc Registration Types

  • When extending your own custom adhoc Registration Types you can handle all collected values in your inline code.

Handle collected values for standard Mobile WMS Registration Types

  • When extending standard Mobile WMS adhoc registration types, usually values can 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. In such cases the relevant PostXXX-function from 'Mobile WMS Adhoc Registr.' may be need to be cloned to a new custom Registration Type to be able handle your values.
  • However, 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