psdi.app.po

Class POStatusHandler

  • All Implemented Interfaces:
    MboConstants


    public class POStatusHandler
    extends StatusHandler
    Handles all the status changes for a po object.This is a helper class.
    • Field Detail

      • PNDREV

        protected java.lang.String PNDREV
        String object that holds the string "PNDREV"
      • REVISE

        protected java.lang.String REVISE
        String object that holds the string "REVISE"
      • HOLD

        protected java.lang.String HOLD
        String object that holds the string "HOLD"
      • PndRev

        protected static final int PndRev
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Revise

        protected static final int Revise
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Hold

        protected static final int Hold
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • statusChangeMatrix

        public static boolean[][] statusChangeMatrix
        A statusChangeMatrix for the legal status changes that can be made.

        Status   WAPPR   APPR    CLOSE   CANCEL  INPRG 
        WAPPR false true false true true
        APPR true false true true true
        CLOSE false false false false false
        CANCEL true false false false false
        INPRG true true true true false
        The above table must be read from right to left only.
        For example , if you want to change the status from CLOSE to WAPPR , look at the left for the CLOSE row and look at the intersecting WAPPR column. The value is false. This means that this status change is not allowed.
      • alreadyAsked

        public static boolean alreadyAsked
    • Constructor Detail

      • POStatusHandler

        public POStatusHandler(StatefulMbo sm)
        Constructor
    • Method Detail

      • canChangeStatus

        public void canChangeStatus(java.lang.String currentStatus,
                                    java.lang.String desiredStatus,
                                    long accessModifier)
                             throws MXException,
                                    java.rmi.RemoteException
        Defines which status changes are legal. If a status change is not legal, an MXAccessException is thrown.
        Overrides:
        canChangeStatus in class StatusHandler
        Parameters:
        currentStatus - The current external status of the PO
        desiredStatus - The desired external status of the PO
        accessModifier -
        Throws:
        MXApplicationException("po", - "invalidstatus")
        MXException
        java.rmi.RemoteException
        See Also:
        possibleStatusChange, statusChangeMatrix#matrix
      • checkStatusChangeAuthorization

        public void checkStatusChangeAuthorization(java.lang.String desiredExternalStatus)
                                            throws MXException,
                                                   java.rmi.RemoteException
        Checks to see if the user is authorised to make a status changes. In other words , it checks if the user has the required privilege to change the status. After ensuring that the user has the required privilege, this methods checks if the status change is legal.
        Specified by:
        checkStatusChangeAuthorization in class StatusHandler
        Parameters:
        currentExternalStatus - The current external status of the PO.
        desiredExternalStatus - The desired external status of the PO.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        checkUserSecurity, possibleStatusChange
      • getOptionName

        public static java.lang.String getOptionName(java.lang.String status)
        Given a PO Status, return the optionName Note the status passed in is the INTERNAL status code.
        The SigOption Option Name doesn't always match the status name.
        Parameters:
        status - The status to return the optionName of.
        Returns:
        optionName The Option Name.
      • changeStatus

        public void changeStatus(java.lang.String currentStatus,
                                 java.lang.String desiredStatus,
                                 java.util.Date date,
                                 java.lang.String memo)
                          throws MXException,
                                 java.rmi.RemoteException
        Change the status from the current state to a desired state.
        Overrides:
        changeStatus in class StatusHandler
        Parameters:
        currentStatus - The PO's status now.
        desiredStatus - The status to change to.
        date - The date as of the status change is to be made.
        memo - Memo text.
        Throws:
        MXException
        java.rmi.RemoteException
      • approve

        public void approve(java.util.Date date)
                     throws MXException,
                            java.rmi.RemoteException
        Perform the purchase order approval. The following rules must be followed while going through the process of approval
        • The Purchase Order must have a vendor.
        • If this is a RELEASE PO, then the BLANKET PO must exist and must be approved and the release cost must not exceed balnket cost.
        • The amount of the order cannot exceed purchasing limits.
        • The GLCredit Account and the GLDebit Account must be fully specified on the PO.
        • If this is an internal PO, reservations are created.
        • generate required work orders if po is direct issue item line.
        • Based on a maxvar value check if the pocost's GL debit and credit accounts are required for this transaction.
        Throws:
        MXApplicationException(po, - blanketunapproved) is thrown when the blanket PO is unapproved.
        MXApplicationException(po, - releaseexceedsblanket) is thrown when the release cost exceeds the blanket cost.
        MXApplicationException(po, - totalblanketcostzero) is thrown when the blanket cost is zero.
        MXApplicationException(po, - approveamountexceeded) is thrown when the PO amount exceeds designated limits.
        MXApplicationException(po, - glcreditnotfull) is thrown when the GLCredit Acct is not fully specified.
        MXApplicationException(po, - gldebitnotfull) is thrown when the GLDebit Acct is not fully specified.
        MXApplicationException - (financial, GLRequiredForTrans) The debit and credit GL accounts for pocosts require a value.
        MXException
        java.rmi.RemoteException
      • updateMboForStatus

        public void updateMboForStatus(java.lang.String status)
                                throws MXException,
                                       java.rmi.RemoteException
        Set the relevant fields to be read-only based on the status
        Overrides:
        updateMboForStatus in class StatusHandler
        Throws:
        MXException
        java.rmi.RemoteException
      • revise

        public void revise()
                    throws MXException,
                           java.rmi.RemoteException
        Sets the status of the PO to Revised. Revised POs become history records.
        Throws:
        MXException
        java.rmi.RemoteException
      • hold

        public void hold()
                  throws MXException,
                         java.rmi.RemoteException
        Sets the status of the PO to Hold.
        Throws:
        MXException
        java.rmi.RemoteException
      • pndrev

        public void pndrev()
                    throws MXException,
                           java.rmi.RemoteException
        Sets the status of the PO to Pending Revision.
        Throws:
        MXException
        java.rmi.RemoteException
      • canPndRev

        public void canPndRev(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Pending Revision is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canRevise

        public void canRevise(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Revised is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canHold

        public void canHold(java.lang.String currentMaxStatus)
                     throws MXException,
                            java.rmi.RemoteException
        Contains conditions to check if the status change to Hold is legal.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • isPOFromPR

        public boolean isPOFromPR()
                           throws MXException,
                                  java.rmi.RemoteException
        Check if any POLines in this PO are from PR?
        Throws:
        MXException
        java.rmi.RemoteException
      • isPOFromRFQ

        public boolean isPOFromRFQ()
                            throws MXException,
                                   java.rmi.RemoteException
        Check if any POLines in this PO are from RFQ?
        Throws:
        MXException
        java.rmi.RemoteException
      • updatePRPRLine

        public void updatePRPRLine()
                            throws MXException,
                                   java.rmi.RemoteException
        Remove PO reference from PRLines if POLines are deleted and reopen PR status
        Throws:
        MXException
        java.rmi.RemoteException
      • updateRFQRFQLine

        public void updateRFQRFQLine()
                              throws MXException,
                                     java.rmi.RemoteException
        Remove PO reference from PRLines if POLines are deleted and reopen PR status
        Throws:
        MXException
        java.rmi.RemoteException
      • checkPndRevLines

        public void checkPndRevLines(MboRemote poRemote,
                                     MboSetRemote poLines)
                              throws MXException,
                                     java.rmi.RemoteException
        If one of PNDREV POLines don't matched with Approve POLines, cannot approve PNDREV PO.
        Parameters:
        poRemote - The Approved PO
        poLines - The PNDREV POLineSet
        Throws:
        MXException
        java.rmi.RemoteException
      • updatePndRevLines

        public void updatePndRevLines(MboRemote poRemote,
                                      MboSetRemote poLines)
                               throws MXException,
                                      java.rmi.RemoteException
        Set mrnum/mrlinenum when revision is aproved.
        Parameters:
        poRemote - The Approved PO
        poLines - The PNDREV POLineSet
        Throws:
        MXException
        java.rmi.RemoteException
      • samePOlineOnTwoVersions

        public boolean samePOlineOnTwoVersions(MboRemote prLineRemote)
                                        throws MXException,
                                               java.rmi.RemoteException
        Find out how many polines are in PRLine regardless po revision
        Parameters:
        prLineRemote - PRLine set that has the The Approved PO
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException