question

sara S2 avatar image
0 Likes"
sara S2 asked sara S2 commented

How to change puller by token in “WHERE CUtoteItemType = puller.Prior”?

Hello,

I model a replenishment process, where empty "CUtotes" on "rack 15" are replenished by items (boxes) of types corresponding to the label "ItemsType" (Fig1). Empty "CUtotes" are selected by order; according to the "ItemsType" label that is equal to the label "Prior" (in "Query/Object/Array" of “Pull From List0” activity -see Fig 2). The label "Prior" values are assigned according to a custom code and written in the global table “CWDB” column 5.

The problem is: In "Query/Object/Array" of “Pull From List0” activity, the expression “WHERE CUtoteItemType = puller.Prior” doesn’t perform the described order because of “puller.Prior” that gives the “Prior” value of the token number “puller.Prior” (Exp: the first value corresponds to 1 wich is the label “Prior” value of the token 3 – because puller.Prior=3 ). So, in order to apply the described order, I must change “puller” with “token”. But, the new expression “WHERE CUtoteItemType = token.Prior” is invalid.

I can’t find the convenient expression in "Query/Object/Array" of “Pull From List0” activity that allows to perform the described order for “Cutotes” selection.

Please help me to fix this.

Regards.

fig1.png

fig2.png

trying1.fsm

FlexSim 19.0.0
pull from list
fig1.png (146.1 KiB)
fig2.png (180.1 KiB)
trying1.fsm (80.4 KiB)
· 2
5 |100000

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

sara S2 avatar image sara S2 commented ·
@Matthew Gillespie
would you please help me to fix this?
0 Likes 0 ·
tannerp avatar image tannerp commented ·

In this situation, "puller" is the token. Could you explain more about what you mean when you said the following?

"Exp: the first value corresponds to 1 wich is the label “Prior” value of the token 3 – because puller.Prior=3"

0 Likes 0 ·

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered sara S2 commented

I've modified your model to do what I think you're attempting to do. I was very confused by your question and by the first few activities in the process flow. I don't understand why you are both pushing totes on the list and listening to the OnEntry of the rack. This seems very redundant. You are pushing an item on the list and then having a token associated with that item pull the item right back off the list.

I looked through the logic of the process flow and I think this is what you're trying to do. I removed the CUtotes list entirely since you already have a reference to a CUtote by listening to the OnEntry of the rack. This token first acquires the Combiner and then splits into two tokens, one to move the tote to the combiner and the other to collect the other 8 items and move them to the Combiner.

combinermodel.fsm


combinermodel.fsm (79.1 KiB)
· 9
5 |100000

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

sara S2 avatar image sara S2 commented ·

Thank you @Matthew Gillespie for your reply.

In fact, what I want to do is to select the “CUtotes” in an ascending order of their items' "SC" value. The order is the following (by items type that corresponds to the label "ItemsType"):

3 1 5 2 6 4 7 8 (which are the label "Prior" values - see global table "CWDB" column 5)

So the first “CUtote” to select is the “CUtote” which “ItemsType” label is equal to 3 ...

I wrote the custom code in "Prior" label that allows giving this order to tokens. But, the problem is the expression that I should put in "Query/Object/Array" of “Pull From List0” activity.

“WHERE CUtoteItemType = puller.Prior” expression is not convenient because it is not giving the right order because of "puller". So, I want to replace "puller" by "token" but this is invalid.

For example:

The first value of "puller.Prior" is puller.3 which corresponds to token3 and this gives the value of “Prior” label of the token3 which is equal to 1. While I have to get the value 3 not 1 according to the above order. The value 3 is given by token1.

I hope I could explain this situation. I just need the right expression in "Query/Object/Array" of “Pull From List0” activity that allows performing the selection of “Cutotes” according to the “Prior” label values.

I would be grateful of your help.

Regards.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ sara S2 commented ·

You're still going about this the wrong way. Pushing totes on the list and then pulling them off with a token representing the tote doesn't make any sense.

It sounds like you're trying to sort the totes into a certain order. To do that you need an ORDER BY statement not a WHERE statement. You either need to have the combiner pull totes off the list or put a back order queue strategy on the Combiner resource. Either way you just need the right where statement to order the totes correctly.

I can help you do this, but I still don't understand how you want to order the totes. You said "what I want to do is to select the “CUtotes” in an ascending order of their items' "SC" value." Your items don't have an SC value. You keep mentioning the Prior label. What is this label? The custom code you have to set the tote's Prior label looks like a mess of spaghetti code.

2 Likes 2 ·
sara S2 avatar image sara S2 Matthew Gillespie ♦♦ commented ·

I want to select the "CUtotes" according to an ascending order of the global table "CWDB" column 4 values, considering only the first “CUtote” of each item type. I hope this is more clear.

0 Likes 0 ·
Show more comments
sara S2 avatar image sara S2 commented ·

@Matthew Gillespie

In this model, I have 8 different types of items (boxes). Each type has 2 "CUtotes" the first one and the second one (by "CUtoteType" label). Generally, the selection of "CUtotes" from "Rack15" to "Combiner2" is performed according to "ItemsType" values (Each CUtote has its "ItemsType" label value that corresponds to the item - that contains - type). In the global table "CWDB" column 4, I set "SC" values ("SC" is not a label) for each item type (row 1 corresponds to item type 1, so item type 1 has "SC" value equal to 1, item type 2 has "SC" value equal to 3....).

The selection of "CUtotes" is performed starting by the "CUtote" of the item type having the smallest "SC" value.

"SC" is not a label and it is not attributed to totes. It is actually an indicator (Stock Coverage) for each item.

I know this is complicated, but I try to simplify it the possible I can.

I hope I could clarify this.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ sara S2 commented ·

OK, I think I understand. I've updated the model so that the combiner pulls totes in the order of lowest SC value. Rack 15 pushes totes to the "Totes" list and values on this list are assigned an "SC" value which I get from the CWDB table like this:

Table("CWDB")[value.itemstype][4]

Then in the Pull Tote activity that pulls from the "Totes" list I use an ORDER BY statement in the query to pull the lowest SC tote:

ORDER BY SC ASC

orderbysc.fsm

1 Like 1 ·
orderbysc.fsm (78.0 KiB)
sara S2 avatar image sara S2 commented ·

Thank you very much for your help. In fact, I want to select the first totes then the second totes (replenish all the first totes then the second totes).

In addition, I would like to know if it is possible to include another condition in the query:

in case two or more totes have the same "SC" value, and one of them corresponds to a critical item (which is item of type 5), the puller start by the tote of this item then the others.

figure.png25794-

orderbysc.fsm

0 Likes 0 ·
figure.png (141.4 KiB)
25794-orderbysc.fsm (77.8 KiB)
Matthew Gillespie avatar image Matthew Gillespie ♦♦ sara S2 commented ·

Both of these things can be done by modifying the ORDER BY statement. In the attached model I changed the query to this:

ORDER BY CUtoteType, SC ASC, PriorityType DESC

So first we order the totes on the list by their CUtoteType label. So all the type 1 totes are pulled first and then all the type 2 totes. Now since we have a bunch of ties the query uses the next part of the ORDER BY statement. So out of all the type 1 totes it picks the 1 with the lowest SC value. Finally, if there is a tie between totes with the same SC value it finds the tote with the highest PriorityType value. This is a new field that I added to the "Totes" list with this expression:

value.itemstype == 5

So all the itemtype 5 totes will have a PriorityType value of 1 while all the other totes have a value of 0.

orderbysc2.fsm

1 Like 1 ·
orderbysc2.fsm (78.1 KiB)
sara S2 avatar image sara S2 Matthew Gillespie ♦♦ commented ·

@Matthew Gillespie thank you very very much for your help.

0 Likes 0 ·

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.