最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

使用图形表示Dynamics AX中的仓库 / Graphical representation of warehouse usage in Dynamics AX

网络文摘 William 251浏览 0评论
A often recurring requirement is a graphical inventory overview showing the usage of locations. There are many ways how to implement such a solution. One simple way is to use data shapes in Visio and link them to Dynamics Ax data. graphical inventory usage

Visio

Since every warehouse is different, you have to create a separate Visio drawing for each one. Visio provides you with good standard shapes to draw a floor plan. In this example I am using a simple drawing of a warehouse with one door and 12 locations. In my example a square in Visio represents a WMSLocation in Dynamics AX. Create one Visio file per warehouse and save it on a file share. Warehouse floor plan

Data

Next create a view for each warehouse on the Dynamics AX database. Ask you DBA to secure access to the view for your users. Here is an example SQL code I am using to fetch data from Location 11 and 12 ( Contoso Demo Data)
SELECT w.INVENTLOCATIONID, w.WMSLOCATIONID, w.DATAAREAID, w.VOLUME, COALESCE (l.CURRENTVOLUMEADJUSTED, 0) AS CURRENTVOLUMEADJUSTED, w.VOLUME – COALESCE (l.CURRENTVOLUMEADJUSTED,0) AS FreeTotal, (w.VOLUME – COALESCE (l.CURRENTVOLUMEADJUSTED, 0)) * 100 / w.VOLUME AS FreePercent FROM dbo.WMSLOCATION AS w LEFT OUTER JOIN dbo.WMSLOCATIONLOAD AS l ON w.INVENTLOCATIONID = l.INVENTLOCATIONID AND w.WMSLOCATIONID = l.WMSLOCATIONID AND w.DATAAREAID = l.WMSLOCATIONDATAAREAID WHERE (w.VOLUME > 0) AND (w.DATAAREAID = ‚USMF‘) AND (w.INVENTLOCATIONID = ’11‘) OR (w.INVENTLOCATIONID = ’12‘)

Link SQL Data to Visio shapes

In the Visio main menu go to the Data tab and Link Data with Shapes. Go through the wizard and connect to your SQL Server and the view you have just created. This will open the External Data window showing the results from the SQL query. Load Dynamics AX data in Visio In the Visio drawing panel select the first square that represents a location. Right click on a record in the external data grid and select Link to selected shape. A chain symbol will appear next to the record, showing you that this record is new linked to a shape in your drawing. Right click on the shape that is now linked to a record in the external data. In the shapes context menu go to shape data and open edit data graphic. Here you can add and format the column values from the record to the shape. In my case I’ve formatted the InventLocationId as Header and the FreePercent as progress bar. image Once you have formatted one shape you can copy & paste it multiple times. You only need to selected the copy and then right click on the corresponding row in the external data and link to shape. This will update the shape data with the values from the new record.

View in Dynamics AX

Finally some work is needed in Dynamics AX to view the Visio drawing. At the InventLocation table add a new field using the FileName extended data type. Add the field in the InventLocation form, so you can provide a Visio file path for each InventLocation. Visio floor plan for invent location Create a new form and add an ActiveX control. Use the Microsoft Visio Document class. image Overwrite the init() method of the form to load the Visio document.
public void init() { InventLocation inventLocation; super();     if(element.args() && element.args().record() && element.args().record().TableId == tableNum(inventLocation)) { inventLocation = element.args().record(); if(inventLocation.ERPFilenameOpen != "") { Visio.Load(inventLocation.ERPFilenameOpen); } } }
Create a display menu item for the form and add it to the InventLocation form. Make sure to set the InventLocation as data source for the menu item. Now if you have created a Visio document and provided the file path in the InventLocation record, by clicking on the menu item you can see a graphical representation of your warehouse. Open Invent Location floor plan from Dynamics AX
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址