Last active
December 29, 2021 23:16
-
-
Save BrianMRO/4ada72d94fd2353fcd3d59c0192a5651 to your computer and use it in GitHub Desktop.
Prepare Replenishment - Determine Qty (Standard)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class INReplenishmentCreate: PXGraph<INReplenishmentCreate>... | |
protected virtual decimal OnRoundQtyByVendor(INReplenishmentItem rec, decimal qty) | |
{ | |
POVendorInventory vendorSettings = | |
FetchVendorSettings(this, rec) ?? new POVendorInventory(); | |
if (rec.ReplenishmentMethod == INReplenishmentMethod.FixedReorder) | |
qty = vendorSettings.ERQ.GetValueOrDefault(); | |
else | |
{ | |
if (vendorSettings.LotSize > 0) | |
{ | |
Decimal size = vendorSettings.LotSize.GetValueOrDefault(); | |
qty = decimal.Ceiling(qty / size) * size; | |
} | |
if (qty < vendorSettings.MinOrdQty.GetValueOrDefault()) | |
qty = vendorSettings.MinOrdQty.GetValueOrDefault(); | |
Decimal maxOrderQty = vendorSettings.MaxOrdQty ?? Decimal.Zero; //By default, in DB this value is 0, rather then null. So 0 is considered as "not set" for this value | |
if (maxOrderQty > 0 && qty > maxOrderQty) | |
qty = maxOrderQty; | |
} | |
return qty; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment