Minimum Requirements
- Android App 1.8.1.1
Description
Interrupt posting and add an extra Header (ImageCapture) Step.
- Adds an extra ImageCapture step during posting.
- The collected image is then saved in Mob Wms Media Queue.
- In the Mobile Document Queue List, a PostMedia Request will appear after adding the Header Steps - for these examples, after PostPickOrder or PostAdHocRegistration.
Behaviour on the device
To collect an Image in the step, the user will need to use the plus sign (+) to take a picture and add an optional note before posting.
Examples
This How-to contains two examples.
The following examples are made for an unplanned (Adjust Quantity) and a planned step (Pick), respectively.
Example 1: Add header ImageCapture step for Planned function (Pick)
Step 1.1 - Create an header step
Use OnPostPickOrder_OnAddStepsToWarehouseActivityHeader to add an ImageCapture step:
//Create an ImageCapture header step that interrupts the posting of a pick
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnPostPickOrder_OnAddStepsToWarehouseActivityHeader', '', true, true)]
local procedure MyOnPostPickOrder_OnAddStepsToWarehouseActivityHeader(var _OrderValues: Record "MOB Common Element"; _WhseActivityHeader: Record "Warehouse Activity Header"; var _StepsElement: Record "MOB Steps Element")
begin
if _OrderValues.HasValue('ImageCapture') then
exit;
_StepsElement.Create_ImageCaptureStep(50, 'ImageCapture');
_StepsElement.Set_helpLabel('Take a picture');
end;
Step 1.2 - Handle the header step
// Handle the ImageCapture step. The picture taken will be saved in the MOB Wms Media Queue
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Pick", 'OnPostPickOrder_OnBeforePostWarehouseActivityOrder', '', true, true)]
local procedure OnPostPickOrder_OnBeforePostWarehouseActivityOrder(var _OrderValues: Record "MOB Common Element"; var _WhseActivityHeader: Record "Warehouse Activity Header")
var
MobWmsMediaQueue: Record "MOB WMS Media Queue";
MobWmsLanguage: Codeunit "MOB WMS Language";
MOBSessionData: Codeunit "MOB SessionData";
ImageIdsAndNotes: Text;
ImageAndNoteList: List of [Text];
begin
ImageIdsAndNotes := _OrderValues.GetValue('ImageCapture', true);
if ImageIdsAndNotes = '' then
Error(MobWmsLanguage.GetMessage('NO_PICTURE_TO_ATTACH'));
MobWmsMediaQueue.Init();
ImageAndNoteList := ImageIdsAndNotes.Split(';'); //Splits the list into Image Id and Note
ImageAndNoteList.Get(1, MobWmsMediaQueue."Image Id");
ImageAndNoteList.Get(2, MobWmsMediaQueue.Note);
MobWmsMediaQueue."Device ID" := MOBSessionData.GetDeviceID(); //Gets the Device ID
MobWmsMediaQueue.Description := format(_WhseActivityHeader.RecordId); // Add the RecordId from the Warehouse Activity Header, to know which pick the picture came from.
MobWmsMediaQueue.Insert(true);
MobWmsMediaQueue."Record ID" := MobWmsMediaQueue.RecordId;
MobWmsMediaQueue.Modify(false)
end;
Example 1: ImageCapture Step in Pick
Example 1: The picture and note were saved in Mob Wms Media Queue
Example 2: Add header ImageCapture step for Unplanned function (Adjust Quantity)
Step 2.1 - Create an adhoc header step
//Create a simple ImageCapture header step
[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
MobWmsToolbox: Codeunit "MOB WMS Toolbox";
begin
if _RegistrationType <> MobWmsToolbox."CONST::AdjustQuantity"() then
exit;
if _RequestValues.HasValue('ImageCapture') then
exit;
_Steps.Create_ImageCaptureStep(50, 'ImageCapture');
_Steps.Set_helpLabel('Take a picture of the item');
end;
Step 2.2 - Handle the header step
// Handle the ImageCapture step. The picture taken will be saved in the MOB Wms Media Queue
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnPostAdhocRegistration_OnAfterPost', '', true, true)]
local procedure MyOnPostAdhocRegistration_OnAfterPost(_MessageId: Guid; _RegistrationType: Text; var _RequestValues: Record "MOB NS Request Element"; var _XmlResponseDoc: XmlDocument; var _RegistrationTypeTracking: Text)
var
MobWmsMediaQueue: Record "MOB WMS Media Queue";
MobWmsLanguage: Codeunit "MOB WMS Language";
MobWmsToolbox: Codeunit "MOB WMS Toolbox";
MobSessionData: Codeunit "MOB SessionData";
ItemImageList: List of [Text];
Image: Text;
begin
if _RegistrationType <> MobWmsToolbox."CONST::AdjustQuantity"() then
exit;
if _RequestValues.HasValue('ImageCapture') then begin
Image := _RequestValues.GetValue('ImageCapture', true);
// Set the tracking value displayed in the document queue
_RegistrationTypeTracking := ('Saved image: ' + Image);
MobWmsMediaQueue.Init();
ItemImageList := Image.Split(';'); // Splits it into two parts, Image Id and note
ItemImageList.Get(1, MobWmsMediaQueue."Image Id");
ItemImageList.Get(2, MobWmsMediaQueue.Note);
MobWmsMediaQueue."Device ID" := MOBSessionData.GetDeviceID(); // Gets the device ID and adds it to the Device ID field in the MOB Wms Media Queue
MobWmsMediaQueue.Description := Format(MobWmsMediaQueue."Record ID");
MobWmsMediaQueue.Insert(true);
MobWmsMediaQueue."Record ID" := MobWmsMediaQueue.RecordId;
MobWmsMediaQueue.Modify(false);
end;
end;
Example 2: ImageCapture Step in Adjust Quantity
Example 2: The picture and note were saved in Mob Wms Media Queue
See also
-
-
How-to: Select Line and set default Step values (LineSelection) — The LineSelection functionality makes it possible to:
- Select a line based on a response from the backend
- Set default values on the line steps