Skip to content

OBLS-833 Auto allocation job stops working when a failure occurs#6022

Merged
awalkowiak merged 3 commits into
feature/obaf-integrationfrom
feature/OBLS-833
Jul 17, 2026
Merged

OBLS-833 Auto allocation job stops working when a failure occurs#6022
awalkowiak merged 3 commits into
feature/obaf-integrationfrom
feature/OBLS-833

Conversation

@adambalcerzak

Copy link
Copy Markdown
Collaborator

also apply same fix to AutomaticReceiptJob

✨ Description of Change

Link to GitHub issue or Jira ticket:
https://openboxes.atlassian.net/browse/OBLS-833

Description:
Besides fixing the issue in AutomaticAllocationJob I also applied it in AutomaticReceiptJob. In addition I added a check to stop requisition without requisitionItems to change status CREATED -> PICKING.


📷 Screenshots & Recordings (optional)

also apply same fix to AutomaticReceiptJob
@github-actions github-actions Bot added type: feature A new piece of functionality for the app domain: backend Changes or discussions relating to the backend server stakeholder: vvg Issues or topics relating to VVG (velocity vehicle group) labels Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.40%. Comparing base (5f61d78) to head (b342282).
⚠️ Report is 27 commits behind head on feature/obaf-integration.

Files with missing lines Patch % Lines
.../pih/warehouse/allocation/AllocationService.groovy 0.00% 15 Missing ⚠️
...g/pih/warehouse/jobs/AutomaticAllocationJob.groovy 0.00% 11 Missing ⚠️
.../org/pih/warehouse/jobs/AutomaticReceiptJob.groovy 0.00% 11 Missing ⚠️
.../org/pih/warehouse/receiving/ReceiptService.groovy 0.00% 7 Missing ⚠️
...n/org/pih/warehouse/requisition/Requisition.groovy 0.00% 3 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##             feature/obaf-integration    #6022      +/-   ##
==============================================================
- Coverage                       10.43%   10.40%   -0.03%     
+ Complexity                       1711     1702       -9     
==============================================================
  Files                             901      916      +15     
  Lines                           51619    52217     +598     
  Branches                        12239    12376     +137     
==============================================================
+ Hits                             5384     5434      +50     
- Misses                          45379    45914     +535     
- Partials                          856      869      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return null
}

void receiveInboundShipments(Location facility) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm, do we need to move this method to AutomaticReceiptJob?
I think ReceiptService is better place for it, especially here we have similar method 'receiveInboundShipment' that is called by 'receiveInboundShipments'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, receiveInboundShipments is doing the iteration and is calling receiveInboundShipment.
What I want in the end is from AutomaticReceiptJob to separately call receiptService.receiveInboundShipment(shipment) and surround it by try-catch and authService.withSystemUser. I thought adding this inside receiptService would not be right. Or not?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@adambalcerzak You can use the AuthService in the ReceiptService (it is already used there). If this logic still works properly after moving back to the ReceiptService, it would be better to have it inside the ReceiptService. The same applies to the allocateRequisition() from AutomaticAllocationJob

List<Location> autoReceiptFacilities = locationService.getLocationsSupportingActivities([ActivityCode.AUTO_RECEIVING]) as List<Location>
log.info "Running automatic receipt job for all shipped shipments... "
autoReceiptFacilities.each { Location facility ->
receiveInboundShipments(facility)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can't we call receiptService.receiveInboundShipments(facility) ?

}

if (!requisition.isEligibleForAutomaticAllocation()) {
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a log.debug here that the "Requisition ${requisitionId} is not eligible for automatic allocation, skipping"

return
}

if (!requisition.requisitionItems) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this could be a part of the requisition.isEligibleForAutomaticAllocation()

return null
}

void receiveInboundShipments(Location facility) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@adambalcerzak You can use the AuthService in the ReceiptService (it is already used there). If this logic still works properly after moving back to the ReceiptService, it would be better to have it inside the ReceiptService. The same applies to the allocateRequisition() from AutomaticAllocationJob

@awalkowiak
awalkowiak merged commit 30effb7 into feature/obaf-integration Jul 17, 2026
7 checks passed
@awalkowiak
awalkowiak deleted the feature/OBLS-833 branch July 17, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server stakeholder: vvg Issues or topics relating to VVG (velocity vehicle group) type: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants