Пример #1
0
        /// <summary>
        /// Creates a new case analysis
        /// </summary>
        /// <returns>created case analysis</returns>
        public BoxCasePalletAnalysis CreateNewBoxCasePalletOptimizationUI()
        {
            FormNewCaseAnalysis form = new FormNewCaseAnalysis(this)
            {
                Boxes = Boxes.ToArray()
            };

            if (DialogResult.OK == form.ShowDialog())
            {
                BoxCasePalletConstraintSet constraintSet = new BoxCasePalletConstraintSet()
                {
                    // aligned / alternate layers
                    AllowAlignedLayers   = form.AllowAlignedLayers,
                    AllowAlternateLayers = form.AllowAlternateLayers
                };
                // patterns
                foreach (string patternName in form.AllowedPatterns)
                {
                    constraintSet.SetAllowedPattern(patternName);
                }
                // 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);
                // use maximum case weight
                constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                constraintSet.MaximumCaseWeight    = form.MaximumCaseWeight;
                // use maximum number of boxes
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                // minimum number of items
                constraintSet.MinimumNumberOfItems    = form.MinimumNumberOfItems;
                constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems;
                // number of solutions kept
                constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept;

                if (!constraintSet.IsValid)
                {
                    MessageBox.Show(string.Format(Properties.Resources.ID_CASEANALYSIS_INVALIDCONSTRAINTSET));
                    return(null); // invalid constraint set -> exit
                }
                return(CreateNewBoxCasePalletOptimization(
                           form.CaseAnalysisName
                           , form.CaseAnalysisDescription
                           , form.SelectedBox
                           , constraintSet
                           , form.PalletSolutionList
                           , new BoxCasePalletSolver()));
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Edit given box/case/pallet analysis
        /// </summary>
        /// <param name="caseAnalysis"></param>
        public void EditCaseAnalysis(BoxCasePalletAnalysis caseAnalysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired   = false;
            FormNewCaseAnalysis form = new FormNewCaseAnalysis(caseAnalysis.ParentDocument, caseAnalysis);

            form.Boxes = Boxes.ToArray();
            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                // analysis name / description
                caseAnalysis.Name        = form.CaseAnalysisName;
                caseAnalysis.Description = form.CaseAnalysisDescription;
                // selected box
                caseAnalysis.BoxProperties = form.SelectedBox;
                // pallet solutions
                caseAnalysis.PalletSolutionsList = form.PalletSolutionList;
                // constraint set
                BoxCasePalletConstraintSet constraintSet = caseAnalysis.ConstraintSet;
                // aligned / alternate layers
                constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                // patterns
                constraintSet.AllowedPatternString = form.AllowedPatternsString;
                // 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);
                // use maximum case weight
                constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                constraintSet.MaximumCaseWeight    = form.MaximumCaseWeight;
                // use maximum number of boxes
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                // minimum number of items
                constraintSet.MinimumNumberOfItems    = form.MinimumNumberOfItems;
                constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems;
                // number of solutions kept
                constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept;
            }
            if (recomputeRequired)
            {
                caseAnalysis.OnEndUpdate(null);
            }
        }
Пример #3
0
 /// <summary>
 /// Edit given box/case/pallet analysis
 /// </summary>
 /// <param name="caseAnalysis"></param>
 public void EditCaseAnalysis(BoxCasePalletAnalysis caseAnalysis)
 {
     // do we need to recompute analysis
     bool recomputeRequired = false;
     FormNewCaseAnalysis form = new FormNewCaseAnalysis(caseAnalysis.ParentDocument, caseAnalysis);
     form.Boxes = Boxes.ToArray();
     if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
     {
         // analysis name / description
         caseAnalysis.Name = form.CaseAnalysisName;
         caseAnalysis.Description = form.CaseAnalysisDescription;
         // selected box
         caseAnalysis.BoxProperties = form.SelectedBox;
         // pallet solutions
         caseAnalysis.PalletSolutionsList = form.PalletSolutionList;
         // constraint set
         BoxCasePalletConstraintSet constraintSet = caseAnalysis.ConstraintSet;
         // aligned / alternate layers
         constraintSet.AllowAlignedLayers = form.AllowAlignedLayers;
         constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
         // patterns
         constraintSet.AllowedPatternString = form.AllowedPatternsString;
         // 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);
         // use maximum case weight
         constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
         constraintSet.MaximumCaseWeight = form.MaximumCaseWeight;
         // use maximum number of boxes
         constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
         constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems;
         // minimum number of items
         constraintSet.MinimumNumberOfItems = form.MinimumNumberOfItems;
         constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems;
         // number of solutions kept
         constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept;
     }
     if (recomputeRequired)
         caseAnalysis.OnEndUpdate(null);
 }
Пример #4
0
        /// <summary>
        /// Creates a new case analysis
        /// </summary>
        /// <returns>created case analysis</returns>
        public BoxCasePalletAnalysis CreateNewBoxCasePalletOptimizationUI()
        {
            FormNewCaseAnalysis form = new FormNewCaseAnalysis(this);
            form.Boxes = Boxes.ToArray();
            if (DialogResult.OK == form.ShowDialog())
            {
                BoxCasePalletConstraintSet constraintSet = new BoxCasePalletConstraintSet();
                // aligned / alternate layers
                constraintSet.AllowAlignedLayers = form.AllowAlignedLayers;
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                // patterns
                foreach (string patternName in form.AllowedPatterns)
                    constraintSet.SetAllowedPattern(patternName);
                // 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);
                // use maximum case weight
                constraintSet.UseMaximumCaseWeight = form.UseMaximumCaseWeight;
                constraintSet.MaximumCaseWeight = form.MaximumCaseWeight;
                // use maximum number of boxes
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems;
                // minimum number of items
                constraintSet.MinimumNumberOfItems = form.MinimumNumberOfItems;
                constraintSet.UseMinimumNumberOfItems = form.UseMinimumNumberOfItems;
                // number of solutions kept
                constraintSet.NumberOfSolutionsKept = form.NumberOfSolutionsKept;

                if (!constraintSet.IsValid)
                {
                    MessageBox.Show(string.Format(Properties.Resources.ID_CASEANALYSIS_INVALIDCONSTRAINTSET));
                    return null; // invalid constraint set -> exit
                }

                 return CreateNewBoxCasePalletOptimization(
                    form.CaseAnalysisName
                    , form.CaseAnalysisDescription
                    , form.SelectedBox
                    , constraintSet
                    , form.PalletSolutionList
                    , new BoxCasePalletSolver());
            }
            return null;
        }