Skip to content

Instantly share code, notes, and snippets.

@BrianMRO
Last active December 29, 2021 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianMRO/4ada72d94fd2353fcd3d59c0192a5651 to your computer and use it in GitHub Desktop.
Save BrianMRO/4ada72d94fd2353fcd3d59c0192a5651 to your computer and use it in GitHub Desktop.
Prepare Replenishment - Determine Qty (Standard)
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