question

Amy M3 avatar image
0 Likes"
Amy M3 asked Amy M3 commented

Rack Inventory

What is the easiest way to check inventory in Racks? I want to make sure I have all the right materials before I start pulling pallets out. I have the items in a list as well...so not sure if I can get a count that way or need to check the racks directly. I want to do something like select "count" of each sku. Once I get that I'll compare to the requirements for each sku for the order. Looking for help with syntax to get a count either from the list or the racks.

FlexSim 22.2.2
rack inventory
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 Amy M3 commented

You can get the item count by querying the storage system for items with a specific sku.

int countStorage = Storage.system.queryItems("WHERE sku == $1", 0, sku).length;


Or you use the "Table.query()" command to query the list and receive a table with counts for all available sku types. Since empty sku types will not appear in the list you can not count on a specific sku to always being found in the same row, so you would have to search for the correct row. This does have the advantage that you can get a complete table of contents with a single command, as opposed to just the count for one sku.

Table queryResult = Table.query("SELECT COUNT(sku) AS Count, sku FROM ItemList1 GROUP BY sku ORDER BY sku ASC");
int countQuery = queryResult.getValueByKey(sku, 1, 2);


You can also push the different skus to different partitions on the list to begin with, so you can retrieve their count via the "PartitionContent" statistic of the list. This method should be much faster with large item quantities than the other two, so depending on how often you query the content, I would recommend this approach. You would then specify the sku in the partition field rather than the query, when pulling items from the list.

int countPartition = getstat(List("ItemList2").as(treenode), "PartitionContent", STAT_CURRENT, sku);

GetStorageCount.fsm


getstoragecount.fsm (42.2 KiB)
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

You can also query the storage system to get all SKUs in one hit:

Array result=Storage.system.queryItems("SELECT SKU, count(*) GROUP BY SKU ORDER BY SKU ASC",0);
result.as(Table).cloneTo("GlobalTable1");

SKUsummaryStock.fsm

1 Like 1 ·
skusummarystock.fsm (58.1 KiB)
Amy M3 avatar image Amy M3 Jason Lightfoot ♦♦ commented ·
Thank you both, I tried all methods just to learn..all worked, but wondering on the Storage.system.queryItems..how does it know which rack i'm looking at? I have 6 but only want to check 1 specific rack?
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Amy M3 commented ·

Then you need to specify slot.storageObject=$1 and pass in the rack as the 3rd parameter (1st is the query string, second is reserved for flags, 3rd is your first parameter)

0 Likes 0 ·
Show more comments