15.07.2009, 03:07 | #1 |
Участник
|
DynamicsAxSCM: Picking update via .Net Business Connector
Источник: http://blogs.msdn.com/dynamicsaxscm/...connector.aspx
============== We have received extensive feedback on previous blog postings about the outbound processes within Inventory management in Microsoft Dynamics AX. Many readers have requested information on how to interact with Microsoft Dynamics AX via .NET Business Connector to create picking operations. With this technical posting we will try to demonstrate how easy it is to code a terminal solution in C# .NET and call simple picking update methods in Microsoft Dynamics AX. The solution is coded by using Microsoft.Dynamics.BusinessConnectorNet; You will need a reference in the project to run the example code. HINT: Get more information about the .NET Business Connector at MSDN (Microsoft Dynamics AX Developer Center) http://msdn.microsoft.com/en-us/library/aa659581.aspx This small Microsoft Visual Studio project includes information about: How to log on to an AX installation // company name, language, object server, configuration // this uses Windows Authentication ax.Logon(CompanyId, null, null, null);.csharpcode { FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff}.csharpcode PRE { FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff}.csharpcode PRE { MARGIN: 0em}.csharpcode .rem { COLOR: #008000}.csharpcode .kwrd { COLOR: #0000ff}.csharpcode .str { COLOR: #006080}.csharpcode .op { COLOR: #0000c0}.csharpcode .preproc { COLOR: #cc6633}.csharpcode .asp { BACKGROUND-COLOR: #ffff00}.csharpcode .html { COLOR: #800000}.csharpcode .attr { COLOR: #ff0000}.csharpcode .alt { MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4}.csharpcode .lnum { COLOR: #606060}How to read data from AX and insert the data in a grid on a Windows form View picking routes in the upper pane and picking lines in the lower pane. How to prepare data and call picking update functions from the .NET C# code Picking in AX: In AX you can pick multiple lines by calling the WMSOrderTrans::finishPickingLinesMulti method. This method takes a packed AX Map where the key is the recId of the wmsOrdertrans to be picked and the value is an AX container with the OrderId and recVersion. The example shows how to prepare the map and call the method to do the pick. private AxaptaObject BuildAxaptaMapForWMSPickingLines(){//build a map of the following structure//key is WMSOrderTrans.recId and whose value //is [WMSOrderTrans.OrderId,WMSOrderTrans.recVersion].AxaptaObject axMap = ax.CreateAxaptaObject("Map", (int)Types.Int64,(int)Types.Container);foreach (DataGridViewRow dgvRow in wmsOrderTransGrid.SelectedRows){ AxaptaContainer axContainerWMSPair = ax.CreateAxaptaContainer(); DataRow row = null; DataRowView drv = (DataRowView)dgvRow.DataBoundItem; row = drv.Row; axContainerWMSPair.Add(row.Field<SPAN class=kwrdstring/SPAN>(1)); //orderid axContainerWMSPair.Add(row.Field(7)); //recversion //add to axapta map axMap.Call("Insert", row.Field(6), axContainerWMSPair);} return axMap;} private void PickSelectedLinesFromMap(AxaptaObject axaptaObjectMap){ // call below takes a packed map whose key is // WMSOrderTrans.recId and whose value is // WMSOrderTrans.OrderId,WMSOrderTrans.recVersion. ax.CallStaticClassMethod("WMSOrderTransType", "finishPickingLinesMulti", axaptaObjectMap.Call("pack"));} Apart from the method to multi-update picking lines the project also includes a method to pick-update multiple picking routes by calling WMSPickingRoute::finishMulti. private void PickSelectedRoutesFromList(AxaptaObject axList) { ax.CallStaticRecordMethod("WMSPickingRoute", "finishMulti", axList.Call("pack")); } Have fun trying this yourself! Bibi Christensen, Alexander Malafeev, Per Lykke Lynnerup & Lennart Conrad Источник: http://blogs.msdn.com/dynamicsaxscm/...connector.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|