unassign and reassign orders with differnt sequence programatically in AL 10

607
3
02-05-2012 12:45 PM
RizwanBashir
New Contributor
Hi
   I am developing a project where I have to change the order sequence of assigned orders on basis of some client algorithm.

  so I unassign all orders using

  ALCollection col = route.Orders;
  // raf = routingfolder
   raf.UnassignOrders(col, null);

now I need to assign orders back with specified index to same route.

Can anyone please help me and let me know how I can assign the order back with different sequence number ?
I know there might be some issues in above as timewindow wont match so lets say we have 10 routes, changing the sequence may work for 3 orders and rest of the 7 remains unassigned would even work for me. + in some cases I can also set time window to wide open so all 10 would fit back , but question is how to assign them back with my required sequence ?


Best Regards
Rizwan Bashir
0 Kudos
3 Replies
JeffWickstrom
Esri Contributor
Hello Rizwan,

You can use IALRoutingFolder.AssignOrdersToRoute(pOrders, pRoute, postion ...

Sorry I don't have a sample handy.  Let us know if you get stuck using it and I'll make one.  I'm not sure how the in-feasible assignments will behave.  Perhaps an exception is raised calling the method. 

Jeff
0 Kudos
RizwanBashir
New Contributor
Hi jeff
        I tried alot but no luck. this is my code


// First of all I am preparing my list from stops

                            ALCollectionClass cl = new ALCollectionClass();
                           
                            int pos = 0;
                            ALRoute r = (ALRoute)route;
                            ArrayList arPostion = new ArrayList();

                            for (int i = dictionary.Keys.Count; i > 0; i--)
                            {
                                ALStop stop = dictionary;
                                ALOrder order = (ALOrder)stop.AssociatedObject;
                               
                                r.Orders.Insert(pos, order);
                                cl.Insert(pos, order);
                                ar.Add(pos);

                                pos++;
                            }
                            IALCollection v = (IALCollection)cl;
                       
                           // raf = Routing folder and   v i Interface as you can see abovce line, r = route , arPostion = array list with positions and null is for track
                            raf.AssignOrdersToRoute(v, r, arPostion, null);


Any idea or tip would be very helpful.  There is one more minor issue, when I change the values of route in some other function , it does not refresh in AL app, until it refresh the list somehow. is there any way in coding to let AL know that values has changed so it refresh listings ?

Thanks
Best Regards
Rizwan Bashir
0 Kudos
RizwanBashir
New Contributor
Hi
  is there any one who can help me on this issue, solution in AL 9 will work as well ?

Best Regards
Rizwan Bashir
0 Kudos