Package org.openwms.wms.inventory
Class PackagingUnit
java.lang.Object
org.ameba.integration.jpa.BaseEntity
org.ameba.integration.jpa.ApplicationEntity
org.openwms.wms.inventory.PackagingUnit
- All Implemented Interfaces:
Serializable
,org.ameba.integration.TypedEntity<Long>
@Entity
public class PackagingUnit
extends org.ameba.integration.jpa.ApplicationEntity
implements Serializable
A PackagingUnit represents a quantity of a
Product
packed into a single physical unit.- Author:
- Heiko Scherrer
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Location
TheLocation
thePackagingUnit
is placed on.private Boolean
Is thePackagingUnit
marked for deletion?private @NotNull AvailabilityState
Availability state of thisPackagingUnit
.Arbitrary detail information on thisPackagingUnit
.private Dimension
The current dimension of thePackagingUnit
.private ZonedDateTime
The expiration date of this particularPackagingUnit
.private Date
The first-in-first-out date is used to control the allocation strategy.APackagingUnit
can have arbitrary labels assigned.private static final String
private LoadUnit
The carryingLoadUnit
.private static final String
private String
The business key referring to a definedLot
.private Message
A message placed on thePackagingUnit
.private Set<PackagingUnit>
ChildPackagingUnit
s.private PackagingUnit
ParentPackagingUnit
.Some hint where to find thePackagingUnit
within its container.private ZonedDateTime
The production date of this particularPackagingUnit
.private Product
The packagedProduct
.private static final String
private @NotNull org.openwms.core.units.api.Measurable
The current quantity of thisPackagingUnit
.private static final String
private List<Reservation>
Tracks all activeReservation
s on thisPackagingUnit
.private String
A non-unique serial number, that might be null in projects.private final TimeProvider
private UomRelation
Described in what kind of UOM thePackagingUnit
is stored in.private org.openwms.core.units.api.Weight
The current weight of thePackagingUnit
.Fields inherited from class org.ameba.integration.jpa.ApplicationEntity
C_ID
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Dear JPA...PackagingUnit
(org.openwms.core.units.api.Measurable qty, Product product) PackagingUnit
(LoadUnit lu, org.openwms.core.units.api.Measurable qty) PackagingUnit
(LoadUnit lu, org.openwms.core.units.api.Measurable qty, Product product) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addReservation
(Reservation reservation) private void
void
void
boolean
- Not the timeProvider - Not the packagingUnits - Not the reservationsGet the actualLocation
.getAlive()
Get the availabilityState.Get the details.Get the current dimension.When thePackagingUnit
is going to expire.Get the fifoDate.Get the labels assigned to thePackagingUnit
.Get theLoadUnit
.getLotId()
Get the persistent key of theLot
.Get the currentMessage
.Get the childPackagingUnit
s.Get the parentPackagingUnit
.Get the physicalPosition.Get the date when thePackagingUnit
has been produced.Get the product.org.openwms.core.units.api.Measurable
org.openwms.core.units.api.Measurable
Get the quantity.Get the reservation.getReservedBy
(String reservationId) Checks whether thisPackagingUnit
is reserved by someone with thereservationId
.Get the serialNumber.org.openwms.core.units.api.Weight
Get the current weight.boolean
boolean
int
hashCode()
- Not the timeProvider - Not the packagingUnits - Not the reservationsboolean
Checks if thePackagingUnit
has aLoadUnit
assigned.boolean
Whether thePackagingUnit
has a parent or not.boolean
Checks whether thisPackagingUnit
has reservations or not.boolean
private void
initFifoDate
(Date fifoDate) Set the fifoDate if not already initialized.boolean
isReservedBy
(String reservationId) Checks whether thisPackagingUnit
is reserved by someone with thereservationId
.@javax.validation.Valid boolean
isValid()
void
kill()
makeSplitPU
(org.openwms.core.units.api.Measurable qtyPicked, Product product) makeSplitPU
(LoadUnit loadUnit, org.openwms.core.units.api.Measurable qtyPicked, Product product) boolean
removeReservation
(Reservation reservation) void
setActualLocation
(Location actualLocation) Set or override the actualLocation
.void
void
setAvailabilityState
(AvailabilityState availabilityState) Set or override the availabilityState.void
setDetails
(Map<String, String> details) void
setDimension
(Dimension dimension) Set or override the dimension.void
setExpiresAt
(ZonedDateTime expiresAt) Set the expiration date of thePackagingUnit
.void
setFifoDate
(Date fifoDate) Set or override the fifoDate.void
Set the labels on thePackagingUnit
.void
setLoadUnit
(LoadUnit loadUnit) Set or override theLoadUnit
thisPackagingUnit
is stored in.void
Set or override the persistent key of theLot
.void
setMessage
(Message message) Set or override aMessage
.void
setPackagingUnits
(Set<PackagingUnit> packagingUnits) Set thePackagingUnit
.void
setParent
(PackagingUnit parent) Set the parent.void
setPhysicalPosition
(String physicalPosition) Set the physicalPosition.void
setProducedAt
(ZonedDateTime producedAt) Set the production date of thePackagingUnit
.void
setProduct
(Product product) Set or override theProduct
.void
setQuantity
(org.openwms.core.units.api.Measurable qty) Set or override the quantity.void
setReservations
(List<Reservation> reservations) Set or override reservations on thisPackagingUnit
.void
setSerialNumber
(String serialNumber) Set or override the serialNumber.void
setUomRelation
(UomRelation uomRelation) void
setWeight
(org.openwms.core.units.api.Weight weight) Set or override the weight.toString()
- Not the timeProvider - Not the packagingUnits - Not the reservationsvoid
unbindFromLoadUnit
(Location newLocation) void
validate()
Methods inherited from class org.ameba.integration.jpa.ApplicationEntity
getPersistentKey, hasPersistentKey, onEntityPersist, onPersist, setPersistentKey
Methods inherited from class org.ameba.integration.jpa.BaseEntity
getCreatedBy, getCreateDt, getLastModifiedBy, getLastModifiedDt, getOl, getPk, isNew, setOl
-
Field Details
-
timeProvider
-
LOAD_UNIT_MUST_NOT_BE_NULL
- See Also:
-
LOCATION_MUST_NOT_BE_NULL
- See Also:
-
QUANTITY_MUST_NOT_BE_NULL
- See Also:
-
PRODUCT_MUST_NOT_BE_NULL
- See Also:
-
physicalPosition
Some hint where to find thePackagingUnit
within its container. -
product
The packagedProduct
. -
serialNumber
A non-unique serial number, that might be null in projects. Non-unique because aPackagingUnit
can be split up into multiples that share the same serial. -
lotId
The business key referring to a definedLot
. -
expiresAt
The expiration date of this particularPackagingUnit
. TheLot
may also store an expiration date that is only considered when it is not explicitly overridden on thePackagingUnit
. -
producedAt
The production date of this particularPackagingUnit
. -
labels
APackagingUnit
can have arbitrary labels assigned. -
quantity
@NotNull private @NotNull org.openwms.core.units.api.Measurable quantityThe current quantity of thisPackagingUnit
. -
reservations
Tracks all activeReservation
s on thisPackagingUnit
. -
availabilityState
Availability state of thisPackagingUnit
. -
fifoDate
The first-in-first-out date is used to control the allocation strategy. -
loadUnit
The carryingLoadUnit
. -
actualLocation
TheLocation
thePackagingUnit
is placed on. -
weight
private org.openwms.core.units.api.Weight weightThe current weight of thePackagingUnit
. -
dimension
The current dimension of thePackagingUnit
. -
message
A message placed on thePackagingUnit
. -
alive
Is thePackagingUnit
marked for deletion? -
parent
ParentPackagingUnit
. -
uomRelation
Described in what kind of UOM thePackagingUnit
is stored in. -
packagingUnits
ChildPackagingUnit
s. -
details
Arbitrary detail information on thisPackagingUnit
.
-
-
Constructor Details
-
PackagingUnit
protected PackagingUnit()Dear JPA... -
PackagingUnit
- Parameters:
lu
- The LoadUnit where this PackingUnit is stored inqty
- The quantity
-
PackagingUnit
- Parameters:
lu
- The LoadUnit where this PackingUnit is stored inqty
- The quantityproduct
- The Product
-
PackagingUnit
- Parameters:
qty
- The quantityproduct
- The Product
-
-
Method Details
-
assignPKey
public void assignPKey() -
makeSplitPU
public PackagingUnit makeSplitPU(LoadUnit loadUnit, org.openwms.core.units.api.Measurable qtyPicked, Product product) -
makeSplitPU
-
assignInitialValues
-
addReservation
-
removeReservation
-
getQtyAvailable
public org.openwms.core.units.api.Measurable getQtyAvailable() -
hasActualLocation
public boolean hasActualLocation() -
isValid
@Valid public @javax.validation.Valid boolean isValid() -
getPhysicalPosition
Get the physicalPosition.- Returns:
- The physicalPosition
-
setPhysicalPosition
Set the physicalPosition.- Parameters:
physicalPosition
- The physicalPosition
-
getProduct
Get the product.- Returns:
- the product.
-
setProduct
Set or override theProduct
.- Parameters:
product
- The product to set
-
getSerialNumber
Get the serialNumber.- Returns:
- The serialNumber or null
-
setSerialNumber
Set or override the serialNumber.- Parameters:
serialNumber
- The serialNumber to set
-
getLotId
Get the persistent key of theLot
.- Returns:
- The persistent key or null
-
setLotId
Set or override the persistent key of theLot
.- Parameters:
lotPKey
- The persistent key of the Lot
-
getExpiresAt
When thePackagingUnit
is going to expire.- Returns:
- As date
-
setExpiresAt
Set the expiration date of thePackagingUnit
.- Parameters:
expiresAt
- As date
-
getProducedAt
Get the date when thePackagingUnit
has been produced.- Returns:
- As date
-
setProducedAt
Set the production date of thePackagingUnit
.- Parameters:
producedAt
- As date
-
getLabels
Get the labels assigned to thePackagingUnit
.- Returns:
- As a list of strings
-
setLabels
Set the labels on thePackagingUnit
.- Parameters:
labels
- A list of strings to assigne
-
getQuantity
public org.openwms.core.units.api.Measurable getQuantity()Get the quantity.- Returns:
- the quantity or null
-
setQuantity
public void setQuantity(org.openwms.core.units.api.Measurable qty) Set or override the quantity.- Parameters:
qty
- The quantity to set
-
getReservations
Get the reservation.- Returns:
- Or null if not reserved
-
hasReservations
public boolean hasReservations()Checks whether thisPackagingUnit
has reservations or not.- Returns:
- true if it has reservations on it otherwise false
-
setReservations
Set or override reservations on thisPackagingUnit
.- Parameters:
reservations
- The reservations to set
-
getReservedBy
Checks whether thisPackagingUnit
is reserved by someone with thereservationId
.- Parameters:
reservationId
- Compared against the reservation.reservedBy field- Returns:
- true if it matches
-
isReservedBy
Checks whether thisPackagingUnit
is reserved by someone with thereservationId
.- Parameters:
reservationId
- Compared against the reservation.reservedBy field- Returns:
- true if it matches
-
getAvailabilityState
Get the availabilityState.- Returns:
- the availabilityState
-
hasAvailabilityState
public boolean hasAvailabilityState() -
setAvailabilityState
Set or override the availabilityState.- Parameters:
availabilityState
- The availabilityState to set
-
getFifoDate
Get the fifoDate.- Returns:
- the fifoDate or null
-
setFifoDate
Set or override the fifoDate.- Parameters:
fifoDate
- The fifoDate
-
initFifoDate
Set the fifoDate if not already initialized.- Parameters:
fifoDate
- The fifoDate
-
getLoadUnit
Get theLoadUnit
.- Returns:
- the loadUnit or null
-
hasLoadUnit
public boolean hasLoadUnit()Checks if thePackagingUnit
has aLoadUnit
assigned.- Returns:
- true if so
-
setLoadUnit
Set or override theLoadUnit
thisPackagingUnit
is stored in.- Parameters:
loadUnit
- The LoadUnit instance
-
unbindFromLoadUnit
-
getActualLocation
Get the actualLocation
.- Returns:
- The actual Location
-
setActualLocation
Set or override the actualLocation
.- Parameters:
actualLocation
- The actualLocation
-
getWeight
public org.openwms.core.units.api.Weight getWeight()Get the current weight.- Returns:
- The weight
-
setWeight
public void setWeight(org.openwms.core.units.api.Weight weight) Set or override the weight.- Parameters:
weight
- The weight to set
-
getDimension
Get the current dimension.- Returns:
- The dimension
-
setDimension
Set or override the dimension.- Parameters:
dimension
- The dimension to set
-
getMessage
Get the currentMessage
.- Returns:
- The message
-
setMessage
Set or override aMessage
.- Parameters:
message
- The message
-
getAlive
-
setAlive
-
kill
public void kill() -
getUomRelation
-
hasUomRelation
public boolean hasUomRelation() -
setUomRelation
-
getParent
Get the parentPackagingUnit
.- Returns:
- The parent instance or null
-
hasParent
public boolean hasParent()Whether thePackagingUnit
has a parent or not.- Returns:
- true if it has a parent
-
setParent
Set the parent.- Parameters:
parent
- May also be null
-
getPackagingUnits
Get the childPackagingUnit
s.- Returns:
- All children or null
-
setPackagingUnits
Set thePackagingUnit
.- Parameters:
packagingUnits
- May also be null
-
getDetails
Get the details.- Returns:
- As Map of Strings
-
setDetails
-
equals
- Not the timeProvider - Not the packagingUnits - Not the reservations- Overrides:
equals
in classorg.ameba.integration.jpa.ApplicationEntity
-
hashCode
public int hashCode()- Not the timeProvider - Not the packagingUnits - Not the reservations- Overrides:
hashCode
in classorg.ameba.integration.jpa.ApplicationEntity
-
toString
- Not the timeProvider - Not the packagingUnits - Not the reservations -
validate
public void validate() -
completeBeforeCreation
-