public void EditPackPalletAnalsyis(PackPalletAnalysis analysis) { // do we need to recompute analysis bool recomputeRequired = false; FormNewAnalysisPackPallet form = new FormNewAnalysisPackPallet(this, analysis); form.Packs = ListByType(typeof(PackProperties)).ToArray(); form.Pallets = Pallets.ToArray(); form.Interlayers = ListByType(typeof(InterlayerProperties)).ToArray(); if (recomputeRequired = (DialogResult.OK == form.ShowDialog())) { // analysis name / description analysis.Name = form.ItemName; analysis.Description = form.ItemDescription; // analysis pack / pallet /interlayer analysis.PackProperties = form.PackProperties; analysis.PalletProperties = form.PalletProperties; analysis.InterlayerProperties = form.InterlayerProperties; // constraint set PackPalletConstraintSet constraintSet = analysis.ConstraintSet; constraintSet.OverhangX = form.OverhangX; constraintSet.OverhangY = form.OverhangY; constraintSet.MinOverhangX = form.MinimumOverhangX; constraintSet.MinOverhangY = form.MinimumOverhangY; constraintSet.MinimumSpace = form.MinimumSpace; constraintSet.MaximumSpaceAllowed = form.MaximumSpace; constraintSet.LayerSwapPeriod = form.LayerSwapPeriod; constraintSet.InterlayerPeriod = form.InterlayerPeriod; constraintSet.HasFirstInterlayer = form.HasFirstInterlayer; // stop criterions constraintSet.MaximumPalletHeight = form.MaximumPalletHeight; constraintSet.MaximumPalletWeight = form.MaximumPalletWeight; } if (recomputeRequired) { analysis.OnEndUpdate(null); if (analysis.Solutions.Count < 1) MessageBox.Show(Properties.Resources.ID_ANALYSISHASNOSOLUTION, Application.ProductName, MessageBoxButtons.OK); } }
public PackPalletAnalysis CreateNewPackPalletAnalysisUI() { if (!CanCreatePackPalletAnalysis) return null; FormNewAnalysisPackPallet form = new FormNewAnalysisPackPallet(this, null); form.Packs = ListByType(typeof(PackProperties)).ToArray(); form.Pallets = ListByType(typeof(PalletProperties)).ToArray(); form.Interlayers = ListByType(typeof(InterlayerProperties)).ToArray(); if (DialogResult.OK == form.ShowDialog()) { PackPalletConstraintSet constraintSet = new PackPalletConstraintSet(); constraintSet.MaximumPalletHeight = form.MaximumPalletHeight; constraintSet.MaximumPalletWeight = form.MaximumPalletWeight; constraintSet.MaximumLayerWeight = form.MaximumLayerWeight; constraintSet.OverhangX = form.OverhangX; constraintSet.OverhangY = form.OverhangY; constraintSet.MinOverhangX = form.MinimumOverhangX; constraintSet.MinOverhangY = form.MinimumOverhangY; constraintSet.MinimumSpace = form.MinimumSpace; constraintSet.MaximumSpaceAllowed = form.MaximumSpace; constraintSet.HasFirstInterlayer = form.HasFirstInterlayer; constraintSet.InterlayerPeriod = form.InterlayerPeriod; constraintSet.LayerSwapPeriod = form.LayerSwapPeriod; PackPalletAnalysis analysis = CreateNewPackPalletAnalysis( form.ItemName, form.ItemDescription, form.PackProperties, form.PalletProperties, form.InterlayerProperties, constraintSet, new PackPalletSolver()); if (null == analysis) MessageBox.Show(Properties.Resources.ID_ANALYSISHASNOSOLUTION, Application.ProductName, MessageBoxButtons.OK); return analysis; } return null; }