Package org.openwms.tms.impl
Class TransportationServiceImpl
java.lang.Object
org.openwms.tms.impl.TransportationServiceImpl
- All Implemented Interfaces:
TransportationService<TransportOrder>
@TxService
class TransportationServiceImpl
extends Object
implements TransportationService<TransportOrder>
A TransportationServiceImpl is a Spring managed transactional service.
- Author:
- Heiko Scherrer
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.springframework.context.ApplicationContext
private static final org.slf4j.Logger
private final TransportOrderRepository
<TransportOrder, Long> private final StateManager
private final List
<TargetResolver<org.openwms.common.location.api.TargetVO>> private final org.ameba.i18n.Translator
private final List
<UpdateFunction> -
Constructor Summary
ConstructorDescriptionTransportationServiceImpl
(org.ameba.i18n.Translator translator, TransportOrderRepository<TransportOrder, Long> repository, org.springframework.context.ApplicationContext ctx, StateManager stateManager, List<UpdateFunction> updateFunctions, List<TargetResolver<org.openwms.common.location.api.TargetVO>> targetResolvers) -
Method Summary
Modifier and TypeMethodDescriptionchange
(String barcode, TransportOrderState currentState, TransportOrderState targetState, Message message) change
(TransportOrderState state, Collection<String> pKeys) Try to turn a list ofTransportOrder
s into the givenstate
.Create a newTransportOrder
with the giventarget
.private TransportOrder
@NotNull TransportOrder
findByPKey
(@NotBlank String pKey) Find and return theTransportOrder
identified by the persisted keypKey
.int
getNoTransportOrdersToTarget
(String target, String... states) update
(TransportOrder transportOrder) Modifies an existingTransportOrder
according to the argument passed asTransportOrder
.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
translator
private final org.ameba.i18n.Translator translator -
repository
-
ctx
private final org.springframework.context.ApplicationContext ctx -
stateManager
-
updateFunctions
-
targetResolvers
-
-
Constructor Details
-
TransportationServiceImpl
TransportationServiceImpl(org.ameba.i18n.Translator translator, TransportOrderRepository<TransportOrder, Long> repository, org.springframework.context.ApplicationContext ctx, StateManager stateManager, @Autowired(required=false) List<UpdateFunction> updateFunctions, @Autowired(required=false) List<TargetResolver<org.openwms.common.location.api.TargetVO>> targetResolvers)
-
-
Method Details
-
findBy
- Specified by:
findBy
in interfaceTransportationService<TransportOrder>
- Parameters:
barcode
- The Barcode of the TransportUnitstates
- A set of TransportOrder states- Returns:
- A List of all TransportOrders, never null
-
findByPKey
Find and return theTransportOrder
identified by the persisted keypKey
.- Specified by:
findByPKey
in interfaceTransportationService<TransportOrder>
- Parameters:
pKey
- The persisted key- Returns:
- An
TransportOrder
instance
-
findBy
-
getNoTransportOrdersToTarget
- Specified by:
getNoTransportOrdersToTarget
in interfaceTransportationService<TransportOrder>
- Parameters:
target
- The target place to search TransportOrders forstates
- An array of TransportOrder states to filter TransportOrders for- Returns:
- Number of all TransportOrders in one of the
states
that are on the way to thetarget
-
create
@Transactional(propagation=REQUIRES_NEW, noRollbackFor=StateChangeException.class) @Measured public TransportOrder create(String barcode, String target, String priority) Create a newTransportOrder
with the giventarget
.Checks that all necessary data to create a TransportOrder is given, does not do any logical checks, whether a target is blocked or a
TransportOrder
for theTransportUnit
exist.- Specified by:
create
in interfaceTransportationService<TransportOrder>
- Parameters:
barcode
- The ID of theTransportUnit
to movetarget
- The target of the TransportOrder to move topriority
- APriorityLevel
of the newTransportOrder
- Returns:
- The newly created
TransportOrder
- Throws:
org.ameba.exception.NotFoundException
- when the barcode is null or no transportunit with barcode can be found or no target can be found.
-
update
Modifies an existingTransportOrder
according to the argument passed asTransportOrder
.- Specified by:
update
in interfaceTransportationService<TransportOrder>
- Parameters:
transportOrder
- Stores the ID of theTransportOrder
to change as well as the state to change- Returns:
- The modified instance
-
change
Try to turn a list ofTransportOrder
s into the givenstate
.- Specified by:
change
in interfaceTransportationService<TransportOrder>
- Parameters:
state
- The state to change all orders topKeys
- The persisted keys ofTransportOrder
s- Returns:
- A list of persisted keys of
TransportOrder
s that have not been changed
-
change
@Measured public Collection<Message> change(String barcode, TransportOrderState currentState, TransportOrderState targetState, Message message) - Specified by:
change
in interfaceTransportationService<TransportOrder>
- Parameters:
barcode
- The ID of theTransportUnit
to movecurrentState
- The state of TransportOrders to changetargetState
- The state to change all orders tomessage
- A messages attached to the changed TransportOrder, may be null- Returns:
- A list of Messages according to the
TransportOrder
s that have not been changed
-