Beispiel #1
0
        internal void ChangeStorageTypesOf(int shelfID, int to)
        {

            
            this.LoadFromRawSql(String.Format("update PalletLocation set StorageTypeID = {1} where ShelfID = {0} ", shelfID, to));
            // correctly removes entries from PickFace and PreferedItemLocation!
            PickFace.FixPickFaceEntries();
        }
Beispiel #2
0
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int            id  = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();

            // check if the existing rows are null;
            if (this.IsColumnNull("Rows"))
            {
                this.Rows = 0;
            }
            if (this.IsColumnNull("Columns"))
            {
                this.Columns = 0;
            }
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged    = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Column";
                src.Index   = i;
                src.Label   = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Row";
                src.Index   = i;
                src.Label   = ArrOfChars[i];
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column        = j;
                        pl.Row           = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID       = id;
                        pl.LoadLabel();
                        pl.IsEnabled = true;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(String.Format("delete from PalletLocation where ShelfID = {0} and [Row] >= {1}", id, rows));
                this.LoadFromRawSql(String.Format("delete from ShelfRowColumn where ShelfID = {0} and [Index] >= {1} and Type = 'Row'", id, rows));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {
                for (int i = this.Columns; i < cols; i++)
                {
                    for (int j = 0; j < this.Rows; j++)
                    {
                        {
                            pl.AddNew();
                            pl.Column        = i;
                            pl.Row           = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID       = id;
                            pl.LoadLabel();
                            pl.IsEnabled = true;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(String.Format("delete from PalletLocation where ShelfID = {0} and [Column] >= {1}", id, cols));
                this.LoadFromRawSql(String.Format("delete from ShelfRowColumn where ShelfID = {0} and [Index] >= {1} and Type = 'Column'", id, cols));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows    = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Saves the pallet locations in shelf.
        /// </summary>
        /// <param name="rows">The rows.</param>
        /// <param name="cols">The cols.</param>
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int            id  = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();

            // check if the existing rows are null;
            if (this.IsColumnNull("Rows"))
            {
                this.Rows = 0;
            }
            if (this.IsColumnNull("Columns"))
            {
                this.Columns = 0;
            }
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged    = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Column";
                src.Index   = i;
                src.Label   = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Row";
                src.Index   = i;
                src.Label   = getChar(i).ToString();
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column        = j;
                        pl.Row           = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID       = id;
                        pl.LoadLabel();
                        pl.IsFullSize      = true;
                        pl.IsExtended      = false;
                        pl.IsEnabled       = true;
                        pl.Width           = this.Width;
                        pl.Height          = 1;
                        pl.Length          = 1;
                        pl.AvailableVolume = 0;
                        pl.UsedVolume      = 0;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteSavePalletLocationsInShelf(rows, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteShelfRowColumnSavePalletLocationsInShelf(rows, id));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {
                for (int i = this.Columns; i < cols; i++)
                {
                    for (int j = 0; j < this.Rows; j++)
                    {
                        {
                            pl.AddNew();
                            pl.Column        = i;
                            pl.Row           = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID       = id;
                            pl.LoadLabel();
                            pl.IsFullSize      = true;
                            pl.IsExtended      = false;
                            pl.IsEnabled       = true;
                            pl.Width           = this.Width;
                            pl.Height          = 1;
                            pl.Length          = 1;
                            pl.AvailableVolume = 0;
                            pl.UsedVolume      = 0;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeletePalletLocationSavePalletLocationsInShelf(cols, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteFromShelfRowColumnSavePalletLocationsInShelf(cols, id));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows    = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }

            FixVolume();

            //Find all Shelf pallet locations
            Shelf shelf = new Shelf();

            shelf.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.SelectSavePalletLocationsInShelf(id));
            while (!shelf.EOF)
            {
                PalletLocation plc = new PalletLocation();
                plc.LoadByPrimaryKey(shelf.ID);
                plc.Label = string.Format("{0}-{1}-{2}", this.ShelfCode, plc.Column + 1, getChar(plc.Row));
                plc.Save();
                shelf.MoveNext();
            }
        }