Documentation
¶
Index ¶
- type AllocationRequest
- type ListReceivingOrdersEndpoint
- type ListReceivingOrdersRequest
- type ReceiveReceivingOrderEndpoint
- type ReceiveReceivingOrderLineEndpoint
- type ReceiveReceivingOrderLineRequest
- type ReceiveReceivingOrderRequest
- type ReceivingOrderSvc
- type ReceivingOrderSvcConfig
- type RetrieveReceivingOrderEndpoint
- type RetrieveReceivingOrderRequest
- type StockLineItemRequest
- type StockReceivingOrderEndpoint
- type StockReceivingOrderRequest
- type UpdateReceivingOrderLineEndpoint
- type UpdateReceivingOrderLineRequest
- type VoidReceivingOrderEndpoint
- type VoidReceivingOrderLineEndpoint
- type VoidReceivingOrderLineRequest
- type VoidReceivingOrderRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocationRequest ¶
type AllocationRequest struct {
// ID of the storage location to put the quantity away at.
//
// When omitted, the inventory receipt is created without a storage location.
LocationID field.Optional[string] `json:"location_id,omitzero"`
// Quantity to allocate, as a decimal string.
Quantity string `json:"quantity"`
}
A portion of a line's accepted quantity placed at a storage location.
type ListReceivingOrdersEndpoint ¶
type ListReceivingOrdersEndpoint struct{}
Returns a paginated list of receiving orders for the current account, newest first.
Only open (incomplete) orders are returned by default; pass `status` to change this.
func (*ListReceivingOrdersEndpoint) Materialize ¶
func (e *ListReceivingOrdersEndpoint) Materialize() *apiendpoint.APIEndpoint[*ListReceivingOrdersRequest, *apiresource.List[apiresource.ReceivingOrder]]
type ListReceivingOrdersRequest ¶
type ListReceivingOrdersRequest struct {
apiresource.PaginationRequest
// Filter by completion status.
//
// Completed orders are hidden when this is omitted.
Status *constants.ReceivingOrderStatus `query:"status"`
// Filter to orders that have at least one line for any of the given item IDs.
ItemIDs []string `query:"item_ids"`
// Filter to orders whose originating purchase order was placed with any of the given supplier account IDs.
SupplierIDs []string `query:"supplier_ids"`
// Only return orders created on or after this date (`YYYY-MM-DD`).
StartDate *string `query:"starts_at"`
// Only return orders created on or before this date (`YYYY-MM-DD`), covering that whole day.
EndDate *string `query:"ends_at"`
}
Request to list receiving orders.
type ReceiveReceivingOrderEndpoint ¶
type ReceiveReceivingOrderEndpoint struct{}
Records the full outstanding quantity as received on every unstocked line of a receiving order.
Each unstocked line's quantity is set to what is still outstanding on its purchase order line — the ordered quantity less everything already stocked against that line — and lines with nothing outstanding are left as they are. Nothing enters inventory and no delivery is recorded; use Stock Receiving Order to put the received quantities away.
func (*ReceiveReceivingOrderEndpoint) Materialize ¶
func (e *ReceiveReceivingOrderEndpoint) Materialize() *apiendpoint.APIEndpoint[*ReceiveReceivingOrderRequest, *apiresource.ReceivingOrder]
type ReceiveReceivingOrderLineEndpoint ¶
type ReceiveReceivingOrderLineEndpoint struct{}
Records the full outstanding quantity as received on a single receiving order line.
Sets the line's quantity to what is still outstanding on its purchase order line — the ordered quantity less everything already recorded across the receiving lines for that order line — and returns the line unchanged when nothing is outstanding. Nothing enters inventory; use Stock Receiving Order to put the received quantity away.
func (*ReceiveReceivingOrderLineEndpoint) Materialize ¶
func (e *ReceiveReceivingOrderLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*ReceiveReceivingOrderLineRequest, *apiresource.ReceivingOrderLine]
type ReceiveReceivingOrderLineRequest ¶
type ReceiveReceivingOrderLineRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"receiving_order_id" validate:"required"`
// Receiving order line ID.
LineID string `path:"id" validate:"required"`
}
Request to receive a receiving order line.
type ReceiveReceivingOrderRequest ¶
type ReceiveReceivingOrderRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"id" validate:"required"`
}
Request to receive all unstocked lines on a receiving order.
type ReceivingOrderSvc ¶
type ReceivingOrderSvc interface {
ListReceivingOrders(ctx context.Context, req *ListReceivingOrdersRequest) (*apiresource.List[apiresource.ReceivingOrder], *apierror.APIError)
GetReceivingOrder(ctx context.Context, req *RetrieveReceivingOrderRequest) (*apiresource.ReceivingOrder, *apierror.APIError)
StockReceivingOrder(ctx context.Context, req *StockReceivingOrderRequest) (*apiresource.ReceivingOrder, *apierror.APIError)
ReceiveReceivingOrder(ctx context.Context, req *ReceiveReceivingOrderRequest) (*apiresource.ReceivingOrder, *apierror.APIError)
VoidReceivingOrder(ctx context.Context, req *VoidReceivingOrderRequest) (*apiresource.ReceivingOrder, *apierror.APIError)
UpdateReceivingOrderLine(ctx context.Context, req *UpdateReceivingOrderLineRequest) (*apiresource.ReceivingOrderLine, *apierror.APIError)
VoidReceivingOrderLine(ctx context.Context, req *VoidReceivingOrderLineRequest) (*apiresource.ReceivingOrderLine, *apierror.APIError)
ReceiveReceivingOrderLine(ctx context.Context, req *ReceiveReceivingOrderLineRequest) (*apiresource.ReceivingOrderLine, *apierror.APIError)
}
func NewReceivingOrderSvc ¶
func NewReceivingOrderSvc(config *ReceivingOrderSvcConfig) ReceivingOrderSvc
type ReceivingOrderSvcConfig ¶
type ReceivingOrderSvcConfig struct {
// CoreClient (required) is the core-service receiving gRPC client.
CoreClient pb.CoreReceivingServiceClient
}
type RetrieveReceivingOrderEndpoint ¶
type RetrieveReceivingOrderEndpoint struct{}
Returns a receiving order by ID.
func (*RetrieveReceivingOrderEndpoint) Materialize ¶
func (e *RetrieveReceivingOrderEndpoint) Materialize() *apiendpoint.APIEndpoint[*RetrieveReceivingOrderRequest, *apiresource.ReceivingOrder]
type RetrieveReceivingOrderRequest ¶
type RetrieveReceivingOrderRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"id" validate:"required"`
}
Request to retrieve a receiving order.
type StockLineItemRequest ¶
type StockLineItemRequest struct {
// ID of the receiving order line being stocked.
ReceivingOrderLineID string `json:"receiving_order_line_id"`
// Lot number to record for the received goods.
//
// A lot is created for the line's item if one with this number does not already exist for it. The lot applies to every allocation and to any rejected quantity on this line item.
LotNumber field.Optional[string] `json:"lot_number,omitzero"`
// Quantity refused on inspection, as a decimal string.
//
// The refused quantity is recorded on the delivery and on the receiving order line's `rejected_quantity`, but never enters inventory.
RejectedQuantity field.Optional[string] `json:"rejected_quantity,omitzero"`
// Storage allocations for the quantity being accepted.
//
// Each allocation creates an inventory receipt for the given quantity at the given location, so a single line can be split across several locations.
Allocations []AllocationRequest `json:"allocations,omitzero"`
}
Stocking details for one receiving order line.
type StockReceivingOrderEndpoint ¶
type StockReceivingOrderEndpoint struct{}
Stocks the received quantities on a receiving order into inventory.
Every unstocked line with a non-zero quantity is marked as stocked. For each entry in `line_items`, the allocations create inventory receipts at the given storage locations (and lot, if one was given), and any `rejected_quantity` is recorded as refused without entering inventory. One delivery is recorded for the whole stocking event, with a line per allocation and a line per refused quantity.
The newly received stock is then applied to any open inventory issues for the same item, oldest first, so demand already waiting on the item is satisfied automatically.
If a line was received short of its ordered quantity, a new unstocked line is created automatically for the remainder. Once every line is stocked, the order is marked complete and the originating purchase order is marked fulfilled.
A receiving order with no unstocked, non-zero lines is returned untouched: no delivery is recorded and no inventory is created.
func (*StockReceivingOrderEndpoint) Materialize ¶
func (e *StockReceivingOrderEndpoint) Materialize() *apiendpoint.APIEndpoint[*StockReceivingOrderRequest, *apiresource.ReceivingOrder]
type StockReceivingOrderRequest ¶
type StockReceivingOrderRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"id" validate:"required"`
// Per-line stocking details: where to put the goods away, which lot to record them under, and how much was refused on inspection.
//
// Unstocked lines left out of this list are still marked as stocked, but nothing is added to inventory for them and they contribute no delivery lines.
LineItems []StockLineItemRequest `json:"line_items,omitzero"`
}
Request to stock a receiving order.
func (*StockReceivingOrderRequest) SchemaExample ¶
func (*StockReceivingOrderRequest) SchemaExample() any
type UpdateReceivingOrderLineEndpoint ¶
type UpdateReceivingOrderLineEndpoint struct{}
Updates the received quantity on a receiving order line.
Use this to record the quantity that actually arrived — a partial delivery, for example — before stocking the order. Nothing enters inventory until the order is stocked.
func (*UpdateReceivingOrderLineEndpoint) Materialize ¶
func (e *UpdateReceivingOrderLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*UpdateReceivingOrderLineRequest, *apiresource.ReceivingOrderLine]
type UpdateReceivingOrderLineRequest ¶
type UpdateReceivingOrderLineRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"receiving_order_id" validate:"required"`
// Receiving order line ID.
LineID string `path:"id" validate:"required"`
// New received quantity for the line, as a decimal string.
//
// When omitted, the line is returned unchanged.
QuantityValue field.Optional[string] `json:"quantity_value,omitzero"`
}
Request to update a receiving order line's quantity.
func (*UpdateReceivingOrderLineRequest) SchemaExample ¶
func (*UpdateReceivingOrderLineRequest) SchemaExample() any
type VoidReceivingOrderEndpoint ¶
type VoidReceivingOrderEndpoint struct{}
Voids a receiving order, resetting all receiving progress.
Every line's received quantity is reset to `0` and its stocked state is cleared, the extra lines created for short receipts are removed so that one line per purchase order line remains, and the order returns to open. The receiving order itself is not deleted, and it can be received and stocked again from scratch.
A receiving order that has already been marked complete is only reopened: the extra lines are still removed, but the lines that remain keep their received quantities and stay marked as stocked.
Deliveries and inventory received by earlier stocking are not reversed — voiding only reopens the receiving order.
func (*VoidReceivingOrderEndpoint) Materialize ¶
func (e *VoidReceivingOrderEndpoint) Materialize() *apiendpoint.APIEndpoint[*VoidReceivingOrderRequest, *apiresource.ReceivingOrder]
type VoidReceivingOrderLineEndpoint ¶
type VoidReceivingOrderLineEndpoint struct{}
Voids a single receiving order line, resetting its receiving progress.
The line's received quantity is reset to `0` and its stocked state is cleared, leaving the rest of the order untouched. The line itself is not deleted, and any inventory already stocked from it is not reversed.
func (*VoidReceivingOrderLineEndpoint) Materialize ¶
func (e *VoidReceivingOrderLineEndpoint) Materialize() *apiendpoint.APIEndpoint[*VoidReceivingOrderLineRequest, *apiresource.ReceivingOrderLine]
type VoidReceivingOrderLineRequest ¶
type VoidReceivingOrderLineRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"receiving_order_id" validate:"required"`
// Receiving order line ID.
LineID string `path:"id" validate:"required"`
}
Request to void a receiving order line.
type VoidReceivingOrderRequest ¶
type VoidReceivingOrderRequest struct {
// Receiving order ID.
ReceivingOrderID string `path:"id" validate:"required"`
}
Request to void a receiving order.