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

As Xml Step nodes for custom GetRegistrationConfiguration RegistrationType.

Consider using the OnGetRegistrationConfiguration_OnAddSteps


Template:

[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfigurationOnCustomRegistrationType_OnAddStepsAsXml', '', true, true)]
local procedure OnGetRegistrationConfigurationOnCustomRegistrationType_OnAddStepsAsXml(var _XMLRequestDoc: XmlDocument; var _XMLSteps: XmlNode; _RegistrationType: Text; var _RegistrationTypeTracking: Text[200]; var _IsHandled: Boolean)
begin
     if _RegistrationType = 'MyCustomRegistrationType' then begin      // Replace constant 'MyCustomRegistrationType' with your own RegistrationType
          if _IsHandled then
               exit;

          // Add Steps elements as Xml here
          // ....

          _IsHandled := true;
     end;
end;

Example:

[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Adhoc Registr.", 'OnGetRegistrationConfigurationOnCustomRegistrationType_OnAddStepsAsXml', '', true, true)]
local procedure OnGetRegistrationConfigurationOnCustomRegistrationType_OnAddStepsAsXml(var _XMLRequestDoc: XmlDocument; var _XMLSteps: XmlNode; _RegistrationType: Text; var _RegistrationTypeTracking: Text[200]; var _IsHandled: Boolean)
begin
     if _RegistrationType = 'SetWhseClassCode' then begin
          if _IsHandled then
               exit;

          _RegistrationTypeTracking := CreateSetWhseClassCodeRegColConf(_XmlRequestDoc, _XMLSteps);

          _IsHandled := true;
     end;
end;

procedure CreateSetWhseClassCodeRegColConf(_XMLRequestDoc: XmlDocument; var _XMLSteps: XmlNode) ReturnRegistrationTypeTracking: Text[200];
var
     MobSetup: Record "MOB Setup";

     Item: Record Item;
     MobXMLMgt: Codeunit "MOB XML Management";
     MobWMSToolbox: Codeunit "MOB WMS Toolbox";
     MOBToolbox: Codeunit "MOB Toolbox";
     MobConfTools: Codeunit "MOB WMS Conf. Tools";
     XMLRequestNode: XmlNode;
     XMLRequestDataNode: XmlNode;
     XMLParameterNode: XmlNode;
     ItemNumber: Code[20];
begin
     // Extract any parameters from the XML
     // The parameters are located in the <requestData> element
     // The Set Warehouse Class Code feature expects 1 header value
     // Item
     MobXMLMgt.GetDocRootNode(_XMLRequestDoc, XMLRequestNode);
     MobXMLMgt.FindNode(XMLRequestNode, MobWMSToolbox."CONST::requestData"(), XMLRequestDataNode);

     // -- Now find the item parameter
     MobXMLMgt.FindNode(XMLRequestDataNode, 'ItemNumber', XMLParameterNode);
     
     // -- Get the parameter

     ItemNumber := MobWMSToolbox.GetItemNumber(MOBToolbox.ReadMisc(MobXmlMgt.GetNodeInnerText(XMLParameterNode)));
     item.Get(ItemNumber);

     // Set the tracking value displayed in the document queue
     ReturnRegistrationTypeTracking := StrSubstNo('SetWhseClassCode: %1', ItemNumber);

     MobSetup.GET();

     // Now we have the parameters -> determine which registrations to collect
     // Unit of Measure
     // Set the basic required values
     MobConfTools.RC_Std_Parms(1,
                                                       'WhseClassCode',
                                                       'Enter Warehouse Class Code',
                                                       Item.FieldCaption("Warehouse Class Code") + ':',
                                                       '');

     // Set extended values
     MobConfTools.RC_Ext_Parms('', false, true, true, 0);

     // Create the step
     MobConfTools.RC_List_ListData_XmlNode(_XMLSteps,
                                                                           GetWhseClassCode(Item),
                                                                           '');
end;

procedure GetWhseClassCode(_Item: Record Item) WhseClassList: Text[1024];
var
     WhseClass: Record "Warehouse Class";
begin
     if _Item."Warehouse Class Code" <> '' then begin
          WhseClassList := _Item."Warehouse Class Code";
          WhseClass.SetFilter(Code, '<>%1', _Item."Warehouse Class Code");
     end;

     if WhseClass.FINDFIRST() then
          repeat
               if WhseClassList = '' then
                    WhseClassList := WhseClass.Code
               else
                    WhseClassList += ';' + WhseClass.Code;
          until WhseClass.NEXT() = 0;

     if WhseClassList = '' then
          WhseClassList := ' '
     else
          if _Item."Warehouse Class Code" <> '' then
               WhseClassList += ';' + ' '
          else
               WhseClassList := ' ;' + WhseClassList;

     exit(WhseClassList);
end;


Version History:

VersionChanges
MOB5.00Introduced
  • No labels