예제 #1
0
        internal void LoadLabel()
        {
            Shelf shelf = new Shelf();
            shelf.LoadByPrimaryKey(this.ShelfID);
            this.Label = shelf.ShelfCode;
            
            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(this.ShelfID,this.Column);
            this.Label = this.Label;
            this.Label += "-" + src.Label;

            src.LoadRowForShelf(this.ShelfID, this.Row);
            this.Label += "-" + src.Label;

        }
        private void lkRackID2_EditValueChanged(object sender, EventArgs e)
        {
            selectedRackID = Convert.ToInt32(lkRackID2.EditValue);

            gridItemDetailByLocation.DataSource = null;
            if (!bw.IsBusy)
            {
                bw.RunWorkerAsync();
            }

            // THIS OPTION HAS BEEN DISABLED FOR THE TIME BEING
            //lkFrom.Properties.DataSource = PalletLocation.GetNonFree(selectedRackID);
            //lkTo.Properties.DataSource = PalletLocation.GetFreeIn(selectedRackID);
            gridItemMovementView.Columns.Clear();

            var src = new ShelfRowColumn();
            src.LoadColumnsForShelf(selectedRackID);
            while (!src.EOF)
            {
                GridColumn gc = gridItemMovementView.Columns.Add();
                gc.FieldName = src.Index.ToString();
                gc.Caption = src.Label;
                gc.Visible = true;
                repositoryItemButtonEdit1.AllowFocused = true;
                gc.ColumnEdit = repositoryItemButtonEdit1;
                src.MoveNext();
            }
        }
 private void gridView2_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
 {
     if (e.RowHandle >= 0)
     {
         ShelfRowColumn srr = new ShelfRowColumn();
         srr.LoadRowForShelf(selectedRackID, (gridItemMovementView.DataRowCount - e.RowHandle)-1);
         if (srr.RowCount > 0)
         {
             e.Info.DisplayText = srr.Label;
         }
     }
 }
        private void lookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            selectedRackID = Convert.ToInt32(lkRackID2.EditValue);
            //gridControl1.DataSource = null;
            //gridView1.Columns.Clear();

            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerReportsProgress = true;
            DataTable dtbl = PalletLocation.GetIDItemDataTableFor(selectedRackID, bw);

            gridView2.Columns.Clear();

            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(selectedRackID);
            while (!src.EOF)
            {
               GridColumn gc =  gridView2.Columns.Add();
               gc.FieldName = src.Index.ToString();
               gc.Caption = src.Label;
               gc.Visible = true;
               gc.ColumnEdit = repositoryItemButtonEdit1;
               src.MoveNext();
            }

            gridItemDetailByLocation.DataSource = dtbl;

            // bind
            lkHighlightItems.Properties.DataSource = Shelf.GetItemsOnShelf( selectedRackID );
        }
예제 #5
0
파일: Shelf.cs 프로젝트: HCMISFE/FE
        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();
            }
        }
        private void cmbRack_SelectedIndexChanged(object sender, EventArgs e)
        {
            ShelfRowColumn src = new ShelfRowColumn();
            if (cmbRack.SelectedValue != null)
            {
                int shelfID = int.Parse(cmbRack.SelectedValue.ToString());
                src.LoadColumnsForShelf(shelfID);
                cmbColumn.DataSource = src.DefaultView;
                cmbColumn.Enabled = true;

                src.LoadRowsForShelf(shelfID);
                cmbRow.DataSource = src.DefaultView;
                cmbRow.Enabled = true;
            }
        }
        /// <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();
            }
        }
예제 #8
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();
            }
        }
        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();
            }
        }
        internal void LoadLabel()
        {
            Shelf shelf = new Shelf();
            shelf.LoadByPrimaryKey(this.ShelfID);
            this.Label = shelf.ShelfCode;

            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(this.ShelfID,this.Column);
            this.Label = this.Label;
            this.Label += "-" + src.Label;

            src.LoadRowForShelf(this.ShelfID, this.Row);
            this.Label += "-" + src.Label;
        }
        /// <summary>
        /// Gets the percentage grid for.
        /// </summary>
        /// <param name="shelfID">The shelf ID.</param>
        /// <returns></returns>
        public static DataTable GetPercentageGridFor(int shelfID)
        {
            // create the table
            DataTable dtbl = new DataTable();
            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(shelfID);
            while (!src.EOF)
            {
                dtbl.Columns.Add(src.Label, typeof(float));
                src.MoveNext();
            }

            ShelfRowColumn srcrows = new ShelfRowColumn();
            srcrows.LoadRowsForShelf(shelfID);
            PalletLocation pl = new PalletLocation();

            while (!srcrows.EOF)
            {
                src.Rewind();
                DataRowView drv = dtbl.DefaultView.AddNew();
                while (!src.EOF)
                {
                    pl.LoadPalletLocationFor(shelfID, src.Index, srcrows.Index);
                    if (pl.RowCount > 0)
                    {

                        {
                            if (pl.IsColumnNull("PalletID"))
                            {
                                pl.UsedVolume = 0;
                            }
                            else
                            {
                                Pallet p = new Pallet();
                                p.LoadByPrimaryKey(pl.PalletID);
                                pl.UsedVolume = p.CalculateCurrentVolume(pl.PalletID);
                                pl.Save();
                            }

                        }
                        pl.PercentUsed = pl.AvailableVolume == 0 ? 0 : Convert.ToDouble((pl.UsedVolume / pl.AvailableVolume) * 100);
                        pl.Save();
                        drv[src.Label] = pl.PercentUsed;

                    }
                    src.MoveNext();
                }
                srcrows.MoveNext();
            }
            return dtbl;
        }
 /// <summary>
 /// Uns the extend.
 /// </summary>
 public void UnExtend()
 {
     int id = this.ID;
     this.IsExtended = false;
     int ext = this.ExtendedRows;
     this.ExtendedRows = 0;
     // this.SetColumnNull("PalletID");
     this.LoadLabel();
     this.Save();
     PalletLocation pl = new PalletLocation();
     ShelfRowColumn src = new ShelfRowColumn();
     for (int i = 0; i < ext; i++)
     {
         // recreate the removed pallet locations
         pl.AddNew();
         pl.ShelfID = this.ShelfID;
         pl.StorageTypeID = this.StorageTypeID;
         pl.Column = this.Column;
         pl.Row = this.Row + i + 1;
         pl.Width = this.Width;
         pl.IsEnabled = true;
         src.LoadRowForShelf(this.ShelfID, pl.Row);
         pl.Height = src.Dimension;
         pl.Length = this.Length;
         pl.IsFullSize = true;
         pl.IsExtended = false;
         pl.ExtendedRows = 0;
         pl.AvailableVolume = (pl.Length * pl.Height * pl.Width);
         pl.UsedVolume = 0;
         pl.Confirmed = false;
         pl.LoadLabel();
     }
     pl.Save();
 }