Interface TransportUnitService

All Known Implementing Classes:
TransportUnitServiceImpl

public interface TransportUnitService
A TransportService offers functionality to create, read, update and delete TransportUnits. Additionally it defines useful methods regarding the general handling with TransportUnits.
Author:
Heiko Scherrer
  • Method Details

    • create

      @NotNull @NotNull TransportUnit create(@NotBlank @NotBlank String transportUnitBK, @NotNull @NotNull TransportUnitType transportUnitType, @NotNull @NotNull LocationPK actualLocation, Boolean strict)
      Create a new TransportUnit with the type TransportUnitType placed on an initial Location. The new TransportUnit has the given Barcode as identifier.
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      transportUnitType - The type of the TransportUnit
      actualLocation - The Location where the TransportUnit is placed on
      strict - Whether the implementation shall throw an exception when a TransportUnit already exists (true) or not (false
      Returns:
      The newly created instance
    • create

      @NotNull @NotNull TransportUnit create(@NotBlank @NotBlank String transportUnitBK, @NotBlank @NotBlank String transportUnitType, @NotBlank @NotBlank String actualLocation, Boolean strict)
      Create a new TransportUnit with the TransportUnitType placed on the given actualLocation. The new TransportUnit has the given Barcode as identifier.
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit, must not be null
      transportUnitType - The type of the TransportUnit, must not be null
      actualLocation - The Location where the TransportUnit is placed on, must not be null
      strict - Whether the implementation shall throw an exception when a TransportUnit already exists (true) or not (false
      Returns:
      The newly created instance
      Throws:
      org.ameba.exception.ServiceLayerException - when invalid parameters
    • createNew

      @NotNull @NotNull TransportUnit createNew(@NotBlank @NotBlank String transportUnitType, @NotBlank @NotBlank String actualLocation)
      Create a new TransportUnit with the TransportUnitType placed on the given actualLocation. The new TransportUnit has a Barcode generated by the system.
      Parameters:
      transportUnitType - The type of the TransportUnit, must not be null
      actualLocation - The Location where the TransportUnit is placed on, must not be null
      Returns:
      The newly created instance
      Throws:
      org.ameba.exception.ServiceLayerException - when invalid parameters
    • update

      @NotNull @NotNull TransportUnit update(@NotNull @NotNull Barcode barcode, @Valid @NotNull @Valid @NotNull TransportUnit tu)
      Take the TransportUnit tu and try to update it as-is in the persistent storage.

      The implementation does not require any further checks. Assume that it tries to detach the entity class with the persistence context and save the given state.

      Parameters:
      barcode - The business identifier of the TransportUnit
      tu - The TransportUnit instance to save
      Returns:
      The updated instance
    • moveTransportUnit

      @NotNull @NotNull TransportUnit moveTransportUnit(@NotNull @NotNull Barcode barcode, @NotBlank @NotBlank String targetLocation)
      Move a TransportUnit identified by its Barcode to the Location identified by the given targetLocationPK.
      Parameters:
      barcode - The business identifier of the TransportUnit
      targetLocation - Unique identifier of the target Location, either the LocationID, ERPCode or PLCCode
      Returns:
      The moved instance
    • changeTarget

      @NotNull @NotNull TransportUnit changeTarget(@NotNull @NotNull Barcode barcode, @NotBlank @NotBlank String targetLocationId)
      Change the target of the TransportUnit identified with its barcode to the Location identified by the targetLocationId.
      Parameters:
      barcode - The business identifier of the TransportUnit
      targetLocationId - The LocationPK or null to reset the current target
    • deleteTransportUnits

      void deleteTransportUnits(@NotNull @NotNull List<TransportUnit> transportUnits)
      Delete already persisted TransportUnits from the persistent storage. It is not allowed in every case to delete a TransportUnit, potentially an active TransportOrder could exist or Inventory is still linked with one of the transportUnits.
      Parameters:
      transportUnits - A collection of TransportUnits to delete
    • delete

      void delete(@NotBlank @NotBlank String pKey)
      Delete a TransportUnit after requesting all parties for removal.
      Parameters:
      pKey - The persistent key
    • findByBarcode

      @NotNull @NotNull TransportUnit findByBarcode(@NotBlank @NotBlank String transportUnitBK)
      Find and return a TransportUnit by it's transportUnitBK.
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      Returns:
      The TransportUnit
      Throws:
      org.ameba.exception.NotFoundException - may throw if not found
    • findByBarcodes

      @NotNull @NotNull List<TransportUnit> findByBarcodes(@NotEmpty @NotEmpty List<Barcode> barcodes)
      Find and return all TransportUnits identified by their particular Barcode.
      Parameters:
      barcodes - A list of business identifiers of the TransportUnits
      Returns:
      A List of TransportUnits or an empty List, never null
    • findOnLocation

      @NotNull @NotNull List<TransportUnit> findOnLocation(@NotBlank @NotBlank String actualLocation)
      Find and return all TransportUnits that are located on the Location identified by the given actualLocation.
      Parameters:
      actualLocation - The Location where the TransportUnits are placed on
      Returns:
      All TransportUnits or an empty List, never null
    • findByPKey

      @NotNull @NotNull TransportUnit findByPKey(@NotBlank @NotBlank String pKey)
      Find and return a TransportUnit identified by the given pKey.
      Parameters:
      pKey - The persistent key
      Returns:
      The instance, never null
      Throws:
      org.ameba.exception.NotFoundException - may throw if not found
    • addError

      void addError(@NotBlank @NotBlank String transportUnitBK, @NotNull @NotNull UnitError errorCode)
      Add an error to a TransportUnit.
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      errorCode - The errorCode bitmap
    • findAll

      @NotNull @NotNull List<TransportUnit> findAll()
      Find and return all existing TransportUnits.
      Returns:
      a List of all existing or an empty List but never null
    • setState

      void setState(@NotBlank @NotBlank String transportUnitBK, @NotBlank @NotBlank String state)
      Change the state of a TransportUnit.
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      state - The desired state
      Throws:
      StateChangeException - if change is not allowed
    • synchronizeTransportUnits

      void synchronizeTransportUnits()
      Trigger a synchronization of TransportUnits.