psdi.app.mr

Class MRLine

  • All Implemented Interfaces:
    java.rmi.Remote, MRLineRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class MRLine
    extends Mbo
    implements MRLineRemote
    MBO object to represent an MRLine. Either Items, services or special order items that are to be requisitioned are entered here. Special Order items are requisitioned by just adding a description of the item on the MRLine. A new itemnumber for that description is created and is called a Special Order Item. Each line can be requisitioned to either a Vendor or a storeroom.   Each line can have a different vendor and this line on Approval gets into a separate Purchase Requisition, thanks to the Reorder process that automatically kicks in on MR Approval.
    The key attributes for this object are SiteID and MRLineID.

    See Purchase Requisition Package description.
    The attributes in this object are as follows:


    Attribute Name Description
    AgreementPONum Identifier of the Agreement Purchase Order pertaining to the MRLine. The item ordered on the MRLine was part of the agreement
    AvailDate The earliest available date for the item.
    CatalogCode Vendor's catalog or product list number. The default is taken from inventory.
    Category Indicates if the item on the line is either stocked , non-stocked or a special order part (STK, NS, SP)
    ChargeStore Indicates whether the cost of the line should be added to the asset Assetnum
    ClassificationID Asset classification Identifier.
    Complete Flag to indicate if all items or services on the line have been received.
    CurrencyCode Currency Code that represents the vendor currency.
    Description The description of the item on the line.
    DirectReq Flag to specify if the line is ordering items from a vendor or from a storeroom. The line would be a direct request if items were ordered from a vendor.
    DropPoint The point where the item should be delivered.
    AssetNum Asset to charge the cost of the line item.
    ExchangeRate Exchange rate at the time of approval.
    ExchangeRate2 Exchangerate in basecurrency2.
    FinCtrlID Financial Control Identifier for the MRLine.
    GLDebitAcct Code for the GL Acoount to be debited for the line item's cost.
    InspectionRequired Indicates wheteher the item requires inspection upon receipt.
    ItemNum Identifier for the item number on the PRLine. A foreign key to inventory control.
    LDKey Long description key associated with the LONGDESCRIPTION table.
    LineCost Cost of the line item calculated as qty * unitcost. For service lines, the field is directly entered by the user.
    LineCost1 Linecost in BaseCurrency1
    LineCost2 Linecost in BaseCurrency2
    LineType Indicates the type of commodity being ordered on this line. Can be a SERVICE, MATERIAL, ITEM or SPORDER. Items purchased from external catalogs have their linetype set to EXTERNAL.
    Location Location where the item or service will be used. If a Work Order is entered, the location is taken from the corresponding Work Order Record.
    Manufacturer Code for the manufacturer who manufactures the item and from whom the item is required.
    ModelNum Manufacturer's model number for the item.
    MRLineID Material Request line ID. The ID is unique for each MRLine in the database.
    MRLineNum Material Request line number. The line number is unique for each MRLine inside an MR.
    MRNum Material Request num. Part of the Primary key. Indicates the MRNUM to which the MRLine is associated.
    OrderUnit Standard unit by which the item is ordered. If you are requisitioning an item that has an orderunit, that unit (such as dozen or box)
    OrgID Identifier of the organization for this Material Requisition line.
    PartialIssue Is Partial issue of the item on the line allowed?
    PCardExpDate The date on which the Procurement card is going to expire. Synonymous with the credit card expiration date. Crosses over from MRLine.PCardExpDate.
    PCardType Type of Procurement card. Example VISA, MASTERCARD etc.Crosses over to PRLine.PCardType.
    PCardNum The number on the Procurement card. Crosses over to PRLine.PCardNum.
    PCardVerification Procurement card verification value. Similar to the credit card number.
    PRNum Identifier of the Purchase Requisition that was created on the approval of the MR.
    Qty Required qty
    RefWOThe referenced work order number.
    Remarks General remarks about the line.
    RequiredDate The earliest date by which the items on the material req must be delivered.
    SiteIDIdentifier of the site for this Material Requisition line.
    Storeloc The storeroom location that currently stocks the item.
    TaskIDThe task id in the work order that requires the item.
    UnitCost Cost of each unit on the MRLine.
    Vendor Identifier of the Vendor to whom the MR would be sent to.Also see Vendor.
    VendorPackCode The pack code of the product. It is the code of how the items will be packed. For example, BOX (12 to a box) or PALLET (30 to a pallet).
    VendorPackQuantity The quantity of the pack code. For example, pack code is "DOZEN", pack quantity is 12.
    VendorWareHouse Vendor warehouse that the product will come from.
    WONum Work Order number for the line item. If you specify a wonum, MAXIMO takes information from the WorkOrder to fill in Location, Asset, GLDebitAcct fields since the PRLine is linked to the WorkOrder.
    MRLALN1 thru MRLALN5 Extra crossover fields. Crosses over to PRLine.PRLALN1 thru PRLine.PRLALN5.


    Last Update: March 22, 2002 - Ganesh - javadocs
    • Field Detail

      • invReserveRef

        public MboRemote invReserveRef
        Variable to hold the invReserve reference.
    • Constructor Detail

      • MRLine

        public MRLine(MboSet ms)
               throws MXException,
                      java.rmi.RemoteException
        Construct the MRLine. Just call the super constructor.
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Init method called by Architecture inititialize fields to readonly based on mr.status
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a new Line item for an MR The following fields are required fields
          chargestore complete currencycode directreq linecost linetype mrlineid mrlinenum mrnum partialissue
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • isNullQty

        public void isNullQty()
                       throws MXException,
                              java.rmi.RemoteException
        This method is used to check if the qty field on the MRLine is null Check to see if this MRLine is a material line.If so,check to see if the qty is null.If the qty is null throw an error message because only service lines can only have null quantities.
        Specified by:
        isNullQty in interface MRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.isNullQty()
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        This saves the MRLine and all related Mbos
        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Application validation routine Makes sure that either Item or Description is entered Makes sure that either Item or Storeloc is entered Makes sure that either vendor or storeloc is entered if category is non-stocked or special-order and specidied item does not exist, adds it to the item table
        Specified by:
        appValidate in interface MRLineRemote
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.appValidate()
      • checkMRCostValidity

        public void checkMRCostValidity()
                                 throws MXException,
                                        java.rmi.RemoteException
        Checks if the MRCost lines associated with this MRLine have correct values for percentage and linecost. If the percentage is not equal to hundred but the sum of the linecosts are equal to that of the parent mrline, the percentage on the last distribution line is increased so that the sum of the percentages on the distribution is 100. The line cost on the last line is adjusted so that the sum of the linecosts on the distribution matches the linecost on the MRLine if the percentages total to 100.
        Specified by:
        checkMRCostValidity in interface MRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.checkMRCostValidity()
      • validateCombination

        public void validateCombination()
                                 throws MXException,
                                        java.rmi.RemoteException
        ensure that one of the following has been specified assetnum, wonum, location, gldebitacct should be taken care of required field setting
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        Can the MRLine be deleted ? MRLines can only be deleted if the status of the owner MR is WAPPR.The Line cannot be deleted if the MR has any other status.
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException - thrown when the record cannot be deleted
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Delete this record. This will update the totalcost of the owner mr.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier - The bitwise flag specified to determine if certain normal security checks are to be bypassed for this delete request. For example: if the accessModifer is NOACCESSCHECK, then the check for the object's NODELETE flag and the call to the object's canDelete() method will not be performed. If the accessModifer is NONE, then all the access checks are performed before this object is marked delete.
        Throws:
        MXException - thrown when the record cannot be deleted
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        Un-delete this record. This will update the totalcost of the owner mr.
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • setPriceDetails

        public void setPriceDetails()
                             throws MXException,
                                    java.rmi.RemoteException
        This is an important method that decides the best price that can be used for an item. USE: This method calls the DefaultOrderPrice.getDefaultOrderPrice() which allows programmers to determine a default order price. Price is calculated using the following logic: - Consider Blanket PO Agreements ! search for a blanket po with this item and vendor ! if found, determine whether the cost available on this po is sufficient to meet caller's needs - this may include considering those funds withdrawn from the PO during this process. - Consider Price Agreement PO's ! search for a price agreement po 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
        Throws:
        MXException
        java.rmi.RemoteException
      • isStocked

        public boolean isStocked()
                          throws MXException,
                                 java.rmi.RemoteException
        returns true if the MAXVALUE of valuelist "CATEGORY" is "STK" else returns false
        Specified by:
        isStocked in interface MRLineRemote
        Returns:
        returns true if the maxvalue of "inventory.category" is "STK"
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.isStocked()
      • isNonStocked

        public boolean isNonStocked()
                             throws MXException,
                                    java.rmi.RemoteException
        returns true if the MAXVALUE of valuelist "CATEGORY" is "NS" else returns false
        Specified by:
        isNonStocked in interface MRLineRemote
        Returns:
        returns true if the maxvalue of "inventory.category" is "NS"
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.isNonStocked()
      • isSpecialOrder

        public boolean isSpecialOrder()
                               throws MXException,
                                      java.rmi.RemoteException
        returns true if the MAXVALUE of valuelist "CATEGORY" is "NS" else returns false
        Specified by:
        isSpecialOrder in interface MRLineRemote
        Returns:
        returns true if the maxvalue of "inventory.category" is "SP"
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.isSpecialOrder()
      • setLineCosts

        public void setLineCosts(double lineCost)
                          throws MXException,
                                 java.rmi.RemoteException
        This method calculates and sets the linecost1 and linecost2 based on the exchangerate1 and exchangerate2.
        Throws:
        MXException
        java.rmi.RemoteException
      • reCalculateTotalCost

        public double reCalculateTotalCost()
                                    throws MXException,
                                           java.rmi.RemoteException
        This method recalculates the total cost and sets it on the MR header. Primarily called by the field validation classes when there is change in the line cost. If all the mrlines are in the same vendor currency, the total cost has to be in the same currency. If the mrlines are in different vendor currencies, the total cost has to be in the base currency.
        Specified by:
        reCalculateTotalCost in interface MRLineRemote
        Returns:
        The recalculated total cost.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.reCalculateTotalCost()
      • isTotalCostInBaseCurrency

        public boolean isTotalCostInBaseCurrency(MboSetRemote mrLineSet)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Check if the total cost has to be calculated in the base currency or the vendor currency. We loop through all the mrlines to check if all of them are in the same currency or not. If yes we return false. This method will basically be used when we are recalculating the total cost. If the currency is not same for all the lines we have to calulate the total cost in the base currency.
        Returns:
        A booelan indicating if the total cost is in base currency or not.
        Throws:
        MXException
        java.rmi.RemoteException
      • calBaseTotalCost

        public double calBaseTotalCost(MboSetRemote mrLineSet,
                                       double totalCost)
                                throws MXException,
                                       java.rmi.RemoteException
        This method is primarily used by the MR.totalcost field validation class to calculate the base total cost which is the total cost in base currency1. If the total cost is already in the base currency then the base total cost is the same as the total cost.
        Parameters:
        mrLineSet - The source MRLineSet.
        totalCost - The MR header total cost.
        Returns:
        The calculated base total cost.
        Throws:
        MXException
        java.rmi.RemoteException
      • afterAdd

        public void afterAdd()
                      throws MXException,
                             java.rmi.RemoteException
        Called right after the new MRLine mbo is added to the MRLineSet. It creates a new MRCost Mbo using a relationship. The MRCost Mbo has a percentage value set to 100. Since the linecost and the linecost dont have values yet, they are not copied over from the MRLine.
        Throws:
        MXException
        java.rmi.RemoteException
      • calBaseTotalCost2

        public double calBaseTotalCost2(MboSetRemote mrLineSet,
                                        double totalCost)
                                 throws MXException,
                                        java.rmi.RemoteException
        This method is primarily used by the MR.totalcost field validation class to calculate the base total cost2 which is the total cost in base currency2. If the mrlines are in different vendor currencies we have to calculate the linecost in base curency2 and then add them up to make the base total cost2. If the mrlines are in the same vendor currency calculate the base total cost2 by multiplying total cost by exchange rate based on the base currency2.
        Parameters:
        mrLineSet - The source MRLineSet.
        totalCost - The MR header total cost.
        Returns:
        The calculated base total cost2.
        Throws:
        MXException
        java.rmi.RemoteException
      • getTotalCostCurrencyCode

        public java.lang.String getTotalCostCurrencyCode(MboSetRemote mrLineSet)
                                                  throws MXException,
                                                         java.rmi.RemoteException
        This method returns the currencycode based on the following conditions:
        1. Returns the basecurrency1 if the mrlines are in different vendor currencies.
        2. Returns the mrline currencycode if all the lines are in the same currency.
        Parameters:
        mrLineSet - The source MRLineSet.
        Returns:
        The currencycode.
        Throws:
        MXException
        java.rmi.RemoteException
      • setNullValuesToSomeMRLineAttributes

        public void setNullValuesToSomeMRLineAttributes()
                                                 throws MXException,
                                                        java.rmi.RemoteException
        This method is used to set the values of the following fields to null.
        1. contractrefnum
        2. vendor
        3. manufacturer
        4. catalogcode
        5. modelnum
        6. orderunit
        7. classificationid
        8. category
        9. description
        10. long description

        The other fields that are being set are
        1. storeloc = storeloc from the user's profile
        2. glaccount = call glmerger
        3. unitcost = 0.0
        4. quantity = 1.o
        5. linecost = 0.0
        Called from the ITEM field validation.The intention of this method is to return the Mbo to the original state it was just after the add was done. So if any field validation changes any of the above field values this method would reset them in order avoid confusion about which field validation set which field and so on.This uniforn clearing pattern of the fields ensures that the values in the Mbo are the correct values.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.mr.FldmRLineItemnum
      • isNullItemOrDescription

        public void isNullItemOrDescription()
                                     throws MXException,
                                            java.rmi.RemoteException
        An MRLine must have either an itemnum or description regardless of whether this is a service line or a material line. If there is neither an itemnum or description on this line an exception is thrown.
        Specified by:
        isNullItemOrDescription in interface MRLineRemote
        Throws:
        MXException.
        RemoteException.
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.isNullItemOrDescription()
      • canDistribute

        public void canDistribute()
                           throws MXException,
                                  java.rmi.RemoteException
        Checks if distribution can be allowed on a MRLine Distribution cannot be allowed if
        • the status of the MR is not waiting for approval.
        • this line is not a direct issue line.
        • the item on this line is a rotating item.
        Specified by:
        canDistribute in interface MRLineRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MRLine.canDistribute()
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        This method overrides the skipCopyField() in the Mbo.Since this method takes the MboValueInfo as its parameter just check to see if this field needs to be copied or skipped.If this field does not need to be copied return true. The following is a list of fields that are not copied from the source MRLine to the target MRLine.
        1. AVAILDATE
        2. COMPLETE
        3. MRLINEID
        4. MRLINENUM
        5. MRNUM
        6. ORGID
        7. PRNUM
        8. REQUIREDDATE
        9. SITEID
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        - - The MboValueInfo object of the MboValue that needs to be copied.
        Returns:
        - True,if the field does not need to be copied.In all other cases return false.
        Throws:
        java.rmi.RemoteException
        MXException
      • validateQty

        public void validateQty()
                         throws MXException,
                                java.rmi.RemoteException
        Checks to see if the quantity on the MRLine is less than the sum of quantities on the MATUSETRANS records. Throws an exception if the above is true.
        Throws:
        MXException
        java.rmi.RemoteException
      • getValidateOrder

        public java.lang.String[] getValidateOrder()
        Validation Order for MRLine attributes.
        Overrides:
        getValidateOrder in class Mbo