/// <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; }
private void SavePutAwayItems() { PalletLocation pl = new PalletLocation(); Pallet pallet = new Pallet(); foreach (DataRow rw in _dtPutAwayPalletized.Rows) { pl.LoadByPrimaryKey(Convert.ToInt32(rw["PutAwayLocation"])); if (pl.IsColumnNull("PalletID")) { pl.PalletID = GetPalletID(rw["PalletNumber"].ToString()); pl.Confirmed = false; pallet.LoadByPrimaryKey(pl.PalletID); pl.UsedVolume = pallet.CalculateCurrentVolume(pl.PalletID); pl.Save(); } else { } } }
/// <summary> /// Calculates all volumes. /// </summary> /// <param name="itemID">The item ID.</param> internal static void CalculateAllVolumes(int itemID) { PalletLocation pl = new PalletLocation(); pl.LoadFromRawSql(HCMIS.Repository.Queries.PalletLocation.SelectCalculateAllVolumes(itemID)); Pallet pallet = new Pallet(); while (!pl.EOF) { pl.UsedVolume = pallet.CalculateCurrentVolume(pl.PalletID); pl.Save(); pl.MoveNext(); } }