/// <summary>
        /// Starts operation process.
        /// </summary>
        /// <param name="args">Command args. Empty there.</param>
        protected override void _Execute(params object[] args)
        {
            // Create command parameters.
            OptimizeAndEditPage schedulePage = (OptimizeAndEditPage)App.Current.MainWindow.GetPage(PagePaths.SchedulePagePath);
            Schedule schedule = schedulePage.CurrentSchedule;
            ICollection<Route> targetRoutes = ViolationsHelper.GetBuildRoutes(schedule);

            // And pass they to call _Execute from base class.
            base._Execute(targetRoutes, (string)App.Current.FindResource(BEST_ROUTE_OPTION_RESOURCE));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets build routes operation parameters for the specified schedule.
        /// </summary>
        /// <param name="schedule">The schedule to get build routes operation
        /// parameters for.</param>
        /// <returns>Build routes operation parameters.</returns>
        private BuildRoutesParameters _GetBuildRoutesParameters(Schedule schedule)
        {
            var routes = ViolationsHelper.GetBuildRoutes(schedule);

            // get orders planned on schedule's date
            var day = (DateTime)schedule.PlannedDate;

            var orders =
                from order in App.Current.Project.Orders.Search(day)
                where !ConstraintViolationsChecker.IsOrderRouteLocked(order, schedule)
                select order;

            var parameters = new BuildRoutesParameters()
            {
                TargetRoutes   = routes,
                OrdersToAssign = orders.ToList()
            };

            return(parameters);
        }