modifiedField Method in D365FO in x++
ModifiedField Method in D365FO in x++
/// <summary>
///
/// </summary>
/// <param name = "_fieldId"></param>
public void modifiedField(FieldId _fieldId)
{
super(_fieldId);
SalesLine _salesline;
InventSum _inventsum,_inventsum1;
CBLCartonsInfo _cblcartonsinfo;
CBLFNInventBatchView _inventbatch;
int _onhand,_packed;
switch (_fieldId)
{
case fieldNum(CBLCartonsHeader, CBLOrderNo):
//select firstonly _salesline where _salesline.SalesId == this.CBLOrderNo;
select _inventbatch where _inventbatch.InventBatchId == this.CBLOrderNo;
this.ItemId = _inventbatch.ItemId;
this.configid = _inventbatch.configId;
while
select _inventsum where _inventsum.ItemId == this.ItemId
&& _inventsum.AvailPhysical+_inventsum.ReservPhysical>0
&& _inventsum.inventBatchId == this.CBLOrderNo
{
if (_inventsum.InventDimension3 != '00')
{
_packed+=_inventsum.AvailPhysical+_inventsum.ReservPhysical;
}
_onhand+= _inventsum.AvailPhysical+_inventsum.ReservPhysical;
}
this.OnHandQty = _onhand;
//while
//select _inventsum1 where _inventsum1.ItemId == this.ItemId
// && _inventsum1.AvailPhysical+_inventsum1.ReservPhysical>0
// && _inventsum1.inventBatchId == this.CBLOrderNo
// && _inventsum1.InventDimension3 != '00'
//{
this.PostedQty = _packed;
this.PackedQty = _packed;
this.OpenQty = this.OnHandQty-this.PackedQty;
break;
case fieldNum(CBLCartonsHeader, CBLCartonTypeEnum):
if (this.InventJournalId!=''||this.InventJournalId !=null)
{
throw error('You Can not Update this Document');
}
}
}
Comments
Post a Comment