question

Krzysztof J avatar image
1 Like"
Krzysztof J asked Valentin R edited

Problem with slot labels in warehousing module

Hello everyone,

The problem is how to update slot assignment labels which where assigned firstly by "Paint Slot Labels" option. I have prepared a code which is sth like:

Storage.Slot NAME = Storage.system.getSlot("PRODUCT_ID");
NAME.slot_name = "SLOT_NAME";

and it is work and assign data as I want but after reseting the model all data go back to the deafault values. I do not want to repeat this operation any time I reset the model (there is sth like 100 000 references to calculate).

Any sugestions?

And on the other hand - how to unmark "Paint Slot Labels" results?

FlexSim 19.2.3
labelswarehousingslot
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
1 Like"
Jordan Johnson answered

If the model is running when you set the labels, the will go back to their "time 0" values when the model is reset. If setting the labels before running the model doesn't work, please post a model that we can look at to help you out.

As an alternative to using the getSlot method, you could iterate through all the slots of your model:

var objs = Storage.system.storageObjects;
for (int i = 1; i <= objs.length; i++) {
	Storage.Object obj = objs[i];
	var bays = obj.bays;
	for (int j = 1; j <= bays.length; j++) {
		var levels = bays[j].levels;
		for (int k = 1; k <= levels.length; k++) {
			var slots = levels[k].slots;
			for (int s = 1; s <= slots.length; s++) {
				slots[s].slot_name = "SLOT_NAME";
			}
		}
	}
}
5 |100000

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

Valentin R avatar image
2 Likes"
Valentin R answered Valentin R edited

I had the same issue... And there is the solution !!!

You can use the following function:
function_s(myStorageSlot.as(Object), "paintLabel", string LabelName, num LabelValue , num PaintMode);

It does the same as the "Paint Slot Labels" library tool. The paintMode is the same as the "Mode" of the tool which is in the same order as in the Mode display (paintMode = 1 means "Paint Individual Slots", ... , paintMode = 5 means "Paint all slots in same objet").

Thank you @Begoña Espiñeira ;)

5 |100000

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

Krzysztof J avatar image
1 Like"
Krzysztof J answered Valentin R edited

Thank you for your answer. It is very useful but I still can not understand why label values go back to the default values. Ok - if the code you provided is somehow part of a model logic it is clear - each time I reset the model iI need to do this calculation.

But...

If I write this code in script window, and then run this code all labels should be assigned to slots and they should be as you had written "their time 0 values". Why it is not working this way and after reset all values dissapear?

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.