AlmondTill/G3N API

On this page

repairInventoryOnOrder

mutation · in the family Inventory operations

What it does

Correct one stock item’s on-order figure to what your open purchase orders add up to — with a reason.

REPAIR one junction's on-order figure: re-derive the InventoryItem's onOrderQty from the receivable purchase orders' open lines for its variant × logical facility and stamp THAT figure over the stored one — ONE OCC full-item write with the REQUIRED reason on the revision cause (kind edit); a converged cell answers changed false and writes nothing. No stock moves and no Stock-Card entry posts — on order is bookkeeping beside the five buckets, never a bucket. 'reason' is REQUIRED and non-blank (blank/oversize refuse VALIDATION/INVALID naming the cure). Requires the unrestricted capability.

What happens

Rewrites that one figure and records the reason; nothing moves in stock and no ledger entry posts. An item that already agrees is left alone and says so.

Careful

Repairing while an order is still walking writes a figure the walk’s next chunk moves again — let the walk finish first.

Who may call it

Capability area: Inventory operations — Receiving, counting, transferring and moving stock.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
reasonString String!yesNo further notes.

Returns

InventoryOnOrderRepair InventoryOnOrderRepair! — The answer of ONE on-order repair: the junction as it now stands, the figure it held before, the derived figure it was stamped to, and whether anything changed (a converged cell answers false — nothing written).

Example request

mutation ExampleRepairInventoryOnOrder($id: ID!, $reason: String!) {
  repairInventoryOnOrder(id: $id, reason: $reason) {
    previous
    derived
    changed
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "repairInventoryOnOrder": {
      "previous": "<previous>",
      "derived": "<derived>",
      "changed": true
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer