public bool CanContain(DataItemINTEX item, double thickness)
 {
     double[] dimItem = item.OuterDimensions;
     Array.Sort(dimItem);
     double[] dimCase = InnerDimensions(thickness);
     Array.Sort(dimCase);
     return(dimItem[0] <= dimCase[0] &&
            dimItem[1] <= dimCase[1] &&
            dimItem[2] <= dimCase[2]);
 }
        public bool onFileNew(ref string fileName)
        {
            // INTEX data are in cms
            UnitsManager.CurrentUnitSystem = UnitsManager.UnitSystem.UNIT_METRIC2;

            string dbPath = Properties.Settings.Default.DatabasePathINTEX;

            if (string.IsNullOrWhiteSpace(dbPath) || !File.Exists(dbPath))
            {
                OpenFileDialog fd = new OpenFileDialog();
                fd.DefaultExt       = "xls";
                fd.AddExtension     = false;
                fd.Filter           = "Microsoft Excel File (*.xls)|*.xls|All files (*.*)|*.*";
                fd.FilterIndex      = 0;
                fd.RestoreDirectory = true;
                fd.CheckFileExists  = true;
                if (DialogResult.OK != fd.ShowDialog())
                {
                    return(false);
                }

                dbPath = fd.FileName;
                Properties.Settings.Default.DatabasePathINTEX = dbPath;
                Properties.Settings.Default.Save();
            }
            // load INTEX excel file
            List <DataItemINTEX>   listItems   = null;
            List <DataPalletINTEX> listPallets = null;
            List <DataCaseINTEX>   listCases   = null;

            try
            {
                // Set cursor as hourglass
                Cursor.Current = Cursors.WaitCursor;
                // load excel file
                if (!ExcelDataReader.ExcelDataReader.LoadIntexFile(dbPath, ref listItems, ref listPallets, ref listCases))
                {
                    Cursor.Current = Cursors.Default;
                    string message = string.Empty;
                    if (null == listItems || listItems.Count < 1)
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_NOITEMFOUND, "article", "Articles");
                    }
                    else if (null == listPallets || listPallets.Count < 1)
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_NOITEMFOUND, "palette", "Palettes");
                    }
                    else
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_INVALIDFILE, dbPath);
                    }
                    if (!string.IsNullOrEmpty(message))
                    {
                        MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ex.Message
                    , Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                _log.Error(ex.Message);
            }
            finally
            { Cursor.Current = Cursors.Default; }
            // do we have a valid list
            if (null == listItems || 0 == listItems.Count)
            {
                return(false);
            }
            // proceed : buid project file
            try
            {
                FormNewINTEX form = new FormNewINTEX();
                form._listItems   = listItems;
                form._listPallets = listPallets;
                form._listCases   = listCases;
                if (DialogResult.OK != form.ShowDialog())
                {
                    return(false);
                }
                // create document
                DataItemINTEX item     = form._currentItem;
                Document      document = new Document(item._ref, item._description, "INTEX", DateTime.Now, null);
                // create box properties
                Color[] colorsCase = new Color[6];
                for (int i = 0; i < 6; ++i)
                {
                    colorsCase[i] = Color.Chocolate;
                }
                BoxProperties itemProperties = null;
                if (!form.UseIntermediatePacking)
                {
                    itemProperties = document.CreateNewCase(
                        item._ref
                        , string.Format("{0};EAN14 : {1};UPC : {2};PCB : {3}", item._description, item._gencode, item._UPC, item._PCB)
                        , UnitsManager.ConvertLengthFrom(item._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._length - 0.6, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._width - 0.6, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._height - 0.6, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(item._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , colorsCase);
                }
                else
                {
                    itemProperties = document.CreateNewBox(
                        item._ref
                        , string.Format("{0};EAN14 : {1};UPC : {2};PCB : {3}", item._description, item._gencode, item._UPC, item._PCB)
                        , UnitsManager.ConvertLengthFrom(item._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(item._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , colorsCase);
                }
                itemProperties.ShowTape  = true;
                itemProperties.TapeColor = Color.Beige;
                itemProperties.TapeWidth = 5.0;
                InsertPictogram(ref itemProperties);

                BoxProperties currentCase = null;
                if (form.UseIntermediatePacking)
                {
                    // create cases
                    foreach (DataCaseINTEX dataCase in listCases)
                    {
                        double lengthInt = dataCase._lengthInt > 0 ? dataCase._lengthInt : dataCase._lengthExt - 2 * form.DefaultCaseThickness;
                        double widthInt  = dataCase._widthInt > 0 ? dataCase._widthInt : dataCase._widthExt - 2 * form.DefaultCaseThickness;
                        double heightInt = dataCase._heightInt > 0 ? dataCase._heightInt : dataCase._heightExt - 2 * form.DefaultCaseThickness;

                        BoxProperties intercaseProperties = document.CreateNewCase(
                            dataCase._ref
                            , string.Format("{0:0.0}*{1:0.0}*{2:0.0}", dataCase._lengthExt, dataCase._widthExt, dataCase._heightExt)
                            , UnitsManager.ConvertLengthFrom(dataCase._lengthExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(dataCase._widthExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(dataCase._heightExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(lengthInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(widthInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(heightInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertMassFrom(dataCase._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , colorsCase);
                        intercaseProperties.ShowTape  = true;
                        intercaseProperties.TapeColor = Color.Beige;
                        intercaseProperties.TapeWidth = 5.0;

                        if (string.Equals(form._currentCase._ref, intercaseProperties.Name))
                        {
                            currentCase = intercaseProperties;
                        }
                    }
                }

                if (form.UseIntermediatePacking)
                {
                    // Case constraint set
                    BoxCaseConstraintSet boxCaseConstraintSet = new BoxCaseConstraintSet();
                    boxCaseConstraintSet.SetAllowedOrthoAxisAll();
                    if (boxCaseConstraintSet.IsValid)
                    {
                        // create case analysis
                        BoxCaseAnalysis analysis = document.CreateNewBoxCaseAnalysis(
                            string.Format(Properties.Resources.ID_PACKING, item._ref)
                            , item._description
                            , itemProperties
                            , currentCase
                            , boxCaseConstraintSet
                            , new BoxCaseSolver());
                    }
                }

                // create pallets
                PalletProperties currentPallet = null;
                foreach (DataPalletINTEX pallet in listPallets)
                {
                    PalletProperties palletProperties = document.CreateNewPallet(
                        pallet._type, pallet._type, "EUR"
                        , UnitsManager.ConvertLengthFrom(pallet._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(pallet._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(pallet._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(pallet._weight, UnitsManager.UnitSystem.UNIT_METRIC2));
                    if (string.Equals(form._currentPallet._type, pallet._type))
                    {
                        currentPallet = palletProperties;
                    }
                }

                // *** pallet analysis ***
                // constraint set
                CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
                constraintSet.UseMaximumHeight = true;
                constraintSet.MaximumHeight    = UnitsManager.ConvertLengthFrom(form.PalletHeight, UnitsManager.UnitSystem.UNIT_METRIC2);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true);
                constraintSet.AllowAlignedLayers   = true;
                constraintSet.AllowAlternateLayers = true;
                constraintSet.SetAllowedPattern("Column");
                constraintSet.SetAllowedPattern("Diagonale");
                constraintSet.SetAllowedPattern("Interlocked");
                constraintSet.SetAllowedPattern("Trilock");
                constraintSet.SetAllowedPattern("Spirale");
                constraintSet.SetAllowedPattern("Enlarged spirale");
                if (constraintSet.IsValid)
                {
                    // create analysis
                    CasePalletSolver   solver         = new CasePalletSolver();
                    CasePalletAnalysis palletAnalysis = document.CreateNewCasePalletAnalysis(
                        item._ref, item.ToString()
                        , form.UseIntermediatePacking ? currentCase : itemProperties
                        , currentPallet,
                        null, null,
                        null, null, null,
                        constraintSet, solver);
                }
                // save document
                fileName = form.FilePath;
                document.Write(form.FilePath);
                // return true to let application open
                return(File.Exists(fileName));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Example #3
0
        public bool OnFileNew(ref string fileName)
        {
            // INTEX data are in cms
            UnitsManager.CurrentUnitSystem = UnitsManager.UnitSystem.UNIT_METRIC2;

            string dbPath = Properties.Settings.Default.DatabasePathINTEX;

            if (string.IsNullOrWhiteSpace(dbPath) || !File.Exists(dbPath))
            {
                OpenFileDialog fd = new OpenFileDialog();
                fd.DefaultExt       = "xls";
                fd.AddExtension     = false;
                fd.Filter           = "Microsoft Excel File (*.xls)|*.xls|All files (*.*)|*.*";
                fd.FilterIndex      = 0;
                fd.RestoreDirectory = true;
                fd.CheckFileExists  = true;
                if (DialogResult.OK != fd.ShowDialog())
                {
                    return(false);
                }

                dbPath = fd.FileName;
                Properties.Settings.Default.DatabasePathINTEX = dbPath;
                Properties.Settings.Default.Save();
            }
            // load INTEX excel file
            List <DataItemINTEX>   listItems   = null;
            List <DataPalletINTEX> listPallets = null;
            List <DataCaseINTEX>   listCases   = null;

            try
            {
                // Set cursor as hourglass
                Cursor.Current = Cursors.WaitCursor;
                // load excel file
                if (!ExcelDataReader.ExcelDataReader.LoadIntexFile(dbPath, ref listItems, ref listPallets, ref listCases))
                {
                    Cursor.Current = Cursors.Default;
                    string message = string.Empty;
                    if (null == listItems || listItems.Count < 1)
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_NOITEMFOUND, "article", "Articles");
                    }
                    else if (null == listPallets || listPallets.Count < 1)
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_NOITEMFOUND, "palette", "Palettes");
                    }
                    else
                    {
                        message = string.Format(Properties.Resources.ID_ERROR_INVALIDFILE, dbPath);
                    }
                    if (!string.IsNullOrEmpty(message))
                    {
                        MessageBox.Show(message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ex.Message
                    , Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                _log.Error(ex.Message);
            }
            finally
            { Cursor.Current = Cursors.Default; }
            // do we have a valid list
            if (null == listItems || 0 == listItems.Count)
            {
                return(false);
            }
            // proceed : buid project file
            try
            {
                FormNewINTEX form = new FormNewINTEX()
                {
                    ListItems   = listItems,
                    ListPallets = listPallets,
                    ListCases   = listCases
                };
                if (DialogResult.OK != form.ShowDialog())
                {
                    return(false);
                }
                // create document
                DataItemINTEX item     = form._currentItem;
                Document      document = new Document(item._ref, item._description, "INTEX", DateTime.Now, null);
                // create box properties
                Color[] colorsCase = new Color[6];
                for (int i = 0; i < 6; ++i)
                {
                    colorsCase[i] = Color.Chocolate;
                }
                BoxProperties itemProperties = null;
                if (!form.UseIntermediatePacking)
                {
                    itemProperties = document.CreateNewCase(
                        item._ref
                        , $"{item._description};EAN14 : {item._gencode};UPC : {item._UPC};PCB : {item._PCB}"
                        , UnitsManager.ConvertLengthFrom(item._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(item._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , colorsCase);
                }
                else
                {
                    itemProperties = document.CreateNewBox(
                        item._ref
                        , string.Format("{0};EAN14 : {1};UPC : {2};PCB : {3}", item._description, item._gencode, item._UPC, item._PCB)
                        , UnitsManager.ConvertLengthFrom(item._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(item._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(item._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , colorsCase);
                }
                itemProperties.TapeColor = Color.Beige;
                itemProperties.TapeWidth = new OptDouble(true, 5.0);
                InsertPictogram(ref itemProperties);

                BoxProperties currentCase = null;
                if (form.UseIntermediatePacking)
                {
                    // create cases
                    foreach (DataCaseINTEX dataCase in listCases)
                    {
                        double lengthInt = dataCase._lengthInt > 0 ? dataCase._lengthInt : dataCase._lengthExt - 2 * form.DefaultCaseThickness;
                        double widthInt  = dataCase._widthInt > 0 ? dataCase._widthInt : dataCase._widthExt - 2 * form.DefaultCaseThickness;
                        double heightInt = dataCase._heightInt > 0 ? dataCase._heightInt : dataCase._heightExt - 2 * form.DefaultCaseThickness;

                        BoxProperties intercaseProperties = document.CreateNewCase(
                            dataCase._ref
                            , string.Format("{0:0.0}*{1:0.0}*{2:0.0}", dataCase._lengthExt, dataCase._widthExt, dataCase._heightExt)
                            , UnitsManager.ConvertLengthFrom(dataCase._lengthExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(dataCase._widthExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(dataCase._heightExt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(lengthInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(widthInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertLengthFrom(heightInt, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , UnitsManager.ConvertMassFrom(dataCase._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                            , colorsCase);
                        intercaseProperties.TapeColor = Color.Beige;
                        intercaseProperties.TapeWidth = new OptDouble(true, 5.0);

                        if (string.Equals(form._currentCase._ref, intercaseProperties.Name))
                        {
                            currentCase = intercaseProperties;
                        }
                    }
                }

                // initialize Layer solver
                SolutionLayered.SetSolver(new LayerSolver());

                if (form.UseIntermediatePacking)
                {
                    // Case constraint set
                    ConstraintSetBoxCase constraintSetBoxCase = new ConstraintSetBoxCase(currentCase);
                    constraintSetBoxCase.AllowedOrientationsString = "1,1,1";
                    if (constraintSetBoxCase.Valid)
                    {
                        SolverBoxCase    solver     = new SolverBoxCase(itemProperties, currentCase);
                        Layer2DBrickImp  layer      = solver.BuildBestLayer(constraintSetBoxCase);
                        List <LayerDesc> layerDescs = new List <LayerDesc>();
                        if (null != layer)
                        {
                            layerDescs.Add(layer.LayerDescriptor);
                        }

                        // create case analysis
                        AnalysisLayered analysis = document.CreateNewAnalysisBoxCase(
                            string.Format(Properties.Resources.ID_PACKING, item._ref)
                            , item._description
                            , itemProperties
                            , currentCase
                            , null
                            , constraintSetBoxCase
                            , layerDescs);
                    }
                }

                // create pallets
                PalletProperties currentPallet = null;
                foreach (DataPalletINTEX pallet in listPallets)
                {
                    PalletProperties palletProperties = document.CreateNewPallet(
                        pallet._type, pallet._type, "EUR"
                        , UnitsManager.ConvertLengthFrom(pallet._length, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(pallet._width, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertLengthFrom(pallet._height, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , UnitsManager.ConvertMassFrom(pallet._weight, UnitsManager.UnitSystem.UNIT_METRIC2)
                        , Color.Gold);
                    if (string.Equals(form._currentPallet._type, pallet._type))
                    {
                        currentPallet = palletProperties;
                    }
                }

                // *** pallet analysis ***
                // constraint set
                ConstraintSetCasePallet constraintSet = new ConstraintSetCasePallet();
                constraintSet.SetMaxHeight(new OptDouble(true, UnitsManager.ConvertLengthFrom(form.PalletHeight, UnitsManager.UnitSystem.UNIT_METRIC2)));
                constraintSet.SetAllowedOrientations(new bool[] { false, false, true });
                if (constraintSet.Valid)
                {
                    SolverCasePallet solver     = new SolverCasePallet(form.UseIntermediatePacking ? currentCase : itemProperties, currentPallet);
                    Layer2DBrickImp  layer      = solver.BuildBestLayer(constraintSet);
                    List <LayerDesc> layerDescs = new List <LayerDesc>();
                    if (null != layer)
                    {
                        layerDescs.Add(layer.LayerDescriptor);
                    }

                    // create analysis
                    AnalysisLayered palletAnalysis = document.CreateNewAnalysisCasePallet(
                        item._ref, item.ToString()
                        , form.UseIntermediatePacking ? currentCase : itemProperties
                        , currentPallet,
                        null, null,
                        null, null,
                        constraintSet,
                        layerDescs);
                }
                // save document
                fileName = form.FilePath;
                document.Write(form.FilePath);

                if (null != OpenFile)
                {
                    OpenFile(fileName);
                }
                // return true to let application open
                return(File.Exists(fileName));
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
                return(false);
            }
        }
 private void cbRefDescription_SelectedIndexChanged(object sender, EventArgs e)
 {
     _currentItem = (DataItemINTEX)cbRefDescription.SelectedItem;
     if (null == _currentItem)
         return;
     tbUPC.Text = _currentItem._UPC;
     tbGenCode.Text = _currentItem._gencode;
     tbLength.Text = string.Format("{0:0.0}", _currentItem._length);
     tbWidth.Text = string.Format("{0:0.0}", _currentItem._width);
     tbHeight.Text = string.Format("{0:0.0}", _currentItem._height);
     tbWeight.Text = string.Format("{0:0.000}", _currentItem._weight);
     // set output file path
     fileSelectCtrl.FileName = BuildFilePath(_currentItem._ref);
     // update pallet height if necessary
     UpdatePalletHeight();
     UpdateButtonOkStatus();
 }
Example #5
0
 public bool CanContain(DataItemINTEX item, double thickness)
 {
     double[] dimItem = item.OuterDimensions;
     Array.Sort(dimItem);
     double[] dimCase = InnerDimensions(thickness);
     Array.Sort(dimCase);
     return dimItem[0] <= dimCase[0]
         && dimItem[1] <= dimCase[1]
         && dimItem[2] <= dimCase[2];
 }
Example #6
0
        public ExcelDataReader(Stream file, 
            ref List<DataItemINTEX> listItems,
            ref List<DataPalletINTEX> listPallets,
            ref List<DataCaseINTEX> listCases)
        {
            XlsHeader hdr = XlsHeader.ReadHeader(file);
            XlsRootDirectory dir = new XlsRootDirectory(hdr);
            XlsDirectoryEntry workbookEntry = dir.FindEntry("Workbook");
            if (workbookEntry == null)
                workbookEntry = dir.FindEntry("Book");
            if (workbookEntry == null)
                throw new FileNotFoundException("Oops! Neither stream 'Workbook' nor 'Book' was found in file");
            if (workbookEntry.EntryType != STGTY.STGTY_STREAM)
                throw new FormatException("Oops! Workbook directory entry is not a Stream");
            m_stream = new XlsBiffStream(hdr, workbookEntry.StreamFirstSector);
            ReadWorkbookGlobals();
            GC.Collect();
            m_workbookData = new DataSet();
            // first sheet : boxes
            for (int iSheet = 0; iSheet < m_sheets.Count; ++iSheet)
            {
                if (string.Equals(m_sheets[iSheet].Name, "Articles", StringComparison.CurrentCultureIgnoreCase))
                {
                    listItems = new List<DataItemINTEX>();
                    if (ReadWorksheet(m_sheets[iSheet]))
                    {
                        DataTable dt = m_sheets[iSheet].Data;
                        for (int iRow = 4; iRow < dt.Rows.Count; ++iRow)
                        {
                            try
                            {
                                DataItemINTEX item = new DataItemINTEX();
                                item._ref = (string)dt.Rows[iRow][0];
                                item._description = (string)dt.Rows[iRow][1];
                                if (DBNull.Value != dt.Rows[iRow][2])
                                    item._UPC = (string)dt.Rows[iRow][2];
                                if (DBNull.Value != dt.Rows[iRow][3])
                                    item._PCB = Convert.ToInt32((string)dt.Rows[iRow][3]);
                                if (DBNull.Value != dt.Rows[iRow][4])
                                    item._gencode = (string)dt.Rows[iRow][4];
                                item._weight = double.Parse((string)dt.Rows[iRow][5], System.Globalization.CultureInfo.InvariantCulture);
                                item._length = double.Parse((string)dt.Rows[iRow][6], System.Globalization.CultureInfo.InvariantCulture);
                                item._width = double.Parse((string)dt.Rows[iRow][7], System.Globalization.CultureInfo.InvariantCulture);
                                item._height = double.Parse((string)dt.Rows[iRow][8], System.Globalization.CultureInfo.InvariantCulture);
                                listItems.Add(item);
                            }
                            catch (Exception /*ex*/)
                            {
                            }
                        }
                    }
                }
                // Pallets
                else if (string.Equals(m_sheets[iSheet].Name, "Palettes", StringComparison.CurrentCultureIgnoreCase))
                {
                    listPallets = new List<DataPalletINTEX>();
                    if (ReadWorksheet(m_sheets[iSheet]))
                    {
                        DataTable dt = m_sheets[iSheet].Data;
                        for (int iRow = 4; iRow < dt.Rows.Count; ++iRow)
                        {
                            try
                            {
                                DataPalletINTEX pallet = new DataPalletINTEX();
                                pallet._type = (string)dt.Rows[iRow][0];
                                pallet._length = double.Parse((string)dt.Rows[iRow][1], System.Globalization.CultureInfo.InvariantCulture);
                                pallet._width = double.Parse((string)dt.Rows[iRow][2], System.Globalization.CultureInfo.InvariantCulture);
                                pallet._height = double.Parse((string)dt.Rows[iRow][3], System.Globalization.CultureInfo.InvariantCulture);
                                if (!DBNull.Value.Equals(dt.Rows[iRow][4]))
                                    pallet._weight = double.Parse((string)dt.Rows[iRow][4], System.Globalization.CultureInfo.InvariantCulture);
                                listPallets.Add(pallet);
                            }
                            catch (Exception /*ex*/)
                            {
                            }
                        }
                    }
                }
                // Caisses
                else if (string.Equals(m_sheets[iSheet].Name, "Caisses", StringComparison.CurrentCultureIgnoreCase))
                {
                    listCases = new List<DataCaseINTEX>();
                    if (ReadWorksheet(m_sheets[iSheet]))
                    {
                        DataTable dt = m_sheets[iSheet].Data;
                        for (int iRow = 4; iRow < dt.Rows.Count; ++iRow)
                        {
                            try
                            {
                                DataCaseINTEX caseItem = new DataCaseINTEX();
                                caseItem._ref = (string)dt.Rows[iRow][0];
                                caseItem._lengthExt = double.Parse((string)dt.Rows[iRow][1], System.Globalization.CultureInfo.InvariantCulture);
                                caseItem._widthExt = double.Parse((string)dt.Rows[iRow][2], System.Globalization.CultureInfo.InvariantCulture);
                                caseItem._heightExt = double.Parse((string)dt.Rows[iRow][3], System.Globalization.CultureInfo.InvariantCulture);
                                if (!DBNull.Value.Equals(dt.Rows[iRow][4]))
                                    caseItem._lengthInt = double.Parse((string)dt.Rows[iRow][4], System.Globalization.CultureInfo.InvariantCulture);
                                if (!DBNull.Value.Equals(dt.Rows[iRow][5]))
                                    caseItem._widthInt = double.Parse((string)dt.Rows[iRow][5], System.Globalization.CultureInfo.InvariantCulture);
                                if (!DBNull.Value.Equals(dt.Rows[iRow][6]))
                                    caseItem._heightInt = double.Parse((string)dt.Rows[iRow][6], System.Globalization.CultureInfo.InvariantCulture);
                                if (!DBNull.Value.Equals(dt.Rows[iRow][7]))
                                    caseItem._weight = double.Parse((string)dt.Rows[iRow][7], System.Globalization.CultureInfo.InvariantCulture);
                                listCases.Add(caseItem);
                            }
                            catch (Exception /*ex*/)
                            {
                            }
                        }
                    }
                }
            }

            m_globals.SST = null;
            m_globals = null;
            m_sheets = null;
            m_stream = null;
            hdr = null;
            GC.Collect();
        }