psdi.app.workorder

Class Assignment

  • java.lang.Object
  • All Implemented Interfaces:
    java.rmi.Remote, AssignmentRemote, MboConstants, MboRemote, MaxRemoteProxy
    Direct Known Subclasses:
    WMAssignment


    public class Assignment
    extends Mbo
    implements AssignmentRemote
    MBO to represent Assignment object See Workorder Package description for details.

    This is a site level object.

    There is no unique key for this object.

    The attributes in this object are as follows:

    Attribute Name Description
    Craft The craft that is needed to meet this requirement.
    FinishDate The datetime someone was assigned to finish this requirement.
    Labor A non persistent attribute to represent the laborcode or craft code which assigned to this requirement.
    LaborCode The identifier of the Labor assigned to this requirement.
    LaborHrs The length of time the craft will be required.
    Name The name of the laborcode or craft code which assigned to this requirement, non persistent attribute.
    OrgID Identifier of the organization for this failure.
    Rate The Rate of the labor or craft which assigned to this requirement, non persistent attribute.
    ScheduleDate The datetime when this requirement has been rescheduled for.
    SiteID Identifier of the site for this failure.
    StartDate The datetime someone was assigned to start this requirement.
    Status The status of the requirement.
    TaskID The task identifier to the work order which this requirement applies, non persistent attribute.
    WplaborId Identifier to the exact WPLabor record used to generate this row.
    WoNum Identifier to the work order which this requirement applies.
    • Constructor Detail

      • Assignment

        public Assignment(MboSet ms)
                   throws MXException,
                          java.rmi.RemoteException
        Your basic construtor
        Parameters:
        ms - The Assignment MboSet.
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Initialization routine. Always read-only fields has their READONLY flag set here.
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Creates a new assigment object. Parent must be a Work Order object.
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXApplicationException - AddAssignment when its owner is not Workorder
        MXException
        java.rmi.RemoteException
      • calledFromAssignmentManager

        public boolean calledFromAssignmentManager()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Returns:
        A boolean indicating whether or not the current action was called from Assignment Manager (or a clone of it).
        Throws:
        MXException
        java.rmi.RemoteException
      • completeAssignment

        public void completeAssignment()
                                throws MXException,
                                       java.rmi.RemoteException
        Calls completeAssignment(boolean) with the boolean set to true, which will complete the work order as part of its action. This matches the original action of this call.
        Specified by:
        completeAssignment in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • completeAssignment

        public void completeAssignment(boolean completeWO)
                                throws MXException,
                                       java.rmi.RemoteException
        Completes an assignment: changes the status to Complete, creates a LabTrans record, and completes or closes the parent Work Order if all assignments are now complete and if the passed completeWO parameter is set to true.
        Specified by:
        completeAssignment in interface AssignmentRemote
        Parameters:
        completeWO - Determines whether the workorder that owns this assignment will have its status changed to Close or Comp.
        Throws:
        MXException
        java.rmi.RemoteException
      • getLabTransSet

        public LabTransSetRemote getLabTransSet()
                                         throws MXException,
                                                java.rmi.RemoteException
        Allows a bean to retrieve a newly created labTrans MboSet for cleanup purposes if there was a problem.
        Specified by:
        getLabTransSet in interface AssignmentRemote
        Returns:
        A LabTransRemote mboset.
        Throws:
        MXException
        java.rmi.RemoteException
      • createLabTrans

        public void createLabTrans(WORemote ownerWO)
                            throws MXException,
                                   java.rmi.RemoteException
        Creates a LabTrans record for this assignment. If the assignment have a Crew assigned, then we need to create LabTrans for each single labor assigned to the crew.
        Specified by:
        createLabTrans in interface AssignmentRemote
        Parameters:
        ownerWO - The workorder that is the owner of this assignment.
        Throws:
        MXException
        java.rmi.RemoteException
      • setLabTrans

        protected LabTransRemote setLabTrans(MboRemote resource,
                                             LabTransRemote labTrans)
                                      throws MXException,
                                             java.rmi.RemoteException
        Set the values in the new LabTrans record.
        Parameters:
        resource - - The own assignment or a AMCrewLabor could be used to provide values for
        labTrans - - The new LabTrans record
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • completeTheWO

        public void completeTheWO(WORemote ownerWO)
                           throws MXException,
                                  java.rmi.RemoteException
        Completes or closes the parent work order if all assignments are now complete.
        Specified by:
        completeTheWO in interface AssignmentRemote
        Parameters:
        ownerWO - The workorder that is the owner of this assignment.
        Throws:
        MXException
        java.rmi.RemoteException
      • canFinishWO

        public boolean canFinishWO(WO woMbo)
                            throws MXException,
                                   java.rmi.RemoteException
        Checks whether the workorder can be completed or closed. If all the assignments associated with this workorder are not completed, then we cannot complete or close it. This version of this method is called from the Assignment tab of the WOTrack app, where the AssignmentSet is precisely those Assignments, no more, no less, associated with the passed work order.
        Specified by:
        canFinishWO in interface AssignmentRemote
        Parameters:
        ownerWO - The workorder that is the owner of this assignment.
        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 a workperiod. Deals with the case when the workperiod spans midnight.
        Specified by:
        getWPEndDateTime in interface AssignmentRemote
        Parameters:
        WorkTimeMbo - The WorkPeriod or ModAvail mbo whos endtime we're converting to a datetime.
        wpStartDateTime - The start time of the workperiod in datetime format.
        scratchCal - A Gregorian calendar.
        availCalc - An AvailCalc object.
        Returns:
        The end time of the workperiod as a datetime.
        Throws:
        MXException
        java.rmi.RemoteException
      • calcFinishDate

        public void calcFinishDate()
                            throws MXException,
                                   java.rmi.RemoteException
        Calculates the finish date based on ScheduleDate and LaborHrs; if either is null, then FinishDate is also set to null. However, assignments with LaborHrs = 0.0 are allowed, in which case FinishDate = ScheduleDate.
        Specified by:
        calcFinishDate in interface AssignmentRemote
        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. If this field does not need to be copied return true. The following is a list of fields that are not copied from the source Assignment to the target Assignment.
        1. WONUM
        2. WPLABORID
        3. STATUS
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        mvi - 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
      • 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
      • startAssignment

        public void startAssignment(java.util.Date startDate)
                             throws MXException,
                                    java.rmi.RemoteException
        Start the assignment. Change the status of assignment to "STARTED" Change the status of the workorder to "in progress"
        Specified by:
        startAssignment in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • interruptAssignment

        public void interruptAssignment(java.util.Date interruptDate)
                                 throws MXException,
                                        java.rmi.RemoteException
        Interrupt Assignment. Change the status of the assignment to WAITASSIGN Creates the labor transaction record for this labor
        Specified by:
        interruptAssignment in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • finishAssignment

        public void finishAssignment(java.util.Date finishDate)
                              throws MXException,
                                     java.rmi.RemoteException
        Finish Assignment. Change the status of the assignment to COMPLETE Check to see whether the workorder has any other assignments which are still needed to be completed. Otherwise clear this assignment from Assignment set and change the workorder status to either complete or close depending on the user request. This method also Creates the labor transaction record for this labor
        Specified by:
        finishAssignment in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • 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
      • getCrewWorkZoneWhere

        public java.lang.String getCrewWorkZoneWhere(MboRemote owner)
                                              throws MXException,
                                                     java.rmi.RemoteException
        Specified by:
        getCrewWorkZoneWhere in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException - This is to build a query to find the 'Work Zones associated to a Crew via the main Location/Asset on WO application and the Crew Type in the Assignment table.
      • getCrewWorkZoneWhere

        public java.lang.String getCrewWorkZoneWhere(java.lang.String assetNum,
                                                     java.lang.String location,
                                                     java.lang.String siteId,
                                                     java.lang.String orgId)
                                              throws MXException,
                                                     java.rmi.RemoteException
        Specified by:
        getCrewWorkZoneWhere in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • getLaborWorkZoneWhere

        public java.lang.String getLaborWorkZoneWhere(java.lang.String assetNum,
                                                      java.lang.String location,
                                                      java.lang.String siteId,
                                                      java.lang.String orgId)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Specified by:
        getLaborWorkZoneWhere in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException - This is to build a query to find the 'Work Zones associated to a Labor via the main Location/Asset on WO application and the planned Craft in the Assignment table.
      • getLaborWorkZoneWhere

        public java.lang.String getLaborWorkZoneWhere(MboRemote owner)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Specified by:
        getLaborWorkZoneWhere in interface AssignmentRemote
        Throws:
        MXException
        java.rmi.RemoteException - This is to build a query to find the 'Work Zones associated to a Labor via the main Location/Asset on WO application and the planned Craft in the Assignment table.
      • countMembers

        public int countMembers()
                         throws java.rmi.RemoteException,
                                MXException,
                                java.sql.SQLException
        Throws:
        java.rmi.RemoteException
        MXException
        java.sql.SQLException
      • delete

        public void delete()
                    throws MXException,
                           java.rmi.RemoteException
        Description copied from class: Mbo
        Mark the object to be deleted with all the normal security checks. An object can be successfully marked delete only when it is not flagged NODELETE, the current set it belongs to is not being flagged NODELETE, and it passes all the checks in its canDelete method.

        Please note that if you need to apply application specific rules when an object is being deleted, please overwrite method delete(long) instead of this one in the derived class.

        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        Description copied from class: Mbo
        Unmark the Mbo for deletion. Can only be called after a delete() and before the save() has been performed. This method will also unmark associated Long Description and Translation Mbos.
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        Internal method that marks the record as modified. Not usually called except by PSDI objects. Called when ever a field is modified so we can update the changedate/changeby.
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException