diff --git a/pom.xml b/pom.xml index d89abed4..5b54f7c5 100644 --- a/pom.xml +++ b/pom.xml @@ -66,9 +66,8 @@ 2.1.0-SNAPSHOT 2.1.0-SNAPSHOT - 30.0-jre + 32.0.0-jre 1.18.30 - 3.2 0.12.21 2021.0.8 5.6.14.Final @@ -177,12 +176,6 @@ hibernate-jpamodelgen ${hibernate-jpamodelgen.version} - - - org.objenesis - objenesis - ${objenesis.version} - org.openwms org.openwms.core.util @@ -269,6 +262,11 @@ spring-cloud-starter-bootstrap true + + org.springframework.cloud + spring-cloud-starter-bus-amqp + true + org.springframework.cloud spring-cloud-starter-config @@ -283,12 +281,6 @@ org.springframework.cloud spring-cloud-starter-openfeign true - - - commons-io - commons-io - - org.springframework.cloud @@ -349,13 +341,6 @@ dozer-core true - - - - com.google.guava - guava - true - com.h2database h2 @@ -378,12 +363,6 @@ ameba-lib true - - net.logstash.logback - logstash-logback-encoder - runtime - true - org.hibernate hibernate-jpamodelgen diff --git a/src/main/asciidoc/2-movements.adoc b/src/main/asciidoc/2-movements.adoc index 419b2cc4..2f4116a2 100644 --- a/src/main/asciidoc/2-movements.adoc +++ b/src/main/asciidoc/2-movements.adoc @@ -11,46 +11,52 @@ up or dropped off but has no assignment to the human user. The operator/user may [[movement-index]] === Movement Index The index with all possible operations on `Movements` can be retrieved with a GET request: - include::{generated}/move-index/http-request.adoc[] The response lists all the operations possible on `Movements` with a name and the corresponding href link: - include::{generated}/move-index/http-response.adoc[] [[movement-create]] === Create a Movement To create a new `Movement` a client needs to send a `POST` request to `Movements` sub resource of the primary -`TransportUnits` resource with the required data in the request body. The required data must contain the source where to -pick up the `TransportUnit` and the target where to drop it. The `TransportUnit` that shall be moved is directly +`TransportUnits` resource with the data in the request body. The required data must contain the source where to +pick up the `TransportUnit` and the target where to drop it off. The `TransportUnit` that shall be moved is directly referenced as the primary resource in the URI. - include::{generated}/move-create/http-request.adoc[] +include::{generated}/move-create/request-fields.adoc[] If the `Movement` has been created successfully, the server returns the URI to the created resource: - include::{generated}/move-create/http-response.adoc[] +include::{generated}/move-create/response-fields.adoc[] -[[movement-findForStateAndTypesAndSource]] +[[movement-findAll]] === Find all Movements -A HTTP `GET` request to the primary resource without any query parameters returns an array of all existing `Movements`. - +An HTTP `GET` request to the primary resource without any query parameters returns an array of all existing `Movements`. include::{generated}/move-find-all/http-request.adoc[] Returns in this example an array of three `Movements` or an empty array if none exist: - include::{generated}/move-find-all/http-response.adoc[] [[movement-findForStateAndTypesAndSource]] -=== Find Movements -A HTTP `GET` request to the primary resource with additional query parameters is required to find `Movements` in a -particular `state`, `type` and `source`. - -include::{generated}/order-find-all/http-request.adoc[] +=== Find Movements for a TransportUnit in States and of Types +An HTTP `GET` request to the primary resource with additional query parameters is required to find `Movements` in particular `states` of +particular `types` for a `TransportUnit` identified by its `barcode`. +include::{generated}/move-find-tuTypesStates/http-request.adoc[] +include::{generated}/move-find-tuTypesStates/request-parameters.adoc[] Returns an array of `Movements` or an empty array: +include::{generated}/move-find-tuTypesStates/http-response.adoc[] +include::{generated}/move-find-tuTypesStates/response-fields.adoc[] -include::{generated}/order-find-all/http-response.adoc[] +[[movement-findForStateAndTypesAndSource]] +=== Find Movements in State of Types and at Source +An HTTP `GET` request to the primary resource with additional query parameters is required to find `Movements` in a particular `state`, of +particular `types` and at a given `source`. +include::{generated}/move-find-stateTypesSource/http-request.adoc[] +include::{generated}/move-find-stateTypesSource/request-parameters.adoc[] + +Returns an array of `Movements` or an empty array: +include::{generated}/move-find-stateTypesSource/http-response.adoc[] [[movement-move]] === Move a Movement @@ -84,7 +90,7 @@ include::{generated}/move-cancel/http-response.adoc[] === Complete a Movement To complete a `Movement` a client needs to explicitly send the `COMPLETE` action along a `POST` request to the `Movement` resource. This completes the `Movement` and sets the target to the required `target` that is passed from the -caller in the response body. +caller in the response body. If the `Movement` has already been completed no changes are done. A valid request looks like: include::{generated}/move-complete/http-request.adoc[] diff --git a/src/main/asciidoc/api.adoc b/src/main/asciidoc/api.adoc index 29445619..0d619b09 100644 --- a/src/main/asciidoc/api.adoc +++ b/src/main/asciidoc/api.adoc @@ -11,7 +11,7 @@ Heiko Scherrer; :operation-curl-request-title: Example request :operation-http-response-title: Example response -Copyright © 2005-2023 +Copyright © 2005-2024 Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. diff --git a/src/main/java/org/openwms/common/location/LocationPK.java b/src/main/java/org/openwms/common/location/LocationPK.java index 6426e080..c7cae679 100644 --- a/src/main/java/org/openwms/common/location/LocationPK.java +++ b/src/main/java/org/openwms/common/location/LocationPK.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/common/location/package-info.java b/src/main/java/org/openwms/common/location/package-info.java index 39bc329d..990c3eb0 100644 --- a/src/main/java/org/openwms/common/location/package-info.java +++ b/src/main/java/org/openwms/common/location/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/common/package-info.java b/src/main/java/org/openwms/common/package-info.java index 919994c7..c628f825 100644 --- a/src/main/java/org/openwms/common/package-info.java +++ b/src/main/java/org/openwms/common/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/common/transport/Barcode.java b/src/main/java/org/openwms/common/transport/Barcode.java index 1459e245..302db535 100644 --- a/src/main/java/org/openwms/common/transport/Barcode.java +++ b/src/main/java/org/openwms/common/transport/Barcode.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/common/transport/TransportPackage.java b/src/main/java/org/openwms/common/transport/TransportPackage.java index 72558462..7763ca0b 100644 --- a/src/main/java/org/openwms/common/transport/TransportPackage.java +++ b/src/main/java/org/openwms/common/transport/TransportPackage.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/common/transport/package-info.java b/src/main/java/org/openwms/common/transport/package-info.java index 1cb6dde3..bc9c0a42 100644 --- a/src/main/java/org/openwms/common/transport/package-info.java +++ b/src/main/java/org/openwms/common/transport/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/TransactionBuilder.java b/src/main/java/org/openwms/transactions/api/TransactionBuilder.java index 636162cf..0d71bc32 100644 --- a/src/main/java/org/openwms/transactions/api/TransactionBuilder.java +++ b/src/main/java/org/openwms/transactions/api/TransactionBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/TransactionVO.java b/src/main/java/org/openwms/transactions/api/TransactionVO.java index a6b6d312..ea6f98ff 100644 --- a/src/main/java/org/openwms/transactions/api/TransactionVO.java +++ b/src/main/java/org/openwms/transactions/api/TransactionVO.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/ValidationGroups.java b/src/main/java/org/openwms/transactions/api/ValidationGroups.java index d8e0ac4f..efe545f8 100644 --- a/src/main/java/org/openwms/transactions/api/ValidationGroups.java +++ b/src/main/java/org/openwms/transactions/api/ValidationGroups.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApi.java b/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApi.java index f535f7e9..cc88d1a2 100644 --- a/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApi.java +++ b/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApi.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApiImpl.java b/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApiImpl.java index 48e42c86..4841b449 100644 --- a/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApiImpl.java +++ b/src/main/java/org/openwms/transactions/api/commands/AsyncTransactionApiImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/commands/NoOpAsyncTransactionApi.java b/src/main/java/org/openwms/transactions/api/commands/NoOpAsyncTransactionApi.java index e6a8a69f..6c8a5174 100644 --- a/src/main/java/org/openwms/transactions/api/commands/NoOpAsyncTransactionApi.java +++ b/src/main/java/org/openwms/transactions/api/commands/NoOpAsyncTransactionApi.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/transactions/api/commands/TransactionCommand.java b/src/main/java/org/openwms/transactions/api/commands/TransactionCommand.java index 2b856795..0415f899 100644 --- a/src/main/java/org/openwms/transactions/api/commands/TransactionCommand.java +++ b/src/main/java/org/openwms/transactions/api/commands/TransactionCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/IndexController.java b/src/main/java/org/openwms/wms/movements/IndexController.java index 06be10e1..b0252a12 100644 --- a/src/main/java/org/openwms/wms/movements/IndexController.java +++ b/src/main/java/org/openwms/wms/movements/IndexController.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/Message.java b/src/main/java/org/openwms/wms/movements/Message.java index fdfa01e4..f59eccd7 100644 --- a/src/main/java/org/openwms/wms/movements/Message.java +++ b/src/main/java/org/openwms/wms/movements/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/MovementConstants.java b/src/main/java/org/openwms/wms/movements/MovementConstants.java index f216d705..78d35483 100644 --- a/src/main/java/org/openwms/wms/movements/MovementConstants.java +++ b/src/main/java/org/openwms/wms/movements/MovementConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/MovementController.java b/src/main/java/org/openwms/wms/movements/MovementController.java index fdf0d901..b69578e4 100644 --- a/src/main/java/org/openwms/wms/movements/MovementController.java +++ b/src/main/java/org/openwms/wms/movements/MovementController.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ import javax.validation.Valid; import java.util.List; +import static java.util.Arrays.asList; import static org.openwms.wms.movements.api.MovementApi.API_MOVEMENTS; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; @@ -61,6 +62,7 @@ public ResponseEntity index() { new Index( linkTo(methodOn(MovementController.class).create("transportUnitBK", new MovementVO(), null)).withRel("movement-create"), linkTo(methodOn(MovementController.class).findAll()).withRel("movement-findAll"), + linkTo(methodOn(MovementController.class).findForTuAndTypesAndStates("transportUnitBK", asList(MovementType.INBOUND), asList("state"))).withRel("movement-findForTuAndTypesAndStates"), linkTo(methodOn(MovementController.class).findForStateAndTypesAndSource("state", "source", MovementType.INBOUND)).withRel("movement-findForStateAndTypesAndSource"), linkTo(methodOn(MovementController.class).move("pKey", new MovementVO())).withRel("movement-move"), linkTo(methodOn(MovementController.class).cancel("pKey")).withRel("movement-cancel"), @@ -113,7 +115,7 @@ public ResponseEntity> findAll(){ @GetMapping(value = API_MOVEMENTS, params = {"barcode", "types", "states"}) public ResponseEntity> findForTuAndTypesAndStates( @RequestParam("barcode") String barcode, - @RequestParam("types") List types, + @RequestParam("types") List types, @RequestParam("states") List states) { return ResponseEntity.ok(service.findForTuAndTypesAndStates(barcode, types, states)); diff --git a/src/main/java/org/openwms/wms/movements/MovementProperties.java b/src/main/java/org/openwms/wms/movements/MovementProperties.java index 5d2d0387..973b6537 100644 --- a/src/main/java/org/openwms/wms/movements/MovementProperties.java +++ b/src/main/java/org/openwms/wms/movements/MovementProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/MovementService.java b/src/main/java/org/openwms/wms/movements/MovementService.java index e73ab284..726e564d 100644 --- a/src/main/java/org/openwms/wms/movements/MovementService.java +++ b/src/main/java/org/openwms/wms/movements/MovementService.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,5 +102,5 @@ public interface MovementService { * @param states A list of states to consider * @return A list of Movements, never {@literal null} */ - @NotNull List findForTuAndTypesAndStates(@NotBlank String barcode, @NotEmpty List types, @NotEmpty List states); + @NotNull List findForTuAndTypesAndStates(@NotBlank String barcode, @NotEmpty List types, @NotEmpty List states); } diff --git a/src/main/java/org/openwms/wms/movements/MovementTarget.java b/src/main/java/org/openwms/wms/movements/MovementTarget.java index b16e94a7..bd4cf8ab 100644 --- a/src/main/java/org/openwms/wms/movements/MovementTarget.java +++ b/src/main/java/org/openwms/wms/movements/MovementTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/MovementsMessages.java b/src/main/java/org/openwms/wms/movements/MovementsMessages.java index ca11328f..140705d1 100644 --- a/src/main/java/org/openwms/wms/movements/MovementsMessages.java +++ b/src/main/java/org/openwms/wms/movements/MovementsMessages.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/api/MovementApi.java b/src/main/java/org/openwms/wms/movements/api/MovementApi.java index e39b0e69..3dc59f35 100644 --- a/src/main/java/org/openwms/wms/movements/api/MovementApi.java +++ b/src/main/java/org/openwms/wms/movements/api/MovementApi.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/api/MovementState.java b/src/main/java/org/openwms/wms/movements/api/MovementState.java index 85dae377..a5672039 100644 --- a/src/main/java/org/openwms/wms/movements/api/MovementState.java +++ b/src/main/java/org/openwms/wms/movements/api/MovementState.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/api/MovementType.java b/src/main/java/org/openwms/wms/movements/api/MovementType.java index a3d6cb04..41cf0a2e 100644 --- a/src/main/java/org/openwms/wms/movements/api/MovementType.java +++ b/src/main/java/org/openwms/wms/movements/api/MovementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/api/MovementVO.java b/src/main/java/org/openwms/wms/movements/api/MovementVO.java index 96803131..4eb01c4f 100644 --- a/src/main/java/org/openwms/wms/movements/api/MovementVO.java +++ b/src/main/java/org/openwms/wms/movements/api/MovementVO.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import lombok.ToString; import org.ameba.http.AbstractBase; -import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.time.ZonedDateTime; @@ -51,49 +51,69 @@ public class MovementVO extends AbstractBase implements Serializable /** The persistent key is returned from the service as soon as the {@code Movement} has been created. */ @JsonProperty("pKey") private String persistentKey; - /** The business key of the {@code TransportUnit} to move. */ + + /** The business key of the {@code TransportUnit}. */ @JsonProperty("transportUnitBk") private String transportUnitBk; - /** The type of {@code Movement} must be passed by the caller. */ + + /** The type of {@code Movement}. */ @JsonProperty("type") // Not required at creation because it can be resolved from the TU and the target private MovementType type; + /** Initiator of the {@code Movement}, who ordered or triggered it. */ @JsonProperty("initiator") private String initiator; + /** Whether the {@code Movement} should be directly processed (AUTOMATIC) or delayed (MANUAL). */ @JsonProperty("mode") private StartMode startMode = StartMode.AUTOMATIC; + + /** Refers to the demanded {@code Product} for that the {@code Movement} has been created. */ @JsonProperty("sku") private String sku; - /** A priority how fast and prio the {@code Movement} needs to be processed; A higher value means less prio than lower values. */ + + /** A priority how fast the {@code Movement} needs to be processed; A higher value means less prior than lower values. */ @JsonProperty("priority") private Integer priority; - /** The state of the {@code Movement}. */ + + /** The current state of the {@code Movement}. */ @JsonProperty("state") - @NotEmpty(groups = Move.class) + @NotBlank(groups = Move.class) private String state; - /** The source {@code Location} where the {@code TransportUnit} shall be picked up (must be passed by the caller). */ + + /** The source {@code Location} where the {@code TransportUnit} shall be picked up. */ @JsonProperty("sourceLocation") - @NotEmpty(groups = {Create.class, Move.class}) + @NotBlank(groups = {Create.class, Move.class}) private String sourceLocation; - /** The {@code LocationGroup} the {@code sourceLocation} belongs to. */ + + /** The name of the {@code LocationGroup} the {@code sourceLocation} belongs to. */ @JsonProperty("sourceLocationGroupName") private String sourceLocationGroupName; - /** The target where to move the {@code TransportUnit} to (must be passed by the caller). */ + + /** The target where to move the {@code TransportUnit}. */ @JsonProperty("target") - @NotEmpty(groups = {Create.class, Complete.class}) + @NotBlank(groups = {Create.class, Complete.class}) private String target; + /** The target {@code LocationGroup} used to define in what area */ @JsonProperty("targetLocationGroup") private String targetLocationGroup; + /** When the {@code Movement} has been started. */ @JsonProperty("startedAt") @JsonFormat(pattern = DATE_TIME_WITH_TIMEZONE) private ZonedDateTime startedAt; + + /** Latest possible finish date of the {@code Movement}. */ + @JsonProperty("latestDueAt") + @JsonFormat(pattern = DATE_TIME_WITH_TIMEZONE) + private ZonedDateTime latestDueDate; + /** When the {@code Movement} has been finished. */ @JsonProperty("finishedAt") @JsonFormat(pattern = DATE_TIME_WITH_TIMEZONE) private ZonedDateTime finishedAt; + /** When the {@code Movement} has been created. */ @JsonProperty("createdAt") @JsonFormat(pattern = DATE_TIME_WITH_TIMEZONE) diff --git a/src/main/java/org/openwms/wms/movements/api/StartMode.java b/src/main/java/org/openwms/wms/movements/api/StartMode.java index 8f55541c..dd429125 100644 --- a/src/main/java/org/openwms/wms/movements/api/StartMode.java +++ b/src/main/java/org/openwms/wms/movements/api/StartMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/api/package-info.java b/src/main/java/org/openwms/wms/movements/api/package-info.java index 0bdd7ba0..836f2231 100644 --- a/src/main/java/org/openwms/wms/movements/api/package-info.java +++ b/src/main/java/org/openwms/wms/movements/api/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/app/MovementAsyncConfiguration.java b/src/main/java/org/openwms/wms/movements/app/MovementAsyncConfiguration.java index 722e2641..bd0870bc 100644 --- a/src/main/java/org/openwms/wms/movements/app/MovementAsyncConfiguration.java +++ b/src/main/java/org/openwms/wms/movements/app/MovementAsyncConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/app/MovementFeignConfiguration.java b/src/main/java/org/openwms/wms/movements/app/MovementFeignConfiguration.java index 9877514f..4092f423 100644 --- a/src/main/java/org/openwms/wms/movements/app/MovementFeignConfiguration.java +++ b/src/main/java/org/openwms/wms/movements/app/MovementFeignConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/app/MovementModuleConfiguration.java b/src/main/java/org/openwms/wms/movements/app/MovementModuleConfiguration.java index 124c279b..05cb5f41 100644 --- a/src/main/java/org/openwms/wms/movements/app/MovementModuleConfiguration.java +++ b/src/main/java/org/openwms/wms/movements/app/MovementModuleConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.ameba.mapping.BeanMapper; import org.ameba.mapping.DozerMapperImpl; import org.ameba.system.NestedReloadableResourceBundleMessageSource; +import org.openwms.core.app.JSONConfiguration; import org.openwms.wms.movements.impl.MovementHandler; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; @@ -32,6 +33,7 @@ import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -63,6 +65,7 @@ @EnableJpaAuditing @EnableAspects(propagateRootCause = true) @EnableScheduling +@Import(JSONConfiguration.class) public class MovementModuleConfiguration implements WebMvcConfigurer { @Override diff --git a/src/main/java/org/openwms/wms/movements/app/MovementStandaloneConfiguration.java b/src/main/java/org/openwms/wms/movements/app/MovementStandaloneConfiguration.java index 2830e1e6..943f7235 100644 --- a/src/main/java/org/openwms/wms/movements/app/MovementStandaloneConfiguration.java +++ b/src/main/java/org/openwms/wms/movements/app/MovementStandaloneConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/app/package-info.java b/src/main/java/org/openwms/wms/movements/app/package-info.java index 00fac42a..4da76d06 100644 --- a/src/main/java/org/openwms/wms/movements/app/package-info.java +++ b/src/main/java/org/openwms/wms/movements/app/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/commands/MovementCommand.java b/src/main/java/org/openwms/wms/movements/commands/MovementCommand.java index 9a0cd195..376a1069 100644 --- a/src/main/java/org/openwms/wms/movements/commands/MovementCommand.java +++ b/src/main/java/org/openwms/wms/movements/commands/MovementCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/commands/MovementCommandListener.java b/src/main/java/org/openwms/wms/movements/commands/MovementCommandListener.java index 5e290320..2ba0f221 100644 --- a/src/main/java/org/openwms/wms/movements/commands/MovementCommandListener.java +++ b/src/main/java/org/openwms/wms/movements/commands/MovementCommandListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/commands/MovementMO.java b/src/main/java/org/openwms/wms/movements/commands/MovementMO.java index 8e2d3e5c..064a777f 100644 --- a/src/main/java/org/openwms/wms/movements/commands/MovementMO.java +++ b/src/main/java/org/openwms/wms/movements/commands/MovementMO.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/commands/SplitMO.java b/src/main/java/org/openwms/wms/movements/commands/SplitMO.java index 7478c4e2..617d5066 100644 --- a/src/main/java/org/openwms/wms/movements/commands/SplitMO.java +++ b/src/main/java/org/openwms/wms/movements/commands/SplitMO.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/commands/package-info.java b/src/main/java/org/openwms/wms/movements/commands/package-info.java index 9d48969f..9970dd2f 100644 --- a/src/main/java/org/openwms/wms/movements/commands/package-info.java +++ b/src/main/java/org/openwms/wms/movements/commands/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/events/ReservationMessageListener.java b/src/main/java/org/openwms/wms/movements/events/ReservationMessageListener.java index 6c2eac39..a0a497a2 100644 --- a/src/main/java/org/openwms/wms/movements/events/ReservationMessageListener.java +++ b/src/main/java/org/openwms/wms/movements/events/ReservationMessageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/events/api/MovementEvent.java b/src/main/java/org/openwms/wms/movements/events/api/MovementEvent.java index a47dd3d9..ce4369c6 100644 --- a/src/main/java/org/openwms/wms/movements/events/api/MovementEvent.java +++ b/src/main/java/org/openwms/wms/movements/events/api/MovementEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/events/api/package-info.java b/src/main/java/org/openwms/wms/movements/events/api/package-info.java index d0cbb5f1..e2e0c0f2 100644 --- a/src/main/java/org/openwms/wms/movements/events/api/package-info.java +++ b/src/main/java/org/openwms/wms/movements/events/api/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/events/package-info.java b/src/main/java/org/openwms/wms/movements/events/package-info.java index 3a0fe422..1d5abe64 100644 --- a/src/main/java/org/openwms/wms/movements/events/package-info.java +++ b/src/main/java/org/openwms/wms/movements/events/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/Movement.java b/src/main/java/org/openwms/wms/movements/impl/Movement.java index 7c1fd4f7..c636a8b1 100644 --- a/src/main/java/org/openwms/wms/movements/impl/Movement.java +++ b/src/main/java/org/openwms/wms/movements/impl/Movement.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,6 +78,7 @@ public class Movement extends ApplicationEntity implements Serializable { @JoinColumn(name = "C_GROUP_PK", nullable = true, foreignKey = @ForeignKey(name = "FK_MVM_GRP")) private MovementGroup group; + /** Refers to the demanded {@code Product} for that the {@code Movement} has been created. */ @Column(name = "C_SKU") private String sku; diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementEvent.java b/src/main/java/org/openwms/wms/movements/impl/MovementEvent.java index 78533d05..0f73513a 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementEvent.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementEventListener.java b/src/main/java/org/openwms/wms/movements/impl/MovementEventListener.java index 1ff9c721..2642f8c8 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementEventListener.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementEventPropagator.java b/src/main/java/org/openwms/wms/movements/impl/MovementEventPropagator.java index 9f029c9e..e93469a3 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementEventPropagator.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementEventPropagator.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementGroup.java b/src/main/java/org/openwms/wms/movements/impl/MovementGroup.java index 4d3605b1..af9d1e71 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementGroup.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/MovementHandler.java index 73f3642e..a8d91043 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementRepository.java b/src/main/java/org/openwms/wms/movements/impl/MovementRepository.java index 45c4f943..de91ce94 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementRepository.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementServiceImpl.java b/src/main/java/org/openwms/wms/movements/impl/MovementServiceImpl.java index 78519579..325c4988 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementServiceImpl.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -323,10 +323,10 @@ private Movement findInternal(String pKey) { */ @Measured @Override - public List findForTuAndTypesAndStates(@NotBlank String barcode, @NotEmpty List types, @NotEmpty List states) { + public List findForTuAndTypesAndStates(@NotBlank String barcode, @NotEmpty List types, @NotEmpty List states) { var all = repository.findByTransportUnitBkAndTypeInAndStateIn( Barcode.of(barcode), - types.stream().map(MovementType::valueOf).toList(), + types, states.stream().map(DefaultMovementState::valueOf).toList() ); if (all.isEmpty()) { diff --git a/src/main/java/org/openwms/wms/movements/impl/MovementTargetChangedEvent.java b/src/main/java/org/openwms/wms/movements/impl/MovementTargetChangedEvent.java index b2a11006..4eb266d3 100644 --- a/src/main/java/org/openwms/wms/movements/impl/MovementTargetChangedEvent.java +++ b/src/main/java/org/openwms/wms/movements/impl/MovementTargetChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/PriorityConverter.java b/src/main/java/org/openwms/wms/movements/impl/PriorityConverter.java index 428ca22f..a7dfaa0d 100644 --- a/src/main/java/org/openwms/wms/movements/impl/PriorityConverter.java +++ b/src/main/java/org/openwms/wms/movements/impl/PriorityConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/PriorityLevel.java b/src/main/java/org/openwms/wms/movements/impl/PriorityLevel.java index fc60a7a4..69aa27eb 100644 --- a/src/main/java/org/openwms/wms/movements/impl/PriorityLevel.java +++ b/src/main/java/org/openwms/wms/movements/impl/PriorityLevel.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/ProblemHistory.java b/src/main/java/org/openwms/wms/movements/impl/ProblemHistory.java index 19ad9935..e426d5f5 100644 --- a/src/main/java/org/openwms/wms/movements/impl/ProblemHistory.java +++ b/src/main/java/org/openwms/wms/movements/impl/ProblemHistory.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/PutawayAdapter.java b/src/main/java/org/openwms/wms/movements/impl/PutawayAdapter.java index 7a6e6041..4aebf706 100644 --- a/src/main/java/org/openwms/wms/movements/impl/PutawayAdapter.java +++ b/src/main/java/org/openwms/wms/movements/impl/PutawayAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/TransactionWriter.java b/src/main/java/org/openwms/wms/movements/impl/TransactionWriter.java index 015e0c7c..cc7f06fc 100644 --- a/src/main/java/org/openwms/wms/movements/impl/TransactionWriter.java +++ b/src/main/java/org/openwms/wms/movements/impl/TransactionWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/ValidationGroups.java b/src/main/java/org/openwms/wms/movements/impl/ValidationGroups.java index 76a07c4f..c724f581 100644 --- a/src/main/java/org/openwms/wms/movements/impl/ValidationGroups.java +++ b/src/main/java/org/openwms/wms/movements/impl/ValidationGroups.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/AbstractMovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/handler/AbstractMovementHandler.java index 8a0386c1..1a67658c 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/AbstractMovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/AbstractMovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/InboundMovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/handler/InboundMovementHandler.java index 097362a0..6359f0a6 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/InboundMovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/InboundMovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/ManualMovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/handler/ManualMovementHandler.java index 722acfa6..c8fc4fa8 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/ManualMovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/ManualMovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/RelocationMovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/handler/RelocationMovementHandler.java index 33363c45..d9cf5592 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/RelocationMovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/RelocationMovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/ReplenishmentMovementHandler.java b/src/main/java/org/openwms/wms/movements/impl/handler/ReplenishmentMovementHandler.java index 70551311..d62c64ad 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/ReplenishmentMovementHandler.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/ReplenishmentMovementHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/handler/package-info.java b/src/main/java/org/openwms/wms/movements/impl/handler/package-info.java index c7e0dae3..476f40fc 100644 --- a/src/main/java/org/openwms/wms/movements/impl/handler/package-info.java +++ b/src/main/java/org/openwms/wms/movements/impl/handler/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/impl/package-info.java b/src/main/java/org/openwms/wms/movements/impl/package-info.java index 9ca15e1d..222d2330 100644 --- a/src/main/java/org/openwms/wms/movements/impl/package-info.java +++ b/src/main/java/org/openwms/wms/movements/impl/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/package-info.java b/src/main/java/org/openwms/wms/movements/package-info.java index e2ebe2ba..a7ab9be1 100644 --- a/src/main/java/org/openwms/wms/movements/package-info.java +++ b/src/main/java/org/openwms/wms/movements/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementState.java b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementState.java index 18229cff..ca3ed28f 100644 --- a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementState.java +++ b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementState.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementStateResolver.java b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementStateResolver.java index 28ce84ad..783e259c 100644 --- a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementStateResolver.java +++ b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementStateResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementTypeResolver.java b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementTypeResolver.java index 118b0adf..9648a354 100644 --- a/src/main/java/org/openwms/wms/movements/spi/DefaultMovementTypeResolver.java +++ b/src/main/java/org/openwms/wms/movements/spi/DefaultMovementTypeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/DefaultValidatorsImpl.java b/src/main/java/org/openwms/wms/movements/spi/DefaultValidatorsImpl.java index 3c558e94..299fd227 100644 --- a/src/main/java/org/openwms/wms/movements/spi/DefaultValidatorsImpl.java +++ b/src/main/java/org/openwms/wms/movements/spi/DefaultValidatorsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/MovementStateResolver.java b/src/main/java/org/openwms/wms/movements/spi/MovementStateResolver.java index f8a4d092..9b3fba26 100644 --- a/src/main/java/org/openwms/wms/movements/spi/MovementStateResolver.java +++ b/src/main/java/org/openwms/wms/movements/spi/MovementStateResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/MovementTypeResolver.java b/src/main/java/org/openwms/wms/movements/spi/MovementTypeResolver.java index d015f6ba..06f0b362 100644 --- a/src/main/java/org/openwms/wms/movements/spi/MovementTypeResolver.java +++ b/src/main/java/org/openwms/wms/movements/spi/MovementTypeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/Validators.java b/src/main/java/org/openwms/wms/movements/spi/Validators.java index dc1a295a..8c368b49 100644 --- a/src/main/java/org/openwms/wms/movements/spi/Validators.java +++ b/src/main/java/org/openwms/wms/movements/spi/Validators.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApi.java b/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApi.java index 356d6def..2d6dd833 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApi.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApi.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApiImpl.java b/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApiImpl.java index d83ad934..73ce5b85 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApiImpl.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/AsyncTransportUnitApiImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/NoOpTransportUnitApiImpl.java b/src/main/java/org/openwms/wms/movements/spi/common/NoOpTransportUnitApiImpl.java index 069ab27e..69129635 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/NoOpTransportUnitApiImpl.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/NoOpTransportUnitApiImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/package-info.java b/src/main/java/org/openwms/wms/movements/spi/common/package-info.java index c47c055a..6c98942a 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/package-info.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/putaway/PutawayApi.java b/src/main/java/org/openwms/wms/movements/spi/common/putaway/PutawayApi.java index dd908566..62f3095a 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/putaway/PutawayApi.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/putaway/PutawayApi.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/common/putaway/package-info.java b/src/main/java/org/openwms/wms/movements/spi/common/putaway/package-info.java index 3b7f9733..6b438452 100644 --- a/src/main/java/org/openwms/wms/movements/spi/common/putaway/package-info.java +++ b/src/main/java/org/openwms/wms/movements/spi/common/putaway/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/spi/package-info.java b/src/main/java/org/openwms/wms/movements/spi/package-info.java index 6144b3a2..3a05efe6 100644 --- a/src/main/java/org/openwms/wms/movements/spi/package-info.java +++ b/src/main/java/org/openwms/wms/movements/spi/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/ui/MovementUIController.java b/src/main/java/org/openwms/wms/movements/ui/MovementUIController.java index 33ae7b99..48a6b529 100644 --- a/src/main/java/org/openwms/wms/movements/ui/MovementUIController.java +++ b/src/main/java/org/openwms/wms/movements/ui/MovementUIController.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/org/openwms/wms/movements/ui/package-info.java b/src/main/java/org/openwms/wms/movements/ui/package-info.java index 1e6494c1..f3e05911 100644 --- a/src/main/java/org/openwms/wms/movements/ui/package-info.java +++ b/src/main/java/org/openwms/wms/movements/ui/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE index 090d4004..8e1f0cb8 100644 --- a/src/main/resources/META-INF/LICENSE +++ b/src/main/resources/META-INF/LICENSE @@ -1,4 +1,4 @@ -Copyright 2005-2023 the original author or authors. +Copyright 2005-2024 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/test/java/org/openwms/wms/movements/EnsureArchitectureIT.java b/src/test/java/org/openwms/wms/movements/EnsureArchitectureIT.java index 97b809d7..d958f715 100644 --- a/src/test/java/org/openwms/wms/movements/EnsureArchitectureIT.java +++ b/src/test/java/org/openwms/wms/movements/EnsureArchitectureIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/java/org/openwms/wms/movements/IndexControllerDocumentation.java b/src/test/java/org/openwms/wms/movements/IndexControllerDocumentation.java new file mode 100644 index 00000000..c8909939 --- /dev/null +++ b/src/test/java/org/openwms/wms/movements/IndexControllerDocumentation.java @@ -0,0 +1,89 @@ +/* + * Copyright 2005-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openwms.wms.movements; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.openwms.common.location.api.LocationApi; +import org.openwms.common.location.api.LocationGroupApi; +import org.openwms.common.transport.api.TransportUnitApi; +import org.openwms.transactions.api.commands.AsyncTransactionApi; +import org.openwms.wms.movements.spi.common.AsyncTransportUnitApi; +import org.openwms.wms.movements.spi.common.putaway.PutawayApi; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.restdocs.RestDocumentationContextProvider; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.filter.CharacterEncodingFilter; + +import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; +import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** + * A IndexControllerDocumentation. + * + * @author Heiko Scherrer + */ +@MovementsApplicationTest +class IndexControllerDocumentation { + + protected MockMvc mockMvc; + @Autowired + protected ObjectMapper objectMapper; + @MockBean + protected TransportUnitApi transportUnitApi; + @MockBean + protected LocationApi locationApi; + @MockBean + protected LocationGroupApi locationGroupApi; + @MockBean + protected PutawayApi putawayApi; + @MockBean + protected AsyncTransactionApi asyncTransactionApi; + @MockBean + protected AsyncTransportUnitApi asyncTransportUnitApi; + + /** + * Do something before each test method. + */ + @BeforeEach + void setUp(RestDocumentationContextProvider restDocumentation, WebApplicationContext context) { + mockMvc = MockMvcBuilders.webAppContextSetup(context) + .apply(documentationConfiguration(restDocumentation)) + .addFilters(new CharacterEncodingFilter("UTF-8", true)) + .build(); + } + + @AfterEach + public void reset_mocks() { + Mockito.reset(transportUnitApi); + } + + @Test + void shall_create_index() throws Exception { + mockMvc.perform(get("/index")) + .andDo(document("get-index")) + .andExpect(status().isOk()) + ; + } +} diff --git a/src/test/java/org/openwms/wms/movements/MovementDocumentation.java b/src/test/java/org/openwms/wms/movements/MovementDocumentation.java index f3165ff3..534fefc6 100644 --- a/src/test/java/org/openwms/wms/movements/MovementDocumentation.java +++ b/src/test/java/org/openwms/wms/movements/MovementDocumentation.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ import org.openwms.common.location.api.LocationApi; import org.openwms.common.location.api.LocationGroupApi; import org.openwms.common.location.api.LocationVO; -import org.openwms.transactions.api.commands.AsyncTransactionApi; import org.openwms.common.transport.api.TransportUnitApi; import org.openwms.common.transport.api.TransportUnitVO; +import org.openwms.transactions.api.commands.AsyncTransactionApi; import org.openwms.wms.movements.api.MovementVO; import org.openwms.wms.movements.spi.common.AsyncTransportUnitApi; import org.openwms.wms.movements.spi.common.putaway.PutawayApi; @@ -42,6 +42,7 @@ import java.util.Optional; +import static org.hamcrest.CoreMatchers.is; import static org.mockito.BDDMockito.given; import static org.openwms.wms.movements.api.MovementApi.API_MOVEMENTS; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; @@ -50,7 +51,15 @@ import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.patch; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; +import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; +import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** @@ -93,24 +102,53 @@ public void reset_mocks() { Mockito.reset(transportUnitApi); } + @Test void shall_create_index() throws Exception { + mockMvc.perform(get("/v1/movements/index")) + .andDo(document("move-index")) + .andExpect(status().isOk()) + ; + } + @Test void shall_create_a_movement() throws Exception { - TransportUnitVO transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); + var transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); given(transportUnitApi.findTransportUnit("4711")).willReturn(transportUnit); - LocationVO sourceLocation = new LocationVO("WE__/0001/0000/0000/0000"); + var sourceLocation = new LocationVO("WE__/0001/0000/0000/0000"); sourceLocation.setErpCode("WE_01"); sourceLocation.setLocationGroupName("WE"); given(locationApi.findByErpCode("WE_01")).willReturn(Optional.of(sourceLocation)); - MovementVO m = new MovementVO(); - m.setInitiator("test"); - m.setTransportUnitBk("4711"); + var m = new MovementVO(); + m.setInitiator("ERP"); m.setSourceLocation("WE_01"); m.setTarget("ERR_/0001/0000/0000/0000"); mockMvc.perform( - post("/v1/transport-units/4711/movements") - .content(objectMapper.writeValueAsString(m)).contentType(MediaType.APPLICATION_JSON) - ) - .andDo(document("move-create")) + post("/v1/transport-units/4711/movements") + .content(objectMapper.writeValueAsString(m)) + .contentType(MediaType.APPLICATION_JSON) + ) + .andDo(document("move-create", + preprocessResponse(prettyPrint()), + requestFields( + fieldWithPath("initiator").optional().description("(Optional) Initiator of the Movement, who ordered or triggered it"), + fieldWithPath("mode").optional().description("(Optional) Whether the Movement should be directly processed (AUTOMATIC) or delayed (MANUAL)"), + fieldWithPath("sourceLocation").description("The source Location where the TransportUnit shall be picked up"), + fieldWithPath("target").description("The target where to move the TransportUnit to") + ), + responseFields( + fieldWithPath("ol").ignored(), + fieldWithPath("pKey").description("The persistent technical key of the Movement"), + fieldWithPath("transportUnitBk").description("The business key of the TransportUnit to create"), + fieldWithPath("type").description("The type of Movement"), + fieldWithPath("initiator").description("Initiator of the Movement, who ordered or triggered it"), + fieldWithPath("mode").description("Whether the Movement should be directly processed (AUTOMATIC) or delayed (MANUAL)"), + fieldWithPath("priority").description("A priority how fast the Movement needs to be processed; A higher value means less prior than lower values"), + fieldWithPath("state").description("The current state of the Movement"), + fieldWithPath("sourceLocation").description("The source Location where the TransportUnit shall be picked up"), + fieldWithPath("sourceLocationGroupName").description("The name of the LocationGroup the sourceLocation belongs to"), + fieldWithPath("target").description("The target where to move the TransportUnit to"), + fieldWithPath("createdAt").description("Timestamp when the Movement has been created") + ) + )) .andExpect(status().isCreated()) .andExpect(header().exists(HttpHeaders.LOCATION)) ; @@ -126,9 +164,71 @@ public void reset_mocks() { ; } + @Sql(scripts = "classpath:import-TEST.sql") + @Test void shall_find_for_TU_Type_State() throws Exception { + mockMvc.perform( + get(API_MOVEMENTS) + .param("barcode", "4711") + .param("types", "INBOUND") + .param("states", "INACTIVE") + ) + .andDo(document("move-find-tuTypesStates", + preprocessResponse(prettyPrint()), + requestParameters( + parameterWithName("barcode").description("The business key of the TransportUnit to search for"), + parameterWithName("types").description("The Movement types to search for"), + parameterWithName("states").description("The Movement states to search for") + ), + responseFields( + fieldWithPath("[].ol").ignored(), + fieldWithPath("[].pKey").description("The persistent technical key of the Movement"), + fieldWithPath("[].transportUnitBk").description("The business key of the TransportUnit to move"), + fieldWithPath("[].type").description("The type of Movement"), + fieldWithPath("[].initiator").description("Initiator of the Movement, who ordered or triggered it"), + fieldWithPath("[].mode").description("Whether the Movement should be directly processed (AUTOMATIC) or delayed (MANUAL)"), + fieldWithPath("[].sku").description("Refers to the demanded Product for that the Movement has been created"), + fieldWithPath("[].priority").description("A priority how fast the Movement needs to be processed; A higher value means less prior than lower values"), + fieldWithPath("[].state").description("The current state of the Movement"), + fieldWithPath("[].sourceLocation").description("The source Location where the TransportUnit shall be picked up"), + fieldWithPath("[].sourceLocationGroupName").description("The name of the LocationGroup the sourceLocation belongs to"), + fieldWithPath("[].target").description("The target where to move the TransportUnit to"), + fieldWithPath("[].startedAt").description("Timestamp when the Movement has been started"), + fieldWithPath("[].latestDueAt").description("Timestamp until when the Movement must be done"), + fieldWithPath("[].finishedAt").description("Timestamp when the Movement has been finished"), + fieldWithPath("[].createdAt").description("Timestamp when the Movement has been created") + ) + )) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(1))) + .andExpect(jsonPath("$.[0].transportUnitBk", is("4711"))) + .andExpect(jsonPath("$.[0].type", is("INBOUND"))) + .andExpect(jsonPath("$.[0].state", is("INACTIVE"))) + ; + } + + @Sql(scripts = "classpath:import-TEST.sql") + @Test void shall_find_for_State_Types_Source() throws Exception { + mockMvc.perform( + get(API_MOVEMENTS) + .param("state", "DONE") + .param("types", "INBOUND,REPLENISHMENT") + .param("source", "STOCK") + ) + .andDo(document("move-find-stateTypesSource", + preprocessResponse(prettyPrint()), + requestParameters( + parameterWithName("state").description("The Movement states to search for"), + parameterWithName("types").description("The Movement types to search for"), + parameterWithName("source").description("Either the source Location or the name of the source LocationGroup to search Movements for") + ) + )) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(2))) + ; + } + @Sql(scripts = "classpath:import-TEST.sql") @Test void shall_cancel_a_movement() throws Exception { - TransportUnitVO transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); mockMvc.perform( delete(API_MOVEMENTS + "/1000") ) @@ -139,14 +239,14 @@ public void reset_mocks() { @Sql(scripts = "classpath:import-TEST.sql") @Test void shall_move_a_movement() throws Exception { - TransportUnitVO transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); + var transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); given(transportUnitApi.findTransportUnit("4711")).willReturn(transportUnit); - LocationVO sourceLocation = new LocationVO("LOC_/0002/0000/0000/0000"); + var sourceLocation = new LocationVO("LOC_/0002/0000/0000/0000"); sourceLocation.setErpCode("LOC2"); sourceLocation.setLocationGroupName("STOCK"); given(locationApi.findByErpCode("LOC2")).willReturn(Optional.of(sourceLocation)); - MovementVO m = new MovementVO(); + var m = new MovementVO(); m.setTransportUnitBk("4711"); m.setSourceLocation("LOC2"); m.setState("ACTIVE"); @@ -161,15 +261,15 @@ public void reset_mocks() { @Sql(scripts = "classpath:import-TEST.sql") @Test void shall_move_a_completed_movement_fails() throws Exception { - TransportUnitVO transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); - given(transportUnitApi.findTransportUnit("4711")).willReturn(transportUnit); - LocationVO sourceLocation = new LocationVO("LOC_/0002/0000/0000/0000"); + var transportUnit = TransportUnitVO.newBuilder().barcode("4713").build(); + given(transportUnitApi.findTransportUnit("4713")).willReturn(transportUnit); + var sourceLocation = new LocationVO("LOC_/0002/0000/0000/0000"); sourceLocation.setErpCode("LOC2"); sourceLocation.setLocationGroupName("STOCK"); given(locationApi.findByErpCode("LOC2")).willReturn(Optional.of(sourceLocation)); - MovementVO m = new MovementVO(); - m.setTransportUnitBk("4711"); + var m = new MovementVO(); + m.setTransportUnitBk("4713"); m.setSourceLocation("LOC2"); m.setState("ACTIVE"); mockMvc.perform( @@ -180,4 +280,29 @@ public void reset_mocks() { .andDo(document("move-move-with-completed")) ; } + + @Sql(scripts = "classpath:import-TEST.sql") + @Test void shall_complete_movement() throws Exception { + var transportUnit = TransportUnitVO.newBuilder().barcode("4711").build(); + given(transportUnitApi.findTransportUnit("4711")).willReturn(transportUnit); + var sourceLocation = new LocationVO("LOC_/0002/0000/0000/0000"); + sourceLocation.setErpCode("LOC2"); + sourceLocation.setLocationGroupName("STOCK"); + given(locationApi.findByErpCode("LOC2")).willReturn(Optional.of(sourceLocation)); + + var m = new MovementVO(); + m.setTransportUnitBk("4711"); + m.setTarget("LOC2"); + m.setState("ACTIVE"); + mockMvc.perform( + patch("/v1/movements/1000/complete") + .content(objectMapper.writeValueAsString(m)).contentType(MediaType.APPLICATION_JSON) + ) + .andExpect(status().isOk()) + .andDo(document("move-complete")) + .andExpect(jsonPath("$.state", is("DONE"))) + .andExpect(jsonPath("$.target", is("LOC2"))) + .andReturn().getResponse() + ; + } } diff --git a/src/test/java/org/openwms/wms/movements/MovementServiceIT.java b/src/test/java/org/openwms/wms/movements/MovementServiceIT.java index 2bd55a1d..bc4c1254 100644 --- a/src/test/java/org/openwms/wms/movements/MovementServiceIT.java +++ b/src/test/java/org/openwms/wms/movements/MovementServiceIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,16 +22,16 @@ import org.openwms.common.location.api.LocationApi; import org.openwms.common.location.api.LocationGroupApi; import org.openwms.common.location.api.LocationVO; -import org.openwms.transactions.api.commands.AsyncTransactionApi; import org.openwms.common.transport.api.TransportUnitApi; import org.openwms.common.transport.api.TransportUnitVO; +import org.openwms.transactions.api.commands.AsyncTransactionApi; import org.openwms.wms.movements.api.MovementType; import org.openwms.wms.movements.api.MovementVO; import org.openwms.wms.movements.api.StartMode; import org.openwms.wms.movements.impl.Movement; +import org.openwms.wms.movements.spi.DefaultMovementState; import org.openwms.wms.movements.spi.common.AsyncTransportUnitApi; import org.openwms.wms.movements.spi.common.putaway.PutawayApi; -import org.openwms.wms.movements.spi.DefaultMovementState; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.jdbc.Sql; @@ -87,7 +87,7 @@ private MovementVO createValidMovement() { } @Test void test_create_with_empty_Barcode() { - MovementVO inboundMove = createInvalidMovement(); + var inboundMove = createInvalidMovement(); assertThatThrownBy(() -> testee.create(" ", inboundMove)) .isInstanceOf(ServiceLayerException.class) .hasMessageMatching("create.[a-zA-Z0-9]*: must not be blank.*"); @@ -141,7 +141,7 @@ void test_create_with_unknown_SourceErpCode() { @Test void test_create_with_success() { //arrange - LocationVO sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); + var sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); sourceLocation.setErpCode("PASS"); given(transportUnitApi.findTransportUnit("4711")).willReturn(new TransportUnitVO("4711")); given(locationApi.findById("PASS/PASS/PASS/PASS/PASS")).willReturn(Optional.of(sourceLocation)); @@ -152,7 +152,7 @@ void test_create_with_success() { vo.setTarget("KNOWN"); // act - MovementVO result = testee.create("4711", vo); + var result = testee.create("4711", vo); // assert assertThat(result.getPersistentKey()).isNotEmpty(); @@ -178,11 +178,11 @@ void test_findAll() { @Sql(scripts = "classpath:import-TEST.sql") @Test void test_findForTuAndTypesAndStates() { - var result = testee.findForTuAndTypesAndStates("4712", asList("OUTBOUND"), asList("ACTIVE")); + var result = testee.findForTuAndTypesAndStates("4712", asList(MovementType.OUTBOUND), asList("ACTIVE")); assertThat(result).hasSize(1); - result = testee.findForTuAndTypesAndStates("4713", asList("OUTBOUND"), asList("ACTIVE")); + result = testee.findForTuAndTypesAndStates("4713", asList(MovementType.OUTBOUND), asList("ACTIVE")); assertThat(result).isEmpty(); - result = testee.findForTuAndTypesAndStates("4713", asList("INBOUND"), asList("DONE")); + result = testee.findForTuAndTypesAndStates("4713", asList(MovementType.INBOUND), asList("DONE")); assertThat(result).isEmpty(); } @@ -201,7 +201,7 @@ void test_move_fails_without_state() { // act & assert assertThatThrownBy(() -> testee.move("1000", vo)) .isInstanceOf(ServiceLayerException.class) - .hasMessageContaining("state: must not be empty"); + .hasMessageContaining("state: must not be blank"); var vo2 = MovementVO.builder() .state("INACTIVE") @@ -210,7 +210,7 @@ void test_move_fails_without_state() { // act & assert assertThatThrownBy(() -> testee.move("1000", vo2)) .isInstanceOf(ServiceLayerException.class) - .hasMessageContaining("sourceLocation: must not be empty"); + .hasMessageContaining("sourceLocation: must not be blank"); var vo3 = MovementVO.builder() .sourceLocation("PASS/PASS/PASS/PASS/PASS") @@ -222,7 +222,7 @@ void test_move_fails_without_state() { .isInstanceOf(NotFoundException.class) .hasMessageContaining("Location with locationId [PASS/PASS/PASS/PASS/PASS] does not exist"); - LocationVO sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); + var sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); sourceLocation.setErpCode("PASS"); sourceLocation.setLocationGroupName("LG"); given(locationApi.findById("PASS/PASS/PASS/PASS/PASS")).willReturn(Optional.of(sourceLocation)); @@ -236,7 +236,7 @@ void test_move_fails_without_state() { @Test void test_move() { // arrange - LocationVO sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); + var sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); sourceLocation.setErpCode("PASS"); sourceLocation.setLocationGroupName("LG"); given(locationApi.findById("PASS/PASS/PASS/PASS/PASS")).willReturn(Optional.of(sourceLocation)); @@ -273,14 +273,14 @@ void test_complete_fails_without_target() { // act & assert assertThatThrownBy(() -> testee.complete("1002", vo)) .isInstanceOf(ServiceLayerException.class) - .hasMessageContaining("target: must not be empty"); + .hasMessageContaining("target: must not be blank"); } @Sql(scripts = "classpath:import-TEST.sql") @Test void test_complete() { // arrange - LocationVO sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); + var sourceLocation = new LocationVO("PASS/PASS/PASS/PASS/PASS"); sourceLocation.setErpCode("ERPCODE"); sourceLocation.setLocationGroupName("LG"); given(locationApi.findByErpCode("ERPCODE")).willReturn(Optional.of(sourceLocation)); diff --git a/src/test/java/org/openwms/wms/movements/MovementsApplicationTest.java b/src/test/java/org/openwms/wms/movements/MovementsApplicationTest.java index b4c7b50b..f3ecefb7 100644 --- a/src/test/java/org/openwms/wms/movements/MovementsApplicationTest.java +++ b/src/test/java/org/openwms/wms/movements/MovementsApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.openwms.wms.movements; import org.ameba.test.categories.SpringTestSupport; -import org.openwms.wms.movements.MovementsRunner; import org.springframework.boot.test.context.SpringBootTest; import java.lang.annotation.Documented; diff --git a/src/test/java/org/openwms/wms/movements/MovementsRunner.java b/src/test/java/org/openwms/wms/movements/MovementsRunner.java index 38900864..8ece7c8f 100644 --- a/src/test/java/org/openwms/wms/movements/MovementsRunner.java +++ b/src/test/java/org/openwms/wms/movements/MovementsRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 the original author or authors. + * Copyright 2005-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/resources/import-TEST.sql b/src/test/resources/import-TEST.sql index 1fc8eae0..d98abbb5 100644 --- a/src/test/resources/import-TEST.sql +++ b/src/test/resources/import-TEST.sql @@ -6,6 +6,14 @@ DELETE FROM MVM_MOVEMENT_GROUP; INSERT INTO MVM_MOVEMENT_GROUP (c_pk,c_created,c_ol,c_pid,c_user,c_name,c_state) VALUES (1000,now(),0,'1000','tester','Batch 1','INACTIVE'); -- Movements -INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk) VALUES (1000,now(),0,'1000','POP::1',now(),'MANUAL','NORMAL',now(),'WA_01','WA','4711','INBOUND','HRL.10.20.2.0','INACTIVE','STOCK',1000); -INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk) VALUES (1001,now(),0,'1001','SOP::1',now(),'AUTOMATIC','HIGH',now(),'WA_02','WA','4712','OUTBOUND','HRL.10.21.2.0','ACTIVE','STOCK',1000); -INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk) VALUES (1002,now(),0,'1002','UI',now(),'AUTOMATIC','HIGH',now(),'WA_02','WA','4713','OUTBOUND','HRL.10.22.2.0','DONE','STOCK',1000); +INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk,c_sku,C_START_DATE,C_END_DATE,C_OCCURRED,C_NO,C_MESSAGE,c_created_by, c_updated_by, c_updated) +VALUES (1000,now(),0,'1000','POP::1',now(),'MANUAL','NORMAL',now(),'WA_01','WA','4711','INBOUND','HRL.10.20.2.0','INACTIVE','STOCK',1000,'SKU-42',now(),now(),now(),'MSG-0001','Target blocked','SYSTEM','SYSTEM',now()); +INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk) +VALUES (1001,now(),0,'1001','SOP::1',now(),'AUTOMATIC','HIGH',now(),'WA_02','WA','4712','OUTBOUND','HRL.10.21.2.0','ACTIVE','STOCK',1000); +INSERT INTO MVM_MOVEMENT (c_pk,c_created,c_ol,c_pid,c_initiator,c_latest_due,c_mode,c_priority,c_start_earliest_date,c_target_location,c_target_location_group_name,c_transport_unit_bk,c_type,c_source_location,c_state,c_source_location_group_name,c_group_pk) +VALUES (1002,now(),0,'1002','UI',now(),'AUTOMATIC','HIGH',now(),'WA_02','WA','4713','REPLENISHMENT','HRL.10.22.2.0','DONE','STOCK',1000); + +-- Problems +insert into mvm_problem_history (c_pk, c_created, c_created_by, c_updated_by, c_updated, c_ol, c_pid, c_no, c_message, c_occurred, c_fk_movement) +values (1000, now(), 'SYSTEM', 'SYSTEM', now(), 0, '1000', 'MSG-0001', 'Target blocked', now(), 1000); +