Hello all, I'm working with a copy of the InventOnhandItem form in AX 2009.
When Site and Warehouse are checked in the Dimensions display, then our main warehouse '001' is listed on the grid, immediately followed by our Quarantine warehouse '999', if there are any materials which have been rec'd and have been placed into quarantine.
I added a display method in the InventSum table methods for the purpose of totaling the qty field from the ReqTrans table where ReqTrans.ReqPlanId == 'Static' && ReqTrans.RefType == ReqRefType::BOMLine && ReqTrans.ItemId == _inventSum.ItemId && ReqTrans.CovInventDimId == _inventSum.InventDimId I then sum the Qty field and display it on the grid.
This was to show Planned Production Orders on screen. The summation works fine per help rec'd from Kent Carstens.
The problem arises in that, if there are items displaying for the quarantine warehouse, I do not want to show the amounts in my display method, only those for the main warehouse.
I have tried to figure out how to capture where the Dimensions warehouse column is getting its value for the quarantine warehouse '999' on the grid but am unsuccessful. I even found another posting from 06-02-2011, which seemed related to my problem. The posting was titled: InventSum - blank InventDimID x++", where they too were working with a duplicate of the InventOnhandItem form but, like myself they weren't able to get the InventDimID.
In the reply, it was suggested to use the InventSum table display method, findDim, i.e.,
if(!_inventSum.InventDimId)
{
dim = InventDim::findDim(this.inventDim());
if(dim.InventDimId)
_inventSum.InventDimId = dim.InventDimId;
}
However, when I try this and step through my code in the debugger, the 14-items I'm testing against having the same DIM000005 show the main warehouse '001' the first time through as expected, and then during the 2nd pass it again shows the main warehouse instead of the quarantine warehouse '999' and this results in the same amounts being displayed a second time on the grid.
It's puzzling to me that, on the grid both warehouse numbers appear, i.e., '001', '999' but in the debugger only 001 shows up 28-times as the DimId is cycled through.
Can someone please help me to isolate where the value of InventLocationId is populating the grid, or a method, which will allow me to evaluate which warehouse Id is part of the InventDimId?
I seem to have reached a dead-end in my search. Please help! Thank you.
P.S. The code from my display method follows.
Display ReqQty PlannedProdOrders(InventSum _inventSum)
{
InventDim dim;
ReqTrans reqTrans;
real qtyProdOrder = 0.00;
str whse = '';
;
//dim = InventDim::findDim(this.inventDim());//Use 'findDim' to pass correct dim to select.
if (!_inventSum.InventDimId)
{
dim = InventDim::findDim(this.inventDim());
if(dim.inventDimId)
_inventSum.InventDimId = dim.inventDimId;
}
while select ItemId, CovInventDimId, ReqPlanId, RefType, Qty from reqTrans
where reqTrans.ItemId == _inventSum.ItemId && reqTrans.CovInventDimId == _inventSum.InventDimId
&& _inventSum.inventLocationId() == dim.InventLocationId
&& reqTrans.ReqPlanId == 'Static' && reqTrans.RefType == ReqRefType::BOMLine
qtyProdOrder += reqTrans.Qty;
return qtyProdOrder;
}