mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
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>
33 lines
1.3 KiB
AL
33 lines
1.3 KiB
AL
namespace BCQuality.SCM.Samples;
|
|
|
|
using Microsoft.Foundation.Enums;
|
|
using Microsoft.Inventory.Availability;
|
|
using Microsoft.Inventory.Item;
|
|
|
|
codeunit 50115 "SCM Additional Promise Good"
|
|
{
|
|
procedure CanPromiseAdditionalDemand(ItemNo: Code[20]; LocationCode: Code[10]; VariantCode: Code[10]; ShipmentDate: Date; RequestedAdditionalQuantityBase: Decimal; LookaheadDateFormula: DateFormula): Boolean
|
|
var
|
|
Item: Record Item;
|
|
AvailableToPromise: Codeunit "Available to Promise";
|
|
GrossRequirement: Decimal;
|
|
ScheduledReceipt: Decimal;
|
|
PromisableQuantityBase: Decimal;
|
|
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);
|
|
|
|
PromisableQuantityBase := AvailableToPromise.CalcQtyAvailableToPromise(
|
|
Item, GrossRequirement, ScheduledReceipt, ShipmentDate,
|
|
Enum::"Analysis Period Type"::Day, LookaheadDateFormula);
|
|
exit(PromisableQuantityBase >= RequestedAdditionalQuantityBase);
|
|
end;
|
|
|
|
var
|
|
DemandInputErr: Label 'Enter a shipment date and a positive additional base quantity.';
|
|
}
|