Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Angle = 45.0;
                ChkbMirrorLength.Checked = LayersMirrorLength;
                ChkbMirrorWidth.Checked  = LayersMirrorWidth;
                TBFileName.Text          = FileName;

                var interlayerArray = Interlayers.Select(p => p == '1' ? true : false).ToArray();
                var listInterlayers = new List <InterlayerDetails>();
                PalletStacking.InitializeInterlayers(DimCase, DimPallet, MaxPalletHeight, string.Empty, ref listInterlayers);
                for (var i = 0; i < interlayerArray.Length; ++i)
                {
                    if (i < listInterlayers.Count)
                    {
                        listInterlayers[i].Activated = interlayerArray[i];
                    }
                }

                listInterlayers.Reverse();
                LVInterlayers.DataSource = listInterlayers;
                LVInterlayers.DataBind();
            }
            ExecuteKeyPad();
            UpdateImage();
        }
Exemplo n.º 2
0
        public CylinderPalletAnalysis CreateNewCylinderPalletAnalysisUI()
        {
            FormNewAnalysisCylinder form = new FormNewAnalysisCylinder(this);

            form.Cylinders   = Cylinders.ToArray();
            form.Pallets     = Pallets.ToArray();
            form.Interlayers = Interlayers.ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                CylinderPalletConstraintSet constraintSet = new CylinderPalletConstraintSet();
                // interlayer period
                constraintSet.HasInterlayer         = form.HasInterlayer;
                constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // stop criterion
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;

                return(CreateNewCylinderPalletAnalysis(form.AnalysisName, form.AnalysisDescription
                                                       , form.SelectedCylinder, form.SelectedPallet
                                                       , form.SelectedInterlayer, form.SelectedInterlayerAntiSlip
                                                       , constraintSet
                                                       , new CylinderSolver()));
            }
            return(null);
        }
Exemplo n.º 3
0
        public void EditCylinderPalletAnalysis(CylinderPalletAnalysis analysis)
        {
            bool recomputeRequired       = false;
            FormNewAnalysisCylinder form = new FormNewAnalysisCylinder(this, analysis);

            form.Cylinders   = Cylinders.ToArray();
            form.Pallets     = Pallets.ToArray();
            form.Interlayers = Interlayers.ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                analysis.CylinderProperties           = form.SelectedCylinder;
                analysis.PalletProperties             = form.SelectedPallet;
                analysis.InterlayerProperties         = form.SelectedInterlayer;
                analysis.InterlayerPropertiesAntiSlip = form.SelectedInterlayerAntiSlip;
                // analysis name / description
                analysis.Name        = form.AnalysisName;
                analysis.Description = form.AnalysisDescription;
                // constraint set
                CylinderPalletConstraintSet constraintSet = analysis.ConstraintSet;
                // interlayers
                constraintSet.HasInterlayer         = form.HasInterlayer;
                constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // stop criterions
                constraintSet.UseMaximumPalletHeight        = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletHeight           = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletWeight        = form.UseMaximumPalletWeight;
                constraintSet.MaximumPalletWeight           = form.MaximumPalletWeight;
                constraintSet.UseMaximumNumberOfItems       = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems          = form.MaximumNumberOfItems;
                constraintSet.UseMaximumLoadOnLowerCylinder = form.UseMaximumLoadOnLowerCylinder;
                constraintSet.MaximumLoadOnLowerCylinder    = form.MaximumLoadOnLowerCylinder;
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }
Exemplo n.º 4
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)
            {
                FormNewAnalysisLegacy form = new FormNewAnalysisLegacy(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);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new palet analysis
        /// </summary>
        /// <returns>created palet analysis</returns>
        public CasePalletAnalysis CreateNewCasePalletAnalysisUI()
        {
            if (!CanCreateCasePalletAnalysis)
            {
                return(null);
            }

            FormNewAnalysis form = new FormNewAnalysis(this);

            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 (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                CasePalletConstraintSet constraintSet = new 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 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;
                // 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;
                }
                // number of pallet film turns
                constraintSet.PalletFilmTurns = form.PalletFilmTurns;

                return(CreateNewCasePalletAnalysis(
                           form.AnalysisName, form.AnalysisDescription,
                           form.SelectedBox, form.SelectedPallet,
                           form.SelectedInterlayer, form.SelectedInterlayerAntiSlip,
                           form.SelectedPalletCorners, form.SelectedPalletCap, form.SelectedPalletFilm,
                           constraintSet,
                           new CasePalletSolver()));
            }
            return(null);
        }