Hello,
I need to simulate the impact of having only one resource (forklift or operator) in an aisle of my warehouse at a time: when an item is identified for picking, the entire aisle should be blocked while the resource travels, loads, and unloads the item; once the task is completed, the aisle should be unblocked and available for further picking.
To implement this, I started with a standard scenario (without any aisle traffic restrictions), where I assigned a slot label called "alleebloquee" (blockedaisle) with a value of 0 to all the racks. I then added two custom scripts to my process flow:
- Code "Find aisle": After identifying the item to be picked, this code assigns the corresponding aisle label to the token.
- Code "Block aisle": This code is supposed to change the "alleebloquee" label to 1 for all slots in the same aisle (in that case, token.aisle).
So far, the first custom code, "Find aisle," works as expected. However, the second part, "Block aisle," is not working correctly: the "alleebloquee" labels for all slots in the aisle remain set to 0.
Can anyone help me identify what needs to be fixed in my "Block aisle" code?
Thanks in advance!
Model file: 181224 - Exercice_CIBLE_v1.fsm
Custom code (i) - Find aisle:
cppCopier le code/**Custom Code*/
Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);
// First, you get the correct StorageItem
Storage.Item StorageItem = Storage.Item(token.pallet);
// From there, you can access the slot where it is stored
Storage.Slot StorageSlot = StorageItem.currentSlot;
// Then get the position of that slot
token.aisle = StorageSlot.aisleID;
Custom code (ii) - Block aisle:
cppCopier le code/**Custom Code*/
Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);
Array slots = Storage.system.querySlots(""); // Get all slots in the system
for (int n = slots.length; n > 0; n--)
{
treenode slot = slots[n - 1]; // Access each slot in the array
if (slot.aisleID == token.aisle) // Compare the aisle of the slot with that of the token
{
// Update the "alleebloquee" label for the slot
slot.alleebloquee = 1; // Set to 1 or another value as needed
}
}