How to do a Quantity Adjustment in an Epicor Function

I need to perform Quantity Adjustments using the REST API.

The BO is Erp.BO.InventoryQtyAdjSvc. Epicor makes a few calls in its own Quantity Adjustment app :

  1. NegativeInventoryTest
  2. PreSetInventoryQtyAdj
  3. SetInventoryQtyAdj
  4. GetInventoryQtyAdjForPart

An Epicor Function called from the REST API seems like a good way to handle this.

Following this old topic, I expect a few people here having already created a similar function.

Maybe someone would be willing to share its function? :heart_hands:

1 Like

I got one somewhere but busy putting out fires.

Maybe someone will get back to you before I’m done.

2 Likes

this function work for me.

try
{
    this.CallService<Erp.Contracts.InventoryQtyAdjSvcContract>(invAdj =>
    {
        var ds = invAdj.GetInventoryQtyAdj(this.partNum, this.uomCode);

        if (ds.InventoryQtyAdj == null || ds.InventoryQtyAdj.Count == 0)
        {
            this.output = "No adjustment row returned. Check if PartNum or UOM is invalid.";
            return;
        }

        var row = ds.InventoryQtyAdj[0];
        row.PartNum = this.partNum;
        row.WareHseCode = this.warehseCode;
        row.BinNum = this.binNum;
        row.AdjustQuantity = -this.shipLineQty;
        row.ReasonCode = "ADD";
        row.RowMod = "U";

        string pkTrans;
        invAdj.SetInventoryQtyAdj(ref ds, out pkTrans);

        this.output = "Inventory adjust success!";
    });
}
catch (Exception ex)
{
    this.output = "Error message: " + ex.Message;
} 
2 Likes