Exemplo n.º 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 xpButton12_Click(object sender, EventArgs e)
        {
            Shelf slf = new Shelf();

            if(txtShelf.Text=="")
            {
                XtraMessageBox.Show("Please enter the bin code", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                return;
            }

            if (_shelfId != 0)
                slf.LoadByPrimaryKey(_shelfId);
            else
                slf.AddNew();
            slf.ShelfCode = txtShelf.Text;
            //slf.ShelfStorageType = int.Parse(cboType.SelectedItem.ToString());
            slf.Save();
            DataTable dtSlf = slf.GetShelves();
            PopulateShelves(dtSlf.DefaultView);
            ResetLocations();
            XtraMessageBox.Show("Bin Location Record Updated.", "Confirmation", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
        }
        /// <summary>
        /// Update the form based on the selected shelf
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstShelfs.SelectedItems.Count > 0)
            {
                int selected = Convert.ToInt32(lstShelfs.SelectedItems[0].Tag);
                Shelf slf = new Shelf();
                slf.LoadByPrimaryKey(selected);
                txtShelf.Text = slf.ShelfCode;
                cboStore.SelectedValue = slf.StoreID.ToString();
                if (slf.IsColumnNull("ShelfStorageType"))
                {
                    slf.ShelfStorageType = 1;
                }

                cboType.SelectedValue = slf.ShelfStorageType;

                _shelfId = slf.ID;
                btnLocationsave.Text = "Update";
            }
        }
        private bool IsPutawayValid()
        {
            // Check if there is any Empty Put away location
            Dictionary<int, string> keyed = new Dictionary<int, string>();
            Boolean isValid = true;

            // Validate Non Palletized locations
            foreach (DataRow dr in _dtPutAwayNonPalletized.Rows)
            {
                dr.ClearErrors();
                if (dr["PutAwayLocation"] == null || dr["PutAwayLocation"].ToString() == "")
                {
                    dr.SetColumnError("PutAwayLocation", "Cannot be null");
                    isValid = false;
                }
                if (dr["Palletized Quantity"] == null || dr["Palletized Quantity"].ToString() == "")
                {
                    dr.SetColumnError("Palletized Quantity", "Cannot be null");
                    isValid = false;
                }
            }

            //validate Palletized putaway
            foreach (DataRow dr in _dtPutAwayPalletized.Rows)
            {
                dr.ClearErrors();
                if (dr["PutAwayLocation"] == null)
                {
                    dr.SetColumnError("PutAwayLocation", "Cannot be null");
                    isValid = false;
                }
                else
                {
                    //If it is not free, different pallets cannot be put on the same location.
                    int putAwayLocation = int.Parse(dr["PutAwayLocation"].ToString());
                    BLL.PalletLocation pl = new PalletLocation();
                    pl.LoadByPrimaryKey(putAwayLocation);
                    BLL.Shelf shelf = new Shelf();
                    shelf.LoadByPrimaryKey(pl.ShelfID);

                    if (shelf.ShelfStorageType.ToString() != BLL.StorageType.Free)
                    {
                        try
                        {
                            keyed.Add(Convert.ToInt32(dr["PutAwayLocation"]), "");
                        }
                        catch
                        {
                            dr.SetColumnError("PutAwayLocation", "Different Pallets put on the same Location");
                            isValid = false;
                        }
                    }
                    else
                    {
                        ////If the location type is free.  We allow consolidation
                        DataRow[] rows =
                            _dtPalletizedItemList.Select(string.Format("PalletNumber={0}", dr["PalletNumber"].ToString()));
                        foreach (DataRow row in rows)
                        {
                            row["Consolidate"] = true;
                            row["IsStoredInFreeStorageType"] = true;
                        }
                    }
                }

            }
            return isValid;
        }
 private void btnSaveShelf_Click(object sender, EventArgs e)
 {
     Shelf slf = new Shelf();
     if (shelfId != 0)
         slf.LoadByPrimaryKey(shelfId);
     else
         slf.AddNew();
     slf.ShelfCode = txtShelf.Text;
     slf.ShelfStorageType = int.Parse(cboType.SelectedItem.ToString());
     slf.Save();
     DataTable dtSlf = slf.GetShelves();
     PopulateShelves(dtSlf.DefaultView);
     ResetLocations();
 }
        private void gridBinLocationView_FocusedRowChanged(object sender,
                                                           DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridBinLocationView.GetFocusedDataRow();

            if (dr != null)
            {
                int selected = Convert.ToInt32(dr["ID"]);
                Shelf slf = new Shelf();
                slf.LoadByPrimaryKey(selected);
                if (slf.RowCount > 0)
                {
                    txtShelf.Text = slf.ShelfCode;
                    if (!slf.IsColumnNull("StoreID"))
                        cboStore.SelectedValue = slf.StoreID.ToString();
                    if (!slf.IsColumnNull("ShelfStorageType"))
                    {
                        cboType.SelectedValue = slf.ShelfStorageType;
                    }
                    shelfId = slf.ID;
                }
                btnLocationsave.Text = "Update";
            }
        }
 private void lkStorageTypes_EditValueChanged(object sender, EventArgs e)
 {
     DataRow dr = gridViewPhysicalStores.GetFocusedDataRow();
     int id = Convert.ToInt32(dr["ID"]);
     BLL.Shelf shelf = new Shelf();
     shelf.LoadByPrimaryKey(id);
     if (shelf.RowCount > 0)
     {
         shelf.ShelfStorageType = Convert.ToInt32(lkStorageTypes.EditValue);
         shelf.Save();
     }
     //BLL.PhysicalStore phStore = new PhysicalStore();
     //phStore.LoadByPrimaryKey(id);
     //phStore.PhysicalStoreTypeID = Convert.ToInt32(lkStorageTypes.EditValue);
     //phStore.Save();
     PopulateLookups();
 }
        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 free in.
        /// </summary>
        /// <param name="selectedRackID">The selected rack ID.</param>
        /// <returns></returns>
        public static DataView GetFreeIn(int selectedRackID)
        {
            Shelf slf = new Shelf();
            slf.LoadByPrimaryKey(selectedRackID);

            string query = HCMIS.Repository.Queries.PalletLocation.SelectGetFreeIn(slf.ShelfStorageType, slf.ID);

            PalletLocation pl = new PalletLocation();
            pl.LoadFromRawSql(query);
            return pl.DefaultView;
        }