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 Details

  • Constructor Details

    • PackagingUnit

      protected PackagingUnit()
      Dear JPA...
    • PackagingUnit

      public PackagingUnit(LoadUnit lu, org.openwms.core.units.api.Measurable qty)
      Create a PackagingUnit with the quantity of qty and the Product taken from the lu.
      Parameters:
      lu - The LoadUnit where this PackingUnit is stored in
      qty - The quantity
    • PackagingUnit

      public PackagingUnit(LoadUnit lu, org.openwms.core.units.api.Measurable qty, Product product)
      Create a PackagingUnit with the quantity of qty and the Product within the given LoadUnit.
      Parameters:
      lu - The LoadUnit where this PackingUnit is stored in
      qty - The quantity
      product - The Product
    • PackagingUnit

      public PackagingUnit(org.openwms.core.units.api.Measurable qty, Product product)
      Create a PackagingUnit with the quantity of qty and the Product.
      Parameters:
      qty - The quantity
      product - 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 qtyPicked, Product product)
    • assignInitialValues

      private void assignInitialValues(LoadUnit lu)
    • addReservation

      public boolean addReservation(Reservation reservation)
    • removeReservation

      public boolean removeReservation(Reservation reservation)
    • getQtyAvailable

      public org.openwms.core.units.api.Measurable getQtyAvailable()
    • hasActualLocation

      public boolean hasActualLocation()
    • isValid

      @Valid public @javax.validation.Valid boolean isValid()
    • getPhysicalPosition

      public String getPhysicalPosition()
      Get the physicalPosition.
      Returns:
      The physicalPosition
    • setPhysicalPosition

      public void setPhysicalPosition(String physicalPosition)
      Set the physicalPosition.
      Parameters:
      physicalPosition - The physicalPosition
    • getProduct

      public Product getProduct()
      Get the product.
      Returns:
      the product.
    • setProduct

      public void setProduct(Product product)
      Set or override the Product.
      Parameters:
      product - The product to set
    • getSerialNumber

      public String getSerialNumber()
      Get the serialNumber.
      Returns:
      The serialNumber or null
    • setSerialNumber

      public void setSerialNumber(String serialNumber)
      Set or override the serialNumber.
      Parameters:
      serialNumber - The serialNumber to set
    • getLotId

      public String getLotId()
      Get the persistent key of the Lot.
      Returns:
      The persistent key or null
    • setLotId

      public void setLotId(String lotPKey)
      Set or override the persistent key of the Lot.
      Parameters:
      lotPKey - The persistent key of the Lot
    • getExpiresAt

      public ZonedDateTime getExpiresAt()
      When the PackagingUnit is going to expire.
      Returns:
      As date
    • setExpiresAt

      public void setExpiresAt(ZonedDateTime expiresAt)
      Set the expiration date of the PackagingUnit.
      Parameters:
      expiresAt - As date
    • getProducedAt

      public ZonedDateTime getProducedAt()
      Get the date when the PackagingUnit has been produced.
      Returns:
      As date
    • setProducedAt

      public void setProducedAt(ZonedDateTime producedAt)
      Set the production date of the PackagingUnit.
      Parameters:
      producedAt - As date
    • getLabels

      public List<String> getLabels()
      Get the labels assigned to the PackagingUnit.
      Returns:
      As a list of strings
    • setLabels

      public void setLabels(List<String> labels)
      Set the labels on the PackagingUnit.
      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

      public List<Reservation> getReservations()
      Get the reservation.
      Returns:
      Or null if not reserved
    • hasReservations

      public boolean hasReservations()
      Checks whether this PackagingUnit has reservations or not.
      Returns:
      true if it has reservations on it otherwise false
    • setReservations

      public void setReservations(List<Reservation> reservations)
      Set or override reservations on this PackagingUnit.
      Parameters:
      reservations - The reservations to set
    • getReservedBy

      public Optional<Reservation> getReservedBy(String reservationId)
      Checks whether this PackagingUnit is reserved by someone with the reservationId.
      Parameters:
      reservationId - Compared against the reservation.reservedBy field
      Returns:
      true if it matches
    • isReservedBy

      public boolean isReservedBy(String reservationId)
      Checks whether this PackagingUnit is reserved by someone with the reservationId.
      Parameters:
      reservationId - Compared against the reservation.reservedBy field
      Returns:
      true if it matches
    • getAvailabilityState

      public AvailabilityState getAvailabilityState()
      Get the availabilityState.
      Returns:
      the availabilityState
    • hasAvailabilityState

      public boolean hasAvailabilityState()
    • setAvailabilityState

      public void setAvailabilityState(AvailabilityState availabilityState)
      Set or override the availabilityState.
      Parameters:
      availabilityState - The availabilityState to set
    • getFifoDate

      public Date getFifoDate()
      Get the fifoDate.
      Returns:
      the fifoDate or null
    • setFifoDate

      public void setFifoDate(Date fifoDate)
      Set or override the fifoDate.
      Parameters:
      fifoDate - The fifoDate
    • initFifoDate

      private void initFifoDate(Date fifoDate)
      Set the fifoDate if not already initialized.
      Parameters:
      fifoDate - The fifoDate
    • getLoadUnit

      public LoadUnit getLoadUnit()
      Get the LoadUnit.
      Returns:
      the loadUnit or null
    • hasLoadUnit

      public boolean hasLoadUnit()
      Checks if the PackagingUnit has a LoadUnit assigned.
      Returns:
      true if so
    • setLoadUnit

      public void setLoadUnit(LoadUnit loadUnit)
      Set or override the LoadUnit this PackagingUnit is stored in.
      Parameters:
      loadUnit - The LoadUnit instance
    • unbindFromLoadUnit

      public void unbindFromLoadUnit(Location newLocation)
      Set the assigned LoadUnit to null and the PackagingUnit to the given newLocation.
    • getActualLocation

      public Location getActualLocation()
      Get the actual Location.
      Returns:
      The actual Location
    • setActualLocation

      public void setActualLocation(Location actualLocation)
      Set or override the actual Location.
      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

      public Dimension getDimension()
      Get the current dimension.
      Returns:
      The dimension
    • setDimension

      public void setDimension(Dimension dimension)
      Set or override the dimension.
      Parameters:
      dimension - The dimension to set
    • getMessage

      public Message getMessage()
      Get the current Message.
      Returns:
      The message
    • setMessage

      public void setMessage(Message message)
      Set or override a Message.
      Parameters:
      message - The message
    • getAlive

      public Boolean getAlive()
    • setAlive

      public void setAlive(Boolean alive)
    • kill

      public void kill()
    • getUomRelation

      public UomRelation getUomRelation()
    • hasUomRelation

      public boolean hasUomRelation()
    • setUomRelation

      public void setUomRelation(UomRelation uomRelation)
    • getParent

      public PackagingUnit getParent()
      Get the parent PackagingUnit.
      Returns:
      The parent instance or null
    • hasParent

      public boolean hasParent()
      Whether the PackagingUnit has a parent or not.
      Returns:
      true if it has a parent
    • setParent

      public void setParent(PackagingUnit parent)
      Set the parent.
      Parameters:
      parent - May also be null
    • getPackagingUnits

      public Set<PackagingUnit> getPackagingUnits()
      Get the child PackagingUnits.
      Returns:
      All children or null
    • setPackagingUnits

      public void setPackagingUnits(Set<PackagingUnit> packagingUnits)
      Set the PackagingUnit.
      Parameters:
      packagingUnits - May also be null
    • getDetails

      public Map<String,String> getDetails()
      Get the details.
      Returns:
      As Map of Strings
    • setDetails

      public void setDetails(Map<String,String> details)
    • equals

      public boolean equals(Object o)
      - Not the timeProvider - Not the packagingUnits - Not the reservations
      Overrides:
      equals in class org.ameba.integration.jpa.ApplicationEntity
    • hashCode

      public int hashCode()
      - Not the timeProvider - Not the packagingUnits - Not the reservations
      Overrides:
      hashCode in class org.ameba.integration.jpa.ApplicationEntity
    • toString

      public String toString()
      - Not the timeProvider - Not the packagingUnits - Not the reservations
      Overrides:
      toString in class Object
    • validate

      public void validate()
    • completeBeforeCreation

      public void completeBeforeCreation(Date now)