Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
0
        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());
            }
        }