Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new bundle analysis
        /// </summary>
        /// <returns>created bundle analysis</returns>
        public CasePalletAnalysis CreateNewBundlePalletAnalysisUI()
        {
            FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, null);

            form.Boxes   = Bundles.ToArray();
            form.Pallets = Pallets.ToArray();
            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraintSet
                BundlePalletConstraintSet constraintSet = new BundlePalletConstraintSet();
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // allowed patterns
                foreach (string s in form.AllowedPatterns)
                {
                    constraintSet.SetAllowedPattern(s);
                }
                // allow aligned / alternate layer
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                // stop criterion
                constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;

                return(CreateNewCasePalletAnalysis(form.ItemName, form.ItemDescription,
                                                   form.SelectedBundle, form.SelectedPallet, null, null,
                                                   null, null, null,
                                                   constraintSet,
                                                   new CasePalletSolver()));
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Edit specified pallet analysis
        /// </summary>
        /// <param name="analysis"></param>
        public void EditCasePalletAnalysis(CasePalletAnalysis analysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired = false;

            if (analysis.IsBoxAnalysis)
            {
                FormNewAnalysis form = new FormNewAnalysis(this, analysis);
                form.Cases         = Cases.ToArray();
                form.Pallets       = Pallets.ToArray();
                form.Interlayers   = Interlayers.ToArray();
                form.PalletCorners = ListByType(typeof(PalletCornerProperties)).ToArray();
                form.PalletCaps    = ListByType(typeof(PalletCapProperties)).ToArray();
                form.PalletFilms   = ListByType(typeof(PalletFilmProperties)).ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name        = form.AnalysisName;
                    analysis.Description = form.AnalysisDescription;
                    // box / palet / interlayer
                    analysis.BProperties          = form.SelectedBox;
                    analysis.PalletProperties     = form.SelectedPallet;
                    analysis.InterlayerProperties = form.SelectedInterlayer;
                    // build constraint set
                    CasePalletConstraintSet constraintSet = analysis.ConstraintSet as CasePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed axes
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                    // allowed dir change
                    constraintSet.AllowTwoLayerOrientations       = form.AllowTwoLayerOrientations;
                    constraintSet.AllowLastLayerOrientationChange = form.AllowLastLayerOrientationChange;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                    {
                        constraintSet.SetAllowedPattern(s);
                    }
                    // allow alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                    // interlayers
                    constraintSet.HasInterlayer         = form.HasInterlayers;
                    constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                    constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                    // pallet corner
                    analysis.PalletCornerProperties = form.SelectedPalletCorners;
                    // pallet cap
                    analysis.PalletCapProperties = form.SelectedPalletCap;
                    // pallet film
                    analysis.PalletFilmProperties = form.SelectedPalletFilm;
                    // stop criterion
                    constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                    constraintSet.UseMaximumWeightOnBox   = form.UseMaximumLoadOnBox;
                    constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                    constraintSet.MaximumWeightOnBox      = form.MaximumLoadOnBox;
                    // number of solution kept
                    constraintSet.UseNumberOfSolutionsKept = Properties.Settings.Default.KeepBestSolutions;
                    if (constraintSet.UseNumberOfSolutionsKept)
                    {
                        constraintSet.NumberOfSolutionsKept = Properties.Settings.Default.NoSolutionsToKeep;
                    }
                    // pallet film turns
                    constraintSet.PalletFilmTurns = form.PalletFilmTurns;
                }
            }
            else if (analysis.IsBundleAnalysis)
            {
                FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, analysis);
                form.Boxes   = Bundles.ToArray();
                form.Pallets = Pallets.ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name        = form.ItemName;
                    analysis.Description = form.ItemDescription;
                    // analysis bundle / pallet
                    analysis.BProperties      = form.SelectedBundle;
                    analysis.PalletProperties = form.SelectedPallet;
                    // build constraintSet
                    BundlePalletConstraintSet constraintSet = analysis.ConstraintSet as BundlePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                    {
                        constraintSet.SetAllowedPattern(s);
                    }
                    // allow aligned / alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                    // stop criterions
                    constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                    constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                }
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Edit specified pallet analysis
        /// </summary>
        /// <param name="analysis"></param>
        public void EditCasePalletAnalysis(CasePalletAnalysis analysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired = false;

            if (analysis.IsBoxAnalysis)
            {
                FormNewAnalysis form = new FormNewAnalysis(this, analysis);
                form.Cases = Cases.ToArray();
                form.Pallets = Pallets.ToArray();
                form.Interlayers = Interlayers.ToArray();
                form.PalletCorners = ListByType(typeof(PalletCornerProperties)).ToArray();
                form.PalletCaps = ListByType(typeof(PalletCapProperties)).ToArray();
                form.PalletFilms = ListByType(typeof(PalletFilmProperties)).ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name = form.AnalysisName;
                    analysis.Description = form.AnalysisDescription;
                    // box / palet / interlayer
                    analysis.BProperties = form.SelectedBox;
                    analysis.PalletProperties = form.SelectedPallet;
                    analysis.InterlayerProperties = form.SelectedInterlayer;
                    analysis.InterlayerPropertiesAntiSlip = form.SelectedInterlayerAntiSlip;
                    // build constraint set
                    CasePalletConstraintSet constraintSet = analysis.ConstraintSet as CasePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed axes
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                    // allowed dir change
                    constraintSet.AllowTwoLayerOrientations = form.AllowTwoLayerOrientations;
                    constraintSet.AllowLastLayerOrientationChange = form.AllowLastLayerOrientationChange;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                        constraintSet.SetAllowedPattern(s);
                    // allow alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers = form.AllowAlignedLayers;
                    // interlayers
                    constraintSet.HasInterlayer = form.HasInterlayers;
                    constraintSet.InterlayerPeriod = form.InterlayerPeriod;
                    constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                    // pallet corner
                    analysis.PalletCornerProperties = form.SelectedPalletCorners;
                    // pallet cap
                    analysis.PalletCapProperties = form.SelectedPalletCap;
                    // pallet film
                    analysis.PalletFilmProperties = form.SelectedPalletFilm;
                    // stop criterion
                    constraintSet.UseMaximumHeight = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight;
                    constraintSet.UseMaximumWeightOnBox = form.UseMaximumLoadOnBox;
                    constraintSet.MaximumHeight = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
                    constraintSet.MaximumWeightOnBox = form.MaximumLoadOnBox;
                    // number of solution kept
                    constraintSet.UseNumberOfSolutionsKept = Properties.Settings.Default.KeepBestSolutions;
                    if (constraintSet.UseNumberOfSolutionsKept)
                        constraintSet.NumberOfSolutionsKept = Properties.Settings.Default.NoSolutionsToKeep;
                    // pallet film turns
                    constraintSet.PalletFilmTurns = form.PalletFilmTurns;
                }
            }
            else if (analysis.IsBundleAnalysis)
            {
                FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, analysis);
                form.Boxes = Bundles.ToArray();
                form.Pallets = Pallets.ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name = form.ItemName;
                    analysis.Description = form.ItemDescription;
                    // analysis bundle / pallet
                    analysis.BProperties = form.SelectedBundle;
                    analysis.PalletProperties = form.SelectedPallet;
                    // build constraintSet
                    BundlePalletConstraintSet constraintSet = analysis.ConstraintSet as BundlePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                        constraintSet.SetAllowedPattern(s);
                    // allow aligned / alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers = form.AllowAlignedLayers;
                    // stop criterions
                    constraintSet.UseMaximumHeight = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight;
                    constraintSet.MaximumHeight = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
                }
            }
            if (recomputeRequired)
                analysis.OnEndUpdate(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new bundle analysis
        /// </summary>
        /// <returns>created bundle analysis</returns>
        public CasePalletAnalysis CreateNewBundlePalletAnalysisUI()
        {
            FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, null);
            form.Boxes = Bundles.ToArray();
            form.Pallets = Pallets.ToArray();
            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraintSet
                BundlePalletConstraintSet constraintSet = new BundlePalletConstraintSet();
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // allowed patterns
                foreach (string s in form.AllowedPatterns)
                    constraintSet.SetAllowedPattern(s);
                // allow aligned / alternate layer
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                constraintSet.AllowAlignedLayers = form.AllowAlignedLayers;
                // stop criterion
                constraintSet.UseMaximumHeight = form.UseMaximumPalletHeight;
                constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight;
                constraintSet.MaximumHeight = form.MaximumPalletHeight;
                constraintSet.MaximumNumberOfItems = form.MaximumNumberOfBoxes;
                constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;

                return CreateNewCasePalletAnalysis(form.ItemName, form.ItemDescription,
                    form.SelectedBundle, form.SelectedPallet, null, null,
                    null, null, null,
                    constraintSet,
                    new CasePalletSolver());
            }
            return null;
        }