Skip to content
Developerhome
X3

Example GraphQL queries for Stock

  Less than to read

Stock transactions query

{
  x3Stock {
    stockEntryTransaction {
      query {
        totalCount
        edges {
          node {
            _id
            code
            transactionType
            localizedDescription
            document {
              _id
              reportName
              _etag
              _createStamp
              _updateStamp
            }
            defaultStockMovementGroup {
              _id
              code
              description
              shortDescription
              defaultValue
            }
            printingMode
            identifier1Detail
            identifier2Detail
            identifier1Entry
            identifier2Entry
            supplierLot
            stockAutomaticJournal {
              code
            }
            isActive
            preloadedQuantity
            identifier1Destination
            identifier2Destination
          }
        }
      }
    }
  }
}

Stock count list query

{
  x3Stock {
    stockCountList {
      query {
        totalCount
        edges {
          node {
            _id
            stockCountSessionNumber
            stockCountSession {
              _id
              stockCountSession
              stockCountSessionDescription
              stockCountSessionType
              stockCountSessionMode
              stockCountSessionStatus
              stockCountDate
              stockCountSortCode
              isGlobal
              maximumNumberOfLines
              maximumPercentLimit
              numberOfProducts
              numberOfPositionsInLocationCode
              productFormula
              isNonUsableProductSelected
              stockCycleCountClassA
              productFormula2
              stockFormula
              locationFormula
              warehouseFormula
              productWarehouseFormula
              productWarehouse
              isMultipleCount
            }
            stockCountListNumber
            stockCountListDescription
            stockCountDate
            stockSite {
              _id
              code
              name
              isStockSite
            }
            stockCountListStatus
            stockCountListStatusDate
            isStockCountLocked
            numberOfLines
            stockCountOperator
            allocationDate
            movementDescription
            warehouse {
              _id
              code
              description
              shortDescription
            }
            lastAllocationDate
          }
        }
      }
    }
  }
}

Stock miscellaneous receipt with lines mutation (not executable on the read-only demo endpoint)

mutation {
    x3Stock {
        miscellaneousReceipt {
            create (
              data: {
                entryType: "miscellaneousReceipt",
                miscellaneousReceiptLines: [{
                  stockDetails: [{
                    product: "I-AFARTICLE2",
                    packingUnit: "PAC",
                    quantityInPackingUnit: 2,
                    packingUnitToStockUnitConversionFactor: 5,
                    status: "A1",
                    location: "INT402",
                    identifier1: "id1",
                    identifier2: "id2"
                  }, {
                    product: "I-AFARTICLE2",
                    packingUnit: "CLO",
                    quantityInPackingUnit: 1.5,
                    packingUnitToStockUnitConversionFactor: 2,
                    status: "A2",
                    location: "INT403",
                    identifier1: "iidd1",
                    identifier2: "iidd2"
                  }],
                    product: "I-AFARTICLE2",
                    packingUnitToStockUnitConversionFactor: 1,
                  packingUnit: "UN",
                  quantityInStockUnit: "13",
                  quantityInPackingUnit: "13",
                  lineNumber: 835103825},
                  {stockDetails: [{
                    product: "I-AFECC2",
                    packingUnit: "UN",
                    quantityInPackingUnit: 5,
                    packingUnitToStockUnitConversionFactor: 1,
                    status: "A",
                    lot: "LOT4",
                    sublot: "001",
                    majorVersion: "V004",
                    potency: 100,
                    useByDate: "2999-12-31"
                  }],
                    product: "I-AFECC2",
                    packingUnitToStockUnitConversionFactor: 1,
                    packingUnit: "UN",
                    quantityInStockUnit: 5,
                    quantityInPackingUnit: 5,
                    lineNumber: 1592878914
                  }],
                effectiveDate: "2024-03-15",
                stockSite: "I-A41",
                stockAutomaticJournal: "STKEN",
                transaction: "ALL"
              }) {
                id
            }
        }
    }
}

Stock miscellaneous issue with line mutation (not executable on the read-only demo endpoint)

mutation {
    x3Stock {
        miscellaneousIssue {
            create (
              data: {
                id: "",
                miscellaneousIssueLines: [{
                  product: "BMS120",
                  quantityInPackingUnit: 3,
                  packingUnit: "UN",
                  packingUnitToStockUnitConversionFactor: 1,
                  quantityInStockUnit: 3,
                  lineNumber: 1086141824,
                  stockDetails: [{
                    packingUnit: "UN",
                    packingUnitToStockUnitConversionFactor: 1,
                    quantityInPackingUnit: 3,
                    quantityInStockUnit: 3,
                    location: "STO01",
                    licensePlateNumber: "",
                    lot: "LO2406NA0210001",
                    status: "A",
                    sublot: "",
                    serialNumber: "",
                    identifier1: "",
                    identifier2: "",
                    stockCustomField1: "",
                    stockCustomField2: "",
                    stockUnit: "UN"
                  }]}],
                entryType: "miscellaneousIssue",
                stockSite: "NA021",
                effectiveDate: "2024-12-10",
                stockAutomaticJournal: "STKIS"
              }) {
                id
            }
        }
    }
}

Location reorder mutation example for replenishment reorder (not executable on the read-only demo endpoint)

mutation {
    x3Stock {
        stockReorder {
            processReorder (parameters: {stockEntryTransaction: "REP", documentNumber: "I-AD12110PRL00000001", documentLine: 8027, stockSite: "I-AD1", destinationLocation: "IADR06", source: 1, stockId: 1363, stockSequence: 99999999, product: "I-SLADC_RO2", fromLocation: "ADCL01", lot: "ADCLOT-000019", sublot: "", serialNumber: "", status: "A1", identifier1: "", identifier2: "", licensePlateNumber: "undefined", packingUnit: "CAR", packingUnitToStockUnitConversionFactor: 24, packingQuantity: 2}) {
                stockEntryTransaction
                documentNumber
                documentLine
                stockSite
                destinationLocation
                source
                stockId
                stockSequence
                product
                fromLocation
                lot
                sublot
                serialNumber
                status
                identifier1
                identifier2
                licensePlateNumber
                packingUnit
                packingUnitToStockUnitConversionFactor
                packingQuantity
            }
        }
    }
}

Putaway transaction for a tracked product (not executable on the read-only demo endpoint)

mutation {
    x3Stock {
        storageDetails {
            processPutaway (parameters: {stockEntryTransaction: "ADC", storageSite: "I-AD1", stockId: "1361", documentType: "miscellaneousReceipt", documentNumber: "MRC000135", documentLineNumber: 5000, storageSequenceNumber: 1, quantityInPackingUnit: 5, quantityInStockUnit: 5, status: "A", location: "ADCL01", locationType: "ADCL1", lot: "", sublot: "", startingSerialNumber: "XTSER7101", endingSerialNumber: "", licensePlateNumber: "", container: "", labelDestination: ""}) {
                stockEntryTransaction
                storageSite
                stockId
                documentType
                documentNumber
                documentLineNumber
                storageSequenceNumber
                quantityInPackingUnit
                lot
                sublot
                startingSerialNumber
                endingSerialNumber
                status
                container
                licensePlateNumber
                location
                locationType
                quantityInStockUnit
                labelDestination
            }
        }
    }
}

Pick transaction for a pick ticket line with a quantity of 10 with lot controlled product (not executable on the read-only demo endpoint)

mutation {
    x3Stock {
        pickTicketLine {
            updatePickTicketLine (parameters: {entryTransaction: "STD", pickTicket: "PICNA0210334", pickTicketLine: 1, destinationLocation: "", product: "BMS122", shortPick: false, deliverable: true, documentDestination: "", packingUnit: ["UN"], packingUnitToStockUnitConversionFactor: [1], quantityInPackingUnit: [10], quantityInStockUnit: [10], location: ["STO01"], lot: [""], sublot: [""], serialNumber: ["SERNA02100111"], status: ["A"], stockId: [11008], customBoolean: null, customDecimal: null, customString: null, customDate: null}) {
                pickTicket
                pickTicketLine
            }
        }
    }
}

Internal stock change mutation

mutation {
  x3Stock {
    stockChange {
      stockChange(
        parameter: {
          stockChangeLines:
          [{
            lineNumber: 1,
            product: "ART_NORMAL",
            stockId: 10427,
            quantityInPackingUnit: 2,
            stockDetails:
            [{
              packingUnit: "UN",
              packingUnitToStockUnitConversionFactor: 1,
              quantityInPackingUnit: 2,
              quantityInStockUnit: 2,
              location: "INT04",
              status: "A",
              serialNumber: "",
              endingSerialNumber: "",
              identifier1: "",
              identifier2: ""}]}],
          stockChangeDestination: "internal",
          stockSite: "SITEA",
          effectiveDate: "2024-01-15",
          project: "",
          stockMovementGroup: "",
          stockMovementCode: "",
          printingMode: "noPrint",
          destination: "",
        }
      ) {
        id
      }
    }
  }
}

Stock count mutation

mutation {
    x3Stock {
        stockCountListDetail {
            processCount (
              parameters: {
                stockCountSessionNumber: "I-A422112SES00000001",
                stockCountListNumber: "I-A422112INV00000001",
                productRankNumber: 1000,
                product: "I-AFQASAMSER4",
                licensePlateNumber: "",
                location: "INT421",
                lot: "L1",
                sublot: "",
                serialNumber: "",
                status: "A",
                majorVersion: "",
                minorVersion: "",
                packingUnit: "UN",
                countedStockInPackingUnit: 2,
                packingUnitToStockUnitConversionFactor: 1,
                multiCountNumber: 0,
                serialNumberQuantity: [2, 1],
                startingSerialNumber: ["LS01", "LS05"],
                endingSerialNumber: ["LS02", "LS05"],
                serialNumberVariance: ["S", "S"]
              }) {
                stockCountSessionNumber
                stockCountListNumber
            }
        }
    }
}

Inter-site stock change mutation

mutation {
    x3Stock {
        stockChange {
            intersiteTransfer (parameter:
{
                stockChangeLines:
                 [{
                    product: "BMS120",
                    stockId: 11000,
                    lineNumber: 505744414,
                    quantityInPackingUnit: 2,
                    packingUnit: "UN",
                    packingUnitToStockUnitConversionFactor: 1,
                    stockDetails:
                    [{
                    quantityInPackingUnit: 2,
                    quantityInStockUnit: 2,
                    location: "QUA02",
                    status: "A",
                    packingUnit: "UN",
                    packingUnitToStockUnitConversionFactor: 1,
                    serialNumber: "",
                    identifier1: "",
                    identifier2: "",
                    stockUnit: "UN"
                    }],
                    packingUnitDestination: "UN",
                    packingUnitToStockUnitConversionFactorDestination: 1,
                    quantityInPackingUnitDestination: 2,
                    quantityInStockUnitDestination: 2,
                    stockSite: "NA021"
                }],
            stockSite: "NA021",
            effectiveDate: "2024-12-10",
            stockAutomaticJournal: "STKSC",
            destination: "",
            transaction: "STD",
            stockChangeDestination: "intersite",
            stockSiteDestination: "NA022"
}) {
                id
            }
        }
    }
}

Stock change by Licence Plate Number mutation

mutation {
    x3Stock {
        stockChangeByLpn {
            lpnGrouping (parameter: {stockChangeLines: [{licensePlateNumber: "BAG00003", lineNumber: 1}], effectiveDate: "2024-01-15", stockSite: "NA021", licensePlateNumberOperationMode: 1, locationDestination: "QUA01",      stockChangeDestination: "internal", licensePlateNumberDestination: "BAG00001"}) {
                id
                stockSite {
                    code
                }
                effectiveDate
                project {
                    id
                }
                documentDescription
                licensePlateNumberOperationMode
                licensePlateNumberDestination {
                    code
                }
                locationDestination
                stockChangeLines {
                    query {
                        edges {
                            node {
                                stockChangeId
                                lineNumber
                            }
                        }
                    }
                }
            }
        }
    }
}

Subcontract transfer mutation

mutation {
  x3Stock {
    stockChange {
      subcontractTransfer(
        parameter: {
          stockChangeLines:
          [{
            lineNumber: 1,
            product: "ART_NORMAL",
            stockId: 10427,
            quantityInPackingUnit: 2,
            stockDetails:
            [{
              packingUnit: "UN",
              packingUnitToStockUnitConversionFactor: 1,
              quantityInPackingUnit: 2,
              quantityInStockUnit: 2,
              location: "SST01",
              status: "A",
              serialNumber: "",
              endingSerialNumber: "",
              identifier1: "",
              identifier2: ""}]}],
          stockChangeDestination: "subcontractTransfer",
          stockSite: "SITEA",
          effectiveDate: "2024-01-15",
          subcontractor: "FOURN-MAE",
          subcontractorAddress: "AD1",
          subcontractLocation: "SST01",
          project: "",
          stockMovementGroup: "",
          stockMovementCode: "",
          printingMode: "noPrint",
          destination: "",
        }
      ) {
        id
      }
    }
  }
}

Update stock count line with global issued/received tracked product