How can we get the Branch/blueroof name, Qty available, and Qty on rent/in use for each part number by branch/blueroof and everything under the blue roof. What we are trying to do is calculate the % use of each part number.
We are using C#
How can we get the Branch/blueroof name, Qty available, and Qty on rent/in use for each part number by branch/blueroof and everything under the blue roof. What we are trying to do is calculate the % use of each part number.
We are using C#
Does anyone know how we can achieve this calculation. We are looking for Basically the products tab at the blue roof level for the lowest blue roofs.
Hi, Chris.shumaker.
You may use code similar to below to retrieve parts at a Branch.
var branch = TradingPartner.GetTradingPartner("Branch-Name");
var parts = StockedProductList.GetSerializedStockedProductList(branch.StockingLocationID, Guid.Empty);
Thanks for posting.
How do I get the Qty available, at Job etc
I cannot find specifically the QtyAvailable field in the available fields in the API.
Hi Chris. This code may help you. It fetches a branch office (blue roof), then fetches all of the jobs for the branch office, then iterates through the quantity on rent for each job.
// Get branch office
TradingPartner branchTp = TradingPartner.GetTradingPartner("New York Yard");
StockingLocation branch = StockingLocation.GetStockingLocation(branchTp.StockingLocationID, false);
// Get a list of all jobsites for the branch
StockingLocationList jobs = StockingLocationList.GetJobsites(false,
JobTreeNodeDisplayType.Name, branch.StockingLocationID);
// Iterate through the jobs
foreach (StockingLocationListItem job in jobs.OrderBy(x => x.Name))
{
StockingLocation partsForJob =
StockingLocation.GetStockingLocation(job.StockingLocationID, true);
Console.WriteLine("PARTS FOR " + partsForJob.Name.ToUpper());
foreach (StockedProduct prod in partsForJob.StockedProducts)
{
Console.WriteLine(prod.PartNumber + " " + prod.QuantityOnRent);
}
}
Here’s the iteration for the jobs under the branch
And here’s the parts under the first job there