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>
25 lines
932 B
AL
25 lines
932 B
AL
namespace BCQuality.SCM.Samples;
|
|
|
|
using Microsoft.Inventory.Journal;
|
|
using Microsoft.Inventory.Posting;
|
|
|
|
codeunit 50101 "SCM Stock Adjustment Good"
|
|
{
|
|
procedure PostPreparedPositiveAdjustment(var ItemJournalLine: Record "Item Journal Line")
|
|
var
|
|
ItemJnlPostLine: Codeunit "Item Jnl.-Post Line";
|
|
begin
|
|
ItemJournalLine.TestField("Entry Type", ItemJournalLine."Entry Type"::"Positive Adjmt.");
|
|
ItemJournalLine.TestField("Value Entry Type", ItemJournalLine."Value Entry Type"::"Direct Cost");
|
|
ItemJournalLine.TestField("Item No.");
|
|
ItemJournalLine.TestField("Posting Date");
|
|
ItemJournalLine.TestField("Quantity (Base)");
|
|
if ItemJournalLine."Quantity (Base)" < 0 then
|
|
Error(PositiveQuantityErr);
|
|
|
|
ItemJnlPostLine.RunWithCheck(ItemJournalLine);
|
|
end;
|
|
|
|
var
|
|
PositiveQuantityErr: Label 'The prepared adjustment must increase inventory.';
|
|
}
|