Skip to content
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-5237 Fix merging inventory items and PA when products had null … #3848

Merged
merged 2 commits into from
Feb 20, 2023

Conversation

awalkowiak
Copy link
Collaborator

…or empty lot number

Copy link
Member

@jmiranda jmiranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a compelling reason to have methods like this

PicklistService.updatePicklistItemsOnProductMerge()

rather than

ProductMergeService.updatePicklistItems()

def obsoleteLotNumber = obsoleteInventoryItem?.lotNumber
def obsoleteExpirationDate = obsoleteInventoryItem?.expirationDate
return primaryInventoryItems?.find {
def exactLotNumber = obsoleteLotNumber ? (it.lotNumber == obsoleteLotNumber) : (it.lotNumber == null || it.lotNumber == "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget about the whitespace case i.e. if someone enters more than one space character or worse ... tabs, returns, etc.

For readability, it might be better to move this method to Product.

@@ -996,15 +996,10 @@ class ProductAvailabilityService {
existingPA.quantityAllocated += remainingPA.quantityAllocated
existingPA.quantityNotPicked += remainingPA.quantityNotPicked
existingPA.quantityOnHold += remainingPA.quantityOnHold
existingPA. quantityAvailableToPromise += remainingPA.quantityAvailableToPromise
existingPA.quantityAvailableToPromise += remainingPA.quantityAvailableToPromise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's kind of long, but I'd prefer to spell existingPA out as existingProductAvailability for readability. Same with remainingPAs, et al.

Remind me why we need to do this instead of just rerunning the product availability once all transactions have been "fixed".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmiranda I did all the requested changes. I do not remember why I went this route. I only remember that I initially did with the refresh, but then I changed to this approach and pushed this version in the first commit/PR for this feature.

@awalkowiak awalkowiak merged commit 5b8fe9d into feature/OBPIH-3186-Merge-products Feb 20, 2023
@awalkowiak awalkowiak deleted the OBPIH-5237 branch February 20, 2023 21:23
awalkowiak added a commit that referenced this pull request Mar 31, 2023
#3848)

* OBPIH-5237 Fix merging inventory items and PA when products had null or empty lot number

* OBPIH-5237 Minor refactor after review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants