![]() |
#1 |
Участник
|
axmfg: Product Configuration Synchronous Execution
Источник: http://blogs.msdn.com/b/axmfg/archiv...execution.aspx
============== This blog post describes an new way of interacting synchronously from code with the Constraint-Based Product Configurator which has been introduced in Microsoft Dynamics AX 2012 R3 CU8. Scenario The scenario that drove the introduction of this feature can be described as follows: An external 3rd party sales configurator outside of Microsoft Dynamics AX 2012 is used to assign values to a subset of attributes(a partially configured order), from which the remaining mandatory attributes can have their values deduced using the Microsoft Dynamics AX 2012 Configurator, thereby completing the order. ![]() Once the all the values have been deduced, assuming all values are valid, they can be passed on to the back end configuration module, which will create the BOM and potentially the Route (if the model has a Route). Implementation Included in Microsoft Dynamics AX 2012 R3 CU 8 is a new derived version of the PCRuntimeConfigurator class, named PCRuntimeSynchronousConfigurator. This class is designed, as the name indicates, for synchronous interaction with the .NET Configurator component. The configure method on the class is the method which exposes the new functionality added to the .NET Configurator to Xpp. The method takes three arguments; the model as xml, the attribute assignments as xml and a the number of milliseconds which can be used before a timeout occur. The return of the method is a IsConfigurationComplete enum value, from which result of the configuration can be determined;
Note: The PCRuntimeSynchronuosConfigurator class exposes the functionality required by the .NET configurator component to support the above scenario but it is not yet integrated with any order (sales, production etc) or product variant creation nor is it integrated with the BOM and Route generation. KB Article with number 3028719 should be Applied on top of R3 CU 8 as it addresses a stability issue in the solution. Example In this example values are passed from the simulated 3rd party configurator into Dynamics AX 2012 through a web service, as illustrated below: ![]() To expose the PCRuntimeSynchronousConfigurator class through a web service, we start by introducing a new class PCTechDemoService which implements a method with the SysEntryPointAttribute code attribute, which is needed for a method to be exposed as a web service. In this simple implementation the example method looks like this: [SysEntryPointAttribute(true)] public boolean configure(PCName _modelName, str _xmlValues) { boolean ret; str values; PCRuntimeSynchronousConfigurator configurator = PCRuntimeSynchronousConfigurator::construct(); PCProductConfigurationModel productConfigurationModel = PCProductConfigurationModel::findByName(_modelName); values = '' + _xmlValues + ''; if(configurator.configure(productConfigurationModel.getXML(), values,120000) == Microsoft.Dynamics.Ax.Frameworks.Controls.ProductConfiguration.IsConfigurationComplete::Complete) { ret = true; } return ret; } Now we can create a Service in the AOT which uses the PCTechDemoService class and its configure method as an operation. To use this service, it needs to be put in a service group, which can then be deployed. ![]() To test the service, navigate to System administration > Services and Application Integration Framework > Inbound ports. Here we find our new PCTechDemoServiceGroup, copy the WSDL URI value. ![]() Open Visual Studio Command prompt and type: Wcftestclient This will open the WCF test client where we can now see our web service. ![]() For the demo data set I have used, I will use the following argument values _modelName : 20001 _xmlValues : Note: the xPath mechanism used to identify the attributes in model. ![]() If you are familiar with the 20001(Home theater system) model, you will know that it has just two mandatory attributes which are not assigned by defaults; the powerCableLength on the root component and the size on the television component. Attached you will find an Xpp project with code used for the example. Enjoy Источник: http://blogs.msdn.com/b/axmfg/archiv...execution.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|