我正在尝试在AgreementLineQuantityCommitment中插入新行,并将它们插入到表中但不以表格形式出现,代码为: 有什么建议吗?
LineqtyComm.initValue();
select firstOnly LineqtyComm where LineqtyComm.Agreement == _aggrHeader.RecId;
LineqtyComm.initFromAgreementHeader(_aggrHeader);
LineqtyComm.ItemId = _itemId;
LineqtyComm.CommitedQuantity = _qty;
LineqtyComm.ProductUnitOfMeasure = _unitOfMeasure;
LineqtyComm.PriceUnit = _PriceUnit;
LineqtyComm.ExpirationDate = _expirationDate;
inventDimLoc = LineqtyComm.inventDim();
inventDimLoc.InventSiteId = _SiteId;
inventDimLoc.InventLocationId = _locationId;
inventDimLoc.wMSLocationId = _whId;
inventDim = InventDim::findOrCreate(inventDimLoc);
LineqtyComm.inventDimId = inventDim.inventDimId;
LineqtyComm.LineNumber = AgreementLine::lastLineNum(_aggrHeader.RecId) + 1.0;
LineqtyComm.initFromInventTable();
LineqtyComm.insert();
答案 0 :(得分:0)
1)请更改以下代码行。由于这行代码LineqtyComm使用退出记录值进行初始化,但在记录未退出时不会发生。 LineqtyComm.initValue();行初始化总是被覆盖。
LineqtyComm.initValue();
select firstOnly LineqtyComm where LineqtyComm.Agreement == _aggrHeader.RecId;
到
select firstOnly LineqtyComm where LineqtyComm.Agreement == _aggrHeader.RecId;
if (!LineqtyComm.Recid)
{
LineqtyComm.initValue();
}
2)然后改变下面的行
inventDimLoc = LineqtyComm.inventDim();
到
inventDimLoc.clear();
当你创建像InventDim :: findOrCreate(inventDimLoc);这样的inventdim时,最好清除而不是获取现有的inventdim行。