/// <summary> /// Fixes the volume. /// </summary> private void FixVolume() { PalletLocation pl = new PalletLocation(); pl.LoadPalletLocationsByShelf(this.ID); while (!pl.EOF) { pl.AvailableVolume = (pl.Width * pl.Height * pl.Length); pl.MoveNext(); } pl.Save(); }
/// <summary> /// Fixes the volume. /// </summary> private void FixVolume() { PalletLocation pl = new PalletLocation(); pl.LoadPalletLocationsByShelf(this.ID); while (!pl.EOF) { pl.AvailableVolume = (pl.Width * pl.Height * pl.Length); pl.MoveNext(); } pl.Save(); }
/// <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(); } }
/// <summary> /// Gets all free for pallet locations item. /// </summary> /// <param name="itemID">The item ID.</param> /// <param name="StorageType">Type of the storage.</param> /// <param name="volume">The volume.</param> /// <param name="userID">The user ID.</param> /// <returns></returns> public static DataTable GetAllFreeForItem(int itemID, string StorageType, double volume,int userID) { if (volume == 0) { volume = 1; } //Hack to avoid division by zero, it needs to be fixed somehow. string query; if (StorageType == BLL.StorageType.BulkStore) { query = HCMIS.Repository.Queries.PalletLocation.SelectGetAllFreeForItemBulkStore(itemID, StorageType, volume, userID, BLL.StorageType.StackedStorage, BLL.StorageType.Free); } else if (StorageType == BLL.StorageType.Free) { query = HCMIS.Repository.Queries.PalletLocation.SelectGetAllFreeForItem(itemID, StorageType, volume, userID); } else { // load existing locations that contain the item. query = HCMIS.Repository.Queries.PalletLocation.SelectGetAllFreeForItemElseExistingLocation(itemID); PalletLocation pl = new PalletLocation(); pl.LoadFromRawSql(query); //TODO: What the ins string here is used for is not clear. This query needs to be changed. It seems like it's needlessly complicated string ins = ""; while (!pl.EOF) { if (ins == "") { ins = pl.PalletID.ToString(); } else { ins += "," + pl.PalletID; } pl.MoveNext(); } //TOFIX: this is a query where the error resides query = HCMIS.Repository.Queries.PalletLocation.SelectGetAllFreeForItemElseError(itemID, StorageType, volume, userID, ins, BLL.StorageType.Free); } PalletLocation plc = new PalletLocation(); plc.LoadFromRawSql(query); return plc.DataTable; }
/// <summary> /// Recommends the pallet movments. /// </summary> /// <returns></returns> public DataView RecommendPalletMovments() { // check for each pallet in bulk store this.LoadFromRawSql(HCMIS.Repository.Queries.PalletLocation.SelectRecommendPalletMovments(StorageType.BulkStore)); DataTable dtbl = new DataTable(); dtbl.Columns.Add("ItemID"); dtbl.Columns.Add("FullItemName"); dtbl.Columns.Add("PalletNo"); dtbl.Columns.Add("FromID"); dtbl.Columns.Add("ToID"); dtbl.Columns.Add("From"); dtbl.Columns.Add("To"); int itemID = 0; int freePreferedLocationCount = 0; Item itms = new Item(); bool checkable = false; PalletLocation pl = new PalletLocation(); while (!this.EOF) { if (Convert.ToInt32(this.DataRow["ItemID"]) != itemID) { itemID = Convert.ToInt32(this.DataRow["ItemID"]); // do this if this item is a bulk storage itms.GetItemByPrimaryKey(itemID); if (itms.StorageTypeID.ToString() == StorageType.BulkStore) { checkable = true; pl.LoadFreePrefferedLocationFor(itemID); freePreferedLocationCount = pl.RowCount; } else { checkable = false; } } if (checkable && freePreferedLocationCount > 0) { //add it to the table DataRowView drv = dtbl.DefaultView.AddNew(); drv["ItemID"] = itemID; drv["FullItemName"] = itms.FullItemName; drv["FromID"] = this.ID; drv["ToID"] = pl.ID; Pallet pallet = new Pallet(); pallet.LoadByPrimaryKey(this.PalletID); drv["PalletNo"] = pallet.PalletNo; pl.MoveNext(); freePreferedLocationCount--; drv["From"] = this.FullName; drv["To"] = pl.FullName; } this.MoveNext(); } return dtbl.DefaultView; }