private void cbPallet_SelectedIndexChanged(object sender, EventArgs e) { PalletItem palletItem = cbPallet.SelectedItem as PalletItem; PalletProperties palletProperties = null != palletItem ? palletItem.Item : null; lbPalletDimensions.Text = null != palletProperties? string.Format("({0}*{1}*{2})", palletProperties.Length, palletProperties.Width, palletProperties.Height) : string.Empty; OptimizationParameterChanged(sender, e); SetMaxCaseDimensions(); }
private void FormNewAnalysisBundle_Load(object sender, EventArgs e) { try { // name / description if (null != _analysis) { ItemName = _analysis.Name; ItemDescription = _analysis.Description; } else { ItemName = _document.GetValidNewAnalysisName(Resources.ID_ANALYSIS); ItemDescription = ItemName; } // fill boxes combo foreach (BProperties bundle in _bundles) { cbBox.Items.Add(new BoxItem(bundle)); } 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; } } } } // overhang if (null == _analysis) { OverhangX = Settings.Default.OverhangX; OverhangY = Settings.Default.OverhangY; } else { OverhangX = _analysis.ConstraintSet.OverhangX; OverhangY = _analysis.ConstraintSet.OverhangY; } // alternate / aligned layers if (null == _analysis) { AllowAlignedLayers = Settings.Default.AllowAlignedLayer; AllowAlternateLayers = Settings.Default.AllowAlternateLayer; UseMaximumNumberOfBoxes = false; UseMaximumPalletHeight = true; UseMaximumPalletWeight = true; MaximumNumberOfBoxes = 1000; MaximumPalletHeight = UnitsManager.ConvertLengthFrom(1200.0, UnitsManager.UnitSystem.UNIT_METRIC1); MaximumPalletWeight = UnitsManager.ConvertMassFrom(1000.0, UnitsManager.UnitSystem.UNIT_METRIC1); } else { AllowAlignedLayers = _analysis.ConstraintSet.AllowAlignedLayers;; AllowAlternateLayers = _analysis.ConstraintSet.AllowAlternateLayers; UseMaximumNumberOfBoxes = _analysis.ConstraintSet.UseMaximumNumberOfCases; UseMaximumPalletHeight = _analysis.ConstraintSet.UseMaximumHeight; UseMaximumPalletWeight = _analysis.ConstraintSet.UseMaximumPalletWeight; // stop stacking criterion MaximumNumberOfBoxes = _analysis.ConstraintSet.MaximumNumberOfItems; MaximumPalletHeight = _analysis.ConstraintSet.MaximumHeight; MaximumPalletWeight = _analysis.ConstraintSet.MaximumPalletWeight; } if (null == _analysis) { AllowedPatternsString = Settings.Default.AllowedPatterns; } else { AllowedPatternsString = _analysis.ConstraintSet.AllowedPatternString; } UpdateCriterionFields(); UpdateStatus(string.Empty); // windows settings if (null != Settings.Default.FormNewAnalysisPosition) { Settings.Default.FormNewAnalysisPosition.Restore(this); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FormNewAnalysisCylinder_Load(object sender, EventArgs e) { try { // name / description if (null != _analysis) { tbName.Text = _analysis.Name; tbDescription.Text = _analysis.Description; } else { tbName.Text = _document.GetValidNewAnalysisName(Resources.ID_ANALYSIS); tbDescription.Text = tbName.Text; } // fill cylinders combo foreach (CylinderProperties cyl in _cylinderProperties) { cbCylinders.Items.Add(new CylinderItem(cyl)); } if (cbCylinders.Items.Count > 0) { if (null == _analysis) { cbCylinders.SelectedIndex = 0; } else { for (int i = 0; i < cbCylinders.Items.Count; ++i) { CylinderItem boxItem = cbCylinders.Items[i] as CylinderItem; if (boxItem.Item == _analysis.CylinderProperties) { cbCylinders.SelectedIndex = i; break; } } } } // fill pallet combo foreach (PalletProperties pallet in _palletProperties) { cbPallets.Items.Add(new PalletItem(pallet)); } if (cbPallets.Items.Count > 0) { if (null == _analysis) { cbPallets.SelectedIndex = 0; } else { for (int i = 0; i < cbPallets.Items.Count; ++i) { PalletItem palletItem = cbPallets.Items[i] as PalletItem; if (palletItem.Item == _analysis.PalletProperties) { cbPallets.SelectedIndex = i; break; } } } } // fill interlayer combo foreach (InterlayerProperties interlayer in _interlayerProperties) { cbInterlayers.Items.Add(new ItemBaseEncapsulator(interlayer)); } if (cbInterlayers.Items.Count > 0) { cbInterlayers.SelectedIndex = 0; if (null != _analysis) { for (int i = 0; i < cbInterlayers.Items.Count; ++i) { ItemBaseEncapsulator interlayerItem = cbInterlayers.Items[i] as ItemBaseEncapsulator; if (interlayerItem.Item == _analysis.InterlayerProperties) { cbInterlayers.SelectedIndex = i; break; } } checkBoxInterlayer.Checked = _analysis.ConstraintSet.HasInterlayer; checkBoxInterlayer.Enabled = true; } } else { checkBoxInterlayer.Checked = false; checkBoxInterlayer.Enabled = false; } // fill interlayer combo foreach (InterlayerProperties interlayer in _interlayerProperties) { cbInterlayersAntiSlip.Items.Add(new ItemBaseEncapsulator(interlayer)); } if (cbInterlayersAntiSlip.Items.Count > 0) { cbInterlayersAntiSlip.SelectedIndex = 0; if (null != _analysis) { for (int i = 0; i < cbInterlayersAntiSlip.Items.Count; ++i) { ItemBaseEncapsulator interlayerItem = cbInterlayersAntiSlip.Items[i] as ItemBaseEncapsulator; if (interlayerItem.Item == _analysis.InterlayerPropertiesAntiSlip) { cbInterlayersAntiSlip.SelectedIndex = i; break; } } checkBoxInterlayerAntiSlip.Checked = _analysis.ConstraintSet.HasInterlayerAntiSlip; checkBoxInterlayerAntiSlip.Enabled = true; } } else { checkBoxInterlayer.Checked = false; checkBoxInterlayer.Enabled = false; } // overhang if (null == _analysis) { OverhangX = Settings.Default.OverhangX; OverhangY = Settings.Default.OverhangY; } else { OverhangX = _analysis.ConstraintSet.OverhangX; OverhangY = _analysis.ConstraintSet.OverhangY; } // stop stacking criterions if (null == _analysis) { UseMaximumNumberOfItems = false; UseMaximumPalletHeight = true; UseMaximumPalletWeight = false; UseMaximumLoadOnLowerCylinder = false; MaximumNumberOfItems = 500; MaximumPalletHeight = UnitsManager.ConvertLengthFrom(Settings.Default.MaximumPalletHeight, UnitsManager.UnitSystem.UNIT_METRIC1); MaximumPalletWeight = UnitsManager.ConvertMassFrom(Settings.Default.MaximumPalletWeight, UnitsManager.UnitSystem.UNIT_METRIC1); MaximumLoadOnLowerCylinder = UnitsManager.ConvertMassFrom(100.0, UnitsManager.UnitSystem.UNIT_METRIC1); } else { UseMaximumNumberOfItems = _analysis.ConstraintSet.UseMaximumNumberOfItems; UseMaximumPalletHeight = _analysis.ConstraintSet.UseMaximumPalletHeight; UseMaximumPalletWeight = _analysis.ConstraintSet.UseMaximumPalletWeight; UseMaximumLoadOnLowerCylinder = _analysis.ConstraintSet.UseMaximumLoadOnLowerCylinder; MaximumNumberOfItems = _analysis.ConstraintSet.MaximumNumberOfItems; MaximumPalletHeight = _analysis.ConstraintSet.MaximumPalletHeight; MaximumPalletWeight = _analysis.ConstraintSet.MaximumPalletWeight; MaximumLoadOnLowerCylinder = _analysis.ConstraintSet.MaximumLoadOnLowerCylinder; } UpdateButtonOkStatus(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void FormNewAnalysisHCylinder_Load(object sender, EventArgs e) { try { // name / description if (null != _analysis) { tbName.Text = _analysis.Name; tbDescription.Text = _analysis.Description; } else { tbName.Text = _document.GetValidNewAnalysisName(Resources.ID_ANALYSIS); tbDescription.Text = tbName.Text; } // fill cylinders combo foreach (CylinderProperties cyl in _cylinderProperties) { cbCylinders.Items.Add(new CylinderItem(cyl)); } if (cbCylinders.Items.Count > 0) { if (null == _analysis) { cbCylinders.SelectedIndex = 0; } else { for (int i = 0; i < cbCylinders.Items.Count; ++i) { CylinderItem boxItem = cbCylinders.Items[i] as CylinderItem; if (boxItem.Item == _analysis.CylinderProperties) { cbCylinders.SelectedIndex = i; break; } } } } // fill pallet combo foreach (PalletProperties pallet in _palletProperties) { cbPallets.Items.Add(new PalletItem(pallet)); } if (cbPallets.Items.Count > 0) { if (null == _analysis) { cbPallets.SelectedIndex = 0; } else { for (int i = 0; i < cbPallets.Items.Count; ++i) { PalletItem palletItem = cbPallets.Items[i] as PalletItem; if (palletItem.Item == _analysis.PalletProperties) { cbPallets.SelectedIndex = i; break; } } } } // overhang if (null == _analysis) { OverhangX = Settings.Default.OverhangX; OverhangY = Settings.Default.OverhangY; } else { OverhangX = _analysis.ConstraintSet.OverhangX; OverhangY = _analysis.ConstraintSet.OverhangY; } // stop stacking criterions if (null == _analysis) { UseMaximumNumberOfItems = false; UseMaximumPalletHeight = true; UseMaximumPalletWeight = false; MaximumNumberOfItems = 500; MaximumPalletHeight = UnitsManager.ConvertLengthFrom(Settings.Default.MaximumPalletHeight, UnitsManager.UnitSystem.UNIT_METRIC1); MaximumPalletWeight = UnitsManager.ConvertMassFrom(Settings.Default.MaximumPalletWeight, UnitsManager.UnitSystem.UNIT_METRIC1); AllowPatternDefault = true; AllowPatternStaggered = false; AllowPatternColumn = false; } else { UseMaximumNumberOfItems = _analysis.ConstraintSet.UseMaximumNumberOfItems; UseMaximumPalletHeight = _analysis.ConstraintSet.UseMaximumPalletHeight; UseMaximumPalletWeight = _analysis.ConstraintSet.UseMaximumPalletWeight; MaximumNumberOfItems = _analysis.ConstraintSet.MaximumNumberOfItems; MaximumPalletHeight = _analysis.ConstraintSet.MaximumPalletHeight; MaximumPalletWeight = _analysis.ConstraintSet.MaximumPalletWeight; // patterns AllowPatternDefault = _analysis.ConstraintSet.AllowPattern("Default"); AllowPatternColumn = _analysis.ConstraintSet.AllowPattern("Column"); AllowPatternStaggered = _analysis.ConstraintSet.AllowPattern("Staggered"); } chkPatternColumnized_CheckedChanged(this, null); UpdateButtonOkStatus(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
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; 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()); } }