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
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 Summary
FieldsModifier and TypeFieldDescriptionprivate LocationThe currentLocationof theTransportUnit.private LocalDateTimeDate when theTransportUnithas been moved to the currentLocation.private BarcodeUnique natural key.private Set<TransportUnit> A set of all childTransportUnits, ordered by id.private BooleanIndicates whether theTransportUnitis empty or not (nullable).A List of errors occurred on theTransportUnit.private StringATransportUnitmay belong to a group ofTransportUnits.private LocalDateTimeDate of last inventory check.private StringTheUserwho performed the last inventory action on theTransportUnit.private TransportUnitOwningTransportUnit.private List<TransportUnitReservation> Tracks all activeTransportUnitReservations on thisTransportUnit.private StringState of theTransportUnit.private LocationThe targetLocationof theTransportUnit.private TransportUnitTypeTheTransportUnitTypeof theTransportUnit.private org.openwms.core.units.api.WeightWeight of theTransportUnit.Fields inherited from class org.ameba.integration.jpa.ApplicationEntity
C_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDear JPA...TransportUnit(@NotNull Barcode barcode) TransportUnit(@NotNull Barcode barcode, @NotNull TransportUnitType transportUnitType, @NotNull Location actualLocation) Create a newTransportUnitwith an uniqueBarcode. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(TransportUnit transportUnit) Add aTransportUnitto the children.Add an error to theTransportUnit.booleanUses barcode for comparison.Get the actualLocationof theTransportUnit.Returns the date when theTransportUnitmoved to the actualLocation.Return theBarcodeof theTransportUnit.Get all childTransportUnits.getEmpty()Indicates whether theTransportUnitis 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.intNumber ofTransportUnits belonging to theTransportUnit.Returns the parentTransportUnit.getState()Return the state of theTransportUnit.Get the targetLocationof theTransportUnit.Return theTransportUnitTypeof theTransportUnit.org.openwms.core.units.api.WeightReturns the current weight of theTransportUnit.booleanChecks whether thisTransportUnithas childTransportUnits or not.inthashCode()Uses barcode for calculation.booleanChecks whether thisTransportUnithas a parentTransportUnitor not.booleanChecks whether thisTransportUnithas one or more reservations.voidInitialize inventory info of theTransportUnit.voidremoveChild(TransportUnit transportUnit) Remove aTransportUnitfrom the list of children.voidsetActualLocation(Location actualLocation) Place theTransportUnitand all its children to aLocation.voidMarks theTransportUnitto be empty.voidsetGroupName(String groupId) Set the groupId.voidsetInventoryDate(LocalDateTime inventoryDate) Set the timestamp of the last inventory action of theTransportUnit.voidsetInventoryUser(String inventoryUser) Set the username who performed the last inventory action on theTransportUnit.voidsetParent(TransportUnit parent) Set a parentTransportUnit.voidsetPersistentKey(String pKey) Required for the Mapper.voidSet the state of theTransportUnit.voidsetTargetLocation(Location targetLocation) Set the targetLocationof theTransportUnit.voidsetTransportUnitType(TransportUnitType transportUnitType) Set theTransportUnitTypeof theTransportUnit.voidsetWeight(org.openwms.core.units.api.Weight weight) Sets the current weight of theTransportUnit.toString()Return theBarcodeas String.Methods inherited from class org.ameba.integration.jpa.ApplicationEntity
getPersistentKey, hasPersistentKey, onEntityPersist, onPersistMethods 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 theTransportUnitis empty or not (nullable). -
groupName
ATransportUnitmay belong to a group ofTransportUnits. -
actualLocationDate
Date when theTransportUnithas been moved to the currentLocation. -
weight
private org.openwms.core.units.api.Weight weightWeight of theTransportUnit. -
state
State of theTransportUnit. -
actualLocation
The currentLocationof theTransportUnit. -
targetLocation
-
transportUnitType
TheTransportUnitTypeof theTransportUnit. -
parent
OwningTransportUnit. -
inventoryUser
TheUserwho performed the last inventory action on theTransportUnit. -
inventoryDate
Date of last inventory check. -
children
A set of all childTransportUnits, ordered by id. -
errors
A List of errors occurred on theTransportUnit. -
reservations
Tracks all activeTransportUnitReservations 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 newTransportUnitwith an uniqueBarcode.- Parameters:
barcode- The unique identifier of thisTransportUnitis theBarcode- must not be nulltransportUnitType- TheTransportUnitTypeof thisTransportUnit- must not be nullactualLocation- The currentLocationof thisTransportUnit- must not be null- Throws:
IllegalArgumentException- when one of the params is null
-
-
Method Details
-
setPersistentKey
Required for the Mapper.- Overrides:
setPersistentKeyin classorg.ameba.integration.jpa.ApplicationEntity
-
getActualLocation
Get the actualLocationof theTransportUnit.- Returns:
- The
Locationwhere theTransportUnitis placed on
-
setActualLocation
Place theTransportUnitand all its children to aLocation.- Parameters:
actualLocation- The newLocationof theTransportUnitand all its children- Throws:
IllegalArgumentException- whenactualLocationis null
-
initInventory
public void initInventory()Initialize inventory info of theTransportUnit. -
getTargetLocation
Get the targetLocationof theTransportUnit. This property can not be null when an activeTransportOrderexists.- Returns:
- The target location
-
setTargetLocation
Set the targetLocationof theTransportUnit. Shall only be set in combination with an activeTransportOrder.- Parameters:
targetLocation- The targetLocationwhere thisTransportUnitshall be transported to
-
getEmpty
Indicates whether theTransportUnitis empty or not.- Returns:
- true if empty, false if not empty, null when not defined
-
setEmpty
Marks theTransportUnitto be empty.- Parameters:
empty- true to mark theTransportUnitas 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 ofTransportUnits belonging to theTransportUnit.- Returns:
- The number of all
TransportUnits belonging to this one
-
getActualLocationDate
Returns the date when theTransportUnitmoved to the actualLocation.- Returns:
- The timestamp when the
TransportUnitmoved 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- wheninventoryDateis 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- AnUnitErrorto be added- Returns:
- The key.
- Throws:
IllegalArgumentException- whenerroris null
-
hasReservations
public boolean hasReservations()Checks whether thisTransportUnithas 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 theTransportUnitTypeof theTransportUnit.- Returns:
- The
TransportUnitTypetheTransportUnitbelongs to
-
setTransportUnitType
Set theTransportUnitTypeof theTransportUnit.- Parameters:
transportUnitType- The type of theTransportUnit
-
getBarcode
Return theBarcodeof 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 childTransportUnits.- Returns:
- the transportUnits.
-
addChild
Add aTransportUnitto the children.- Parameters:
transportUnit- TheTransportUnitto be added to the list of children- Throws:
IllegalArgumentException- when transportUnit is null
-
hasParent
public boolean hasParent()Checks whether thisTransportUnithas a parentTransportUnitor not.- Returns:
trueit has a parent, otherwisefalse
-
hasChildren
public boolean hasChildren()Checks whether thisTransportUnithas childTransportUnits or not.- Returns:
trueit has children, otherwisefalse
-
removeChild
Remove aTransportUnitfrom the list of children.- Parameters:
transportUnit- TheTransportUnitto be removed from the list of children- Throws:
IllegalArgumentException- whentransportUnitis null or not a child of this instance
-
toString
Return theBarcodeas String. -
equals
Uses barcode for comparison.- Overrides:
equalsin classorg.ameba.integration.jpa.ApplicationEntity
-
hashCode
public int hashCode()Uses barcode for calculation.- Overrides:
hashCodein classorg.ameba.integration.jpa.ApplicationEntity
-