-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OBPIH-6365 Add import validation on quantity available when item is picked #4664
Conversation
@@ -1165,7 +1165,10 @@ class StockMovementService { | |||
) | |||
} | |||
|
|||
if (availableItem && AvailableItemStatus.listUnavailable().contains(availableItem.status)) { | |||
Boolean hasUnavailableStatus = availableItem && AvailableItemStatus.listUnavailable().contains(availableItem.status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to create a method in AvailableItemStatus
for checking whether the status passed as argument is in the list
@@ -1165,7 +1165,10 @@ class StockMovementService { | |||
) | |||
} | |||
|
|||
if (availableItem && AvailableItemStatus.listUnavailable().contains(availableItem.status)) { | |||
Boolean hasUnavailableStatus = availableItem && AvailableItemStatus.listUnavailable().contains(availableItem.status) | |||
Boolean isPickedItemPickable = availableItem?.status == AvailableItemStatus.PICKED && !availableItem.isPickable(data?.quantityAsNumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about a few things here plus the wording might be off. Could you explain the context to me? Are you checking in there that item is not available or it is already picked by other requisition items but still available to pick?
Overall thoughts I had looking at it, but depending on a context it might evolve so these are not yet change requests:
isPickedItemPickable
in the context of requested quantity does not make sense, because you already have it picked, so it should rather beisPickedItemValid
or something like that (if it is picked, then it should not be "pickable" for others). However if it is rather "is it still available to pick" it should be already covered byhasUnavailableStatus
and if it is- Initial
AvailableItem.isPickable()
was checking if the specific item can be picked = if inventory item is not with recalled lot and it is not in hold bin, hence I would not mix "pickable" with "available". - I would add a separate method returning
quantityRequested <= quantityAvailable
, but could you explain the context to me as asked above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, looking at the code something doesn't logically add up.
So the case that this part is trying to solve is to return an error for picked quantity if:
- item is on hold
- item is recalled
- item is unavailable (qty available < 0 )
- quantity available is less than what we are trying to pick
Boolean isPickable() {
return (inventoryItem ? inventoryItem.pickable : true) && (binLocation ? binLocation.pickable : true)
}
I did not look into the isPickable function too deep inside and based my logic on the statuses but it looks like isPickable
actually covers a lot of these cases
The isPickable for inventory item
Boolean isPickable() {
return !recalled
}
and isPickable for on Location
Boolean isPickable() {
return !onHold
}
so one more case that I need to add is checking if the quantity that we are trying to pick is <= quantity available which should resolve to this logic in the end
if (availableItem && (!availableItem.isPickable() || data?.quantityAsNumber <= availableItem.quantityAvailable)) {
}
also I can add a method on AvailabeItem
something like availableItem.isRequestedAmoundAvailable(data?.quantityAsNumber )
Boolean hasUnavailableStatus = availableItem && AvailableItemStatus.listUnavailable().contains(availableItem.status) | ||
Boolean isPickedItemPickable = availableItem?.status == AvailableItemStatus.PICKED && !availableItem.isPickable(data?.quantityAsNumber) | ||
|
||
if (hasUnavailableStatus || isPickedItemPickable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if I understand it. If it is still pickable then why do you want to throw an error that it is unavailable?
0f1ee3d
to
4d25476
Compare
|
||
static listUnavailable() { | ||
[RECALLED, HOLD, NOT_AVAILABLE] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to remove this list since it is not used anywhere and I was the one who introduces both list
and listUnavailable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmiranda uses it in his PR
|
||
static listUnavailable() { | ||
[RECALLED, HOLD, NOT_AVAILABLE] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmiranda uses it in his PR
return quantityAvailable > 0 | ||
} | ||
|
||
Boolean isPickableQuantity(Integer quantity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky, but I would call it isQuantityPickable
4d25476
to
add1406
Compare
…available items has enought availabel quantity to be picked
add1406
to
63f9372
Compare
No description provided.