Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Description
TwoWith this article you will create two pages that
willcan:
- Show ("Display/look-up ") a list of entries entries using a Lookup Function
- Make a registration regarding each entry on the list (An "Unplanned Item Registration")
- the lookup entry using an Unplanned Function
Selecting a lookup entry will navigate to the unplanned function.
Use cases
- You want to search for and display a list of outstanding "items" to "handle".
- When you have handled each item, you want that item to disappear from the list and proceed to the next item.
or
- You want to search for and display a list of Jobs.
- Select one or more job and make registrations of Items or Hours etc. spent on that job.
Overview
Table of Contents | ||||
---|---|---|---|---|
|
Defining the pages in Application.cfg
Step 1: Defining the Lookup
Below is sample code for a Lookup called "MyLookup"
Code Block | ||||
---|---|---|---|---|
| ||||
<page id="MyLookup" type="Lookup" icon="mainmenuscaninfo"> <title defaultValue="Titel"/> <lookupConfiguration type="MyLookup"> <header configurationKey="MyLookup" automaticAcceptOnOpen="true" /> <onResultSelected enabled="true" refreshOnSuccess="true" navigateTo="MyItemReg"/> <list listId="Lookup" /> </lookupConfiguration> <actions> <open id="MyItemReg" menuPlacementicon="nonemainmenusettings" contextMenuPlacementtitle="noneMy UnplannedItemRegistration"> <transfer property="LookupSelectedResult" to="UnplannedItemRegistrationInputValue"></transfer> <returnTransfer property="UnplannedItemRegistrationCompleted" to="RefreshOnResume"/> </open> </actions> </page> |
Step 2: Unplanned Item Registration
Below is sample code for an Unplanned Item Registration called "MyItemReg"
Code Block | ||||
---|---|---|---|---|
| ||||
<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 key and Header Key -keys are all name the samenamed "MyItemReg".
- Page id uniquely identifies the page in the config file 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.
- See Header
Step 3: Add the main menu items
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- PAGES --> <pages> <page id="MainMenu" type="Menu" icon="icon"> <title defaultValue="Mobile WMS" /> <menuConfiguration> <menuItems> ... <menuItem id="MyLookup" displayName="MyLookup" icon="mainmenumove-unplanned" alwaysEnabled="true"/> <menuItem id="MyItemReg" displayName="MyItemReg" icon="mainmenushipping" alwaysEnabled="true"/> ... |
Handling the back-end
Step 4: Defining a shared Header for the Pages
This will define the field(s) displayed on the top of the Lookup aka the search criteria.
But it will also enable the MyItemReg page to "Receive" this information.
So the header will be shared between the two pages.
For simplicity we will only have a field called "ID".
This is defined in Codeunit "MOB WMS Reference Data"
Code Block |
---|
CreateConfig(XMLResponseData,'MyLookup'); CreateConfig(XMLResponseData,'MyItemReg'); |
Code Block |
---|
'MyLookup','MyItemReg': MyLookupAndMyItemReg(XMLCDataSection); |
Code Block |
---|
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 5: Handling the Request for Lookup
This is the code that will return the list of results and entries that you require.
We will have some dummy Line data.
This is defined in Codeunit "MOB WMS Lookup"
Code Block |
---|
LOCAL MyLookup(XMLRequestDoc : DotNet "System.Xml.XmlDocument") // Extract any parameters from the XML // The parameters are located in the <requestData> element // The "Lookup bin content" supplies two parameters: // Location and Bin // The names of the XML elements are determined by the LookupBinContentConfiguration supplied as reference data MobXMLMgt.GetDocRootNode(XMLRequestDoc, XMLRequestNode); MobXMLMgt.FindNode(XMLRequestNode, 'requestData', XMLRequestDataNode); // InitializeRead the responseheader xml MobBaseToolbox.InitializeResponseDocWithNS(XMLResultDoc, XMLResponseData, field value of field "ID" MobXMLMgt.FindNode(XMLRequestDataNode, 'ID', XMLParameterNode); // <---- Use the read values for your further logic... // Initialize the response XML MobBaseToolbox.InitializeResponseDocWithNS(XMLResultDoc, XMLResponseData, 'http://schemas.taskletfactory.com/MobileWMS/WarehouseInquiryDataModel'); // Create response values REPEAT // <----- Create logic to generate lookup result MobXMLMgt.AddElement(XMLResponseData, 'LookupResponse', '', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLLookupResponse); // Add the data elements to the <LookupResponse> element MobXMLMgt.AddElement(XMLLookupResponse, 'Location', 'Location xxx', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'ID', 'LinkLookupToReg', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'DisplayLine1', 'Line 1', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'DisplayLine2', 'Line 2', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'DisplayLine3', 'Line 3', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'DisplayLine4', 'Line 4', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'DisplayLine5', 'Line 5', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'ExtraInfo1', '', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'ExtraInfo2', '', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); MobXMLMgt.AddElement(XMLLookupResponse, 'ExtraInfo3', '', MobXMLMgt.GetNodeNSURI(XMLResponseData), XMLCreatedNode); Int += 1; UNTIL Int = 3; |
Step 6: 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."
Code Block |
---|
'MyItemReg': BEGIN MyItemReg(XMLRequestDoc); END; |
Code Block |
---|
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 location parameter // -- Now find the item parameter"ID"-attribute MobXMLMgt.FindNode(XMLRequestDataNode,'ID',XMLParameterNode); // -- Get the parameter // Validation // Now we have the parameters -> determine which registrations to collect // Initialize the response xml // It is important that the xmlns="" attribute is not added, because it will prevent the configuration from loading 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 DetermineUnpMoveItemTracking(ItemNo,RegisterSerialNumber,RegisterLotNumber,RegisterExpirationDate); // From Bin // Set the basic required values MobConfTools.RC_Std_Parms(1, 'SomeText', 'Collecting some text', '', 'Please enter some text'); // Create the step MobConfTools.RC_Text_XmlNode(XMLSteps, '', 20); |
This will produce one collector step.
Asking for a text value.
Step 7: 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."
Code Block |
---|
'MyItemReg': BEGIN Status := PostMyItemReg(XMLRequestDoc); MobBaseToolbox.CreateSimpleResponse(XMLResultDoc,Status); END; |
...And here you need to add your custom post function called "PostMyItemReg"Create function "PostMyItemReg" by copying an existing posting function.
- Modify the new function to read the "ID" and "SomeText" values.
The lookup
The Unplanned Item Registration