When a pallet moves past the exit transfer, the transport task generated for that pallet is aborted by the default behaviour. This brings two issues with it:
- The preempting task sequence only has a single task in it, resulting in an error because the trigger code assumes that the operator will only receive transport task sequences with five tasks. So we need to check for the number of tasks in the task sequence.
- We don't want to abort the task sequence if the box was already taken from the pallet. Thus, when a task sequence with a single task is received (the abort TS) and the operator is currently holding an item, we change the preempt value of the TS so the transport task is not aborted.
- Additionally, you added multiple exit transfers, yet the trigger code always assumes that the pickup happens at the first one. Use the information about the pick location from the first travel or load task to send the operator to the correct location.
if(taskSequence.tasks.length == 5)
{
Object pallet = taskSequence.tasks[2].involved1;
taskSequence.tasks[2].involved1 = pallet.first;
taskSequence.tasks[5].involved1 = pallet.first;
taskSequence.addTask(TASKTYPE_PICKOFFSET, pallet, taskSequence.tasks[1].involved1, 1, 1, 0);
taskSequence.tasks[6].rank = 2;
}
else
{
if(current.subnodes.length > 0)
{
// Ignore abort task
taskSequence.preempt = 0;
}
}
Just to say it again. This code is tailored to exact situation in the model. If you make alterations or add for example a time table or other tasks to the operators, the logic will break and need to be adjusted.