Skip to content
Developerhome

Example GraphQL queries for Stock

  Less than to read

Stock transactions query

{
  xtremX3Inventory {
    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

{
  xtremX3Inventory {
    stockCountList {
      query {
        totalCount
        edges {
          node {
            _id
            stockCountSessionNumber {
              _id
              stockCountSession
              stockCountSessionDescription
              stockCountSessionType
              stockCountSessionMode
              stockCountSessionStatus
              stockCountDate
              stockCountSortCode
              isGlobal
              maximumNumberOfLines
              maximumPercentLimit
              numberOfProducts
              numberOfPositionsInLocationCode
              productFormula
              isNonUsableProductSelected
              stockCycleCountClassA
              productFormula2
              stockFormula
              locationFormula
              warehouseFormula
              productWarehouseFormula
              productWarehouse
              exportNumber
              isMultipleCount
            }
            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 {
  xtremX3Inventory {
    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 {
  xtremX3Inventory {
    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 {
    xtremX3Inventory {
        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 {
    xtremX3Inventory {
        storageDetails {
            processPutaway (
              stockEntryTransaction: "PADC", 
              storageSite: "NA021", 
              stockId: "11037", 
              documentType: "miscellaneousReceipt", 
              documentNumber: "MRCNA0210029", 
              documentLineNumber: 2000, 
              storageSequenceNumber: 1, 
              quantityInPackingUnit: 1, 
              quantityInStockUnit: 1, 
              status: "A", 
              location: "QUA01", 
              locationType: "CQU", 
              lot: "", 
              sublot: "", 
              startingSerialNumber: "", 
              endingSerialNumber: "", 
              licensePlateNumber: "", 
              container: "", 
              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 {
    xtremX3Inventory {
        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 {
    xtremX3Inventory {
        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
            }
        }
    }
}

Stock count mutation

mutation {
    xtremX3Inventory {
        stockCountListDetail {
            processCount(
                stockCountSessionNumber: "NA0212100008"
                stockCountListNumber: "NA0212104002"
                productRankNumber: 0
                product: "PROD1"
                licensePlateNumber: "LPN00001"
                location: "QUA01"
                lot: "PROD1LOT01"
                sublot: "00001"
                serialNumber: "PROD1SER01"
                status: "A"
                majorVersion: "01"
                minorVersion: "03"
                packingUnit: "BAG"
                packingUnitToStockUnitConversionFactor: 5
                countedStockInPackingUnit: 2
                multiCountNumber: 0
            )
        }
    }
}

Inter-site stock change mutation

mutation {
    xtremX3Inventory {
        stockChange {
            create(
                data: {
                    stockChangeDestination: intersite
                    stockSite: "NA011"
                    effectiveDate: "2021-05-11"
                    transportDocumentType: "SCI"
                    stockSiteDestination: "NA012"
                    isStatusChange: false
                    isPackingUnitChange: false
                    stockChangeLines: [
                        {
                            product: "BMS001"
                            stockSite: "NA011"
                            packingUnit: "UN"
                            quantityInPackingUnit: 1
                            packingUnitToStockUnitConversionFactor: 1
                            status: "A"
                            packingUnitDestination: "UN"
                            quantityInStockUnitDestination: 1
                            location: "STO03"
                            locationDestination: "FLR06"
                        }
                    ]
                }
            ) {
                _id
            }
        }
    }
}

Stock change by Licence Plate Number mutation

mutation {
    xtremX3Inventory {
        stockChangeByLpn {
            create(
                data: {
                    stockSite: "NA011"
                    effectiveDate: "2021-09-01"
                    documentDescription: "Group LPN01 and LPN02 into LPN03"
                    stockMovementGroup: ""
                    licensePlateNumberOperationMode: 1
                    licensePlateNumberDestination: "LPN03"
                    locationDestination: "STO13"
                    stockChangeLines: [
                        { lineNumber: 1000, licensePlateNumber: "LPN01" }
                        { lineNumber: 2000, licensePlateNumber: "LPN02" }
                    ]
                }
            ) {
                id
            }
        }
    }
}

Subcontract transfer mutation

mutation {
    xtremX3Inventory {
        stockChange {
            create(
                data: {
                    stockSite: "StockSite"
                    effectiveDate: "yyyy-mm-dd"
                    transportDocumentType: "SCT"
                    stockChangeDestination: subcontractTransfer
                    isStatusChange: true
                    isPackingUnitChange: true
                    documentDescription: "Description"
                    stockMovementGroup: "010"
                    stockMovementCode: "CHS"
                    subcontractor: "AO051"
                    subcontractorAddress: "001"
                    subcontractLocation: "SST01"
                    stockChangeLines: [
                        {
                            product: "productCode"
                            productDescription: "Description Product"
                            lot: "LOT1108"
                            status: "A"
                            location: "SAPI001"
                            packingUnit: "UN"
                            packingUnitToStockUnitConversionFactor: "1"
                            quantityInPackingUnit: "6"
                            quantityInStockUnitDestination: "6"
                            statusDestination: "A1"
                            packingUnitDestination: "CAR"
                            packingUnitToStockUnitConversionFactorDestination: "6"
                            movementDescription: "Movement description"
                        }
                    ]
                }
            ) {
                id
            }
        }
    }
}

Update stock count line with global issued/received tracked product

mutation {
    xtremX3Inventory {
        stockCountListDetail {
            processCount(
                stockCountSessionNumber: "NA0212100013"
                stockCountListNumber: "NA0212106001"
                productRankNumber: 2000
                countedStockInPackingUnit: 230
                multiCountNumber: 0
                serialNumbers: [
                    {
                        serialNumberIndexNumber: 1
                        quantity: 5
                        startingSerialNumber: "GGGGGG00008"
                        endingSerialNumber: "GGGGGG00012"
                        stockCountVariance: "S"
                    }
                    {
                        serialNumberIndexNumber: 2
                        quantity: 5
                        startingSerialNumber: "GGGGGG00027"
                        endingSerialNumber: "GGGGGG00031"
                        stockCountVariance: "S"
                    }
                    {
                        serialNumberIndexNumber: 3
                        quantity: 3
                        startingSerialNumber: "GGGGGG00033"
                        endingSerialNumber: "GGGGGG00035"
                        stockCountVariance: "S"
                    }
                ]
            )
        }
    }
}