Class TransportUnit

java.lang.Object
org.ameba.integration.jpa.BaseEntity
org.ameba.integration.jpa.ApplicationEntity
org.openwms.common.transport.TransportUnit
All Implemented Interfaces:
Serializable, org.ameba.integration.TypedEntity<Long>

@Configurable @Entity public class TransportUnit extends org.ameba.integration.jpa.ApplicationEntity implements Serializable
A TransportUnit is a physical item like a box, a toad, a bin, a pallet etc., used as a container that is moved between warehouse Locations and might carry goods or other items like LoadUnits on top. A TransportUnit must have some kind of identifier, like a physical Barcode, an RFID tag or others. There might be projects where TransportUnits are solely identified by virtual identifiers and don't have any physical identifiers. A TransportUnit may even carry other TransportUnits.
Author:
Heiko Scherrer
See Also:
  • Field Details

    • barcode

      private Barcode barcode
      Unique natural key.
    • empty

      private Boolean empty
      Indicates whether the TransportUnit is empty or not (nullable).
    • groupName

      private String groupName
      A TransportUnit may belong to a group of TransportUnits.
    • actualLocationDate

      private LocalDateTime actualLocationDate
      Date when the TransportUnit has been moved to the current Location.
    • weight

      private org.openwms.core.units.api.Weight weight
      Weight of the TransportUnit.
    • state

      private String state
      State of the TransportUnit.
    • actualLocation

      private Location actualLocation
      The current Location of the TransportUnit.
    • targetLocation

      private Location targetLocation
      The target Location of the TransportUnit. This property is set when a TransportOrder is started.
    • transportUnitType

      private TransportUnitType transportUnitType
      The TransportUnitType of the TransportUnit.
    • parent

      private TransportUnit parent
      Owning TransportUnit.
    • inventoryUser

      private String inventoryUser
      The User who performed the last inventory action on the TransportUnit.
    • inventoryDate

      private LocalDateTime inventoryDate
      Date of last inventory check.
    • children

      private Set<TransportUnit> children
      A set of all child TransportUnits, ordered by id.
    • errors

      private List<UnitError> errors
      A List of errors occurred on the TransportUnit.
    • reservations

      private List<TransportUnitReservation> reservations
      Tracks all active TransportUnitReservations on this TransportUnit.
  • Constructor Details

    • TransportUnit

      protected TransportUnit()
      Dear JPA...
    • TransportUnit

      @ConstructorProperties("barcode") public TransportUnit(@NotNull @NotNull Barcode barcode)
    • TransportUnit

      @ConstructorProperties({"barcode","transportUnitType","actualLocation"}) public TransportUnit(@NotNull @NotNull Barcode barcode, @NotNull @NotNull TransportUnitType transportUnitType, @NotNull @NotNull Location actualLocation)
      Create a new TransportUnit with an unique Barcode.
      Parameters:
      barcode - The unique identifier of this TransportUnit is the Barcode - must not be null
      transportUnitType - The TransportUnitType of this TransportUnit - must not be null
      actualLocation - The current Location of this TransportUnit - must not be null
      Throws:
      IllegalArgumentException - when one of the params is null
  • Method Details

    • setPersistentKey

      public void setPersistentKey(String pKey)
      Required for the Mapper.
      Overrides:
      setPersistentKey in class org.ameba.integration.jpa.ApplicationEntity
    • getActualLocation

      public Location getActualLocation()
      Get the actual Location of the TransportUnit.
      Returns:
      The Location where the TransportUnit is placed on
    • setActualLocation

      public void setActualLocation(Location actualLocation)
      Place the TransportUnit and all its children to a Location.
      Parameters:
      actualLocation - The new Location of the TransportUnit and all its children
      Throws:
      IllegalArgumentException - when actualLocation is null
    • initInventory

      public void initInventory()
      Initialize inventory info of the TransportUnit.
    • getTargetLocation

      public Location getTargetLocation()
      Get the target Location of the TransportUnit. This property can not be null when an active TransportOrder exists.
      Returns:
      The target location
    • setTargetLocation

      public void setTargetLocation(Location targetLocation)
      Set the target Location of the TransportUnit. Shall only be set in combination with an active TransportOrder.
      Parameters:
      targetLocation - The target Location where this TransportUnit shall be transported to
    • getEmpty

      public Boolean getEmpty()
      Indicates whether the TransportUnit is empty or not.
      Returns:
      true if empty, false if not empty, null when not defined
    • setEmpty

      public void setEmpty(Boolean empty)
      Marks the TransportUnit to be empty.
      Parameters:
      empty - true to mark the TransportUnit as empty, false to mark it as not empty and null for no definition
    • getGroupName

      public String getGroupName()
      Get the groupId.
      Returns:
      The groupId
    • setGroupName

      public void setGroupName(String groupId)
      Set the groupId.
      Parameters:
      groupId - The groupId
    • getInventoryUser

      public String getInventoryUser()
      Returns the username of the User who performed the last inventory action on the TransportUnit.
      Returns:
      The username who did the last inventory check
    • setInventoryUser

      public void setInventoryUser(String inventoryUser)
      Set the username who performed the last inventory action on the TransportUnit.
      Parameters:
      inventoryUser - The username who did the last inventory check
    • getNoTransportUnits

      public int getNoTransportUnits()
      Number of TransportUnits belonging to the TransportUnit.
      Returns:
      The number of all TransportUnits belonging to this one
    • getActualLocationDate

      public LocalDateTime getActualLocationDate()
      Returns the date when the TransportUnit moved to the actualLocation.
      Returns:
      The timestamp when the TransportUnit moved the last time
    • getInventoryDate

      public LocalDateTime getInventoryDate()
      Returns the timestamp of the last inventory check of the TransportUnit.
      Returns:
      The timestamp of the last inventory check of the TransportUnit.
    • setInventoryDate

      public void setInventoryDate(LocalDateTime inventoryDate)
      Set the timestamp of the last inventory action of the TransportUnit.
      Parameters:
      inventoryDate - The timestamp of the last inventory check
      Throws:
      IllegalArgumentException - when inventoryDate is null
    • getWeight

      public org.openwms.core.units.api.Weight getWeight()
      Returns the current weight of the TransportUnit.
      Returns:
      The current weight of the TransportUnit
    • setWeight

      public void setWeight(org.openwms.core.units.api.Weight weight)
      Sets the current weight of the TransportUnit.
      Parameters:
      weight - The current weight of the TransportUnit
    • getErrors

      public List<UnitError> getErrors()
    • addError

      public UnitError addError(UnitError error)
      Add an error to the TransportUnit.
      Parameters:
      error - An UnitError to be added
      Returns:
      The key.
      Throws:
      IllegalArgumentException - when error is null
    • hasReservations

      public boolean hasReservations()
      Checks whether this TransportUnit has one or more reservations.
      Returns:
      true if so
    • getState

      public String getState()
      Return the state of the TransportUnit.
      Returns:
      The current state of the TransportUnit
    • setState

      public void setState(String state)
      Set the state of the TransportUnit.
      Parameters:
      state - The state to set on the TransportUnit
    • getTransportUnitType

      public TransportUnitType getTransportUnitType()
      Return the TransportUnitType of the TransportUnit.
      Returns:
      The TransportUnitType the TransportUnit belongs to
    • setTransportUnitType

      public void setTransportUnitType(TransportUnitType transportUnitType)
      Set the TransportUnitType of the TransportUnit.
      Parameters:
      transportUnitType - The type of the TransportUnit
    • getBarcode

      public Barcode getBarcode()
      Return the Barcode of the TransportUnit.
      Returns:
      The current Barcode
    • getParent

      public TransportUnit getParent()
      Returns the parent TransportUnit.
      Returns:
      the parent.
    • setParent

      public void setParent(TransportUnit parent)
      Set a parent TransportUnit.
      Parameters:
      parent - The parent to set.
    • getChildren

      public Set<TransportUnit> getChildren()
      Get all child TransportUnits.
      Returns:
      the transportUnits.
    • addChild

      public void addChild(TransportUnit transportUnit)
      Add a TransportUnit to the children.
      Parameters:
      transportUnit - The TransportUnit to be added to the list of children
      Throws:
      IllegalArgumentException - when transportUnit is null
    • hasParent

      public boolean hasParent()
      Checks whether this TransportUnit has a parent TransportUnit or not.
      Returns:
      true it has a parent, otherwise false
    • hasChildren

      public boolean hasChildren()
      Checks whether this TransportUnit has child TransportUnits or not.
      Returns:
      true it has children, otherwise false
    • removeChild

      public void removeChild(TransportUnit transportUnit)
      Remove a TransportUnit from the list of children.
      Parameters:
      transportUnit - The TransportUnit to be removed from the list of children
      Throws:
      IllegalArgumentException - when transportUnit is null or not a child of this instance
    • toString

      public String toString()
      Return the Barcode as String.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Uses barcode for comparison.
      Overrides:
      equals in class org.ameba.integration.jpa.ApplicationEntity
    • hashCode

      public int hashCode()
      Uses barcode for calculation.
      Overrides:
      hashCode in class org.ameba.integration.jpa.ApplicationEntity