Use this event to
...
- 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 have new events included in standard Mobile WMS to help your customization needs.
...
// [Template]
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps', '', true, true)]
local procedure OnPostAdhocRegistration_OnAddSteps(_RegistrationType: Text; var _RequestValues: Record "MOB NS Request Element"; var _Steps: Record "MOB Steps Element"; var _RegistrationTypeTracking: Text)
begin
end;
Example
Workflow for customization example below:
...
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAddSteps', '', true, true)]
local procedure MyOnPostAdhocRegistration_OnAddSteps(_RegistrationType: Text; var _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;
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...