Esempio n. 1
0
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties          = boxProperties;
     _palletProperties       = palletProperties;
     _palletConstraintSet    = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Esempio n. 2
0
        /// <summary>
        /// Layer pallet analysis constructor (inversed = false)
        /// </summary>
        public Layer(BProperties boxProperties, PalletProperties palletProperties, PalletCornerProperties cornerProperties,
                     PalletConstraintSet constraintSet, HalfAxis.HAxis axisOrtho, bool inversed)
        {
            double cornerThickness = null != cornerProperties ? cornerProperties.Thickness : 0.0;

            _axisOrtho    = axisOrtho;
            _inversed     = inversed;
            _palletLength = palletProperties.Length + constraintSet.OverhangX - 2.0 * cornerThickness;
            _palletWidth  = palletProperties.Width + constraintSet.OverhangY - 2.0 * cornerThickness;
            Initialize(boxProperties);
        }
Esempio n. 3
0
        protected Layer2D BuildLayer(BProperties boxProperties, PalletProperties palletProperties, PalletCornerProperties cornerProperties
                                     , PalletConstraintSet constraintSet, HalfAxis.HAxis axisOrtho, bool swapped, bool inversed)
        {
            double cornerThickness = null != cornerProperties ? cornerProperties.Thickness : 0.0;

            return(new Layer2D(
                       boxProperties.OuterDimensions
                       , new Vector2D(palletProperties.Length + constraintSet.OverhangX - 2.0 * cornerThickness, palletProperties.Width + constraintSet.OverhangY - 2.0 * cornerThickness)
                       , axisOrtho
                       , swapped));
        }
Esempio n. 4
0
 /// <summary>
 /// Process case/pallet analysis
 /// </summary>
 /// <param name="analysis">Pallet analysis to process</param>
 public void ProcessAnalysis(CasePalletAnalysis analysis)
 {
     _bProperties                  = analysis.BProperties;
     _palletProperties             = analysis.PalletProperties;
     _interlayerProperties         = analysis.InterlayerProperties;
     _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip;
     _cornerProperties             = analysis.PalletCornerProperties;
     _capProperties                = analysis.PalletCapProperties;
     _constraintSet                = analysis.ConstraintSet;
     // check contraint set validity
     if (!_constraintSet.IsValid)
     {
         throw new EngineException("Constraint set is invalid!");
     }
     // generate solutions
     analysis.Solutions = GenerateSolutions();
 }
Esempio n. 5
0
 public List <CasePalletSolution> Process(
     BoxProperties boxProperties, PalletProperties palletProperties,
     InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip,
     PalletConstraintSet constraintSet)
 {
     _bProperties                  = boxProperties;
     _palletProperties             = palletProperties;
     _interlayerProperties         = interlayerProperties;
     _interlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     _constraintSet                = constraintSet;
     // check constraint set validity
     if (!_constraintSet.IsValid)
     {
         throw new EngineException("Constraint set is invalid!");
     }
     // generate solutions
     return(GenerateSolutions());
 }
Esempio n. 6
0
        private Layer2D GenerateBestLayer(
            BProperties bProperties, PalletProperties palletProperties, PalletCornerProperties cornerProperties,
            PalletConstraintSet constraintSet, HalfAxis.HAxis hAxis)
        {
            Layer2D bestLayer = null;

            // loop through all patterns
            foreach (LayerPatternBox pattern in LayerPatternBox.All)
            {
                // is pattern allowed
                if (!_constraintSet.AllowPattern(pattern.Name))
                {
                    continue;
                }

                // direction 1
                Layer2D layer1 = BuildLayer(bProperties, palletProperties, cornerProperties,
                                            constraintSet, hAxis, false, false);
                double actualLength = 0.0, actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer1, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer1, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer1.Count)
                {
                    bestLayer = layer1;
                }
                // direction 2 (opposite)
                Layer2D layer2 = BuildLayer(bProperties, palletProperties, cornerProperties,
                                            constraintSet, HalfAxis.Opposite(hAxis), false, false);
                actualLength = 0.0; actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer2, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer2, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer2.Count)
                {
                    bestLayer = layer2;
                }
            }
            return(bestLayer);
        }
Esempio n. 7
0
        private void FormNewAnalysis_Load(object sender, EventArgs e)
        {
            try
            {
                // name / description
                if (null != _analysis)
                {
                    tbName.Text        = _analysis.Name;
                    tbDescription.Text = _analysis.Description;
                }
                // fill boxes combo
                foreach (BProperties box in _cases)
                {
                    cbBox.Items.Add(new BoxItem(box));
                }
                if (cbBox.Items.Count > 0)
                {
                    if (null == _analysis)
                    {
                        cbBox.SelectedIndex = 0;
                    }
                    else
                    {
                        for (int i = 0; i < cbBox.Items.Count; ++i)
                        {
                            BoxItem boxItem = cbBox.Items[i] as BoxItem;
                            if (boxItem.Item == _analysis.BProperties)
                            {
                                cbBox.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                }
                // fill pallet combo
                foreach (PalletProperties pallet in _palletProperties)
                {
                    cbPallet.Items.Add(new PalletItem(pallet));
                }
                if (cbPallet.Items.Count > 0)
                {
                    if (null == _analysis)
                    {
                        cbPallet.SelectedIndex = 0;
                    }
                    else
                    {
                        for (int i = 0; i < cbPallet.Items.Count; ++i)
                        {
                            PalletItem palletItem = cbPallet.Items[i] as PalletItem;
                            if (palletItem.Item == _analysis.PalletProperties)
                            {
                                cbPallet.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                }
                // fill other combo
                FillCombo(checkBoxInterlayer, cbInterlayer, _interlayerProperties, (null == _analysis) ? null : _analysis.InterlayerProperties);
                FillCombo(checkBoxAntiSlipInterlayer, cbInterlayerAntiSlip, _interlayerProperties, (null == _analysis) ? null : _analysis.InterlayerPropertiesAntiSlip);
                FillCombo(chkbPalletCorners, cbPalletCorners, _palletCornerProperties, (null == _analysis) ? null : _analysis.PalletCornerProperties);
                FillCombo(chkbPalletCap, cbPalletCap, _palletCapProperties, (null == _analysis) ? null : _analysis.PalletCapProperties);
                FillCombo(chkbPalletFilm, cbPalletFilm, _palletFilmProperties, (null == _analysis) ? null : _analysis.PalletFilmProperties);
                // overhang
                if (null == _analysis)
                {
                    OverhangX = Settings.Default.OverhangX;
                    OverhangY = Settings.Default.OverhangY;
                }
                else
                {
                    OverhangX = _analysis.ConstraintSet.OverhangX;
                    OverhangY = _analysis.ConstraintSet.OverhangY;
                }

                // allowed position box + allowed patterns
                if (null == _analysis)
                {
                    AllowVerticalX = Settings.Default.AllowVerticalX;
                    AllowVerticalY = Settings.Default.AllowVerticalY;
                    AllowVerticalZ = Settings.Default.AllowVerticalZ;

                    AllowedPatternsString = Settings.Default.AllowedPatterns;

                    AllowTwoLayerOrientations       = Settings.Default.AllowLayerOrientChange;
                    AllowLastLayerOrientationChange = Settings.Default.AllowLayerOrientChangeLastOnly;
                }
                else
                {
                    PalletConstraintSet constraintSet = _analysis.ConstraintSet;
                    InterlayerPeriod = Math.Max(constraintSet.InterlayerPeriod, 1);
                    AllowVerticalX   = constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_X_N) || constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_X_P);
                    AllowVerticalY   = constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_Y_N) || constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_Y_P);
                    AllowVerticalZ   = constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_Z_N) || constraintSet.AllowOrthoAxis(HalfAxis.HAxis.AXIS_Z_P);

                    AllowTwoLayerOrientations       = constraintSet.AllowTwoLayerOrientations;
                    AllowLastLayerOrientationChange = constraintSet.AllowLastLayerOrientationChange;

                    AllowedPatternsString = constraintSet.AllowedPatternString;
                }

                // alternate / aligned layers + stop stacking criterion
                if (null == _analysis)
                {
                    AllowAlignedLayers   = Settings.Default.AllowAlignedLayer;
                    AllowAlternateLayers = Settings.Default.AllowAlternateLayer;

                    UseMaximumNumberOfBoxes = false;
                    UseMaximumPalletHeight  = true;
                    UseMaximumPalletWeight  = true;
                    UseMaximumLoadOnBox     = false;

                    MaximumNumberOfBoxes = 500;
                    MaximumPalletHeight  = UnitsManager.ConvertLengthFrom(Properties.Settings.Default.MaximumPalletHeight, UnitsManager.UnitSystem.UNIT_METRIC1);
                    MaximumPalletWeight  = UnitsManager.ConvertMassFrom(Properties.Settings.Default.MaximumPalletWeight, UnitsManager.UnitSystem.UNIT_METRIC1);
                    MaximumLoadOnBox     = 100.0;
                }
                else
                {
                    AllowAlignedLayers      = _analysis.ConstraintSet.AllowAlignedLayers;
                    AllowAlternateLayers    = _analysis.ConstraintSet.AllowAlternateLayers;
                    UseMaximumNumberOfBoxes = _analysis.ConstraintSet.UseMaximumNumberOfCases;
                    UseMaximumPalletHeight  = _analysis.ConstraintSet.UseMaximumHeight;
                    UseMaximumPalletWeight  = _analysis.ConstraintSet.UseMaximumPalletWeight;
                    UseMaximumLoadOnBox     = _analysis.ConstraintSet.UseMaximumWeightOnBox;

                    MaximumNumberOfBoxes = _analysis.ConstraintSet.MaximumNumberOfItems;
                    MaximumPalletHeight  = _analysis.ConstraintSet.MaximumHeight;
                    MaximumPalletWeight  = _analysis.ConstraintSet.MaximumPalletWeight;
                    MaximumLoadOnBox     = _analysis.ConstraintSet.MaximumWeightOnBox;
                }

                if (null != _analysis)
                {
                    PalletFilmTurns = _analysis.ConstraintSet.PalletFilmTurns;
                }

                UpdateCriterionFields();
                UpdateButtonOkStatus();

                // windows settings
                if (null != Settings.Default.FormNewAnalysisPosition)
                {
                    Settings.Default.FormNewAnalysisPosition.Restore(this);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
            }
        }