Creating Operations

These Operations have no inputs, and have one or several outcomes.

Model.Wms.Operation.Arrival

class anyblok_wms_base.core.operation.arrival.Arrival[source]

Operation to describe physical arrival of goods in some location.

Arrivals store data about the expected or arrived physical objects: properties, code… These are copied over to the corresponding PhysObj records in all cases and stay inert after the fact.

In case the Arrival state is planned, these are obviously only unchecked values, but in case it is done, the actual meaning can depend on the application:

  • maybe the application won’t use the planned state at all, and will only create Arrival after checking them,
  • maybe the application will inspect the Arrival properties, compare them to reality, update them on the created PhysObj and cancel downstream operations if needed, before calling execute().

TODO maybe provide higher level facilities for validation scenarios.

Fields and their semantics

id = <anyblok.column.Integer object>

Primary key.

goods_type = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_type was goods_type.

This does not extend to compatibility of the former low level goods_type_id column.

goods_code = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_code was goods_code.

goods_properties = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_properties was goods_properties.

Specific attributes

inputs_number = 0

This Operation is a purely creative one.

Specific methods

classmethod refine_with_trailing_unpack(arrivals, pack_type, dt_pack_arrival=None, dt_unpack=None, pack_properties=None, pack_code=None)[source]

Replace some Arrivals by the Arrival of a pack followed by an Unpack.

This is useful in cases where it is impossible to predict ahead how incoming goods will actually be packed: the arrivals of individual items can first be planned, and once more is known about the form of delivery, this classmethod can replace some of them with the Arrival of a parcel and the subsequent Unpack.

Together with refine_with_trailing_move, this can handle the use case detailed in Superseding of planned operations.

Parameters:
  • arrivals – the Arrivals considered to be superseded by the Unpack. It is possible that only a subset of them are superseded, and conversely that the Unpack has more outcomes than the superseded Arrivals. For more details about the matching, see Unpack.plan_for_outcomes
  • pack_typeanyblok_wms_base.core.PhysObj.main.PhysObj.type of the expected pack.
  • pack_properties – optional properties of the expected Pack. This optional parameter is of great importance in the case of parcels with variable contents, since it allows to set the contents Property.
  • pack_code (str) – Optional code of the expected Pack.
  • dt_pack_arrival (datetime) – expected date/time for the Arrival of the pack. If not specified, a default one will be computed.
  • dt_unpack (datetime) – expected date/time for the Unpack Operation. If not specified, a default one will be computed.

Mandatory methods of Operation subclasses

after_insert()[source]
execute_planned()[source]

Overridden methods of Operation

classmethod check_create_conditions(state, dt_execution, location=None, **kwargs)[source]

Ensure that location is indeed a container.

Model.Wms.Operation.Apparition

class anyblok_wms_base.core.operation.apparition.Apparition[source]

Inventory Operation to record unexpected physical objects.

This is similar to Arrival, but has a distinct functional meaning. Apparitions can exist only in the done state.

Another difference with Arrivals is that Apparitions have a quantity field.

Fields and their semantics

id = <anyblok.column.Integer object>

Primary key.

quantity = <anyblok.column.Integer object>

The number of identical PhysObj that have appeared.

Here, identical means “same type, code and properties”

location = <anyblok.relationship.Many2One object>

Location of appeared PhysObj.

This will be the location of the initial Avatars.

goods_type = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_type was goods_type.

This does not extend to compatibility of the former low level goods_type_id column.

goods_code = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_code was goods_code.

goods_properties = <anyblok.field.Function object>

Compatibility wrapper.

Before version 0.9.0, physobj_properties was goods_properties.

Specific members

inputs_number = 0

This Operation is a purely creative one.

Mandatory methods of Operation subclasses

classmethod check_create_conditions(state, dt_execution, location=None, **kwargs)[source]

Forbid creation with wrong states, check location is a container.

Raises:

OperationForbiddenState if state is not 'done'

OperationContainerExpected if location is not a container.

after_insert()[source]

Create the PhysObj and their Avatars.

In the wms-core implementation, the quantity field gives rise to as many PhysObj records.

Overridden methods of Operation

classmethod check_create_conditions(state, dt_execution, location=None, **kwargs)[source]

Forbid creation with wrong states, check location is a container.

Raises:

OperationForbiddenState if state is not 'done'

OperationContainerExpected if location is not a container.