psdi.app.pr

Class PR

  • All Implemented Interfaces:
    java.rmi.Remote, PurchasingMboRemote, PRRemote, MboConstants, MboRemote, StatefulMboRemote, MaxRemoteProxy


    public class PR
    extends PurchasingMbo
    implements PRRemote
    MBO object to represent a Purchase Requisition. A Purchase Requisition (PR) is a written request issued internally to a purchasing department to order items or services. There are two parts to a PR, a header and lines. The header contains vendor, shipto, and billto information. Each line item or service has information such as item number or service, quantity, unit cost, required date, and category for the item. A PR is closed when all its line items are assigned to a Purchase Order (PO). If any of the lines on the PO are deleted or cancelled, this PR's status will be changed to "Waiting for Approval". A single PR can list items or services for several vendors.

    See Purchase Requisition Package description.

    This is a site level object.

    The key attributes for this object are SiteID and PRNum.

    The attributes in this object are as follows:

    Attribute Name Description
    BillTo Identifier of the company that will receive the bill.
    BillToAttn Person to whom the bill should be sent.
    BuyAhead Is this a buy ahead rate, ie entered directly by the user and not calculated from the list of active exchange rate.
    ChangeBy, ChangeDate The name of the person who last modified the PR; the date on which this PR was last modified.
    Contact Name of the primary person to contact at the vendor.
    CurrencyCode Currency of the PR.
    CustomerNum Number used by an outside company to identify your company.
    Description Short description of the Purchase Requisition. Also accommodates a long description.
    ExchangeDate, ExchangeRate Date of the exchange rate; exchange rate at the time of PR approval.
    ExchangeRate2 Base exchange rate 2.
    ExternalRefID External reference ID.
    FOB Freight on board point. The point where responsibility and liability are transferred.
    FreightTermsThe terms under which the shipment is made.
    HistoryFlag Flag indicating the history Purchase Requisition (closed or cancelled).
    Inclusive1 thru Inclusive5 Flag indicating if the PR total is inclusive of Tax1 thru Tax5.
    Internal Indicates it's an internal PR or not. Yes means the item vendor is within your company. No means the vendor is external to your company.
    IssueDate Date and time the PR was requested.
    LDKeyLong Description Key. This is a link to text stored in the LongDescription table.
    OrgIDIdentifier of the organization for this PR.
    OwnerSysID A string identifying the system owner.
    PaymentTerms Specified terms of payment for this vendor.
    PayOnReceipt Indicates if there is a payment on receipt agreement with the vendor.
    PcardExpDate The expiry date of the procurement card (mm/yy). Crosses over from MR.PcardExpDate or Labor.PcardExpDate.
    PcardNum The number of the procurement card. Crosses over from MR.PcardNum or Labor.PcardNum.
    PcardType The type of procurement card. Crosses over from MR.PcardType or Labor.PcardType.
    PcardVerification Procurement card verification value.
    Priority Indicates the priority with which this PR should be handled.
    PRNum Purchase requisition number.
    RequestedBy The person who requests this PR.
    RequiredDate Date by which the requisition line items are needed.
    ShipTo Identifier of the company to whom this PR will be shipped.
    ShipToAttn Person to whom the items should be shipped.
    ShipVia Specifies how the goods should be shipped (First class mail, FedEx, UPS, etc.).
    SiteIDIdentifier of the site for this PR.
    StatusThe status of the PR.
    StatusDate The date on which the status of this PR was changed.
    Supervisor The person responsible for approving the work to be done.
    TotalCost The total cost of the PR, including taxes.
    TotalTax1 thru TotalTax5 Total amount of Tax1 -Tax5 owed. This is included in the total cost if Inclusive1 - Inclusive5 is YES.
    Vendor Identifier of the vendor to whom the PR would be sent.
    WFActiveFlag to indicate if this PR is active in workflow.
    WFIDWorkflow ID.
    PR1 thru PR10 Extra fields.
    PRLA1 thru PRLA5 Extra crossover fields cross over from MR.MRLA1 thru MR.MRLA5 or LABOR.LA21 thru LABOR.LA25.
    SenderSysID, SourceSysID Column used by ERP-Integration (APIs).
    • Constructor Detail

      • PR

        public PR(MboSet ms)
           throws MXException,
                  java.rmi.RemoteException
        Construct the PR. This method just includes a call to the super constructor.
        Parameters:
        ms -
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • getProcess

        public java.lang.String getProcess()
        Returns the work flow process for PRs.
        Returns:
        string "PR"
      • getStatusHandler

        protected StatusHandler getStatusHandler()
        Returns a status handler to change the PR status.
        Specified by:
        getStatusHandler in class StatefulMbo
        Returns:
        oject on which status changes are performed
      • init

        public void init()
                  throws MXException
        Initialize the Purchase Requisition by setting certain fields to read only. Based on the status of the requisition, the requisition could be made read only.
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • initFieldFlagsOnMbo

        public void initFieldFlagsOnMbo(java.lang.String attrName)
                                 throws MXException
        Description copied from class: Mbo
        The logic of setting the readonly and required field flags to the mbo. Any setting of the field flags that require expensive operation, such as database query should be moved from init() to this method. However, those which don't require steps such as fetching Mbos can be left in init(). You can group the logic for a few attributes together if logic of deciding their flag is the same, or in other words, can be handled at once.
        Overrides:
        initFieldFlagsOnMbo in class Mbo
        Throws:
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Adds a new Purchase Requisition. Required fields of the Purchase Requisition are initialized in this method. The following fields are initialized with their respective values.

        Attribute Name Attribute Value
        billto Site's billtoaddresscode
        billtoattn Site's billtolaborcode
        buyahead No
        changeby Current Username
        changedate Current Date
        currencycode Base Currency
        historyflag No
        inclusive1 - inclusive5 No
        internal No
        issuedate Current Date
        payonreceipt No
        priority 0 (zero)
        requestedby Login User Name
        shipto Site's shiptoaddresscode
        shiptoattn Site's shiptolaborcode
        status Waiting for Approval
        statusdate Current Date
        totalcost 0 (zero)
        totaltax1 - totaltax5 0 (zero)
        wfactive No
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.signature.SignatureService#getlaborForuserAndOrg
      • setBillToShipToInfo

        public void setBillToShipToInfo()
                                 throws MXException,
                                        java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        This method is called before save for last minute validations.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXApplicationException(po, - fromsiterequired) is thrown when it's internal po and fromsite or storeloc is null.
        MXException
        java.rmi.RemoteException
      • createPRLineFromReorder

        public PRLineRemote createPRLineFromReorder(java.lang.String description,
                                                    java.lang.String storeloc,
                                                    ReorderRemote reoRemote)
                                             throws MXException,
                                                    java.rmi.RemoteException
        This method will create a PR Line item and return a reference to it. The parameters passed in like the item number, description and storeloc are used to set values on the PRLine.
        Specified by:
        createPRLineFromReorder in interface PRRemote
        Parameters:
        itemnum - the item number for the line
        description - the description for the line
        storeloc - the storeroom location for the line
        reoRemote - the reorder object that will further create a PO from this PR
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.pr.PR#createPRLineFromReorder(String, String, String, ReorderRemote)
      • createPOsFromPR

        public java.util.Vector createPOsFromPR(java.util.Date date)
                                         throws MXException,
                                                java.rmi.RemoteException
        Overloaded form of createPOsFromPR(). It creates the autokeyed POs for this PR. PRLines only get created for those PRLines which don't have POLines created yet.
        Specified by:
        createPOsFromPR in interface PRRemote
        Parameters:
        date - the date when the new PO is created
        Throws:
        MXApplicationException - (pr, cannotcreatepo) is thrown if pr status is not APPR.
        MXException
        java.rmi.RemoteException
        See Also:
        createPOsFromPR(Date,Vector,boolean,String)
      • createPOsFromPR

        public void createPOsFromPR(java.lang.String ponums,
                                    java.lang.String description)
                             throws MXException,
                                    java.rmi.RemoteException
        Overloaded form of createPOsFromPR(). An interface for UI to create one PO from PR. It will take a PO number and description.
        Specified by:
        createPOsFromPR in interface PRRemote
        Parameters:
        ponums - the vector that contains the new ponums to be created that can be specified by the user
        description - the PO's description
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        createPOsFromPR(Date,Vector,boolean,String)
      • createPOsFromPR

        public java.util.Vector createPOsFromPR(java.util.Date date,
                                                java.lang.String ponum,
                                                boolean isApprove,
                                                java.lang.String description)
                                         throws MXException,
                                                java.rmi.RemoteException
        Overloaded form of createPOsFromPR().
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        createPOsFromPR(Date,Vector,boolean,String,boolean)
      • createPOsFromPR

        public java.util.Vector createPOsFromPR(java.util.Date date,
                                                java.lang.String ponum,
                                                boolean isApprove,
                                                java.lang.String description,
                                                boolean fromUI)
                                         throws MXException,
                                                java.rmi.RemoteException
        This method creates POs for this PR. It is called when approving PR and when creating PO from PR. The PRlines of this PR are grouped by contract number. One PO will be created for a group of PRLines with the same contract number. One PO will be created for all the PRLines without contract number. As the result, multiple POs are possible to be created for this one PR. If this method is called during PR's approval, and if the maxvar AUTOBLANKETPOREL is set to true, releases will be created for the PRLines referencing Blanket contracts, and standard POs will be created for the PRLines referencing other contracts. No POs will be created for the PRLines without contract reference. If this method is called when creating PO from PR, the POs will be created for all the PRLines which don't have POs or Contracts created yet. If a ponum is specified when this method is called, and if this number can be a valid po number, the newly created po will have this number as the PONum. If ponum is not specified, the PO created will be autokeyed.
        Depending on when this method is called, different values of parameters need to be provided.
        • Case 1 - If approve calls this method it calls it with (date, null, true, null) because in case of approve the user has no choice to specify the new ponums. They all are autokeyed instead. Hence the vector is null.
        • Case 2- If create PO from PR calls this method it is called with (date, ponums, false, description) because now the user can specify the new ponums to be created. The "false" flag indicates that the PR should not be approved but the lines in the PR with contract reference number (if they are already not part of another PO) should be copied to a new Release PO. Whether the release PO is approved or not depends on MAXVARS.
        Parameters:
        date - the date when the new PO is created
        ponums - the vector that contains the new ponums to be created that can be specified by the user
        isApprove - a boolean that specifies if approve or create PO from PR called this method
        description - the PO's description
        Returns:
        a vector of all PORemote created from this pr.
        Throws:
        MXException
        java.rmi.RemoteException
      • createPOHeaderFromPR

        public MboRemote createPOHeaderFromPR(java.lang.String ponum,
                                              java.lang.String description,
                                              MboRemote sourceRemote)
                                       throws MXException,
                                              java.rmi.RemoteException
        This method copies the PR header info to a new PO header. It takes the new PONUM as the parameter and if one is not specified it is autokeyed. Call this method with a null value if you need the ponum to be autokeyed.
        Parameters:
        ponum - the ponum of the newly created PO. Pass null if the PONUM is to be autokeyed.
        Returns:
        a new PO header
        Throws:
        MXException
        java.rmi.RemoteException
      • getPOsCreateByApproval

        public java.util.Vector getPOsCreateByApproval()
                                                throws java.rmi.RemoteException
        Returns a vector of releases created by approving a PR. If the vector is null or empty, the releases are not created or there is no releases created. The returned POs are the releases created by the blanket agreement, and standard POs created by price agreement.
        Specified by:
        getPOsCreateByApproval in interface PRRemote
        Returns:
        a vector of releases that created by approving a PR
        Throws:
        java.rmi.RemoteException
        See Also:
        PR.getPOsCreateByApproval()
      • createRFQHeaderFromPR

        public MboRemote createRFQHeaderFromPR(java.lang.String rfqnum)
                                        throws MXException,
                                               java.rmi.RemoteException
        Copies the PR Header info to the RFQ Header. Returns the RFQ header. It takes the RFQ number as the parameter. If RFQ number is null value, it will be autokeyed.
        Specified by:
        createRFQHeaderFromPR in interface PRRemote
        Parameters:
        rfqnum - the rfq number
        Returns:
        the RFQ that just created
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PR.createRFQHeaderFromPR(String)
      • 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 by using the data from the static HashSet. If this field does not need to be copied return true. The same method is over-rided also in PRLine so that certain PRLine fields can be skipped without being copied.
        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
        See Also:
        POLine.skipCopyField(psdi.mbo.MboValueInfo), PO.loadSkipFieldCopyHashSet()
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        Description copied from class: Mbo
        This called whenever a change is made to the attributes of a MBO. The programmer should override if interested in intercepting this event. An example of the use of this is to set the changeby/changedate of a work order whenever one of the attributes is set. If an MXException is thrown from this routine, the change of value is rolled back, this provides a mechanism to abort any changes. Default behavior is to do nothing. The derived method has to call super.modify().
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • initRelationship

        public void initRelationship(java.lang.String relationName,
                                     MboSetRemote mboSet)
                              throws MXException,
                                     java.rmi.RemoteException
        Called whenever a relationship is initialized or reset from this Mbo to another MboSet. At the time when prline is obtained from PR, move the PRLineSet ahead of PR in the mxtransaction list.
        Overrides:
        initRelationship in class Mbo
        Parameters:
        relationName - the relationship name
        mboSet - the mboset
        Throws:
        MXException
        java.rmi.RemoteException
      • setRelatedMboEditibility

        public void setRelatedMboEditibility(java.lang.String relationName,
                                             MboSetRemote mboSet)
                                      throws MXException,
                                             java.rmi.RemoteException
        Sets the read/only flag for the related set if the set exists.
        Parameters:
        relationName - The relationship name of the related MboSet which need to set the read/only flag.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        #settings, #setEditibilityFlags
      • copySpareParts

        public void copySpareParts(MboSetRemote sparePartSet)
                            throws MXException,
                                   java.rmi.RemoteException
        Adds the spare parts to the PRs PRLines. This method receives a set of spare parts, gets the PRLines for this PR and adds the spare parts as PRLines by calling the copy method on MboSet.
        Specified by:
        copySpareParts in interface PRRemote
        Parameters:
        sparePartSet - The set of spare parts from the UI
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PR.copySpareParts(psdi.mbo.MboSetRemote)
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Checkes to see if any PRLines are deleted and if if in fact they are, it gets that wpmaterial line with the prnum, prlinenum combination and removes the pr and the prlinenum reference from that wpmaterial.
        Overrides:
        save in class StatefulMbo
        Throws:
        MXException
        java.rmi.RemoteException
      • changeStatus

        public void changeStatus(java.lang.String status,
                                 java.util.Date date,
                                 java.lang.String memo,
                                 long accessModifier)
                          throws MXException,
                                 java.rmi.RemoteException
        This method is overridden to add a wrapper to exceptions thrown during change status and to write warnings whether or not the status change is successful
        Specified by:
        changeStatus in interface StatefulMboRemote
        Overrides:
        changeStatus in class StatefulMbo
        Parameters:
        status - The new desired status. This is the translated status (that is, the status code as it would have been entered by a user, or valuelist.value), not the internal status value (valuelist.maxvalue).
        date - The effective date of the new status (java.util.Date). If null the current date/time is used.
        memo - A string briefly describing the circumstances of the change. The memo can be null.
        accessModifier - A value of NOACCESSCHECK will cause the method not to call canChangeStatus. Callers using this flag are responsible for ensuring that they are attempting a valid status change.
        Throws:
        MXException - Thrown if there is a problem.
        java.rmi.RemoteException
        See Also:
        StatefulMbo.canChangeStatus(String)
      • checkingBeforeCreatePOCont

        public boolean checkingBeforeCreatePOCont(boolean createPO)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Checking for different conditions before creating a PO/Contract. 1) If MaxVar PRAPPROVAL is true and PR status is WAPPR, cannot create a PO/Contract. 2) If PR is closed or cancelled, display an error message. 3) If PR is internal PR, cannot create contract. 4) If all PRLines have been created into PO/Contract/RFQ or have referenced contracts, shows an error message.
        Specified by:
        checkingBeforeCreatePOCont in interface PRRemote
        Throws:
        MXApplicationException - (pr, prishistory) is thrown if PR is closed or cancelled.
        MXApplicationException - (po, internalpo) is thrown if it's an internal PR.
        MXApplicationException - (pr, prmustbeappr) is thrown if PRAPPROVAL is true and PR status is WAPPR.
        MXApplicationException - (pr, linesareassigned) is thrown if all PRLines have assigned to PO.
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.jsp.app.pr.Actions#createpo, psdi.jsp.app.pr.Actions#createcont
      • createContractFromPR

        public void createContractFromPR(java.lang.String contractNum,
                                         java.lang.String description,
                                         java.lang.String contractType)
                                  throws MXException,
                                         java.rmi.RemoteException
        An interface for UI to create one contract from a PR. It will take a contract number, description and contract type as parameters.
        Specified by:
        createContractFromPR in interface PRRemote
        Parameters:
        contractNum - the contract number to be created that can be specified by the user
        description - the contract description
        contractType - the contract type to be created that can be specified by the user
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        ContractFromPRSet.execute()
      • isLineContNumFilled

        public boolean isLineContNumFilled(MboSetRemote lineSet)
                                    throws MXException,
                                           java.rmi.RemoteException
        Checks the given PR line(s) contractnum/ponum field(s) for null or not null. It returns true if all PR lines have the contractnum/ponum field filled. If any of the PR line(s) have no contractnum/ponum filled, it returns false.
        Parameters:
        lineSet - The line mbo set being checked
        Returns:
        false if any PR lines do not have a contractnum. Otherwise, return true.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        PR.createContractFromPR(java.lang.String, java.lang.String, java.lang.String)
      • checkWAPPRStatus

        public void checkWAPPRStatus()
                              throws MXException,
                                     java.rmi.RemoteException
        Checks if the PR status is WAPPR. If the status is not WAPPR, display error message.
        Specified by:
        checkWAPPRStatus in interface PRRemote
        Throws:
        MXApplicationException - (pr, onlywapprpr) is thrown if PR status is not WAPPR.
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.jsp.app.pr.Actions#viewagreements
      • findMatchedPOVendor

        public MboRemote findMatchedPOVendor(MboRemote targetMbo,
                                             java.util.Hashtable poHashtable)
                                      throws MXException,
                                             java.rmi.RemoteException
        Return a matched PO with the contract. Compare PO's vendor info with the contract.
        Parameters:
        contractRemote - The Contract object
        poHashtable - PO hashtable
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        Throw exception when trying to delete a PR.
        Overrides:
        canDelete in class Mbo
        Throws:
        MXApplicationException(pr, - cannotdeletepr) is thrown when trying to delete a PR.
        MXException
        java.rmi.RemoteException
      • unapproveMR

        public void unapproveMR(MboRemote prLine)
                         throws MXException,
                                java.rmi.RemoteException
        Unapprove MR. Gets all the mrline records that contains the PRNUM. This method is called from the PR save method. It will wipe out prnum and prlinenum references on any
        Throws:
        MXException
        java.rmi.RemoteException
      • unapproveMR

        public void unapproveMR()
                         throws java.rmi.RemoteException,
                                MXException
        Unapprove MR. Gets all the mrline records that contains the PRNUM. This method is called from the PR cancel method. It will wipe out prnum and prlinenum references on any
        Throws:
        java.rmi.RemoteException
        MXException
      • unapproveMR

        public void unapproveMR(java.lang.String itemnum)
                         throws MXException,
                                java.rmi.RemoteException
        Unapprove MR. Gets all the mrline records that contains the PRNUM and itemnum. This method is called from the PR cancel method. It will wipe out prnum and prlinenum references on any
        Throws:
        MXException
        java.rmi.RemoteException
      • validatePR

        public void validatePR()
                        throws java.rmi.RemoteException,
                               MXException
        09-13690: validate refwo,assetnum,location,storeloc at approve time
        Throws:
        java.rmi.RemoteException
        MXException
      • changePRStatus

        public void changePRStatus(MboRemote fromPRLine)
                            throws java.rmi.RemoteException,
                                   MXException
        This method is for integration to use. Remove PO reference from PRLine. Change PR status to APPR if all lines are not assigned to POs.
        Parameters:
        fromPRLine - PRLine MBO
        Throws:
        java.rmi.RemoteException
        MXException
      • getCreatedByReorderFlag

        public boolean getCreatedByReorderFlag()
                                        throws MXException,
                                               java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • setPOTypeToConsignment

        public void setPOTypeToConsignment(MboRemote noContractPOHeader,
                                           MboRemote prLine,
                                           boolean fromUI)
                                    throws MXException,
                                           java.rmi.RemoteException
        CASE1-Manually created PR/PO -If the reorder is for consignment items and no contract ref on PR header, PO Type will be the 'STD' CASE2-Reoorder creates PO - Reorder option (create unapproved PO) - If the reorder is for consignment items contract ref on PR header is of PURCHASE. All PR lines are lines are consignment items. Consignment PO type is created. Contract ref on PO header is purchase contract. CASE3-Reoorder creates PR - PO option (create approved PO from contract on PR approval to true)-Reorder option (create approved PR) If the reorder is for consignment items contract ref on PR header is of BLANKET.All PR lines are lines are consignment items. Consignment PO type is created. Contract ref on PO header is blanket contract.
        Parameters:
        fromUI - If this is false that means this the reorder process and not the manual creation.
        noContractPOHeader -
        prLine -
        Throws:
        MXException
        java.rmi.RemoteException