Material and Tray#
Material#
- class automatic_warehouse.status_warehouse.material.Material(barcode: str, name: str, height: int, length: int, width: int)#
Class that represents a material that can be found inside a tray.
- Parameters:
- Raises:
ValueError – if the specified height is greater than the maximum height of the tray (config value).
- get_barcode() str#
Get the barcode of the material.
- Return type:
- Returns:
the barcode of the material.
- automatic_warehouse.status_warehouse.material.gen_rand_material(min_height: int = 25, max_height: int = 50, name: str | None = None) Material#
Static method to generate a random material.
- Return type:
- Parameters:
min_height (int) – the minimum height (lower limit) of the material.
max_height (int) – the maximum height (upper limit) of the material.
name (str | None) – name of the random material to be generated, otherwise the name will be taken from the
random_name_materialsvariable.
- Returns:
the material generated.
- automatic_warehouse.status_warehouse.material.gen_rand_materials(how_many: int, min_height: int = 25, max_height: int = 50) list[Material]#
Static method to generate random materials.
- automatic_warehouse.status_warehouse.material.random_name_materials = ['Shirt', 'Screwdriver', 'Bottle', 'Tablet', 'Helmet', 'GPU', 'CPU']#
A list of random materials used by the library when generating random materials.
Tray#
- class automatic_warehouse.status_warehouse.tray.Tray(info: TrayConfiguration | None = None, items: list[Material] | None = None)#
Representation of the tray (or tray) inside the warehouse. It contains all the information about the tray and the methods for add/remove a material, and so on.
- Parameters:
info (TrayConfiguration | None) – configure the tray, leave
Noneif you want to set the default (config) value.items (list[Material] | None) – list of items to be added to the tray.
- add_material(material: Material)#
Add a material to the tray.
Note: The material to be added should respect the following rules:
width smaller than the width of the tray;
height less than the maximum height of the tray (
maximum_heightfield in the configuration);length less than the length of the tray.
- Parameters:
material (Material) – material to be added to the tray.
- Raises:
ValueError – if the material it is too large.
- add_materials(materials: list[Material])#
Add materials to the tray.
Note: Each material to be added should respect the following rules:
width smaller than the width of the tray;
height less than the maximum height of the tray (
maximum_heightfield in the configuration);length less than the length of the tray.
- Parameters:
materials (list[Material]) – materials to be added to the tray.
- Raises:
ValueError – if the materials are too large.
- get_best_offset_x() int#
Get the best offset x of the tray.
- Return type:
- Returns:
the best offset x of the tray.
- get_first_tray_entry()#
Get the first tray entry (object) inside the warehouse.
- Return type:
- Returns:
first tray entry (object) inside the warehouse.
- get_height_limit() int#
Get the height limit of the tray.
- Return type:
- Returns:
the height limit of the tray.
- get_max_height() int#
Get the maximum height of the tray.
- Return type:
- Returns:
maximum height of a material inside tray.
- get_num_materials() int#
Get the number of materials.
- Return type:
- Returns:
the number of materials.
- get_num_space_occupied() int#
Get the number of occupied spaces in the warehouse.
- Return type:
- Returns:
number of occupied spaces in the warehouse.
- remove_material(material: Material)#
Remove a material from the tray.
- Parameters:
material (Material) – material to be removed from the tray.
- set_best_offset_x(offset_x: int)#
Set the best offset x of the tray.
- Parameters:
offset_x (int) – offset x of the tray.
- automatic_warehouse.status_warehouse.tray.gen_rand_tray(info: TrayConfiguration = None, material_to_insert: Material = None) Tray#
Static method to generate a random tray.
- Return type:
- Parameters:
info (TrayConfiguration) – the tray configuration, leave
Noneif you want to set the default (config) value.material_to_insert (Material) – a material to insert.
- Returns:
the generated tray.
- automatic_warehouse.status_warehouse.tray.gen_rand_trays(how_many: int, materials_to_insert: list[Material], info: TrayConfiguration | None = None) list[Tray]#
Static method to generate random trays.
- Return type:
- Parameters:
how_many (int) – how many trays to generate.
materials_to_insert (list[Material]) – a list of materials to insert.
info (TrayConfiguration | None) – information about the tray, leave
Noneif you want to set the default (config) value.
- Returns:
the generated trays list.