public ModelingResult GetLoadingAndPlacingPrograms(List <Box> boxesForPlacing, Container container)
        {
            if (boxesForPlacing == null)
            {
                throw new ArgumentNullException(nameof(boxesForPlacing));
            }

            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var boxesToPlaceNumber = boxesForPlacing.Sum(box => box.OrderQuantity);

            var loadingProgram = _loadingProgramProvider.GetLoadProgram(boxesForPlacing, container);
            var placingPlan    = _placingPlanProvider.GetPlacingPlan(loadingProgram, container);

            var boxesAfterPlacingNumber = placingPlan.SelectMany(box => box).Count();
            var executionPercent        = (double)boxesAfterPlacingNumber / boxesToPlaceNumber * 100;

            return(new ModelingResult
            {
                Container = container,
                LoadingProgram = loadingProgram,
                PlacingPlan = placingPlan,
                ExecutionPercent = executionPercent
            });
        }
Exemplo n.º 2
0
 public void GetLoadProgram_NullOrEmptyBoxesSet_ThrowsArgumentException(List <Box> boxesSet, Container container)
 {
     Assert.Throws <ArgumentException>(() => _loadingProvider.GetLoadProgram(boxesSet, container));
 }