bcquality/microsoft/knowledge/scm/use-date-aware-availability-for-promising.bad.al
Jesper Schulz-Wedde 9ac62e3967 Add SCM functional knowledge domain
Introduce nine source-backed rules with original AL sample pairs, bounded SCM review routing, and complete positive/clean evaluation coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-17 15:54:23 +02:00

25 lines
945 B
AL

namespace BCQuality.SCM.Samples;
using Microsoft.Inventory.Item;
codeunit 50114 "SCM Additional Promise Bad"
{
procedure CanPromiseAdditionalDemand(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; ShipmentDate: Date; RequestedAdditionalQuantityBase: Decimal; LookaheadDateFormula: DateFormula): Boolean
var
Item: Record Item;
begin
if (ShipmentDate = 0D) or (RequestedAdditionalQuantityBase <= 0) then
Error(DemandInputErr);
Item.Get(ItemNo);
Item.TestField(Type, Item.Type::Inventory);
Item.SetRange("Location Filter", LocationCode);
Item.SetRange("Variant Filter", VariantCode);
Item.SetRange("Date Filter", 0D, ShipmentDate);
Item.CalcFields(Inventory);
exit(Item.Inventory >= RequestedAdditionalQuantityBase);
end;
var
DemandInputErr: Label 'Enter a shipment date and a positive additional base quantity.';
}