Skip to content
Developer home
X3

Example GraphQL queries for Stock

  Less than to read

Stock transactions query

{
  xtremX3Stock {
    stockTransaction {
      query {
        totalCount
        edges {
          node {
            _id
            code
            transactionType
            localizedDescription
            document
            defaultStockMovementGroup {
              _id
              code
              description
              shortDescription
              defaultValue
            }
            printingMode
            identifier1Detail
            identifier2Detail
            identifier1Entry
            identifier2Entry
            supplierLot
            stockAutomaticJournal
            isActive
            preloadedQuantity
            identifier1Destination
            identifier2Destination
          }
        }
      }
    }
  }
}

Stock count list query

{
  xtremX3Stock {
    stockCountList {
      query {
        totalCount
        edges {
          node {
            _id
            stockCountSessionNumber
            stockCountListNumber
            stockCountListDescription
            stockCountDate
            stockSite {
              _id
              code
              name
              isStockSite
            }
            stockCountListStatus
            stockCountListStatusDate
            isStockCountLocked
            numberOfLines
            stockCountOperator
            allocationDate
            movementDescription
            warehouse {
              _id
              code
              description
              shortDescription
              exportNumber
            }
            lastAllocationDate
            exportNumber
          }
        }
      }
    }
  }
}

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

mutation {
  xtremX3Stock {
    miscellaneousReceipt {
      create(data:
        { 
          # Header information
          stockSite: "AO011",
          effectiveDate: "2020-12-30",
          
          # Line details
          miscellaneousReceiptLines: [
            
            # First line, product DIS004, quantity 230
            {stockSite: "AO011", product: "DIS004", quantityInPackingUnit: "230", packingUnit: "UN",
              
              # Sub-details: 200 in status 1, 30 in status Q
              stockDetails: [
                {quantityInPackingUnit: "200", packingUnit: "UN", location: "A1C11", status: "A"},
                {quantityInPackingUnit: "30", packingUnit: "UN", location: "A1C11", status: "Q"}
                            ]},

            # Second line: product DIS008, quantity 158, a unique sub-detail line (status A)
            {stockSite: "AO011", product: "DIS008", quantityInPackingUnit: "158", packingUnit: "UN",
              stockDetails: [
                {quantityInPackingUnit: "158", packingUnit: "UN", location: "A1C12", status: "A"}
                            ]},

            # Third line: product CON006, quantity 1, a unique sub-detail line (a serial number)

            {stockSite: "AO011", product: "CON006", quantityInPackingUnit: "1", packingUnit: "UN",
              stockDetails: [
                {quantityInPackingUnit: "1", packingUnit: "UN", serialNumber: "ABC082",
                location: "A1C11", status: "A"}
                            ]
            }                        ]})
      
      # If successful, return the id of the receipt and the effective date
      {
        id
        effectiveDate
      }
    }
  }
}

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

mutation {
  xtremX3Stock {
    miscellaneousIssue {
      create(data:
        {
          stockSite: "AO011", effectiveDate: "2021-02-05",
          miscellaneousIssueLines: [
            {stockSite: "AO011", product: "DIS004", packingUnit: "UN",
              packingUnitToStockUnitConversionFactor: "1",
              quantityInPackingUnit: "100",
              stockDetails:[
                {packingUnit: "UN", packingUnitToStockUnitConversionFactor: "1",
                  quantityInPackingUnit: "100", location: "A1C11", status: "A"},
              ]}]})
      {
        id
      }
    }
  }
}

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


mutation {
    xtremX3Stock {
        stockReorder {
            reorderStock (stockEntryTransaction: "REP",
              documentNumber: "PARNA0110006",
              documentLine: 4968,
              stockSite: "NA011",
              destinationLocation: "REO001",
              source: 1,
              stockId: 11042,
              stockSequence: 99999998,
              product: "ADC-SERIAL-PRODUCT3",
              fromLocation: "ADC03",
              lot: "",
              sublot: "",
              serialNumber: "202",
              status: "A",
              identifier1: "",
              identifier2: "",
              licensePlateNumber: "",
              packingUnit: "UN",
              packingUnitToStockUnitConversionFactor: 1,
              packingQuantity: 5)
        }
    }
}

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

mutation {
  xtremX3Stock {
    storageDetails {
      processPutaway (
        stockEntryTransaction: "STD",
        storageSite: "NA021",
        stockId: 14285,
        documentType: 6,
        documentNumber: "RECNA0210511",
        documentLineNumber: 1000,
        storageSequenceNumber: 1,
        quantityInPackingUnit: 2,
        quantityInStockUnit: 2,
        lot: "LO2004NA0210003",
        sublot: "00001",
        startingSerialNumber: "RLF00018",
        endingSerialNumber: "RLF00019",
        status: "A",
        container: "CTR00001",
        licensePlateNumber: "BAG00001",
        location: "QUA01",
        locationType: "CQU",
        labelDestination: "PRT00001"
      )
    }
  }
}

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 {
    xtremX3Stock {
        pickTicketLine {
            updatePickTicketLine(
                entryTransaction: "STD"
                pickTicket: "PKT00000008"
                pickTicketLineId: 1
                productCode: "L-GLUTAMINE800"
                isShortPick: false
                isDeliverable: false
                destinationLocation: ""
                documentDestination: ""
                allocations: [
                    { sequenceNumber: 1, location: "STO05", lot: "202003100", quantityInStockUnit: 10, status: "A" }
                ]
            )
        }
    }
}

Internal stock change mutation

mutation {
    xtremX3Stock {
        stockChange {
            create(
                data: {
                    stockSite: "ATS01"
                    effectiveDate: "2020-09-03"
                    transportDocumentType: "SCS"
                    stockChangeDestination: internal
                    isLocationChange: true
                    isStatusChange: true
                    isPackingUnitChange: false
                    documentDescription: "Test TS"
                    stockMovementGroup: "010"
                    stockMovementCode: "CHS"
                    stockChangeLines: [
                        {
                            product: "ATS-LOTEMP"
                            productDescription: "Description ATS-LOTEMP"
                            lot: "LOT1108"
                            status: "A"
                            location: "SAPI001"
                            licensePlateNumber: "LPN00001"
                            packingUnit: "UN"
                            packingUnitToStockUnitConversionFactor: "1"
                            quantityInPackingUnit: "1"
                            quantityInStockUnitDestination: "1"
                            locationDestination: "A1C01"
                            statusDestination: "A1"
                            movementDescription: "Changement de stock"
                        }
                    ]
                }
            ) {
                id
            }
        }
    }
}