Skip to content

Commit

Permalink
Expose new fields along the ROP and fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
openwms committed Apr 26, 2023
1 parent fa9aaa9 commit 3ae26ac
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ default String convertFromMO(LocationMO mo) {

/*~ Positions */
@Mapping(target = "orderId", source = "eo.order.orderId")
@Mapping(target = "priority", source = "eo.order.priority")
@Mapping(target = "positionId", source = "posNo")
@Mapping(target = "quantityExpected", source = "quantityExpected")
@Mapping(target = "details", source = "details")
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/org/openwms/wms/receiving/ReceivingRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
package org.openwms.wms.receiving;

import org.ameba.app.SolutionApp;
import org.openwms.wms.receiving.inventory.Product;
import org.openwms.wms.receiving.impl.ReceivingOrder;
import org.openwms.wms.receiving.transport.TransportUnit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
Expand All @@ -34,8 +31,18 @@
ReceivingRunner.class,
SolutionApp.class
})
@EnableJpaRepositories(basePackageClasses = {ReceivingOrder.class, TransportUnit.class, Product.class})
@EntityScan(basePackageClasses = {ReceivingOrder.class, TransportUnit.class, Product.class})
@EnableJpaRepositories(basePackages = {
"org.openwms.wms.receiving.impl",
"org.openwms.wms.receiving.ui.impl",
"org.openwms.wms.receiving.transport.impl",
"org.openwms.wms.receiving.inventory"
})
@EntityScan(basePackages = {
"org.openwms.wms.receiving.impl",
"org.openwms.wms.receiving.ui.impl",
"org.openwms.wms.receiving.transport.impl",
"org.openwms.wms.receiving.inventory"
})
public class ReceivingRunner {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ public class BaseReceivingOrderPositionVO implements Serializable {
/** Current position state. */
@JsonProperty("state")
private String state;
/** The current priority of the ReceivingOrder the position belongs to. */
@JsonProperty("priority")
private int priority;
/** Optional: How the position should be processed, manually oder automatically. */
@JsonProperty("startMode")
private String startMode;
/** Arbitrary detail information on this position, might be populated with ERP information. */
@JsonProperty("details")
private Map<String, String> details;
/** Timestamp when the record was created. */
/** Timestamp when the position has been created. */
@JsonProperty("createDt")
private Date createDt;

Expand Down Expand Up @@ -101,6 +104,14 @@ public void setState(String state) {
this.state = state;
}

public int getPriority() {
return priority;
}

public void setPriority(int priority) {
this.priority = priority;
}

public String getStartMode() {
return startMode;
}
Expand Down Expand Up @@ -143,7 +154,7 @@ public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BaseReceivingOrderPositionVO)) return false;
BaseReceivingOrderPositionVO that = (BaseReceivingOrderPositionVO) o;
return Objects.equals(orderId, that.orderId) && Objects.equals(positionId, that.positionId) && Objects.equals(state, that.state) && Objects.equals(startMode, that.startMode) && Objects.equals(details, that.details) && Objects.equals(createDt, that.createDt);
return Objects.equals(orderId, that.orderId) && Objects.equals(positionId, that.positionId) && Objects.equals(state, that.state) && Objects.equals(priority, that.priority) && Objects.equals(startMode, that.startMode) && Objects.equals(details, that.details) && Objects.equals(createDt, that.createDt);
}

/**
Expand All @@ -153,6 +164,6 @@ public boolean equals(Object o) {
*/
@Override
public int hashCode() {
return Objects.hash(orderId, positionId, state, startMode, details, createDt);
return Objects.hash(orderId, positionId, state, priority, startMode, details, createDt);
}
}
40 changes: 26 additions & 14 deletions src/main/java/org/openwms/wms/receiving/api/ReceivingOrderVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
Expand All @@ -51,6 +51,9 @@ public class ReceivingOrderVO extends AbstractBase<ReceivingOrderVO> implements
/** The current state of this {@code ReceivingOrder}. */
@JsonProperty("state")
private String state;
/** When the order is expected to be received. */
@JsonProperty("expectedReceiptDate")
private ZonedDateTime expectedReceiptDate;
/** A set of {@code ReceivingOrderPosition}s belonging to this {@code ReceivingOrder}. */
@JsonProperty("positions")
@JsonManagedReference
Expand Down Expand Up @@ -91,6 +94,26 @@ public void setOrderId(String orderId) {
this.orderId = orderId;
}

public boolean hasState() {
return state != null;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public ZonedDateTime getExpectedReceiptDate() {
return expectedReceiptDate;
}

public void setExpectedReceiptDate(ZonedDateTime expectedReceiptDate) {
this.expectedReceiptDate = expectedReceiptDate;
}

public List<BaseReceivingOrderPositionVO> getPositions() {
return positions;
}
Expand All @@ -107,18 +130,6 @@ public void setDetails(Map<String, String> details) {
this.details = details;
}

public String getState() {
return state;
}

public boolean hasState() {
return state != null;
}

public void setState(String state) {
this.state = state;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -128,13 +139,14 @@ public boolean equals(Object o) {
return Objects.equals(pKey, that.pKey) &&
Objects.equals(orderId, that.orderId) &&
Objects.equals(state, that.state) &&
Objects.equals(expectedReceiptDate, that.expectedReceiptDate) &&
Objects.equals(positions, that.positions) &&
Objects.equals(details, that.details);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), pKey, orderId, state, positions, details);
return Objects.hash(super.hashCode(), pKey, orderId, state, expectedReceiptDate, positions, details);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void setUp(RestDocumentationContextProvider restDocumentation) {
fieldWithPath("positions[]").description("An array of positions, must not be empty"),
fieldWithPath("positions[].@class").description("The type of the ReceivingOrderPosition"),
fieldWithPath("positions[].positionId").description("Unique identifier of the ReceivingOrderPosition within the ReceivingOrder"),
fieldWithPath("positions[].priority").description("The current priority of the ReceivingOrder the position belongs to"),
fieldWithPath("positions[].quantityExpected").description("The expected quantity of the Product"),
fieldWithPath("positions[].quantityExpected.@class").description("Must be one of the static values to identify the type of UOM"),
fieldWithPath("positions[].quantityExpected.unitType").description("Must be one of the static values to identify the concrete UOM"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void setUp(RestDocumentationContextProvider restDocumentation) {
fieldWithPath("details").description("Stores arbitrary detail information according to the ReceivingOrder"),
fieldWithPath("details.*").ignored(),
fieldWithPath("positions[].positionId").description("The position of the ReceivingOrderPosition"),
fieldWithPath("positions[].priority").description("The current priority of the ReceivingOrder the position belongs to"),
fieldWithPath("positions[].@class").description("The type of the ReceivingOrderPosition"),
fieldWithPath("positions[].state").description("The state of the ReceivingOrderPosition"),
fieldWithPath("positions[].quantityExpected").optional().description("The expected quantity to be received"),
Expand All @@ -101,7 +102,9 @@ void setUp(RestDocumentationContextProvider restDocumentation) {
fieldWithPath("positions[].product.baseUnit").description("The default unit and quantity the Product is shipped"),
fieldWithPath("positions[].product.baseUnit.unitType").description("The default unit type of the Product"),
fieldWithPath("positions[].product.baseUnit.*").ignored(),
fieldWithPath("positions[].product.*").ignored()
fieldWithPath("positions[].product.*").ignored(),
fieldWithPath("positions[].orderId").optional().description("The unique id of the ReceivingOrder the position belongs to"),
fieldWithPath("positions[].createDt").description("Timestamp when the position has been created.")
)
))
;
Expand Down

0 comments on commit 3ae26ac

Please sign in to comment.