21.03.2008, 15:18 | #1 |
Axapta Retail User
|
Очередные грабли while select
Проблема выборки ...
X++: static server container calcQty1(ItemId _itemId, InventDimId _inventDimId, InventLocationId _inventLocationId, InventParameters _inventParameters = InventParameters::find()) { InventSum inventSum; InventSum inventSum1; PurchTable purchTable; InventDim inventDim = InventDim::find(_inventDimId); InventDimParm inventDimParm; Qty MyOnHand; Qty onHand; Qty dcOnHand; Qty ordered; Qty invTrans; InventTrans purch; InventTrans inventTrans; InventDim tmpDim; date dat; ; dat = today() - 2; inventDimParm.ItemIdFlag = NoYes::Yes; inventDimParm.InventLocationIdFlag = NoYes::Yes; inventDim.InventLocationId = 'РЦ';//_inventParameters.DistributionCenter; inventSum = InventSum::findSum(_itemId, inventDim, inventDimParm, InventSumFields::All); dcOnHand = inventSum.availPhysical(); tmpDim = InventDim::findOrCreateInventLocationId(_inventLocationId); invTrans = (select /*firstonly*/ sum(qty) from inventTrans order by TransRefID desc where inventTrans.ItemId == _itemId && inventTrans.inventDimId == tmpDim.inventDimId && inventTrans.TransType == InventTransType::Purch && inventTrans.StatusReceipt == StatusReceipt::Ordered && inventTrans.DatePhysical == str2date("",123) ).Qty && inventDim.RecId != 68956563 ; purch = InventTrans::findRecId( (select /*firstonly*/ sum(qty) from inventTrans order by TransRefID desc where inventTrans.ItemId == _itemId && inventTrans.inventDimId == tmpDim.inventDimId && inventTrans.TransType == InventTransType::Purch && inventTrans.StatusReceipt == StatusReceipt::Ordered && inventTrans.DatePhysical == str2date("",123) ).RecId && inventDim.RecId != 68956563); purchTable = PurchTable::find(purch.TransRefId); if(purchTable.createdDate < dat){ invTrans = 0; } if (_inventLocationId != _inventParameters.DistributionCenter) { while select inventDim { if(inventdim.RecId != 32171 || inventdim.RecID != 2685644 || inventdim.RecID != 81579138 || inventDim.RecId != 68956563){ inventDimParm = null; inventSum = InventSum::findSum(_itemId, inventDim, inventDimParm, InventSumFields::All); } } } onHand = inventSum.availPhysical(); // ordered = inventSum.Ordered; //ordered = invTrans; return [dcOnHand, onHand, ordered]; } X++: while select inventDim { if(inventdim.RecId != 32171 || inventdim.RecID != 2685644 || inventdim.RecID != 81579138 || inventDim.RecId != 68956563){ inventDimParm = null; inventSum = InventSum::findSum(_itemId, inventDim, inventDimParm, InventSumFields::All); } |
|