OBLS-833 Auto allocation job stops working when a failure occurs#6022
Conversation
also apply same fix to AutomaticReceiptJob
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
| return null | ||
| } | ||
|
|
||
| void receiveInboundShipments(Location facility) { |
There was a problem hiding this comment.
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'
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
@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) |
There was a problem hiding this comment.
can't we call receiptService.receiveInboundShipments(facility) ?
| } | ||
|
|
||
| if (!requisition.isEligibleForAutomaticAllocation()) { | ||
| return |
There was a problem hiding this comment.
Add a log.debug here that the "Requisition ${requisitionId} is not eligible for automatic allocation, skipping"
| return | ||
| } | ||
|
|
||
| if (!requisition.requisitionItems) { |
There was a problem hiding this comment.
I think this could be a part of the requisition.isEligibleForAutomaticAllocation()
| return null | ||
| } | ||
|
|
||
| void receiveInboundShipments(Location facility) { |
There was a problem hiding this comment.
@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
move functions to services
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)