Improved: Enhanced ATP rule group execution logic to make it more efficient #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhancements Made:
Introduced a Parameter:
Added a parameter named scanAllProducts to control whether to scan all products or only the updated products.
Scan All Products Conditions:
Rule Group Modified: If the rule group has been modified since the last successful run, process all products.
Rule Group Never Run: If the rule group has never been run before, process all products.
Conditional Scanning Based on Facilities and Facility Groups:
If no rule group has been updated since the last successful run:
1) Threshold Rules:
Check if rules are configured to consider all configuration facilities.
2) Safety Stock, Shipping, and Store Pickup Rules:
Check if rules are configured to consider all facility groups. If such rules exist, verify whether any new facility has been added to the product store since the last run. If so, scan all products.
3) Selected Facility Groups (for Safety Stock, Shipping, and Store Pickup):
Even if no rule is configured for all facility groups, check the facility group members of the selected groups. If any new member has been added since the last successful run, scan all products.
Updated Products:
For all remaining cases, fetch and process only the products updated after the last successful run.