As is the method to obtain by article the available quantities, and additional to this for example if I want to increase the inventory in quantities of an article. ?
Hello Bernardo. Are you wanting sample code to adjust the balance at a branch? This is only available at a branch office, not any other location. You’ll need to use a shipment for all other locations, return or deliver to a branch and then adjust the branch balance. Sample code below. This is the same as adjusting the branch balance by clicking on the button when a branch is selected.
// Adjust branch office balances. Note that this code will throw
// an exception if you attempt to use it on any location type
// besides a branch office or a laydown yard. For staging areas and jobsites
// you need to use a shipment instead.
// Create adjustment object
StockedProductAdjustmentCollection adjusts =
StockedProductAdjustmentCollection.GetStockedProductAdjustmentCollection(
branch.StockingLocationID, true, false, ProductType.Product);
// Loop through items
foreach (StockedProductAdjustment adjust in adjusts)
{
// This example sets all of the for rent balances
// (available) to null
adjust.QuantityForRent = null;
}
// Save adjustment. A comment is required.
StockedProductAdjust.AdjustStockedProducts(adjusts, branch.StockingLocationID, "Purge all stock");
hello I tried to create a new adjustment
StockedProductAdjustment x = StockedProductAdjustment.NewStockedProductAdjustment();
‘StockedProductAdjustment.NewStockedProductAdjustment(SafeDataReader)’
what does this mean SafeDataReader mean?
Thank you
Hello. I don’t think you want to create a new one, you’ll want to fetch one for the branch, so use the Get() method like in the sample code.
Excuse me, but I need to create a new one, I need both cases. If it exists update it, and if it does not exist create it .
Yes, this code does that. It’s a list of all products, stocked and not. Once you have the product in the collection set the new balance quantity that you’d like it to be.
Sorry but I think you are not understanding me, I need to add an article that is not listed in this list,
But if I have it in my products Catalog it means in this list
Hello. You need to add the part to the product catalog first, then adjust the balance.
I need to add a product that is created in my product catalog but it is not in this list of quantities available, reserved etc:
And then add a quantity, be available or reserved etc.
For example I want to add the article or part number 0101 in the list of settings and place it in quantity 10
Hello i posted this and don’t recibe an an answer
Hello. Yes, the sample code above does what you’re asking
// Loop through items
foreach (StockedProductAdjustment adjust in adjusts)
{
if (adjust.PartNumber == "0101")
{
adjust.QuantityForRent = 10;
}
}