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

Version 1 Next »

Description

With this article you will create a page (Unplanned Function) that can make a simple registration optinally followed by a number of collector Steps.


Use cases

  • You want to register a single value in the Header
  • You want to register a single value in the Header and based on the value, a number of subsequent values as Steps


Overview


Defining the page in Application.cfg

Step 1: Unplanned functions are called "Unplanned Item Registration"

Below is sample code for an Unplanned Item Registration called "MyItemReg".


Add to application.cfg
<page id="MyItemReg" type="UnplannedItemRegistration" icon="mainmenuscaninfo">
  <title defaultValue="Titel"/>
  <unplannedItemRegistrationConfiguration type="MyItemReg" includeInputDataRowInSubmitRequest="true" useRegistrationCollector="true">
    <header configurationKey="MyItemReg" clearAfterPost="true" automaticAcceptOnOpen="true" automaticAcceptAfterLastScan="true"/>
    <onSuccessfulPost close="true" />
  </unplannedItemRegistrationConfiguration>
</page>


Note: For simplicity the Page id, Registration and Header -keys are all named "MyItemReg".

  • Page id unique page name
  • Registration key is how the back-end will identify the Unplanned Item Registration (including the Collector Steps)
  • Header key  is how the back-end will identify the Input fields shown on the top of the page. 

Step 2: Add the main menu items

Add to application.cfg
<!-- PAGES -->
<pages>
  <page id="MainMenu" type="Menu" icon="icon">
    <title defaultValue="Mobile WMS" />
    <menuConfiguration>
      <menuItems>          
		...
        <menuItem id="MyItemReg" displayName="MyItemReg" icon="mainmenuscaninfo" alwaysEnabled="true"/>

Handling the back-end

Step 3: Defining Header fields

This will define the field(s) displayed on the top of the page.

For simplicity we will only have a field called "ID".




This is defined in Codeunit "MOB WMS Reference Data"


CreateConfig(XMLResponseData,'MyItemReg');



'MyLookup','MyItemReg': MyLookupAndMyItemReg(XMLCDataSection);


MyLookupAndMyItemReg(VAR XmlCDataSection : DotNet "System.Xml.XmlCDataSection")
// Used for Custom05UnplannedItemReg

AddConfHeaderTextValue(XmlCDataSection,
                       1,                 //id
                       'ID',              //name
                       'Enter ID:',       //label
                       100,               //label width
                       TRUE,              //clear on clear
                       TRUE,              //accept barcode
                       20,                //length
                       TRUE,              //optional
                       '',                //search type
                       '',                //eanAi
                       FALSE);            //locked


Step 4: Defining the "Steps" to collect 

This is the code that will return the list of results and entries that you require.


This is defined in Codeunit "MOB WMS Adhoc Regstr."


'MyItemReg':
    BEGIN
      MyItemReg(XMLRequestDoc);
    END;



LOCAL MyItemReg(XMLRequestDoc : DotNet "System.Xml.XmlDocument")
// Extract any parameters from the XML
// The parameters are located in the <requestData> element
// The Unplanned Move feature expects 2 header values
// Location and Item
MobXMLMgt.GetDocRootNode(XMLRequestDoc, XMLRequestNode);
MobXMLMgt.FindNode(XMLRequestNode,MobWMSToolbox."CONST::requestData",XMLRequestDataNode);

// -- Now find the "ID"-attribute
MobXMLMgt.FindNode(XMLRequestDataNode,'ID',XMLParameterNode);

// Initialize the response xml
MobBaseToolbox.InitializeRespDocWithoutNS(XMLResultDoc,XMLResponseData);

// Add the <registrationCollectorConfiguration> element
MobXMLMgt.AddElement(XMLResponseData,'registrationCollectorConfiguration','',
                     MobXMLMgt.GetDocNSURI(XMLResultDoc),
                     XMLRegCollectorConfiguration);

// Add the <steps> element to the <registrationCollectorConfiguration>
MobXMLMgt.AddElement(XMLRegCollectorConfiguration,'steps','',MobXMLMgt.GetDocNSURI(XMLResultDoc),XMLSteps);

// Add the steps
MobConfTools.RC_Std_Parms(1,
                          'SomeText',
                          'Collecting some text',
                          '',
                          'Please enter some text');

MobConfTools.RC_Text_XmlNode(XMLSteps,
                             '',
                             20);



This will produce one collector step.

Asking for a text value.


Step 5: Handling the "posting" of Unplanned Item Registration

This code read the collected data and posts it.

If this code makes changes to the data the Lookup uses, you will see the result of the posting when the returning to the Lookup.


This is defined in Codeunit "MOB WMS Adhoc Regstr."


'MyItemReg':
  BEGIN
    Status := PostMyItemReg(XMLRequestDoc);
    MobBaseToolbox.CreateSimpleResponse(XMLResultDoc,Status);
  END;

Create function "PostMyItemReg" by copying an existing posting function.

  • Modify the new function to read the "ID" and "SomeText" values.





Main menu with "MyItemReg" icon


The Unplanned Function with header and field




  • No labels