Example GraphQL queries for Stock
Less than to read
Stock information on a product with specific stock site and availability code
{
sage {
x3Stock {
stock (filter: "{ product :{code :{$eq: 'FIN010'} },stockSite :{code :{$eq: 'AO011'} }, status :{$eq: 'A'} }") {
edges {
node {
stockSite {
code
description
shortDescription
}
packingUnit {
code
}
status
owner
location {
code
}
product {
code
productCategory
accountingCode
description1
}
quantityInStockUnit
quantityInPackingUnit
}
}
}
}
}
}
Read stock journal to list detail from stock movements
{
sage {
x3Stock {
stockJournal {
edges {
node {
stockSite {
code
}
transactionType
effectiveDate
product {
code
description1
}
packingUnit {
code
}
quantityInPackingUnit
}
}
}
}
}
}
Read stock detail from a location type
{
sage {
x3Stock {
location(filter: "{ stockSite: 'FR012',type: 'REC' }") {
edges {
node {
code
type
stock {
totalCount
edges {
node {
quantityInPackingUnit
status
packingUnit {
code
}
product {
code
productCategory
description1
}
}
}
}
}
}
}
}
}
}
Read stock detail from a location
{
sage {
x3Stock {
location(filter: "{ stockSite: 'FR012',code: 'A1C15' }") {
edges {
node {
code
type
stock {
edges {
node {
licensePlateNumber
quantityInPackingUnit
status
lot
qualityAnalysisRequestId
isBeingCounted
packingUnit {
code
}
product {
code
productCategory
description1
}
}
}
}
}
}
}
}
}
}
Read stock detail from a stock site, a product and a location
{
sage {
x3Stock {
stock(filter: "{ stockSite: 'AO012',product: 'BMS001',location:'Q0201'}") {
edges {
node {
location{
code
}
locationType
product{
code
}
quantityInPackingUnit
packingUnit{
code
}
packingUnitToStockUnitConversionFactor
status
serialNumber
licensePlateNumber
}
}
}
}
}
}
Read miscellaneous receipt with lines and several stocks details
{
sage {
x3Stock {
miscellaneousStockFlow(filter: "{ stockSite: 'FR012',id: 'MRCFR0120007' }") {
edges {
node {
id
effectiveDate
documentDescription
stockMovementCode {
code
}
stockMovementGroup {
code
}
stockAutomaticJournal
project {
id
}
miscellaneousStockFlowLines {
edges {
node {
product {
code
}
productDescription
quantityInPackingUnit
packingUnit {
code
}
quantityInStockUnit
packingUnitToStockUnitConversionFactor
stockDetails {
edges {
node {
location {
code
}
lot
sublot
}
}
}
}
}
}
}
}
}
}
}
}
Create a miscellaneous receipt on stock (not executable on the read-only demo endpoint)
mutation {
sage {
x3Stock {
miscellaneousStockFlow {
create(data: {miscellaneousStockFlowType: miscellaneousReceipt, stockSite: "FR012", effectiveDate: "2020-01-01", miscellaneousStockFlowLines: [{product: "SFI050", quantityInPackingUnit: "5", packingUnit: "UN", stockDetails: [{quantityInPackingUnit: "5", packingUnit: "UN", location: "A1C11", status: "A", lot: "LO1701FR0120001", majorVersion: "A", minorVersion: "01"}]}]}) {
id
effectiveDate
documentDescription
stockMovementCode {
code
}
stockMovementGroup {
code
}
stockAutomaticJournal
project {
id
}
miscellaneousStockFlowLines {
edges {
node {
product {
code
}
productDescription
quantityInPackingUnit
packingUnit {
code
}
quantityInStockUnit
packingUnitToStockUnitConversionFactor
stockDetails {
edges {
node {
location {
code
}
lot
sublot
}
}
}
}
}
}
}
}
}
}
}
Create a miscellaneous receipt with two lines and several stocks details (not executable on the read-only demo endpoint)
mutation {
sage {
x3Stock {
miscellaneousStockFlow {
create(data: {miscellaneousStockFlowType: miscellaneousReceipt, stockSite: "FR012", effectiveDate: "2020-01-01", miscellaneousStockFlowLines: [{product: "SFI050", quantityInPackingUnit: "5", packingUnit: "UN", stockDetails: [{quantityInPackingUnit: "5", packingUnit: "UN", location: "A1C11", status: "A", lot: "LO1701FR0120001", majorVersion: "A", minorVersion: "01"}]}, {product: "SFI050", quantityInPackingUnit: "5", packingUnit: "UN", stockDetails: [{quantityInPackingUnit: "5", packingUnit: "UN", location: "A1C11", status: "A", lot: "LO1701FR0120002", majorVersion: "A", minorVersion: "01"}]}]}) {
id
effectiveDate
documentDescription
stockMovementCode {
code
}
stockMovementGroup {
code
}
stockAutomaticJournal
project {
id
}
miscellaneousStockFlowLines {
edges {
node {
product {
code
}
productDescription
quantityInPackingUnit
packingUnit {
code
}
quantityInStockUnit
packingUnitToStockUnitConversionFactor
stockDetails {
edges {
node {
location {
code
}
lot
sublot
}
}
}
}
}
}
}
}
}
}
}
Shipment preparation (update - not executable on the read-only demo endpoint)
mutation {
sage {
x3Stock {
pickTicketLine {
updatePickTicketLine(pickTicket: "PICAO0120144", pickTicketLineId: "1", productCode: "FIN003", isShortPick: false, destinationLocation: "STO25",
allocations: [{sequenceNumber: 1, location: "STO01", quantityInStockUnit: 2, status: "A", stockId: 0}]) {
pickTicket
pickTicketLine
adcPickedLine
allocatedLines {
edges {
node {
stockId
}
}
}
}
}
}
}
}