- All 5 batch steps: Picking, Sorting, Clarification, Slots, Handoff - go_router navigation with step indicator - graphql_flutter client wired up (endpoint via env var) - Mock data layer swappable with real GraphQL service - Item types: normal, cold, frozen, alcohol, clarify - Storage slot assignment (cell/freezer/fridge)
176 lines
4.9 KiB
Dart
176 lines
4.9 KiB
Dart
/// GraphQL queries and mutations for the Velmart Picker app.
|
|
/// These map directly to the Magento picker_request schema defined in the backend.
|
|
|
|
class PickerQueries {
|
|
// ─── Auth ──────────────────────────────────────────────────────────────────
|
|
|
|
static const String requestOtp = r'''
|
|
mutation RequestOtp($phone: String!) {
|
|
pickerRequestOtp(phone: $phone) {
|
|
success
|
|
message
|
|
}
|
|
}
|
|
''';
|
|
|
|
static const String verifyOtp = r'''
|
|
mutation VerifyOtp($phone: String!, $code: String!) {
|
|
pickerVerifyOtp(phone: $phone, code: $code) {
|
|
token
|
|
picker {
|
|
id
|
|
name
|
|
phone
|
|
}
|
|
}
|
|
}
|
|
''';
|
|
|
|
// ─── Orders / Batches ──────────────────────────────────────────────────────
|
|
|
|
static const String getOrderQueue = r'''
|
|
query GetOrderQueue($shopId: Int!, $status: [PickerRequestStatus]) {
|
|
pickerRequests(shopId: $shopId, status: $status) {
|
|
items {
|
|
requestId
|
|
orderNumber: order { incrementId }
|
|
amount: order { grandTotal }
|
|
slotTime: deadline
|
|
status
|
|
totalQty
|
|
totalWeight
|
|
customer: order {
|
|
customerFirstname
|
|
customerLastname
|
|
customerPhone: billingAddress { telephone }
|
|
customerComment: order { customerNote }
|
|
}
|
|
segments: items {
|
|
id
|
|
name: zone { name }
|
|
zone: zone { id }
|
|
items {
|
|
id
|
|
sku
|
|
name: orderItem { name }
|
|
price: orderItem { price }
|
|
planQty: qty
|
|
actualQty
|
|
status
|
|
type
|
|
imageUrl: orderItem { product { thumbnail { url } } }
|
|
substitutes {
|
|
id
|
|
sku
|
|
name
|
|
priority
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
''';
|
|
|
|
static const String getOrderDetail = r'''
|
|
query GetOrderDetail($requestId: Int!) {
|
|
pickerRequest(id: $requestId) {
|
|
requestId
|
|
status
|
|
totalQty
|
|
totalWeight
|
|
deadline
|
|
order {
|
|
incrementId
|
|
grandTotal
|
|
customerFirstname
|
|
customerLastname
|
|
customerNote
|
|
billingAddress { telephone }
|
|
}
|
|
items {
|
|
id
|
|
sku
|
|
qty
|
|
actualQty
|
|
status
|
|
type
|
|
weight
|
|
orderItem { name price product { thumbnail { url } } }
|
|
zone { id name }
|
|
substitutes { id sku name priority }
|
|
slot { id name type maxOrders }
|
|
}
|
|
}
|
|
}
|
|
''';
|
|
|
|
// ─── Item mutations ────────────────────────────────────────────────────────
|
|
|
|
static const String markItemPicked = r'''
|
|
mutation MarkItemPicked($itemId: Int!, $actualQty: Float!) {
|
|
pickerMarkItemPicked(itemId: $itemId, actualQty: $actualQty) {
|
|
id
|
|
status
|
|
actualQty
|
|
}
|
|
}
|
|
''';
|
|
|
|
static const String markItemNotFound = r'''
|
|
mutation MarkItemNotFound($itemId: Int!) {
|
|
pickerMarkItemNotFound(itemId: $itemId) {
|
|
id
|
|
status
|
|
}
|
|
}
|
|
''';
|
|
|
|
static const String replaceItem = r'''
|
|
mutation ReplaceItem($itemId: Int!, $substituteSku: String!, $actualQty: Float!) {
|
|
pickerReplaceItem(itemId: $itemId, substituteSku: $substituteSku, actualQty: $actualQty) {
|
|
id
|
|
status
|
|
sku
|
|
actualQty
|
|
}
|
|
}
|
|
''';
|
|
|
|
// ─── Slots ─────────────────────────────────────────────────────────────────
|
|
|
|
static const String getAvailableSlots = r'''
|
|
query GetAvailableSlots($shopId: Int!) {
|
|
pickerAvailableSlots(shopId: $shopId) {
|
|
id
|
|
name
|
|
type
|
|
maxOrders
|
|
currentOrders
|
|
}
|
|
}
|
|
''';
|
|
|
|
static const String assignSlots = r'''
|
|
mutation AssignSlots($requestId: Int!, $slotIds: [Int!]!) {
|
|
pickerAssignSlots(requestId: $requestId, slotIds: $slotIds) {
|
|
success
|
|
slots { id name type }
|
|
}
|
|
}
|
|
''';
|
|
|
|
// ─── Finalize ──────────────────────────────────────────────────────────────
|
|
|
|
static const String finalizeOrder = r'''
|
|
mutation FinalizeOrder($requestId: Int!) {
|
|
pickerFinalizeOrder(requestId: $requestId) {
|
|
success
|
|
requestId
|
|
derivedRequestId
|
|
message
|
|
}
|
|
}
|
|
''';
|
|
}
|