0

我编写了这个程序,通过单击一个名为“问题材料”的按钮将它们添加到项目日记帐行表中。这是程序;

procedure IssueMaterial(IncomingLine: Record "Purchase Requisition Line")
var
ItemCont: Record "Item Journal Line";
begin
IF ItemCont.FindLast then begin
ItemCont."Line No." := ItemCont."Line No." + 10000;
end;
with ItemCont do begin
ItemCont.Init();
ItemCont."Journal Template Name" := 'Item';
Validate("Item No.", IncomingLine."No.");
ItemCont."Posting Date" := WorkDate();
Validate("Location Code", IncomingLine.Location);
ItemCont."Entry Type" := ItemCont."Entry Type"::"Negative Adjmt.";
ItemCont."Journal Batch Name" := 'Default';
ItemCont."Line No." := IncomingLine."Line No.";
Validate(Quantity, IncomingLine.Quantity);
Validate(Amount, IncomingLine.Amount);
Validate("Unit Cost", IncomingLine."Unit Cost");
ItemCont.Insert();
end;
Message('%1 has been successfully created', IncomingLine."No.");
end;

这是我写的动作(按钮)的代码;

trigger OnAction()
var
codeunitcont: Codeunit "Purchase Req. Mgmt.";
PurchReqLine: Record "Purchase Requisition Line";
begin
CurrPage.SetSelectionFilter(PurchReqLine);
IF PurchReqLine.FindSet then
repeat
PurchReqLine.TestField(PurchReqLine.Location);
codeunitcont.IssueMaterial(PurchReqLine);
until PurchReqLine.Next = 0;
end;

它工作正常。我将我的行移至项目日志表,但是,一旦我重新启动租户或重建并重新发布扩展,我的项目日志表就会丢失其记录!感谢您就可能出现的问题提出建议

4

1 回答 1

0

在 OnOpenPage 上编写了删除项目日记帐行的所有记录的代码!行动。

于 2019-08-26T14:22:09.623 回答