consumptionep

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumptionSvcConfig

type ConsumptionSvcConfig struct {
	// CoreClient (required) is the core-service gRPC client.
	CoreClient pb.CoreServiceClient
}

type CreateConsumptionEndpoint

type CreateConsumptionEndpoint struct{}

Adds a material input to a production step.

Adding a consumption recomputes the production flow: if another production step produces the consumed item, the two steps are linked upstream/downstream automatically.

func (*CreateConsumptionEndpoint) Materialize

type CreateConsumptionRequest

type CreateConsumptionRequest struct {
	// ID of the production step that consumes the material.
	ProductionStepID string `path:"production_step_id" validate:"required"`
	// ID of the item to consume.
	ItemID string `json:"item_id" validate:"required"`
	// Amount of the item consumed, as a decimal string.
	//
	// Stated against the step's own output rather than a single unit, so a step producing 100 pairs that consumes 5 kg of yarn takes `5`. Material requirements for an order scale it from there.
	QuantityValue string `json:"quantity_value" validate:"required"`
	// ID of the unit of measure for `quantity_value`.
	QuantityUnitID string `json:"quantity_unit_id" validate:"required"`
	// Amount of the item expected to be lost as waste, as a decimal string.
	//
	// Tracked separately from the consumed quantity, but added to it when material requirements are worked out, since the waste has to be bought as well.
	WasteQuantityValue string `json:"waste_quantity_value" validate:"required"`
	// ID of the unit of measure for `waste_quantity_value`.
	WasteQuantityUnitID string `json:"waste_quantity_unit_id" validate:"required"`
	// Instructions for how this material is consumed.
	Instructions field.Optional[string] `json:"instructions,omitzero"`
}

Request to create a consumption.

func (*CreateConsumptionRequest) SchemaExample

func (*CreateConsumptionRequest) SchemaExample() any

type DeleteConsumptionEndpoint

type DeleteConsumptionEndpoint struct{}

Removes a material input from a production step.

Any production-flow connections established through this consumption are disconnected, and the remaining consumptions are re-linked. The deleted consumption is returned; deleting it again reports that it has already been deleted.

func (*DeleteConsumptionEndpoint) Materialize

type DeleteConsumptionRequest

type DeleteConsumptionRequest struct {
	// Production step ID.
	ProductionStepID string `path:"production_step_id" validate:"required"`
	// Consumption ID.
	ConsumptionID string `path:"id" validate:"required"`
}

Request to delete a consumption.

type RetrieveConsumptionEndpoint

type RetrieveConsumptionEndpoint struct{}

Returns a consumption by ID within a production step.

func (*RetrieveConsumptionEndpoint) Materialize

type RetrieveConsumptionRequest

type RetrieveConsumptionRequest struct {
	// Production step ID.
	ProductionStepID string `path:"production_step_id" validate:"required"`
	// Consumption ID.
	ConsumptionID string `path:"id" validate:"required"`
}

Request to retrieve a consumption.

type UpdateConsumptionEndpoint

type UpdateConsumptionEndpoint struct{}

Updates a production step's material input.

Omitted fields are left unchanged. Each quantity is only rewritten when its value and unit are sent together, and changing the consumed item recomputes the production flow around the step.

func (*UpdateConsumptionEndpoint) Materialize

type UpdateConsumptionRequest

type UpdateConsumptionRequest struct {
	// Production step ID.
	ProductionStepID string `path:"production_step_id" validate:"required"`
	// Consumption ID.
	ConsumptionID string `path:"id" validate:"required"`
	// ID of the item to consume.
	//
	// Changing the item disconnects any production-flow link based on the previous item and re-links the flow using the new item.
	ItemID field.Optional[string] `json:"item_id,omitzero" validate:"omitempty"`
	// Amount of the item consumed, as a decimal string.
	//
	// The consumed quantity only changes when this and `quantity_unit_id` are sent together; sending either one alone leaves it untouched.
	QuantityValue field.Optional[string] `json:"quantity_value,omitzero"`
	// ID of the unit of measure for `quantity_value`.
	//
	// Send it together with `quantity_value`, even when the unit is not changing.
	QuantityUnitID field.Optional[string] `json:"quantity_unit_id,omitzero" validate:"omitempty"`
	// Amount of the item expected to be lost as waste, as a decimal string.
	//
	// The waste quantity only changes when this and `waste_quantity_unit_id` are sent together; sending either one alone leaves it untouched.
	WasteQuantityValue field.Optional[string] `json:"waste_quantity_value,omitzero"`
	// ID of the unit of measure for `waste_quantity_value`.
	//
	// Send it together with `waste_quantity_value`, even when the unit is not changing.
	WasteQuantityUnitID field.Optional[string] `json:"waste_quantity_unit_id,omitzero" validate:"omitempty"`
	// Instructions for how this material is consumed.
	Instructions field.Optional[string] `json:"instructions,omitzero"`
}

Request to partially update a consumption.

func (*UpdateConsumptionRequest) SchemaExample

func (*UpdateConsumptionRequest) SchemaExample() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL