Lots
albert.collections.lots.LotCollection
Bases: BaseCollection
LotCollection is a collection class for managing Lot entities in the Albert platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
An Albert session instance. |
required |
Methods:
| Name | Description |
|---|---|
create |
Create new lots. |
get_by_id |
Get a lot by its ID. |
get_by_ids |
Get a list of lots by their IDs. |
delete |
Delete a lot by its ID. |
search |
Search for Lot records matching the provided filters. |
get_all |
Get all Lot entities with optional filters. |
update |
Update a lot. |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
|
Source code in src/albert/collections/lots.py
create
Create new lots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lots
|
list[Lot]
|
A list of Lot entities to create. |
required |
Returns:
| Type | Description |
|---|---|
list[Lot]
|
A list of created Lot entities. |
Source code in src/albert/collections/lots.py
get_by_id
get_by_ids
Get a list of lots by their IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[str]
|
A list of lot IDs to get. |
required |
Returns:
| Type | Description |
|---|---|
list[Lot]
|
A list of lots with the provided IDs. |
Source code in src/albert/collections/lots.py
delete
delete(*, id: LotId) -> None
Delete a lot by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the lot to delete. |
required |
search
search(
*,
text: str | None = None,
inventory_id: InventoryId
| list[InventoryId]
| None = None,
location_id: str | list[str] | None = None,
storage_location_id: str | list[str] | None = None,
task_id: TaskId | list[TaskId] | None = None,
category: InventoryCategory
| str
| list[InventoryCategory | str]
| None = None,
external_barcode_id: str | list[str] | None = None,
search_field: str | list[str] | None = None,
source_field: str | list[str] | None = None,
additional_field: str | list[str] | None = None,
is_drop_down: bool | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
offset: int | None = None,
max_items: int | None = None,
) -> Iterator[LotSearchItem]
Search for Lot records matching the provided filters.
⚠️ This method returns partial (unhydrated) entities to optimize performance.
To retrieve fully detailed entities, use :meth:get_all instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against lot fields. |
None
|
inventory_id
|
InventoryId or list[InventoryId]
|
Filter by parent inventory IDs. |
None
|
location_id
|
str or list[str]
|
Filter by specific location IDs. |
None
|
storage_location_id
|
str or list[str]
|
Filter by storage location IDs. |
None
|
task_id
|
TaskId or list[TaskId]
|
Filter by source task IDs. |
None
|
category
|
InventoryCategory or list[str]
|
Filter by parent inventory categories. |
None
|
external_barcode_id
|
str or list[str]
|
Filter by external barcode IDs. |
None
|
search_field
|
str or list[str]
|
Restrict the fields the |
None
|
source_field
|
str or list[str]
|
Restrict which fields are returned in the response. |
None
|
additional_field
|
str or list[str]
|
Request additional columns from the search index. |
None
|
is_drop_down
|
bool
|
Use dropdown sanitization for the search text when True. |
None
|
order_by
|
OrderBy
|
Sort order for the results, default DESCENDING. |
DESCENDING
|
sort_by
|
str
|
Attribute to sort by. |
None
|
offset
|
int
|
Pagination offset to start from. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[LotSearchItem]
|
An iterator of matching partial (unhydrated) lot entities. |
Source code in src/albert/collections/lots.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
get_all
get_all(
*,
parent_id: InventoryId | None = None,
inventory_id: InventoryId | None = None,
barcode_id: str | None = None,
parent_id_category: str | None = None,
inventory_on_hand: str | None = None,
location_id: str | None = None,
exact_match: bool = False,
begins_with: bool = False,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[Lot]
Get all Lot entities with optional filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
str
|
Fetch lots for the given parentId (inventory). |
None
|
inventory_id
|
str
|
Fetch lots for the given inventoryId. |
None
|
barcode_id
|
str
|
Fetch lots for the given barcodeId. |
None
|
parent_id_category
|
str
|
Filter by parentIdCategory (e.g., RawMaterials, Consumables). |
None
|
inventory_on_hand
|
str
|
Filter by inventoryOnHand (lteZero, gtZero, eqZero). |
None
|
location_id
|
str
|
Filter by locationId. |
None
|
exact_match
|
bool
|
Whether to match barcodeId exactly. Default is False. |
False
|
begins_with
|
bool
|
Whether to match barcodeId as prefix. Default is False. |
False
|
start_key
|
str
|
The pagination key to continue listing from. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[Lot]
|
An iterator of Lot entities matching the filters. |
Source code in src/albert/collections/lots.py
update
Update a lot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lot
|
Lot
|
The updated lot object. |
required |
Returns:
| Type | Description |
|---|---|
Lot
|
The updated Lot entity as returned by the server. |