question

mm_y_2406 avatar image
0 Likes"
mm_y_2406 asked Jason Lightfoot commented

How to Query on Rack according to even/odd bays?

Hello,

I have a list of items with their labeled SKUs and is pushed to a list to be stored on the rack by a transporter. When finding a slot, how do you query to match even SKUs value to even bay no. and vice versa for odd SKUs value to odd bay no.?

FlexSim 23.2.3
query
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @mm_y_2406, was one of Jordan Johnson's or Felix Möhlmann's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered

I would make a user command that takes a bay and a slot as arguments:

1706120753206.png

Then you can use the usercommand as part of your query:

WHERE itemMatchesSlot($1, slot) AND slot.hasSpace($1)

MatchEvenOddBays.fsm


1706120753206.png (50.6 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.

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jordan Johnson commented

To my knowledge, as opposed to list queries, it is not possible to use Flexscript commands in storage system queries.

So you will have to add a label that denotes whether the bay is even or odd to each slot to use this information in a query. (As a side effect the query will be faster if that slot label is indexed.)
After you have add the respective label as a slot label in the Storage System properties, you can use the following code to assign the values to all slots. The usual disclaimer about "function_s" calls apply (mainly no guaranteed compatibility with other versions).

Array slots = Storage.system.querySlots("");
for(int i = 1; i <= slots.length; i++) {     Storage.Slot slot = slots[i];     function_s(slot.as(treenode), "paintLabel", "LabelName", slot.bayID%2, 1); }

Then do the same for the item label: Create a new label on the token that denotes the type as even or odd and compare that to the slot label in the Find Slot query.

· 4
5 |100000

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

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

You can use FlexScript in storage system queries. However, not all FlexScript will work. In particular, the '%', '[', and ']' symbols all have meaning in both FlexScript and FlexQL. The FlexQL parser does its best to identify when FlexScript is being used, but it always assumes FlexQL in these cases. Very simple expressions (such as label access or slot.hasSpace()) are usually fine. But for more complex logic or for logic that requires any of the above symbols, a user command is the way to go.

2 Likes 2 ·
mm_y_2406 avatar image mm_y_2406 commented ·

Hello,

I am not sure how to do this, could you guide me through? Here is the attached file.

PushBackRackTest_1.fsm

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ mm_y_2406 commented ·
You should be able to run Felix's script in a script console (replacing 'LabelName' with your chosen name - eg. isOdd). Setting your sku-based label is just going to be the SKU%2 and then you can just find a slot with the query clause 'WHERE isOdd=$1.isOdd'
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann mm_y_2406 commented ·

Here's the model in which I tested the logic.

slot-by-even-odd.fsm

Again, the necessary steps are:

- Create a slot label in the Storage System properties.
- Assign values 0 or 1 to it (even/odd) by running the code in the script console.
- Use the label in the Find Slot query.

0 Likes 0 ·
slot-by-even-odd.fsm (180.1 KiB)