psdi.app.labor

Class LabTransSet

  • All Implemented Interfaces:
    java.rmi.Remote, LabTransSetRemote, MboAccessInterface, MboConstants, MboSetListenable, MboSetRemote, MaxRemoteProxy, Transactable, FixedLoggerNames, FixedLoggers


    public class LabTransSet
    extends MboSet
    implements LabTransSetRemote, MboSetListenable
    Represents the set of Labor Transactions.

    Relationships to other MboSets:

    Relationship NameMboSetRelationship
    LABORLABORlaborcode = labtrans.laborcode
    WORKORDERWORKORDERwonum = labtrans.wonum
    WORKORDERWORKORDERwonum = labtrans.refwo
    LABTRANSATTENDANCEATTENDANCElaborcode=:laborcode and orgid=:orgid
    LABTRANS_WOANDTASKWORKORDER((wonum=:refwo)or(parent = :refwo and istask = :yes))and(siteid=:siteid)
    LABTRANS_WOHIERARCHYWOANCESTOR(wonum=:refwo)and(siteid=:siteid)
    LABTRANSWPLABORWPLABOR(wonum=:refwo) and (siteid=:siteid) and (:refwo is not null)
    LOCATIONLOCATIONSlocation = :location and siteid=:siteid
    ASSETASSETassetnum = :assetnum and siteid=:siteid
    • Field Detail

      • showWork

        public boolean showWork
        The user sets the type of work, nonwork and otrefused. And also sets unapprovedlabtrans. They are not stored in the database.
      • showNonWork

        public boolean showNonWork
      • showOTRefused

        public boolean showOTRefused
      • showUnApprLabTrans

        public boolean showUnApprLabTrans
      • allDates

        public boolean allDates
        Boolean to store the userpref settings. To be set at the startup of the application by using the method: setAllDates().
      • startDate

        public java.util.Date startDate
        The user sets the start date and the end date. They are not stored in the database.
      • endDate

        public java.util.Date endDate
    • Method Detail

      • setOwner

        public void setOwner(MboRemote mbo)
                      throws MXException,
                             java.rmi.RemoteException
        setOwner is overridden so the owner can be looked up in the attribute listeners and save method. Note that if setOwner is never called, the variables remain null
        Specified by:
        setOwner in interface MboSetRemote
        Overrides:
        setOwner in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
      • setWork

        public void setWork(boolean workActLab)
                     throws MXException,
                            java.rmi.RemoteException
        Sets the userpref work setting.
        Specified by:
        setWork in interface LabTransSetRemote
        Parameters:
        workActLab - The work to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • getWork

        public boolean getWork()
                        throws MXException,
                               java.rmi.RemoteException
        Get work setting which was set at the startup of the application or later changed by the user.
        Specified by:
        getWork in interface LabTransSetRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setNonWork

        public void setNonWork(boolean nonWorkActLab)
                        throws MXException,
                               java.rmi.RemoteException
        Sets the userpref non-work setting.
        Specified by:
        setNonWork in interface LabTransSetRemote
        Parameters:
        nonWorkActLab - The non-work to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • getNonWork

        public boolean getNonWork()
                           throws MXException,
                                  java.rmi.RemoteException
        Get non-work setting which was set at the startup of the application or later changed by the user.
        Specified by:
        getNonWork in interface LabTransSetRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setOTRefused

        public void setOTRefused(boolean otRefusedActLab)
                          throws MXException,
                                 java.rmi.RemoteException
        Sets the userpref OTRefused setting.
        Specified by:
        setOTRefused in interface LabTransSetRemote
        Parameters:
        otRefusedActLab. - The otrefused to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • getOTRefused

        public boolean getOTRefused()
                             throws MXException,
                                    java.rmi.RemoteException
        Get OTRefused setting which was set at the startup of the application or later changed by the user.
        Specified by:
        getOTRefused in interface LabTransSetRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setUnapproved

        public void setUnapproved(boolean unapprovedActLab)
                           throws MXException,
                                  java.rmi.RemoteException
        Sets the Unapproved LabTrans setting.
        Specified by:
        setUnapproved in interface LabTransSetRemote
        Parameters:
        unapprovedActLab. - The unapproved flag to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • getUnapproved

        public boolean getUnapproved()
                              throws MXException,
                                     java.rmi.RemoteException
        Get Unapproved LabTrans setting which was set at the startup of the application or later changed by the user.
        Specified by:
        getUnapproved in interface LabTransSetRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setAllDates

        public void setAllDates(boolean allDatesActLab)
                         throws MXException,
                                java.rmi.RemoteException
        Set the userpref alldates setting.
        Specified by:
        setAllDates in interface LabTransSetRemote
        Parameters:
        allDatesActLab - The userpref setting for alldates i.e. all the existing labor transactions.
        Throws:
        MXException
        java.rmi.RemoteException
      • setStartDate

        public void setStartDate(java.util.Date startDateActLab)
                          throws MXException,
                                 java.rmi.RemoteException
        Set by the user. If clearing the start date pass null as parameter.
        Specified by:
        setStartDate in interface LabTransSetRemote
        Parameters:
        startDateActLab - The start date to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • setEndDate

        public void setEndDate(java.util.Date endDateActLab)
                        throws MXException,
                               java.rmi.RemoteException
        Set by the user. If clearing the end date pass null as parameter.
        Specified by:
        setEndDate in interface LabTransSetRemote
        Parameters:
        endDateActLab - The end date to be set by the user.
        Throws:
        MXException
        java.rmi.RemoteException
      • getAllDates

        public boolean getAllDates()
                            throws MXException,
                                   java.rmi.RemoteException
        Get the alldates setting which was set at the startup of the application or later changed by the user.
        Specified by:
        getAllDates in interface LabTransSetRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • addToUserPrefWhere

        public java.lang.String addToUserPrefWhere()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Add this where clause to the MboSet's getUserPrefWhere()
        Returns:
        The where clause.
        Throws:
        MXException
        java.rmi.RemoteException
      • getUserPrefWhere

        public java.lang.String getUserPrefWhere()
        Override the MboSet getUserPrefWhere() to return a userpref where clause which is appended to th existing whereClause. This is called by the framework to allow any app specific modifications to the whereClause.
        Overrides:
        getUserPrefWhere in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
      • addDates

        public java.util.Date addDates(java.util.Date date,
                                       int days)
        Add or minus days from the given date.
      • canAdd

        public void canAdd()
                    throws MXException
        Determines if the work order can add labor transactions. If the set isn't owned by a work order, no exception is thrown. Added throwing an exception if owner is LabTransEnterBy and no default values where supplied via that non persistant mbo.
        Overrides:
        canAdd in class MboSet
        Throws:
        MXApplicationException - Thrown with "workorder","ActualsAppr", param(wonum) if the work order owner is not approved.
        Thrown with "workorder", "WOHistory", param (wonum) if the work order is in history. Thrown with "labrep", "DefaultValueRequired" if LabTransEnterBy is owner and' no default values have been input.
        MXException
      • remove

        public void remove(MboRemote mbo)
                    throws MXException,
                           java.rmi.RemoteException
        remove the child mbo need remove it from the childlookup. Also informs the listeners of the removal.
        Specified by:
        remove in interface MboSetRemote
        Overrides:
        remove in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
      • getTimerStartedMbo

        protected MboRemote getTimerStartedMbo(java.lang.String theLaborCode)
                                        throws MXException,
                                               java.rmi.RemoteException
        returns a flag indicating whether a timer is started or not. If the user has no laborcode an exception is thrown.
        Returns:
        true, if timer is started for this laborcode for this wonum/ticket false, if timer is not started or if a timer was not used to create the labor transaction or if caller can not create timers
        Throws:
        MXException
        java.rmi.RemoteException
      • startTimer

        public MboRemote startTimer()
                             throws MXException,
                                    java.rmi.RemoteException
        Method that will start the timer with the current date and time. If timer is already started, or the user has no laborcode or if called from anywhere besides tickets or workorders it will throw an exception. This calls the version of startTimer with a Date parameter.
        Returns:
        MboRemote of the LabTrans object created
        Throws:
        MXException - via call to startTimer(Date)
        java.rmi.RemoteException - via call to startTimer(Date)
        See Also:
        psdi.app.signature.SignatureService#getlaborForuserAndOrg
      • startTimer

        public MboRemote startTimer(java.util.Date targetDateTime)
                             throws MXException,
                                    java.rmi.RemoteException
        Method that will start the timer. If timer is already started, or the user has no laborcode or if called from anywhere besides tickets or workorders it will throw an exception
        Parameters:
        Date - targetDateTime date and time to set startDate and startTime with
        Returns:
        MboRemote of the LabTrans object created
        Throws:
        MXException - if
        • woOwner and ticketOwner are both null
        • timers is already started for this labTrans mbo
        java.rmi.RemoteException - via many calls but not directly
        See Also:
        psdi.app.signature.SignatureService#getlaborForuserAndOrg, LabTransSet.getTimerStartedMbo(java.lang.String)
      • stopTimer

        public MboRemote stopTimer()
                            throws MXException,
                                   java.rmi.RemoteException
        Method that will stop the timer with the current date and time. If timer is already stopped or was not used to create the related labor transaction, or the see the stopTimer(Date) method in this class
        Returns:
        MboRemote - the labor transaction using this timer
        Throws:
        MXException - via call to stopTimer(Date)
        java.rmi.RemoteException - via call to stopTimer(Date)
      • stopTimer

        public MboRemote stopTimer(java.util.Date targetStopDate,
                                   boolean noStopTimerPopup)
                            throws MXException,
                                   java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • stopTimer

        public MboRemote stopTimer(java.util.Date targetStopDate,
                                   java.util.Date startDateTime,
                                   boolean noStopTimerPopup)
                            throws MXException,
                                   java.rmi.RemoteException
        Method that will stop the timer. If timer is already stopped or was not used to create the related labor transaction, or the user has no laborcode or if called from anywhere besides tickets or workorders it will throw an exception
        Parameters:
        Date - targetDateTime date and time to set finishDate and finishTime with
        Date - startDateTime date and time to set startDate and startTime with
        boolean - - true causes the timerstatus to be set to COMPLETE along with setting the finishdate and finishtime attributes, false does not.
        Returns:
        MboRemote - returns the related labtrans MboRemote.
        Throws:
        MXException - if
        • woOwner and ticketOwner are both null
        • we are unable to retrive the laborcode for the user/org
        • the timer was not started in the first place
        java.rmi.RemoteException - via many calls but not directly
        See Also:
        psdi.app.signature.SignatureService#getlaborForuserAndOrg, LabTransSet.getTimerStartedMbo(java.lang.String)
      • copyPlannedLaborToLabTransSet

        public void copyPlannedLaborToLabTransSet(MboSetRemote wmassignmentsSet)
                                           throws MXException,
                                                  java.rmi.RemoteException
        copyPlannedLaborToLabTransSet handles the OK button once wmassignments have been selected to use in creating labtrans records. This may be called from labor reporting dialogs "Enter By Workorder via the select planned labor button" and "Enter By Labor via the select planned labor button" which may set laborcode, workorder, or taskid defaults. Also Workorder.copyPlanLaborToLabTransSet calls this with a planned labor set
        Specified by:
        copyPlannedLaborToLabTransSet in interface LabTransSetRemote
        Parameters:
        wmassignmentsSet - - an MboSetRemote of WMAssignment records
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.app.labor.virtual.LabTransSet#copyPlannedLaborToLabTransSet
      • copyLaborToLabTransSet

        public void copyLaborToLabTransSet(MboSetRemote laborSet)
                                    throws MXException,
                                           java.rmi.RemoteException
        copyLaborToLabTransSet handles the OK button once labor have been selected to use in creating labtrans records
        Specified by:
        copyLaborToLabTransSet in interface LabTransSetRemote
        Parameters:
        laborSet - - an MboSetRemote of WMAssignment records
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.app.labor.virtual.LabTransSet#copyLaborToLabTransSet
      • fromCopyLaborToLabTransSet

        public boolean fromCopyLaborToLabTransSet()
        fromCopyLaborToLabTransSet used to see if Labor is being copied to LabTransSet
      • addDeltaHours

        public void addDeltaHours(java.lang.String laborcode,
                                  java.lang.String orgid,
                                  double reghrs,
                                  double othrs)
        A method to accumulate regular and premium pay hours for the LabTrans objects added to this set. Once all the LabTrans objects have been saved these accumulated hours will be used to update the labor rows for the specific Labor.
        Parameters:
        laborcode - -- The laborcode to update
        orgid - -- The org level laborcode to update
        reghrs - -- a quantity of regular hours
        othrs - -- a quantity of premium pay hours
      • crewLabTrans

        public MboRemote crewLabTrans(java.lang.String laborCode,
                                      java.lang.String laborOrg,
                                      java.util.Date targetDateTime)
                               throws MXException,
                                      java.rmi.RemoteException
        Create labTrans from Everyplace StartTimer by Crew
        Parameters:
        laborCode - Labor Code
        laborOrg - Labor org
        targetDateTime - Traget Date
        Returns:
        labTrans mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • activeTimer

        public boolean activeTimer()
                            throws MXException,
                                   java.rmi.RemoteException
        This mehod returns true if there is any active labor transaction in this set.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • forceDBSort

        public boolean forceDBSort(java.lang.String attrName)
        Description copied from class: MboSet
        Returns true if database sort is enforced for this attribute whether it's persistent or not. This is a special case for LABTRANS.STARTDATE, LABTRANS.FINISHDATE,LABTRANS.STARTTIME, LABTRANS.FINISHDATE. Do not override this method unless it's similar case.
        Overrides:
        forceDBSort in class MboSet
        Returns: