question

Rahul R avatar image
0 Likes"
Rahul R asked Felix Möhlmann answered

"Find slot" for finding a specific number of slots

I have to find X number of slots where X is the number of items I need to put into the rack. I currently have "Find slot" in a sub flow with X child tokens. Is there a way to pull multiple slots in Find slot without having to iterate?


1676963156985.png

FlexSim 22.2.1
warehousefindslot
1676963156985.png (19.2 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

The Find Slot activity is designed to find (and assign) a slot for a single item. You can use "Storage.system.querySlots()" in custom code instead to get an array of slots. Note that "hasSpace" will only be guaranteed to be true for the item you used in the query. You also have to assign the slot. To make sure items are only assigned to slots with space, you would have to check the requirement for each item individually (if you want/need to place more than one item per slot)

The code below assigns each item in the "token.Items" array to the first slot with space, for example.

Array Items = token.Items.clone();
Array Slots = Storage.system.querySlots("WHERE slot.hasSpace($1)", 0, Items[1]);
while(Items.length && Slots.length)
{
    if(Slots[1].as(Storage.Slot).hasSpace(Items[1]))
    {
        Storage.Item SI = Storage.Item(Items.shift());
        SI.assignedSlot = Slots[1];
    }
    else
    {
        Slots.shift();
    }
}

BulkSlotAssignment_fm.fsm


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.