Class TransportUnitServiceImpl

java.lang.Object
org.openwms.common.transport.impl.TransportUnitServiceImpl
All Implemented Interfaces:
TransportUnitService

@Validated @TxService class TransportUnitServiceImpl extends Object implements TransportUnitService
A TransportUnitServiceImpl is a Spring managed bean that deals with TransportUnits.
Author:
Heiko Scherrer
  • Field Details

  • Constructor Details

  • Method Details

    • create

      @Measured @NotNull public @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.
      Specified by:
      create in interface TransportUnitService
      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

      @Measured @NotNull public @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.
      Specified by:
      create in interface TransportUnitService
      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
    • createNew

      @Measured @NotNull public @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.
      Specified by:
      createNew in interface TransportUnitService
      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
    • createInternal

      private TransportUnit createInternal(Barcode barcode, String transportUnitType, Boolean strict, Supplier<Location> locationResolver)
    • update

      @Validated(Update.class) @Measured @NotNull public @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.

      Specified by:
      update in interface TransportUnitService
      Parameters:
      barcode - The business identifier of the TransportUnit
      tu - The TransportUnit instance to save
      Returns:
      The updated instance
    • approveMove

      private void approveMove(TransportUnit transportUnit, Location newLocation)
    • moveInternal

      private TransportUnit moveInternal(TransportUnit transportUnit, Location target)
    • moveTransportUnit

      @Measured @NotNull public @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.
      Specified by:
      moveTransportUnit in interface TransportUnitService
      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
    • deleteTransportUnits

      @Measured public 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.
      Specified by:
      deleteTransportUnits in interface TransportUnitService
      Parameters:
      transportUnits - A collection of TransportUnits to delete
    • delete

      @Measured public void delete(String pKey)
      Delete a TransportUnit after requesting all parties for removal.
      Specified by:
      delete in interface TransportUnitService
      Parameters:
      pKey - The persistent key
    • onEvent

      @Transactional(propagation=MANDATORY) @EventListener public void onEvent(TUCommand command)
    • deleteDefinitely

      private void deleteDefinitely(String pKey)
    • delete

      private void delete(TransportUnit transportUnit)
    • findByBarcode

      @Measured @NotNull public @NotNull TransportUnit findByBarcode(@NotBlank @NotBlank String transportUnitBK)
      Find and return a TransportUnit by it's transportUnitBK.
      Specified by:
      findByBarcode in interface TransportUnitService
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      Returns:
      The TransportUnit
    • findByBarcodeInternal

      private TransportUnit findByBarcodeInternal(Barcode barcode)
    • findByBarcodes

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

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

      @Measured @NotNull public @NotNull TransportUnit findByPKey(@NotBlank @NotBlank String pKey)
      Find and return a TransportUnit identified by the given pKey.
      Specified by:
      findByPKey in interface TransportUnitService
      Parameters:
      pKey - The persistent key
      Returns:
      The instance, never null
    • findByPKeyInternal

      private TransportUnit findByPKeyInternal(String pKey)
    • addError

      @Measured public void addError(@NotBlank @NotBlank String transportUnitBK, @NotNull @NotNull UnitError unitError)
      Add an error to a TransportUnit.
      Specified by:
      addError in interface TransportUnitService
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      unitError - The errorCode bitmap
    • findAll

      @Measured @NotNull public @NotNull List<TransportUnit> findAll()
      Find and return all existing TransportUnits.
      Specified by:
      findAll in interface TransportUnitService
      Returns:
      a List of all existing or an empty List but never null
    • changeTarget

      @Measured public TransportUnit changeTarget(@NotNull @NotNull Barcode barcode, @NotBlank @NotBlank String targetLocation)
      Change the target of the TransportUnit identified with its barcode to the Location identified by the targetLocationId.
      Specified by:
      changeTarget in interface TransportUnitService
      Parameters:
      barcode - The business identifier of the TransportUnit
      targetLocation - The LocationPK or null to reset the current target
    • setState

      @Measured public void setState(@NotBlank @NotBlank String transportUnitBK, @NotBlank @NotBlank String newState)
      Change the state of a TransportUnit.
      Specified by:
      setState in interface TransportUnitService
      Parameters:
      transportUnitBK - The business identifier of the TransportUnit
      newState - The desired state
    • approveStateChange

      private void approveStateChange(TransportUnit transportUnit, String newState)
    • synchronizeTransportUnits

      @Measured public void synchronizeTransportUnits()
      Trigger a synchronization of TransportUnits.
      Specified by:
      synchronizeTransportUnits in interface TransportUnitService