psdi.app.labor

Class Labor

  • All Implemented Interfaces:
    GISable, LBS, java.rmi.Remote, LaborRemote, LinkedMboRemote, MboConstants, MboRemote, StatefulMboRemote, MaxRemoteProxy


    public class Labor
    extends StatefulMbo
    implements LaborRemote, LinkedMboRemote
    Mbo object to represent a new Labor MBO. Allows a user to create a Labor record that provide a detailed information about of hours worked, overtime worked and refused. See the Labor package description for details.

    This is an Org level object.

    The key attributes for this object are O rgId and Laborcode.

    The attributes in this object are as follows:

    Attribute Description

    AttributeDescription
    AttendanceThis is the total attendance (sum(laborhours) of all the labor transactions. This is a non-Persistent field.
    AvailFactor% to use during resource scheduling
    ControlAccLabor recovery account.
    DailyTimeThis is the total daily time (regularhrs+othrs) of all the labor transactions. This is a non-Persistent field.
    DefaultStorelocThe default storeroom for requisitioned items
    GLAccountGL Account used to store default value for labor reporting transcation.
    LabInventoryLocThe location of inventory for this labor.
    LabInventorySiteThe site of inventory for this labor.
    LaborCodeLabor Code
    LaborIdUnique identifier
    OrgIdIdentifier for the Organization of this Labor
    OTScaleOvertime Scale
    OwnerSysIDOwner System ID
    PersonIDPerson associated with the Labor.
    ReportedHrsReported Hours
    ShipToLocationCompany or division where items are to be shipped to
    SourceSysIDSource System ID
    StoreLocationThe inventory labor location.
    TypeType of Work That Can Be Performed
    WorkLocationThe location where laborer works.
    worksiteIdentifier for the site of this Labor
    YTDHRSRefusedOvertime Hours Refused YTD
    YTDOTHRSYear To Date Overtime Hours
    See Also:
    Attendance, LabTrans, ServRecTrans
    • Field Detail

      • serverDateColumn

        public java.util.Date[] serverDateColumn
      • AMGridCreated

        public boolean AMGridCreated
      • availabilityDataCalculated

        public boolean availabilityDataCalculated
        The calculateAvailabilityData() method is called once for each labor row on the Available Labor dialog of the Assignment tab and is triggered by the first access to any of the fields. But after that happens, it must not execute a second time. This boolean keeps track of whether it's been executed yet or not.
    • Constructor Detail

      • Labor

        public Labor(MboSet ms)
              throws MXException,
                     java.rmi.RemoteException
        Construct the Labor object
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Initailzation rountine. Applies READONLY flag for read only fields.
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        This method checks if current labor referenced in LaborAuth,JobPlan,Assignment,Attendance,WPLabor,Workorder objects, before allowing it's deletion. Exception will be thrown if labor can not be deleted See labor.txt for error messages
        Author:
        Irina Borovitsky
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException - will throw this exception if it can't be deleted
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Delete the labor and all related LaborCraftRates, LaborStatuses, LaborQuals, LaborQualStatuses, LaborCertHists, and LaborAuth.
        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,RemoteException
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a new Labor Object. Initialise all the fields that are "required". The table below shows the default values for each of the attributes listed.
        Attribute NameAttribute Value
        statusTranslated value of ACTIVE.
        orgidGet Insert Org.
        reportedhrs0.0
        ytdothrs0.0
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        #getLaborAcctDefaults
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Checks to be sure that the personid on this record is not assigned on any other records in the organization.
        Overrides:
        appValidate in class Mbo
        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 this field needs to be copied or skipped by using the data from the static HashTable. If this field does not need to be copied return true. The following are Labor fields will be skipped without being copied to the newly duplicated Labor
        1. LABORCODE
        2. REPORTEDHRS
        3. YTDOTHRS
        4. YTDHRSREFUSED
        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:
        MXException
        java.rmi.RemoteException
      • zeroYTD

        public void zeroYTD(boolean bReported,
                            boolean bOvertime,
                            boolean bOTRefused)
                     throws MXException,
                            java.rmi.RemoteException
        Zeros the selected YTD Fields for either the Current Query (append sWhere) or the Current Record (append the key field)
        Author:
        Ramadevi Bhogadi
        Specified by:
        zeroYTD in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • associateLoc

        public void associateLoc(java.lang.String loc)
                          throws MXException,
                                 java.rmi.RemoteException
        This method gets called to associate selected location for the current labor record
        Author:
        Ramadevi Bhogadi
        Specified by:
        associateLoc in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getSiteUserForLabor

        public SiteAuth getSiteUserForLabor()
                                     throws MXException,
                                            java.rmi.RemoteException
        This method gets SiteUser object for the labor
        Returns:
        Return the SiteUser object for the labor
        Throws:
        MXException
        java.rmi.RemoteException
      • getUserNameForLabor

        public java.lang.String getUserNameForLabor()
                                             throws MXException,
                                                    java.rmi.RemoteException
        This method gets user name for the labor from the maxusergroup object.
        Author:
        Irina Borovitsky
        Specified by:
        getUserNameForLabor in interface LaborRemote
        Returns:
        the user name for the labor.
        Throws:
        MXException
        java.rmi.RemoteException
      • getStatusHandler

        protected StatusHandler getStatusHandler()
        Return a status handler with the help of which the person status changes can be done.
        Specified by:
        getStatusHandler in class StatefulMbo
      • getStatusHistory

        protected MboSetRemote getStatusHistory()
                                         throws MXException,
                                                java.rmi.RemoteException
        Return the LaborStatus object. Required for statefullness.
        Specified by:
        getStatusHistory in class StatefulMbo
        Returns:
        The set of LABORSTATUS records
        Throws:
        MXException
        java.rmi.RemoteException
      • changeStatus

        public void changeStatus(java.lang.String newStatus,
                                 java.util.Date date,
                                 java.lang.String memo)
                          throws MXException,
                                 java.rmi.RemoteException
        Change status.
        Specified by:
        changeStatus in interface StatefulMboRemote
        Overrides:
        changeStatus in class StatefulMbo
        Parameters:
        newStatus - 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).
        memo - A string briefly describing the circumstances of the change. The memo can be null.
        Throws:
        MXException - Thrown if there is a problem, or the status cannot be changed, as determined by canChangeStatus(String).
        java.rmi.RemoteException
        See Also:
        StatefulMbo.changeStatus(String,java.util.Date,String,long)
      • setWorkHrs

        public void setWorkHrs(java.util.Date DayOneClientDate)
                        throws MXException,
                               java.rmi.RemoteException
        Sets the available hours for the 7 dayN attributes (all non-persistent). This method fetches the eligible hours from the corresponding person object and subtracts the hours already consumed by assignments. The AMGridCreated field tells whether this has already been done for this labor (needed because we can't predict the order in which the dayN fields will be accessed -- whichever one is called first will call the setWorkHrs method).
        Specified by:
        setWorkHrs in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setWorkHrs

        public void setWorkHrs(java.util.Date DayOneClientDate,
                               boolean isCreateAMGrid)
                        throws MXException,
                               java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getServerDTFromClientDT

        public java.util.Date getServerDTFromClientDT(java.util.Date clientDateTime,
                                                      java.util.GregorianCalendar scratchCal)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Generates a datetime in the server time zone from a datetime in the client time zone using the MXFormat datetime/string methods.
        Specified by:
        getServerDTFromClientDT in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getClientDTFromServerDT

        public java.util.Date getClientDTFromServerDT(java.util.Date serverDateTime,
                                                      java.util.GregorianCalendar scratchCal)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Generates a datetime in the client time zone from a datetime in the server time zone using the MXFormat datetime/string methods.
        Specified by:
        getClientDTFromServerDT in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getWPEndDateTime

        public java.util.Date getWPEndDateTime(MboRemote WorkTimeMbo,
                                               java.util.Date wpStartDateTime,
                                               java.util.GregorianCalendar scratchCal,
                                               AvailCalc availCalc)
                                        throws MXException,
                                               java.rmi.RemoteException
        Gets the end datetime for the workperiod. Deals with the case when the workperiod spans midnight.
        Specified by:
        getWPEndDateTime in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getDayNAssignmentSet

        public MboSetRemote getDayNAssignmentSet(MboRemote theLaborMbo,
                                                 java.util.Date wpStartDateTime,
                                                 java.util.Date wpEndDateTime)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Fetches the mboset containing those assignments for this laborcode that overlap the working time of dayN (i.e. the intersection of the assignment time and working time is not empty).
        Specified by:
        getDayNAssignmentSet in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getAssignedHours

        public double getAssignedHours(boolean insideCurrentDateWorkingTime,
                                       java.util.Date rangeStartDateTime,
                                       java.util.Date rangeFinishDateTime,
                                       MboSetRemote dayNAssignmentSet)
                                throws MXException,
                                       java.rmi.RemoteException
        Sums up the assigned hours of the assignments in the assignment set, but only those portions of them that are actually inside the passed range. (That is, the assigned hours are the intersection of the assignment with the range.) There are four scenarios to be handled: 1) the assignment is entirely inside working time (assignStart after-or-equal-to workStart AND assignFinish before-or-equal-to workFinish) 2) the assignment starts in working time and extends beyond it (assignStart after-or-equal-to workStart AND assignFinish after workFinish) 3) the assignment starts before working time and finishes within it (assignStart before workStart AND assignFinish before-or-equal-to workFinish) 4) the assignment wholly spans working time (assignStart before workStart AND assignFinish after workFinish)
        Specified by:
        getAssignedHours in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getEarliestUnassignedDateTime

        public java.util.Date getEarliestUnassignedDateTime(MboSetRemote dayNAssignmentSet,
                                                            java.util.Date rangeStartDateTime,
                                                            java.util.Date rangeFinishDateTime)
                                                     throws MXException,
                                                            java.rmi.RemoteException
        This is passed a mboSet of assignments and a datetime range. It loops through the assignments to find the earliest time in the range that isn't part of an existing assignment (which may turn out to be the end of the range). Note that the assignments should be ordered by scheduledate (i.e. start time), so as soon as we find one that starts *after* the candidate time, we're done.
        Throws:
        MXException
        java.rmi.RemoteException
      • checkCalendarAndShift

        public void checkCalendarAndShift()
                                   throws MXException,
                                          java.rmi.RemoteException
        This method checks whether this labor has a calendar and a shift associated with it. If not, no calendar exceptions may be added to the modavail table through the Modify Availability dialog in Assignment Manager.
        Specified by:
        checkCalendarAndShift in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • updateCalendar

        public void updateCalendar()
                            throws MXException,
                                   java.rmi.RemoteException
        Method to update the PersonCal record associated with this labor using the non persistent fields calnum and shiftnum.
        Throws:
        MXException
        java.rmi.RemoteException
      • calculateAvailabilityData

        public void calculateAvailabilityData()
                                       throws MXException,
                                              java.rmi.RemoteException
        The method calculates the values for the nonpersistent fields StartTime, Availability (i.e. availabile hours) and Assigned (whether there's any assigned time in the working time after the start time) that reside on the Available Labor dialog of the Assignment tab's Assignment table
        Specified by:
        calculateAvailabilityData in interface LaborRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • hasCoords

        public java.lang.Boolean hasCoords()
                                    throws MXException,
                                           java.rmi.RemoteException
        Description copied from interface: GISable
        Check if this autolocatable object has coordinates filled (LAT,LONG)
        Specified by:
        hasCoords in interface GISable
        Returns:
        the boolean
        Throws:
        MXException - the mX exception
        java.rmi.RemoteException - the remote exception
      • getLatitudeY

        public java.lang.Double getLatitudeY()
                                      throws MXException,
                                             java.rmi.RemoteException
        Description copied from interface: GISable
        Return a double value with the the Latitude (or Y) coordinate of the current entitty.
        Specified by:
        getLatitudeY in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • getLongitudeX

        public java.lang.Double getLongitudeX()
                                       throws MXException,
                                              java.rmi.RemoteException
        Description copied from interface: GISable
        Return a double value with the the Longitude (or X) coordinate of the current entitty.
        Specified by:
        getLongitudeX in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • getAddressString

        public java.lang.String getAddressString()
                                          throws MXException,
                                                 java.rmi.RemoteException
        There is no address string with LBSLocation. This will always return null;
        Specified by:
        getAddressString in interface GISable
        Returns:
        Double or null
        Throws:
        MXException
        java.rmi.RemoteException
      • isGISDataReadonly

        public boolean isGISDataReadonly()
                                  throws MXException,
                                         java.rmi.RemoteException
        Description copied from interface: GISable
        Indicate if the current GIS entity is editable or not. Usefull when the coordinates are populated using an external system.
        Specified by:
        isGISDataReadonly in interface GISable
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • saveGISData

        public void saveGISData(java.lang.String address,
                                java.lang.String lat,
                                java.lang.String lng)
                         throws MXException,
                                java.rmi.RemoteException
        The address here is not saved as this will be writing out to LBSLocation table which does not contain an address. The address parameter will be ignored. This method will see if there is an existing record in LBSLocation, delete the record and then add a new record based on the latitude and longitude passed.
        Specified by:
        saveGISData in interface GISable
        Throws:
        MXException
        java.rmi.RemoteException
      • getAltitude

        public java.lang.Double getAltitude()
                                     throws MXException,
                                            java.rmi.RemoteException
        Specified by:
        getAltitude in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getHeading

        public java.lang.Double getHeading()
                                    throws MXException,
                                           java.rmi.RemoteException
        Specified by:
        getHeading in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getLastUpdate

        public java.util.Date getLastUpdate()
                                     throws MXException,
                                            java.rmi.RemoteException
        Specified by:
        getLastUpdate in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • getSpeed

        public java.lang.Double getSpeed()
                                  throws MXException,
                                         java.rmi.RemoteException
        Specified by:
        getSpeed in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException
      • saveLBSData

        public void saveLBSData(java.lang.Double lat,
                                java.lang.Double lng,
                                java.lang.Double locationAccuracy,
                                java.lang.Double altitudeAccuracy,
                                java.lang.Double altitude,
                                java.lang.Double heading,
                                java.lang.Double speed)
                         throws MXException,
                                java.rmi.RemoteException
        Specified by:
        saveLBSData in interface LBS
        Throws:
        MXException
        java.rmi.RemoteException