-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/MODORDERS-989' into MODORDERS-989
- Loading branch information
Showing
8 changed files
with
188 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#%RAML 1.0 | ||
title: Restoration | ||
baseUri: https://github.com/folio-org/mod-orders | ||
version: v1 | ||
protocols: [ HTTP, HTTPS ] | ||
|
||
documentation: | ||
- title: Orders Business Logic API | ||
content: <b>API for transition pieces status from unreceivable to expected</b> | ||
|
||
types: | ||
receiving-collection: !include acq-models/mod-orders/schemas/receivingCollection.json | ||
receiving-results: !include acq-models/mod-orders/schemas/receivingResults.json | ||
errors: !include raml-util/schemas/errors.schema | ||
UUID: | ||
type: string | ||
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ | ||
|
||
traits: | ||
validate: !include raml-util/traits/validation.raml | ||
|
||
resourceTypes: | ||
post-with-200: !include rtypes/post-json-200.raml | ||
|
||
/orders/restore: | ||
displayName: Restore items | ||
description: | | ||
Restore items spanning one or more PO lines. The endpoint is used to: | ||
- move a received piece back to "Expected" in case "receivedItems" element's "itemStatus" is "On order" | ||
type: | ||
post-with-200: | ||
requestSchema: receiving-collection | ||
responseSchema: receiving-results | ||
requestExample: !include acq-models/mod-orders/examples/receivingCollection.sample | ||
responseExample: !include acq-models/mod-orders/examples/receivingResults.sample | ||
is: [validate] | ||
post: | ||
description: Restore items spanning one or more PO lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.folio.helper; | ||
|
||
import io.vertx.core.Context; | ||
import io.vertx.core.Future; | ||
import org.folio.rest.core.models.RequestContext; | ||
import org.folio.rest.jaxrs.model.Piece; | ||
import org.folio.rest.jaxrs.model.ReceivingCollection; | ||
import org.folio.rest.jaxrs.model.ReceivingResults; | ||
|
||
import java.util.Map; | ||
|
||
public class RestoreHelper extends ReceivingHelper { | ||
|
||
public RestoreHelper(ReceivingCollection receivingCollection, Map<String, String> okapiHeaders, Context ctx) { | ||
super(receivingCollection, okapiHeaders, ctx); | ||
} | ||
|
||
public Future<ReceivingResults> restorePiece(ReceivingCollection restorationCollection, RequestContext requestContext) { | ||
return receiveItems(restorationCollection, requestContext); | ||
} | ||
|
||
@Override | ||
protected boolean isRevertToOnOrder(Piece piece) { | ||
return piece.getReceivingStatus() == Piece.ReceivingStatus.UNRECEIVABLE | ||
&& inventoryManager | ||
.isOnOrderItemStatus(piecesByLineId.get(piece.getPoLineId()).get(piece.getId())); | ||
} | ||
|
||
@Override | ||
protected void updatePieceWithReceivingInfo(Piece piece) { | ||
super.updatePieceWithReceivingInfo(piece); | ||
|
||
piece.setReceivedDate(null); | ||
piece.setReceivingStatus(Piece.ReceivingStatus.EXPECTED); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/resources/mockdata/restore/receive-physical-ongoing.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"toBeReceived": [ | ||
{ | ||
"poLineId": "0dd8f1d2-ac2e-4155-a407-72071f6d5f4a", | ||
"received": 1, | ||
"receivedItems": [ | ||
{ | ||
"barcode": 21111111122, | ||
"callNumber": "PR 8923 W6 L36 1990 c.3", | ||
"comment": "Very important note", | ||
"caption": "Vol. 1", | ||
"itemStatus": "On order", | ||
"locationId": "fcd64ce1-6995-48f0-840e-89ffa2288371", | ||
"pieceId": "05a95f03-eb00-4248-9f2e-2bd05957ff04" | ||
} | ||
] | ||
} | ||
], | ||
"totalRecords": 1 | ||
} |