This discussion is archived
10 Replies Latest reply: Dec 10, 2013 7:34 AM by VSalas Branched to a new discussion. RSS

Formulation Inputs Costs

VSalas Newbie
Currently Being Moderated

Hi,


Which is the criteria the UI uses to decide which cost to display when there are more than one cost options for a formulation input and the combination of cross reference, cost type and cost set?


For instance, the following costs were saved throughout the SaveDWBSpecCost web service:


System NameEquivalentCost TypeCost Set (Plant)Cost
XX123456Type 1Plant 10.5612
XX789101Type 1Plant 10.4985
XX111213Type 1Plant 10.5226


Which cost will be displayed on the UI? Why? How can I control this programatically or from the database to display the specific cost that I want?


Thanks.


-Victoria Salas

  • 1. Re: Formulation Inputs Costs
    KellyMayfield Expert
    Currently Being Moderated

    You can select the specific cross reference you would like to use using the pack size drop down, the system will then pull the cost for that specific cross ref.   If no cross reference is selected I think out of the box we just grab the first equivalent in alphabetical/numeric order.   However, we fully intended for customers to extend this logic because we believe most customers will want to apply a unique strategy for their business or even per product category.  For example, for Fresh Fruit products pull the most expensive cost if restrictions are set to XYZ, pull the least expensive if restrictions are set to ABC.  You can see all of the available cost extension points in the extensibility pack > extensibility guide.

     

    We hope to offer a reference implementation in a future extensibility pack release so any information around how you would like the system to behave would be beneficial for that example.  

     

    Thanks

    Kelly

  • 2. Re: Formulation Inputs Costs
    VSalas Newbie
    Currently Being Moderated

    Hi Kelly,

     

    Do you recommend us to use this extension point? Or, should we wait to until a Reference Implementation is officially available?

     

    Also, I would like to reframe the question in case I was not very clear.

     

    Using the pack size drop down, if there are multiple costs stored for a particular material and those multiple costs correspond to the same cross reference, which cost will the P4P show? Is there a rule for picking one when there are several options?

     

    Thank you very much.

     

    -Victoria

  • 3. Re: Formulation Inputs Costs
    KellyMayfield Expert
    Currently Being Moderated

    You definitely should use the extension point now.  If you need help with your extension just post any questions here and I'm sure we can provide guidance.    

     

    The rule the system follows would be the same anytime the system finds more than one corresponding cost - whether a pack size is selected or not.   Right now it just picks the first it finds in alphabetical order.  

     

    Let us know what logic you would like the system to perform and we can provide guidance.

  • 4. Re: Formulation Inputs Costs
    VSalas Newbie
    Currently Being Moderated

    Hi Kelly,

     

    What I need to do is to always show the highest cost available per formulation input given a combination of Cost Reference/Cost Type/Cost Set.

     

    I would really appreciate if you can provide me guidance on:

     

    • How to install the extension point.
    • How to use the extension point.
    • Provide me some scenarios on how the extension point will work.

     

    Thanks a lot.

     

    -Victoria

  • 5. Re: Formulation Inputs Costs
    Ron M Pro
    Currently Being Moderated

    Hi Victoria,

    You will have to do this using the Costing extensions. This type of functionality is what the extension point is meant for, which updates the value in the UI directly.

    This particular extension is not well documented, so I’ll help you along. But I wanted to better understand your requirements.

     

    The cost extension is trying to pull in the highest cost. The Pack Size is defined on the material spec’s cross references grid and is directly associated to one cross reference (SystemID and Equivalent). If you choose a Pack Size in the formulation inputs grid, you are then choosing which cross reference (system ID & equivalent) should be used to pull the cost. This works today, but it doesn’t address the issue of clients having the multiple valid costs with the same systemID and equivalent. From the data you provided, I am assuming that this isn’t a use case you need to handle.

    Is that right?

     

    I believe the use case you need to handle is when the user does not select a pack size. Is this case, we are just pulling in the first equivalent we find in alphabetical order  for the material spec, regardless of the cost. So this is the problem that I assume you need to handle.

    Is that right?

     

    If so, then you will need to write a new FormatPlugin Extension point. These are documented in the Extensibility Pack's PluginExtensions documentation.

     

    Your Format Plugin is configured in the CustomPluginExtensions.xml file. There are three different extension points that could be implemented, so I’m not sure which one you need, but I think you’ll need the “FormulationInputCostBookPriceOverride” one.

    For this extension point, the FormatPlugin will get a FormulationCostContext<IFormulationInputDO> as the context.Context value, which is in the Xeno.Prodika.GSMLib.Formulation.Extension namespace. This class has an Object property, which in this case would be the formulationInput (type of IFormulationInputDO). You should be able to check if a Pack Size has been selected for this input using the formulationInputs’ PackSize property. The Context also has a CostPreferences property, which is a FormulationSpecCostPreferences, giving you the cost preferences of the current formulation spec, such as the Cost Type, Cost Set, Currency, etc.

     

    You should then be able to loop through the Material spec's legacy profiles collection (Material property of the formulationInput), finding the cross references with the matching systemID from the cost preferences. Using these equivalents, you can call the CostLibraryService (available from GeneralServices.dll) and get all the possible costs, returning the highest value.

     

               ...

                    var costLibraryService = CostLibraryService;

                    foreach (string equivalent in matchingEquivalents)

    {

    ICostItem costLibraryCostItem = costLibraryService.GetCostItem(legacyProfile.SystemCode, equivalent, costType, supplierNumber);

    }

    Your plugin should simply return the highest cost as a string (without the currency)

     

             protected static ICostLibraryService CostLibraryService

             {

                      get { return (ICostLibraryService)AppPlatformHelper.ServiceManager[ typeof( ICostLibraryService ).FullName ]; }

             }

     

    Note that this costLibraryService.GetCostItem method will not handle mutliple costs for the same equivalent. If you need to handle that, you can try using one of the GetCostItems methods instead, though this may take some more work.


    This should get your started. Let me know when you need more help.


    Regards,

    Ron

  • 6. Re: Formulation Inputs Costs
    VSalas Newbie
    Currently Being Moderated

    Hi Ron,

     

    After I get the highest cost, how can I make the system to show it after the user selects the Identity Preferences and Cost Book Preferences on the Settings Menu? http://oi41.tinypic.com/2hh3vqg.jpg

     

    What I need to do is to show the highest cost per formulation input after the user selects the preferences on the Settings Menu, assuming that there will be more than one cost options available. In this way, when the user hits save after selecting the cost preferences, the formulation input is being saved with the highest cost available.

     

    Thanks!

     

    -Victoria Salas

  • 7. Re: Formulation Inputs Costs
    Ron M Pro
    Currently Being Moderated

    Did you try implementing the plugin?

     

    If so, what happened?

     

    When you select the cost preferences, I believe that it should reload the costs, so your plugin will get called then.

  • 8. Re: Formulation Inputs Costs
    VSalas Newbie
    Currently Being Moderated

    Hi Ron,

     

    I installed the patch for the bug # 17511080 to solve the problem with unrelated equivalents - costs. I already did some testing and the patch didn't make any difference.

     

    Also, I opened the files v6.1.1.1.21.xml and v6.1.1.1.21-orcl.xml from the patch files and both have the comment /* EMPTY SCRIPTS */. Is this normal?

     

    I'd appreciate your help on this.

     

    Thanks.

     

    -Victoria

  • 9. Re: Formulation Inputs Costs
    Ron M Pro
    Currently Being Moderated

    If you are looking for a highest cost functionality, the patch will not provide that. It was addressing an issue where the user selected a pack size, and it didn't pull in the cost for that pack size's equivalent. To implement a highest cost retrieval, you will need to follow my steps above. Let me know if you have questions.

  • 10. Re: Formulation Inputs Costs
    VSalas Newbie
    Currently Being Moderated

    Hi Ron,

     

    When doing the following:

     

    public string GetText(IFormatPluginContext context)

    {

         FormulationCostContext<IFormulationInputDO> costContext = (FormulationCostContext<IFormulationInputDO>)context.Context;

    ....

     

    I only have access to one formulation input of the Formula (it is always the last input); is there a way that I can obtain a list of the formulation inputs and from there look for the costs options and return the highest cost per input?

     

    Also, since the GetText method returns a single string, how can I be able to assign the desired cost to each formulation input material?

     

    Thank you.

     

    -Victoria.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points