AlmondTill/G3N API

On this page

postCount

mutation · in the family Inventory adjustments

What it does

Post a completed stock count — the counted truth replaces the book figures.

POST a fully-captured Count: posts every NON-ZERO variance as a count_correct DELTA through ONE transaction — gain to / shrink from on_hand; record lines stamp their StockRecord in the SAME transaction (the SECOND record-touching movement); pool lines post bin-blind (the pool re-derives); costImpact = variance x the II's CURRENT WMA (shrink −/gain +; the WMA itself never re-weights on a count) + unitCost = that WMA + refs [IC-sysId] on EVERY entry (never-silent). Uncaptured lines refuse event-less naming the first-8 lineNos; every varianced line's II must be ACTIVE (CONFLICT/REF_STATE — reactivation free); a ZERO-variance posting is LEG-LESS (pure FSM — posted with no movements). Requires the doc CURRENT revision (OCC) + the unrestricted capability.

What happens

Differences post as signed stock movements, all auditable.

Careful

This IS the moment your books change to match the shelves. Wrong counts post wrong stock — review the variances before posting.

Who may call it

Capability area: Inventory adjustments — Correcting stock with a reason and posting counts.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
reasonStringnoNo further notes.

Returns

Count Count! — A stock count: RECORDED stock vs PHYSICALLY-PRESENT stock at ONE LF, posting count_correct variance DELTAS (never absolute sets). Counts count ON_HAND presence only (condition rides reclass). posted is IMMUTABLE non-doomed history (recount = a NEW linked count); cancelled is the ONE doomed terminal (lists filter it). BLIND-BY-SHAPE while counting: line reads omit snapshot/expected/variance.

Example request

mutation ExamplePostCount($id: ID!, $revision: ID!, $reason: String) {
  postCount(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    countType
    recountOfCountId
  }
}

Variables:

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

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

Example response

{
  "data": {
    "postCount": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "IC-EXMP-0000-000F",
      "type": "Count",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "countType": "physical",
      "recountOfCountId": "01900000-0000-7000-8000-200395ec0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in