psdi.app.workorder

Class WPLabor

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


    public class WPLabor
    extends Mbo
    implements WPLaborRemote, WorkPlanMbo
    Mbo to represent a WPLabor object.

    See WorkOrder Package description.

    The key attributes for this object is WPLaborId and SiteID.

    The attributes in this object are as follows:

    Attribute NameDescription
    QUANTITYQuantity of craft for an operation.
    LaborCodeIdentifier of the Craft.
    LaborHrsLabor hours required by this work plan task.
    LdKeyLong description key. This is a link to text stored in the LongDescription table.
    LineCostA non-persistent attribute to calculate the total cost of the line(LaborHrs*QUANTITY*Rate).
    OrgIdIdentifier of the organization for this failure.
    RateLabor rate when workorder was approved.
    RateHasChanged Flag tracks if the labor rate has been overwritten by user.
    SiteIdIdentifier of the site for this failure.
    TaskIDA non-persistent attribute to identify the task number of the the work order associate with this work plan labor.
    Vendor Identifier of the Company for contractor who is a supplier of labor resources for this work plan labor.
    WoNumIdentifier of the work order associate with this work plan labor.
    WPLaborIdUnique Identifier of this wplabor object. If no - field will be overwritten by MAXIMO on Approval. If yes - field will not be overwritten by MAXIMO on Approval.
    WPL1-WPL3Extra fields, crossover fields from JobLabor.JL1-JL3.
    WPL7-WPL9Extra fields, crossover fields from JobLabor.JL7-JL9.
    • Constructor Detail

      • WPLabor

        public WPLabor(MboSet ms)
                throws MXException,
                       java.rmi.RemoteException
        Construct the WPLabor.
        Parameters:
        ms - The MboSet of the WPLabor.
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Initialize the WPLabor object. The owner of this object must be workorder.
        Overrides:
        init in class Mbo
        Throws:
        MXApplicationException - ownerWoWPLabor when this wplabor does not have a owner or its owner is not a workorder.
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Sets Default value for some of the fields of the new WPLabor. New WPLabor can only be created by the work order object.

        WONUM defaults from the parent and set WONUM of parent to read only.
        The table below shows the default values for each of the attributes listed.

        Attribute NameAttribute Value
        QUANTITY1.0
        LaborHrs0.0
        Rate0.0
        WPLaborIDauto-generated number
        RateHasChangedfalse
        LineCost0.0
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXApplicationException - ownerWoWPLabor when this wplabor does not have a owner or its owner is not a workorder.
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException
        Can not delete if there exists an Actual Labor for this WPLABOR
        Overrides:
        canDelete in class Mbo
        Throws:
        MXAccessException - deletewplabor when there exists an Actual Labor for this WPLABOR
        MXException
      • refreshRate

        public void refreshRate()
                         throws MXException,
                                java.rmi.RemoteException
        If ratehaschanged is false, copy labor.payrate to wplabor.rate
        Throws:
        MXException
        java.rmi.RemoteException
      • getRateForLabor

        protected double getRateForLabor()
                                  throws MXException,
                                         java.rmi.RemoteException
        Sets the rate from the payrate of the labor object.
        Throws:
        MXApplicationException - LaborNotFound when the laborcode is not exist in Labor table
        MXException
        java.rmi.RemoteException
      • calculatetotalcost

        public double calculatetotalcost()
        Calculates the Total Cost
      • copyPlan

        public void copyPlan(MboRemote source)
                      throws MXException,
                             java.rmi.RemoteException
        Used to fill in data when copying from Job Plan to Work Plan
        Specified by:
        copyPlan in interface WorkPlanMbo
        Parameters:
        source - remote JobPlan labor object
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Deletes assignments related to the WPLabor object and subtract this line's cost and hours from WO.EstLabCost and WO.EstLabHrs. If the last WPLabor was deleted, make these estimate totals editable.
        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.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        Adds the cost and hours back in and creates new assignments. If we previously had no WPLabor, WO.LabEstCost & WO.LabEstHrs are zero'ed and made read-only.
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • findAssignments

        public java.util.List findAssignments()
                                       throws MXException,
                                              java.rmi.RemoteException
        Creates a vector of Assignment Mbo's which have the wpLaborId. The Vector is always created but it might be empty.
        Returns:
        a vector of Assignment Mbos which have the wpLaborId.
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAssignments

        public void updateAssignments(int newQty)
                               throws MXException,
                                      java.rmi.RemoteException
        Called by the LaborQty field validation class, this function attempts to match the number of assigments to the labor quantity called for by the WPLabor object.
        Parameters:
        newQty - the quantity of this wplabor
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAssignments

        public void updateAssignments(java.lang.String attr,
                                      java.lang.String value)
                               throws MXException,
                                      java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAssignments

        public void updateAssignments(java.lang.String attr,
                                      java.lang.String value,
                                      MboRemote singleAssignment)
                               throws MXException,
                                      java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getWODate

        protected java.util.Date getWODate()
                                    throws MXException,
                                           java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        Overrides the skipCopyField() in the Mbo. Since this method takes the MboValueInfo as its parameter, just check to see if specified field needs to be copied or not. Return true if this field does not need to be copied. The following is a list of fields that are not copied from the source WPLabor to the target WPLabor. if QUANTITY and LABORCODE been copyed, the assignment records will not be created correctly. So set value for QUANTITY and LABORCODE after the copy.
        1. WONUM
        2. WPLABORID
        3. QUANTITY
        4. LABORCODE
        5. LABORHRS
        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, otherwise return false.
        Throws:
        java.rmi.RemoteException
        MXException
      • updateTotals

        public void updateTotals(MboRemote wo,
                                 boolean isGain)
                          throws MXException,
                                 java.rmi.RemoteException
        Updates the work order totals related to the work plan mbo.
        Specified by:
        updateTotals in interface WorkPlanMbo
        Parameters:
        wo - The work order Mbo to update.
        isGain - Is this a gain or loss for the work order.
        Throws:
        MXException
        java.rmi.RemoteException
      • propagateKeyValue

        public void propagateKeyValue(java.lang.String keyName,
                                      java.lang.String keyValue)
                               throws MXException,
                                      java.rmi.RemoteException
        Set value for Wonum.
        Specified by:
        propagateKeyValue in interface MboRemote
        Overrides:
        propagateKeyValue in class Mbo
        Parameters:
        keyName - Should equal "wonum" or else nothing will be propagated.
        keyValue - The new value of wonum.
        Throws:
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Validate that a craft rate exists that matches this WPLabor.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • getLCRWithDefaultCraft

        protected MboRemote getLCRWithDefaultCraft()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • setLineCost

        protected void setLineCost()
                            throws MXException,
                                   java.rmi.RemoteException
        Set the linecost by calculating quantity * laborhrs * displayrate
        Throws:
        MXException
        java.rmi.RemoteException
      • getValidateOrder

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

        protected void save()
                     throws MXException,
                            java.rmi.RemoteException
        Description copied from class: Mbo
        Save the object and other linked objects. Subclasses can code their save() logic to include any appropriate updates to other linked objects and call super.save().
        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • deleteAssociatedTool

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

        public void deleteAssociatedTool(java.lang.String assoc)
                                  throws java.rmi.RemoteException,
                                         MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • updateAssociatedToolData

        public void updateAssociatedToolData()
                                      throws MXException,
                                             java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • undeleteAddAssociatedTool

        public void undeleteAddAssociatedTool()
                                       throws MXException,
                                              java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • deleteAssociatedTool

        public void deleteAssociatedTool(MboValue value)
                                  throws MXException,
                                         java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • deleteAssociatedTool

        public void deleteAssociatedTool(java.lang.String attributename,
                                         java.lang.String svalue)
                                  throws MXException,
                                         java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • UpdateAssignmentSet

        public void UpdateAssignmentSet(boolean apptRequired,
                                        java.lang.String laborid)
                                 throws MXException,
                                        java.rmi.RemoteException
        This method sets the apptrequired flag for assignment set for corresponding labor.
        Parameters:
        boolean -
        laborid -
        Throws:
        MXException
        java.rmi.RemoteException