Is it possible to get all materials for a Project with multiple groups?
GetStockedProductList returns only a few items for a given Project ID, though I think it’s not the right way to get it for a project. For given example, I am only getting 6 products.
// Get jobsite
var job = StockingLocation.GetStockingLocation(siteID, true);
var stockedProducts = StockedProductList.GetStockedProductList(job.StockingLocationID, Guid.Empty, ProductType.Product); // Or ProductType.Consumable
foreach (var part in stockedProducts)
{
// Do stuff
}
Hi, ejjungao.
To also fetch parts under the child groups, using a single call to GetStockedProductList(), the IDs for the for the groups may be passed in as List<Guid>
to the overload.
Thanks for posting
Is there any way to check and iterate through child groups for a given project? I’ve tried GetStockingLocationChild(job.StockingLocationID, true)
but I am getting nothing
Hi, ejjungao.
Attaching a sample for fetching child groups. Also, the entire location data for organization tree may be fetched using StockingLocationOrganization.GetOrganizationData
var parentJob = StockingLocation.GetStockingLocation("ParentTestJob01", false);
var childGroups = StockingLocationView.GetStockingLocationView(parentJob.TradingPartnerID);
var ids = new List<Guid>() { parentJob.StockingLocationID };
ids.AddRange(childGroups.Select(g => g.StockingLocationID));
var stockedProducts = StockedProductList.GetStockedProductList(ids, Guid.Empty, ProductType.Product);
Thanks for posting.
Thanks for that, works well.
My company has been setting the ID for the parent (project) and its children (groups) to the same ID (i.e Parent and child have ID “ParentTestJob01”). Is it possible to only retrieve the parent?
I guess you can ignore this, I switched to getting it by project name instead of number.