Skip to content
Developerhome

Example GraphQL queries for Purchasing

  Less than to read

Read purchase order with their status

{
  xtremX3Purchasing {
    purchaseOrder {
      query(filter: "{purchaseSite : 'FR011', orderFromSupplier : 'FR053', isClosed: {_ne: 'yes'}}") {
        edges {
          node {
            id
            purchaseSite{
              code
            }
            receiptSite {
              code
            }
            orderFromSupplier {
              code {
                code
              }
            }
            isClosed
            receiptStatus
            signatureStatus
            purchaseOrderQuantityLines {
              query {
                edges {
                  node {
                    lineNumber
                    product {
                      code
                    }
                    quantityInOrderUnitOrdered
                    orderUnit {
                      code
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Read purchase receipt with their receipt site and supplier

{
  xtremX3Purchasing {
    purchaseReceipt {
      query(filter: "{receiptSite : 'FR011', supplier : 'FR053'}") {
        edges {
          node {
            id
            receiptSite {
              code
            }
            receiptDate
            supplier {
              code {
                code
              }
            }
            stockMovementCode {
              code
            }
            stockAutomaticJournal
            lines {
              query {
                edges {
                  node {
                    lineNumber
                    product {
                      code
                    }
                    quantityInReceiptUnitReceived
                    receiptUnit {
                      code
                    }
                    receiptUnitToStockUnitConversionFactor
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Create an ADC Purchase receipt (not executable on the read-only demo endpoint)

mutation {
    xtremX3Purchasing {
        purchaseReceipt {
            create(
                data: {
                    receiptSite: "NA011"
                    receiptDate: "2020-01-07"
                    supplier: "NA051"
                    lines: [
                        {
                            receiptSite: "NA011"
                            purchaseOrder: "PONA0110075"
                            purchaseOrderLineNumber: 1000
                            product: "DIS004"
                            receiptUnit: "UN"
                            quantityInReceiptUnitReceived: 1
                            _forMutationOnlyDoClosePurchaseOrderLine: 2
                            stockDetails: [
                                {
                                    status: "A"
                                    packingUnit: "UN"
                                    quantityInPackingUnit: 1
                                    location: "REC01"
                                    supplierLot: "TESTSUPPLOT1"
                                    sublot: "TEST"
                                    lot: "TESTLOT1"
                                    licensePlateNumber: "BAG00034"
                                    minorVersion: "03"
                                    majorVersion: "C"
                                }
                            ]
                        }
                    ]
                }
            ) {
                id
                receiptSite {
                    code
                }
            }
        }
    }
}