psdi.app.common

Class DefaultOrderPrice

  • java.lang.Object
    • psdi.app.common.DefaultOrderPrice


  • public class DefaultOrderPrice
    extends java.lang.Object
    Class: DefaultOrderPrice PURPOSE: This class determines the default price which should be assigned to an item being ordered. AUDIENCE: As of the writing of this class, its primary users were MR, PR, PO, REORDER, and WPMTL HOW TO USE: This class can be instantiated once and then reused. Users of this class should be interested in one thing alone - getting the best price to default for a particular item, vendor combination. PO, PR, and MR users should be using the constructor which creates a FundTracker instance. (DefaultOrderPrice(FULLFUNDTRACKING) The constructor with no parameters required will default to FULLFUNDTRACKING. FundTracker will prove particularly useful in matters of determining whether blanket Contracts meet cost tolerances. If the price contracts on such Contracts are not met, the price which will be returned from this class will not be the most accurate available. The only way to keep track of funds on a contract which the caller may have already spent during their current process is to utilize FundTracker. Reorder is the chief user here, but all callers will game some benefit with little expense. Other OPTIONS are available when retrieving a price!.... - Firstly, the caller can receive the price which they've requested in any ` currency which they request. - Secondly, the caller can decide to bypass logic for considering Blanket Contracts - Thirdly, the caller can decide to bypass logic for considering Non-Blanket (include Price) Contracts Accessor methods include the following: - Price ! getDefaultOrderPrice() - PriceType (how the price was arrived at) ! isBlanket() ! isContractPrice() ! isVendor() ! isInventory() ! isNoPriceFound() - Utility to set auxiliary values ! setPriceAttribute() SEE the javadocs for getDefaultOrderPrice and associated utility methods for further information on their use, parameters and capability
    • Constructor Summary

      Constructors 
      Constructor and Description
      DefaultOrderPrice()
      DefaultOrderPrice() - default Constructor Using this constructor will instantiate a DefaultOrderPrice object using the NOFUNDTRACKING option.
      DefaultOrderPrice(int options)
      DefaultOrderPrice(int) - optional Constructor Use this constructor to determine whether and how the affiliated FundTracker class will be used by DefaultOrderPrice.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double getDefaultOrderPrice(java.lang.String currencyCode, double quantity, boolean considerBlanket, boolean considerPrice, Mbo mbo)
      getDefaultOrderPrice - (a remote public method) -WHAT: The primary method of the DefaultOrderPrice class.
      int getItemNumFlag()
      Return the itemNumFlag
      boolean isBlanketPrice()
      isBlanketPrice() WHAT: provides user boolean return of true if this price was calculated using the Blanket methodology (ie: get the contractline.unitcost for the first blanket contract line found with this item/vendor combo which has costs still available to be used - Tracker handles this as best as can be done for now) RETURN: boolean- true if it is a "Blanket Price"
      boolean isContractPrice()
      isContractPrice() WHAT: provides user boolean return of true if this price was calculated using a Contract methodology (ie: get the contractline.unitcost for the first contract line found with this item/vendor combo) RETURN: boolean- true if it is a "Price (non-Blanket) Contract"
      boolean isInventoryPrice()
      isInventoryPrice() WHAT: provides user boolean return of true if this price was calculated using an Inventory methodology (ie: get the inventory.lastcost for the first inventory record found with this item/vendor or this item in general, if no item/vendor combo is found in inventory) RETURN: boolean- true if it is an "Inventory Price"
      boolean isNoPriceFound()
      isNoPriceFound() WHAT: provides user boolean return of true if this price was not able to be calculated using Blanket, Contract, Vendor, or Inventory methods.
      boolean isVendorPrice()
      isVendorPrice() WHAT: provides user boolean return of true if this price was calculated using the Vendor methodology (ie: get the invvendor.lastcost for the first inventory record found with this item/vendor) RETURN: boolean- true if it is and "Vendor Price"
      void setPriceAttribute(Mbo mbo, java.lang.String attribute, int identifier)
      setPriceAttribute(1,2,3) Overload of setPriceAttribute(1,2,3,4) - allowing user to call setValue without access modifiers.
      void setPriceAttribute(Mbo mbo, java.lang.String attribute, int identifier, long flags)
      setPriceAttribute(1,2,3,4) - USE This method should be used as an aid to setting associated/auxillary DefaultOrderPrice values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • itemNumFlag

        public int itemNumFlag
        The itemnum flag is used to let other objects know about how the price of a commodity was obtained.Three static variables ITEMVENDORCATALOGCODE,ITEMVENDOR,ITEM are used to indicate if the price was obtained using either the item,vendor,catalogcode combination or the item,vendor combination or using only the item(FROM THE INVVENDOR table)
      • ITEMVENDORCATALOGCODE

        public static int ITEMVENDORCATALOGCODE
      • ITEMVENDOR

        public static int ITEMVENDOR
      • ITEM

        public static int ITEM
    • Constructor Detail

      • DefaultOrderPrice

        public DefaultOrderPrice()
        DefaultOrderPrice() - default Constructor Using this constructor will instantiate a DefaultOrderPrice object using the NOFUNDTRACKING option. See the FundTracker class javadocs for more information on FundTracker itself. See the parametric DefaultOrderPrice constructor javadocs for more information on the constructor options.
      • DefaultOrderPrice

        public DefaultOrderPrice(int options)
        DefaultOrderPrice(int) - optional Constructor Use this constructor to determine whether and how the affiliated FundTracker class will be used by DefaultOrderPrice. Refer to the Javadocs for the FundTracker class for more detailed information on the operation and purpose of the FundTracker itself. The options with which DefaultOrderPrice can be instantiated are as follows: - FULLFUNDTRACKING = Uses FundTracker with the history flag - LIMITEDFUNDTRACKING = Uses FundTracker with no history flag - NOFUNDTRACKING = Does NOT use FundTracker - NOFUNDCHECKING = Does NOT check fund availability at all. The constants listed above are defined here in DefaultOrderPrice publicly.
    • Method Detail

      • getItemNumFlag

        public int getItemNumFlag()
                           throws MXException,
                                  java.rmi.RemoteException
        Return the itemNumFlag
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        getVendorSet()
      • getDefaultOrderPrice

        public double getDefaultOrderPrice(java.lang.String currencyCode,
                                           double quantity,
                                           boolean considerBlanket,
                                           boolean considerPrice,
                                           Mbo mbo)
                                    throws MXException,
                                           java.rmi.RemoteException
        getDefaultOrderPrice - (a remote public method) -WHAT: The primary method of the DefaultOrderPrice class. The class was built for the specific purpose of providing users with ability to call this method and have it determine the valid default order price. -USE: This method allows programmers to determine a default order price. Price is calculated using the following logic: - Consider Blanket Contracts ! search for a blanket contract with this item and vendor ! if found, determine whether the cost available on this contract is sufficient to meet caller's needs - this may include considering those funds withdrawn from the Contract during this process. - Consider non-Blanket Contracts (include Price Contracts) ! search for a non-blanket contract with this item and vendor - Consider InvVendor lastcost ! If a vendor has been provided, search the InvVendor table for the most recent lastcost entry - If all else fails, set the price = inventory.lastcost for the first inventory record found for this item or to 0.0 -VALUES: This method seeks to set the following private members, which have accessor methods: - price (ALWAYS SET IN THE CURRENCY REQUESTED, OR BASECURRENCY1 IF NO CURRENCY AVAILABLE) - priceType Additionally, several other private members are set in the interest of providing additional information upon request. -PARAMETERS - @String - currency = the currencycode which you would like the price to be set in - OPTIONAL = pass in null or "" Example: You are writing an MR line on which you want to see the currency in YEN, set currency = YEN - @double - quantity = the quantity being ordered. Useful info for determining an accurate assement of Contract funds needed - OPTIONAL - pass in 0.0 if unknown - @boolean - considerBlanket = determines whether or not blanket Contracts are considered when seeking a price REQUIRED - Recommended default = true - @boolean - considerPrice = determines whether or not price Contracts are considered when seeking a price REQUIRED - Recommended default = true - @Mbo - mbo = the mbo of the current caller (this) - used to determine an editKey for FundTracker REQUIRED - pass in a valid mbo value of the calling line (po, pr, mr, etc) - it will be used by FundTracker history parameter may also prove useful later on for sqlformating etc.
        Throws:
        MXException
        java.rmi.RemoteException
      • setPriceAttribute

        public void setPriceAttribute(Mbo mbo,
                                      java.lang.String attribute,
                                      int identifier,
                                      long flags)
                               throws MXException,
                                      java.rmi.RemoteException
        setPriceAttribute(1,2,3,4) - USE This method should be used as an aid to setting associated/auxillary DefaultOrderPrice values. Examples of such values could (and often do) include the "manufacturer", "catalogcode", "orderunit" etc. There are a number of values, all having an identifier listed as a public constant using the notation priceNAME (eg. priceMANUFACTURER)which this method could be used to set. The complete list follows: priceMANUFACTURER priceMODELNUM priceCATALOGCODE priceORDERUNIT priceCONTRACTNUM priceREVISIONNUM priceCONTRACTID priceORDERQTY If interest exists in setting any of these values, the caller is likely to want to set them using the appropriate value. The appropriate value will depend upon the pricing strategy used to gather the DefaultOrderPrice. For example, if a blanketPO was used to get the DefaultOrderPrice, manufacturer should come from the ContractLine - not the InvVendor table. If the DefaultOrderPrice was gathered using the VendorPrice strategy, the InvVendor table would contain the correct Manufacturer - not the ContractLine. setPriceAttribute makes invisible all of the rustling to determine from which attribute to retrieve the value. -PARAMETERS - @Mbo - mbo = the mbo which the price attribute will be set against (most likely the calling Mbo) REQUIRED = self-explanatory: a value is to be set...but where? answer: mbo - @String - attribute = the string attribute name on the mbo described above. REQUIRED = if no value, no set. a value is to be set....but what value? answer: attribute - @int - identifier = the DefaultOrderPrice Constants desribed above....eg. priceMODELNUM etc. OPTIONAL = required - setPriceAttribute can only be used to set known attribute types - identifiers are the only known types - @long - flags = the bitwise sum of all flags to be associated with the call to mbo.setValue OPTIONAL = if you don't want to pass flags, call overload - which defaults to setValue defaults.
        Throws:
        MXException
        java.rmi.RemoteException
      • setPriceAttribute

        public void setPriceAttribute(Mbo mbo,
                                      java.lang.String attribute,
                                      int identifier)
                               throws MXException,
                                      java.rmi.RemoteException
        setPriceAttribute(1,2,3) Overload of setPriceAttribute(1,2,3,4) - allowing user to call setValue without access modifiers. If caller doesn't want to worry about setting flags, a value of NONE (0) will be passed as an access modifier. See setPriceAttribute(1,2,3,4) javadocs for more info on use of method.
        Throws:
        MXException
        java.rmi.RemoteException
      • isBlanketPrice

        public boolean isBlanketPrice()
        isBlanketPrice() WHAT: provides user boolean return of true if this price was calculated using the Blanket methodology (ie: get the contractline.unitcost for the first blanket contract line found with this item/vendor combo which has costs still available to be used - Tracker handles this as best as can be done for now) RETURN: boolean- true if it is a "Blanket Price"
      • isContractPrice

        public boolean isContractPrice()
        isContractPrice() WHAT: provides user boolean return of true if this price was calculated using a Contract methodology (ie: get the contractline.unitcost for the first contract line found with this item/vendor combo) RETURN: boolean- true if it is a "Price (non-Blanket) Contract"
      • isVendorPrice

        public boolean isVendorPrice()
        isVendorPrice() WHAT: provides user boolean return of true if this price was calculated using the Vendor methodology (ie: get the invvendor.lastcost for the first inventory record found with this item/vendor) RETURN: boolean- true if it is and "Vendor Price"
      • isInventoryPrice

        public boolean isInventoryPrice()
        isInventoryPrice() WHAT: provides user boolean return of true if this price was calculated using an Inventory methodology (ie: get the inventory.lastcost for the first inventory record found with this item/vendor or this item in general, if no item/vendor combo is found in inventory) RETURN: boolean- true if it is an "Inventory Price"
      • isNoPriceFound

        public boolean isNoPriceFound()
        isNoPriceFound() WHAT: provides user boolean return of true if this price was not able to be calculated using Blanket, Contract, Vendor, or Inventory methods. RETURN: boolean- true if no price was able to be determined