Add item and GRN tracking forms
This commit is contained in:
@@ -59,10 +59,24 @@ export const purchaseOrders = {
|
||||
|
||||
// ─── Goods Receipts (GRN) ─────────────────────────────────────────────────────
|
||||
|
||||
export interface GrnBatchLineBody {
|
||||
/** Null for an expiry-only lot (item tracks expiry but not batch numbers). */
|
||||
batchNumber: string | null
|
||||
expiryDate: string | null
|
||||
quantity: number
|
||||
}
|
||||
|
||||
export interface GrnItemBody {
|
||||
purchaseOrderItemId: string
|
||||
/** Set for a PO receipt; omitted for a direct receipt (itemId is used instead). */
|
||||
purchaseOrderItemId?: string
|
||||
/** Set for a direct receipt line. */
|
||||
itemId?: string
|
||||
acceptedQuantity: number
|
||||
rejectedQuantity: number
|
||||
/** Only for items with TracksBatches and/or TracksExpiryDate. */
|
||||
batches?: GrnBatchLineBody[]
|
||||
/** Only for items with TracksSerialNumbers — exactly acceptedQuantity entries. */
|
||||
serialNumbers?: string[]
|
||||
}
|
||||
|
||||
export interface GrnBody {
|
||||
@@ -74,6 +88,14 @@ export interface GrnBody {
|
||||
receivedByUserId: string
|
||||
}
|
||||
|
||||
export interface DirectGrnBody {
|
||||
warehouseId: string
|
||||
supplierId?: string
|
||||
items: GrnItemBody[]
|
||||
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
||||
receivedByUserId: string
|
||||
}
|
||||
|
||||
export const grn = {
|
||||
list: (params?: PageParams & { purchaseOrderId?: string }) =>
|
||||
api.get<PaginatedResponse<GrnResponse>>('/goods-receipts', { params }).then(r => r.data),
|
||||
@@ -83,6 +105,10 @@ export const grn = {
|
||||
|
||||
create: (body: GrnBody) =>
|
||||
api.post<GrnResponse>('/goods-receipts', body).then(r => r.data),
|
||||
|
||||
/** Receive goods with no purchase order. */
|
||||
createDirect: (body: DirectGrnBody) =>
|
||||
api.post<GrnResponse>('/goods-receipts/direct', body).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Purchase Returns ─────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user