22 Aralık 2015 Salı

AX 2012 - Development with new WMS handheld terminal environment

Microsoft abandoned old WMS-II and put NEW WMS to AX 2012 which bought from another company. There is a web working handheld terminal solution too with this NEW WMS. This handheld solution while works competely at web also it runs AX environmet too for easy development and debug. We can run it with WHSWorkExecute menu item at AX. Microsoft published two guide for WMS and TM. Handheld user creating and customizing described at WMS guide. So I passed this issue and go in development.
There isn't anything about development at guide. I used a blog about handheld development. I learned some things I'm sure I couldn't find out if didn't read this blog. :)
I assume you know issues described at WMS guide.
WMS handheld developments all works with X++ classes. Every new menu item is a class. All menu item classes are begins with  WMSWorkExecuteDisplay name.
We assume develop our own menu item. If we don't develop our own menu item we can skip this step:

When you add your own work and/or indirect menu item you should add it to WHSWorkCreationProcess enum as an element. If your menu item is a work you have to also add it to WHSWorkExecuteMode enum too. According to blog which I mentioned before element name  and label added WHSWorkExecuteMode should be same as element added WHSWorkCreationProcess, I never tested it, just followed. Our element name is Test.
Our class WMSWorkExecuteDisplayTest . Class should be extended from WHSWorkExecuteDisplay.
We will see a new menu item at Mobile device menu items ->General->Work creation process. There's one step to tie our class to this menu item; Add this switch/case code part to WHSWorkExecuteDisplay classes construct method:

case WHSWorkExecuteMode::MyTest   : return WHSWorkExecuteDisplayTest::construct();

All menu items at handheld development work with their own displayForm method at their classes. I copied one of WMS classes and used my own work. displayForm method works as stages. It follows with a variable named step. First step is zero. The class I copied and used ends with stage 2 as save stage. You can follow stages as like as original classes with a switch/case block at displayForm.
We use buildControl for add a new control to our Web form:

ret += [this.buildControl(#RFText, #vendor, "@SYS14048", 1, pass.lookup(#vendor), extendedTypeNum(VendAccount), '', 0,false)];

If our macro #vendor doesn't exists at WHSRF macro library we should add it to WHRSF macro library. I just copy/paste method parameters from blog:

ame Data type Description
_controlType str This tells the framework what type of HTML control to build for the provided data. This must be one of the following macro definitions (defined in WHSRF):
#define.RFButton('button')
#define.RFLabel('label') 
#define.RFText('text') 
#define.RFPassword('password') 
#define.RFListbox('listbox') 
#define.RFCombobox('combobox') 
#define.RFError('error')

_name str Name used for the control in the rendered HTML. Also used as the key to store data persisted in the control within the WHSRFPassthrough Map object.
_label str Text to display to the user in the UI for this control.
_newLine int Field that specifies how this control should be rendered in the UI. If a 1 is passed it means this control should be situated on a new line in the HTML table. If a 0 is passed this control will remain on the same line as the previous control(s).
Note this only applied to the default display settings view page used to render the HTML pages. If you have customized the display settings view it is possible this no longer renders in the same way.
_data str Data to display within the control (for example the data to include in a textbox control). Does not apply to label or button controls.
_inputType ExtendedTypeId DataType of the field – important for data entry fields so the correct validation rules can be applied by the framework.
For controls that do not require validation the macro
#WHSRFUndefinedDataType can be used.
_error str Indicates if this control contains validation errors – used to help the user understand which controls contain validation or input errors information.
_defaultButton int Indicates the specified button should be executed as the default form submit – for example when the user presses the enter key in the UI. This is typically applied to the “OK” button in the forms.
_enabled boolean Indicates if the control should be editable in the UI or if it should be displayed in a read-only mode.
Optional – defaults to true.
_selected int If set to 1 this will be the currently active control when the user comes to this page.
Optional – defaults to empty string.
_color WHSRFColorText Color to set the control textual data.
Optional – defaults to WHSRFColorTest::Default.


To check if our data mapped or not which we used at control we use exists method, use lookup method to get value. Usage is like that usually:

if (pass.exists(#vendor) && pass.lookup(#vendor) != '")

To add/chanhe data value use insert method:

pass.insert(#vendor,purchTable.OrderAccount); 

By the way if you need extra parameters which are seem at system menu items but don't seem at user defined items  (look at red circles),

you have to do small update at WHSRFMenuItem forms togglefields method:

if (whsrfMenuItemTable.WorkCreationProcess == WHSWorkCreationProcess::PurchaseOrderItemReceiving             ||
        whsrfMenuItemTable.WorkCreationProcess == 

...
...
        //memre 22.12.2015
        whsrfMenuItemTable.WorkCreationProcess == WHSWorkCreationProcess::PurchaseOrderLineReceivingWithVendor)
        //memre

...
...

Meanwhile you might do a small update at WHSRFControlData classes processControl method. With a development at mine while original class can create LP (License Plate) number, mine couldn't. Reason was check at processControl look for enum values. This small update worked for me:

case #LicensePlateId:
...
...
 else if (mode != WHSWorkExecuteMode::AdjustmentIn                           &&
                     mode != WHSWorkExecuteMode::ReportAsFinished                       &&
...

...
...
                     //memre 22.12.2015
                     mode != WHSWorkExecuteMode::PurchaseOrderLineReceivingWithVendor   &&
                     //memre
                     mode != WHSWorkExecuteMode::PurchaseOrderItemReceivingAndLocate    &&

...
...
That's all I learned to main principles of handheld development of new WMS. For more information you can look for this blog which I used too and WMS documents.

Hiç yorum yok:

Yorum Gönder