Package org.openwms.common.transport
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
Location
s and might carry goods or other items like LoadUnit
s 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 Summary
Modifier and TypeFieldDescriptionprivate Location
The currentLocation
of theTransportUnit
.private LocalDateTime
Date when theTransportUnit
has been moved to the currentLocation
.private Barcode
Unique natural key.private Set
<TransportUnit> A set of all childTransportUnit
s, ordered by id.private Boolean
Indicates whether theTransportUnit
is empty or not (nullable).A List of errors occurred on theTransportUnit
.private String
ATransportUnit
may belong to a group ofTransportUnits
.private LocalDateTime
Date of last inventory check.private String
TheUser
who performed the last inventory action on theTransportUnit
.private TransportUnit
OwningTransportUnit
.private List
<TransportUnitReservation> Tracks all activeTransportUnitReservation
s on thisTransportUnit
.private String
State of theTransportUnit
.private Location
The targetLocation
of theTransportUnit
.private TransportUnitType
TheTransportUnitType
of theTransportUnit
.private org.openwms.core.units.api.Weight
Weight of theTransportUnit
.Fields inherited from class org.ameba.integration.jpa.ApplicationEntity
C_ID
-
Constructor Summary
ModifierConstructorDescriptionprotected
Dear JPA...TransportUnit
(@NotNull Barcode barcode) TransportUnit
(@NotNull Barcode barcode, @NotNull TransportUnitType transportUnitType, @NotNull Location actualLocation) Create a newTransportUnit
with an uniqueBarcode
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(TransportUnit transportUnit) Add aTransportUnit
to the children.Add an error to theTransportUnit
.boolean
Uses barcode for comparison.Get the actualLocation
of theTransportUnit
.Returns the date when theTransportUnit
moved to the actualLocation.Return theBarcode
of theTransportUnit
.Get all childTransportUnit
s.getEmpty()
Indicates whether theTransportUnit
is empty or not.Get the groupId.Returns the timestamp of the last inventory check of theTransportUnit
.Returns the username of the User who performed the last inventory action on theTransportUnit
.int
Number ofTransportUnit
s belonging to theTransportUnit
.Returns the parentTransportUnit
.getState()
Return the state of theTransportUnit
.Get the targetLocation
of theTransportUnit
.Return theTransportUnitType
of theTransportUnit
.org.openwms.core.units.api.Weight
Returns the current weight of theTransportUnit
.boolean
Checks whether thisTransportUnit
has childTransportUnit
s or not.int
hashCode()
Uses barcode for calculation.boolean
Checks whether thisTransportUnit
has a parentTransportUnit
or not.boolean
Checks whether thisTransportUnit
has one or more reservations.void
Initialize inventory info of theTransportUnit
.void
removeChild
(TransportUnit transportUnit) Remove aTransportUnit
from the list of children.void
setActualLocation
(Location actualLocation) Place theTransportUnit
and all its children to aLocation
.void
Marks theTransportUnit
to be empty.void
setGroupName
(String groupId) Set the groupId.void
setInventoryDate
(LocalDateTime inventoryDate) Set the timestamp of the last inventory action of theTransportUnit
.void
setInventoryUser
(String inventoryUser) Set the username who performed the last inventory action on theTransportUnit
.void
setParent
(TransportUnit parent) Set a parentTransportUnit
.void
setPersistentKey
(String pKey) Required for the Mapper.void
Set the state of theTransportUnit
.void
setTargetLocation
(Location targetLocation) Set the targetLocation
of theTransportUnit
.void
setTransportUnitType
(TransportUnitType transportUnitType) Set theTransportUnitType
of theTransportUnit
.void
setWeight
(org.openwms.core.units.api.Weight weight) Sets the current weight of theTransportUnit
.toString()
Return theBarcode
as String.Methods inherited from class org.ameba.integration.jpa.ApplicationEntity
getPersistentKey, hasPersistentKey, onEntityPersist, onPersist
Methods inherited from class org.ameba.integration.jpa.BaseEntity
getCreatedBy, getCreateDt, getLastModifiedBy, getLastModifiedDt, getOl, getPk, isNew, setCreatedBy, setCreateDt, setLastModifiedBy, setLastModifiedDt, setOl
-
Field Details
-
barcode
Unique natural key. -
empty
Indicates whether theTransportUnit
is empty or not (nullable). -
groupName
ATransportUnit
may belong to a group ofTransportUnits
. -
actualLocationDate
Date when theTransportUnit
has been moved to the currentLocation
. -
weight
private org.openwms.core.units.api.Weight weightWeight of theTransportUnit
. -
state
State of theTransportUnit
. -
actualLocation
The currentLocation
of theTransportUnit
. -
targetLocation
-
transportUnitType
TheTransportUnitType
of theTransportUnit
. -
parent
OwningTransportUnit
. -
inventoryUser
TheUser
who performed the last inventory action on theTransportUnit
. -
inventoryDate
Date of last inventory check. -
children
A set of all childTransportUnit
s, ordered by id. -
errors
A List of errors occurred on theTransportUnit
. -
reservations
Tracks all activeTransportUnitReservation
s on thisTransportUnit
.
-
-
Constructor Details
-
TransportUnit
protected TransportUnit()Dear JPA... -
TransportUnit
-
TransportUnit
@ConstructorProperties({"barcode","transportUnitType","actualLocation"}) public TransportUnit(@NotNull @NotNull Barcode barcode, @NotNull @NotNull TransportUnitType transportUnitType, @NotNull @NotNull Location actualLocation) Create a newTransportUnit
with an uniqueBarcode
.- Parameters:
barcode
- The unique identifier of thisTransportUnit
is theBarcode
- must not be nulltransportUnitType
- TheTransportUnitType
of thisTransportUnit
- must not be nullactualLocation
- The currentLocation
of thisTransportUnit
- must not be null- Throws:
IllegalArgumentException
- when one of the params is null
-
-
Method Details
-
setPersistentKey
Required for the Mapper.- Overrides:
setPersistentKey
in classorg.ameba.integration.jpa.ApplicationEntity
-
getActualLocation
Get the actualLocation
of theTransportUnit
.- Returns:
- The
Location
where theTransportUnit
is placed on
-
setActualLocation
Place theTransportUnit
and all its children to aLocation
.- Parameters:
actualLocation
- The newLocation
of theTransportUnit
and all its children- Throws:
IllegalArgumentException
- whenactualLocation
is null
-
initInventory
public void initInventory()Initialize inventory info of theTransportUnit
. -
getTargetLocation
Get the targetLocation
of theTransportUnit
. This property can not be null when an activeTransportOrder
exists.- Returns:
- The target location
-
setTargetLocation
Set the targetLocation
of theTransportUnit
. Shall only be set in combination with an activeTransportOrder
.- Parameters:
targetLocation
- The targetLocation
where thisTransportUnit
shall be transported to
-
getEmpty
Indicates whether theTransportUnit
is empty or not.- Returns:
- true if empty, false if not empty, null when not defined
-
setEmpty
Marks theTransportUnit
to be empty.- Parameters:
empty
- true to mark theTransportUnit
as empty, false to mark it as not empty and null for no definition
-
getGroupName
Get the groupId.- Returns:
- The groupId
-
setGroupName
Set the groupId.- Parameters:
groupId
- The groupId
-
getInventoryUser
Returns the username of the User who performed the last inventory action on theTransportUnit
.- Returns:
- The username who did the last inventory check
-
setInventoryUser
Set the username who performed the last inventory action on theTransportUnit
.- Parameters:
inventoryUser
- The username who did the last inventory check
-
getNoTransportUnits
public int getNoTransportUnits()Number ofTransportUnit
s belonging to theTransportUnit
.- Returns:
- The number of all
TransportUnit
s belonging to this one
-
getActualLocationDate
Returns the date when theTransportUnit
moved to the actualLocation.- Returns:
- The timestamp when the
TransportUnit
moved the last time
-
getInventoryDate
Returns the timestamp of the last inventory check of theTransportUnit
.- Returns:
- The timestamp of the last inventory check of the
TransportUnit
.
-
setInventoryDate
Set the timestamp of the last inventory action of theTransportUnit
.- Parameters:
inventoryDate
- The timestamp of the last inventory check- Throws:
IllegalArgumentException
- wheninventoryDate
is null
-
getWeight
public org.openwms.core.units.api.Weight getWeight()Returns the current weight of theTransportUnit
.- Returns:
- The current weight of the
TransportUnit
-
setWeight
public void setWeight(org.openwms.core.units.api.Weight weight) Sets the current weight of theTransportUnit
.- Parameters:
weight
- The current weight of theTransportUnit
-
getErrors
-
addError
Add an error to theTransportUnit
.- Parameters:
error
- AnUnitError
to be added- Returns:
- The key.
- Throws:
IllegalArgumentException
- whenerror
is null
-
hasReservations
public boolean hasReservations()Checks whether thisTransportUnit
has one or more reservations.- Returns:
- true if so
-
getState
Return the state of theTransportUnit
.- Returns:
- The current state of the
TransportUnit
-
setState
Set the state of theTransportUnit
.- Parameters:
state
- The state to set on theTransportUnit
-
getTransportUnitType
Return theTransportUnitType
of theTransportUnit
.- Returns:
- The
TransportUnitType
theTransportUnit
belongs to
-
setTransportUnitType
Set theTransportUnitType
of theTransportUnit
.- Parameters:
transportUnitType
- The type of theTransportUnit
-
getBarcode
Return theBarcode
of theTransportUnit
.- Returns:
- The current
Barcode
-
getParent
Returns the parentTransportUnit
.- Returns:
- the parent.
-
setParent
Set a parentTransportUnit
.- Parameters:
parent
- The parent to set.
-
getChildren
Get all childTransportUnit
s.- Returns:
- the transportUnits.
-
addChild
Add aTransportUnit
to the children.- Parameters:
transportUnit
- TheTransportUnit
to be added to the list of children- Throws:
IllegalArgumentException
- when transportUnit is null
-
hasParent
public boolean hasParent()Checks whether thisTransportUnit
has a parentTransportUnit
or not.- Returns:
true
it has a parent, otherwisefalse
-
hasChildren
public boolean hasChildren()Checks whether thisTransportUnit
has childTransportUnit
s or not.- Returns:
true
it has children, otherwisefalse
-
removeChild
Remove aTransportUnit
from the list of children.- Parameters:
transportUnit
- TheTransportUnit
to be removed from the list of children- Throws:
IllegalArgumentException
- whentransportUnit
is null or not a child of this instance
-
toString
Return theBarcode
as String. -
equals
Uses barcode for comparison.- Overrides:
equals
in classorg.ameba.integration.jpa.ApplicationEntity
-
hashCode
public int hashCode()Uses barcode for calculation.- Overrides:
hashCode
in classorg.ameba.integration.jpa.ApplicationEntity
-