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 LocationTheLocationthePackagingUnitis placed on.private BooleanIs thePackagingUnitmarked for deletion?private @NotNull AvailabilityStateAvailability state of thisPackagingUnit.Arbitrary detail information on thisPackagingUnit.private DimensionThe current dimension of thePackagingUnit.private ZonedDateTimeThe expiration date of this particularPackagingUnit.private DateThe first-in-first-out date is used to control the allocation strategy.APackagingUnitcan have arbitrary labels assigned.private static final Stringprivate LoadUnitThe carryingLoadUnit.private static final Stringprivate StringThe business key referring to a definedLot.private MessageA message placed on thePackagingUnit.private Set<PackagingUnit> ChildPackagingUnits.private PackagingUnitParentPackagingUnit.Some hint where to find thePackagingUnitwithin its container.private ZonedDateTimeThe production date of this particularPackagingUnit.private ProductThe packagedProduct.private static final Stringprivate @NotNull org.openwms.core.units.api.Measurable<?, ?, ?> The current quantity of thisPackagingUnit.private static final Stringprivate List<Reservation> Tracks all activeReservations on thisPackagingUnit.private StringA non-unique serial number, that might be null in projects.private final TimeProviderprivate UomRelationDescribed in what kind of UOM thePackagingUnitis stored in.private org.openwms.core.units.api.WeightThe current weight of thePackagingUnit.Fields inherited from class org.ameba.integration.jpa.ApplicationEntity
C_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDear 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 TypeMethodDescriptionbooleanaddReservation(Reservation reservation) private voidvoidvoidboolean- Not the timeProvider - Not the packagingUnits - Not the reservationsGet the actualLocation.getAlive()Get the availabilityState.Get the details.Get the current dimension.When thePackagingUnitis 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 childPackagingUnits.Get the parentPackagingUnit.Get the physicalPosition.Get the date when thePackagingUnithas been produced.Get the product.org.openwms.core.units.api.Measurableorg.openwms.core.units.api.MeasurableGet the quantity.Get the reservation.getReservedBy(String reservationId) Checks whether thisPackagingUnitis reserved by someone with thereservationId.Get the serialNumber.org.openwms.core.units.api.WeightGet the current weight.booleanbooleaninthashCode()- Not the timeProvider - Not the packagingUnits - Not the reservationsbooleanChecks if thePackagingUnithas aLoadUnitassigned.booleanWhether thePackagingUnithas a parent or not.booleanChecks whether thisPackagingUnithas reservations or not.booleanprivate voidinitFifoDate(Date fifoDate) Set the fifoDate if not already initialized.booleanisEmpty()Check whether thisPackagingUnithas a quantity less than 1.booleanisReservedBy(String reservationId) Checks whether thisPackagingUnitis reserved by someone with thereservationId.@jakarta.validation.Valid booleanisValid()voidkill()makeSplitPU(org.openwms.core.units.api.Measurable newQuantity, Product product) makeSplitPU(LoadUnit loadUnit, org.openwms.core.units.api.Measurable qtyPicked, Product product) booleanremoveReservation(Reservation reservation) voidsetActualLocation(Location actualLocation) Set or override the actualLocation.voidvoidsetAvailabilityState(AvailabilityState availabilityState) Set or override the availabilityState.voidsetDetails(Map<String, String> details) voidsetDimension(Dimension dimension) Set or override the dimension.voidsetExpiresAt(ZonedDateTime expiresAt) Set the expiration date of thePackagingUnit.voidsetFifoDate(Date fifoDate) Set or override the fifoDate.voidSet the labels on thePackagingUnit.voidsetLoadUnit(LoadUnit loadUnit) Set or override theLoadUnitthisPackagingUnitis stored in.voidSet or override the persistent key of theLot.voidsetMessage(Message message) Set or override aMessage.voidsetPackagingUnits(Set<PackagingUnit> packagingUnits) Set thePackagingUnit.voidsetParent(PackagingUnit parent) Set the parent.voidsetPhysicalPosition(String physicalPosition) Set the physicalPosition.voidsetProducedAt(ZonedDateTime producedAt) Set the production date of thePackagingUnit.voidsetProduct(Product product) Set or override theProduct.voidsetQuantity(org.openwms.core.units.api.Measurable qty) Set or override the quantity.voidsetReservations(List<Reservation> reservations) Set or override reservations on thisPackagingUnit.voidsetSerialNumber(String serialNumber) Set or override the serialNumber.voidsetUomRelation(UomRelation uomRelation) voidsetWeight(org.openwms.core.units.api.Weight weight) Set or override the weight.toString()- Not the timeProvider - Not the packagingUnits - Not the reservationsvoidunbindFromLoadUnit(Location newLocation) voidvalidate()Methods inherited from class org.ameba.integration.jpa.ApplicationEntity
getPersistentKey, hasPersistentKey, onEntityPersist, onPersist, setPersistentKeyMethods inherited from class org.ameba.integration.jpa.BaseEntity
getCreatedBy, getCreateDt, getLastModifiedBy, getLastModifiedDt, getOl, getPk, isNew, setCreatedBy, setCreateDt, setLastModifiedBy, setLastModifiedDt, 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 thePackagingUnitwithin its container. -
product
The packagedProduct. -
serialNumber
A non-unique serial number, that might be null in projects. Non-unique because aPackagingUnitcan 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. TheLotmay 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
APackagingUnitcan have arbitrary labels assigned. -
quantity
@NotNull private @NotNull org.openwms.core.units.api.Measurable<?,?, quantity?> The current quantity of thisPackagingUnit. -
reservations
Tracks all activeReservations 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
TheLocationthePackagingUnitis 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 thePackagingUnitmarked for deletion? -
parent
ParentPackagingUnit. -
uomRelation
Described in what kind of UOM thePackagingUnitis stored in. -
packagingUnits
ChildPackagingUnits. -
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
public PackagingUnit makeSplitPU(org.openwms.core.units.api.Measurable newQuantity, Product product) -
assignInitialValues
-
addReservation
-
removeReservation
-
getQtyAvailable
public org.openwms.core.units.api.Measurable getQtyAvailable() -
isEmpty
public boolean isEmpty()Check whether thisPackagingUnithas a quantity less than 1.- Returns:
- true if so, otherwise false
-
hasActualLocation
public boolean hasActualLocation() -
isValid
@Valid public @jakarta.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 thePackagingUnitis going to expire.- Returns:
- As date
-
setExpiresAt
Set the expiration date of thePackagingUnit.- Parameters:
expiresAt- As date
-
getProducedAt
Get the date when thePackagingUnithas 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 thisPackagingUnithas 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 thisPackagingUnitis reserved by someone with thereservationId.- Parameters:
reservationId- Compared against the reservation.reservedBy field- Returns:
- true if it matches
-
isReservedBy
Checks whether thisPackagingUnitis 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 thePackagingUnithas aLoadUnitassigned.- Returns:
- true if so
-
setLoadUnit
Set or override theLoadUnitthisPackagingUnitis 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 thePackagingUnithas a parent or not.- Returns:
- true if it has a parent
-
setParent
Set the parent.- Parameters:
parent- May also be null
-
getPackagingUnits
Get the childPackagingUnits.- 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:
equalsin classorg.ameba.integration.jpa.ApplicationEntity
-
hashCode
public int hashCode()- Not the timeProvider - Not the packagingUnits - Not the reservations- Overrides:
hashCodein classorg.ameba.integration.jpa.ApplicationEntity
-
toString
- Not the timeProvider - Not the packagingUnits - Not the reservations -
validate
public void validate() -
completeBeforeCreation
-