/// <summary> /// Moves the specified pick list ID. /// </summary> /// <param name="PickListID">The pick list ID.</param> public static void Move(int PickListID) { DataView dv = GetTransferReportForStore(); PalletLocation pl = new PalletLocation(); foreach (DataRowView dr in dv) { int amount = Convert.ToInt32(dr["packs"]); int palletLocationID = Convert.ToInt32(dr["PalletLocationID"]); ReceivePallet rp = new ReceivePallet(); ReceiveDoc rdoc = new ReceiveDoc(); rp.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivePalletID"])); rdoc.LoadByPrimaryKey(rp.ReceiveID); amount *= rdoc.QtyPerPack; int qPalletLocationID = PalletLocation.GetTransferPalletLocation(Convert.ToInt32(dr["PhysicalStoreID"])); pl.LoadByPrimaryKey(qPalletLocationID); if (pl.IsColumnNull("PalletID")) { Pallet p = new Pallet(); p.AddNew(); p.StorageTypeID = Convert.ToInt32(StorageType.Quaranteen); p.Save(); pl.PalletID = p.ID; pl.Save(); } ReceivePallet rp2 = new ReceivePallet(); ReceiveDoc rd = new ReceiveDoc(); rd.LoadByPrimaryKey(rp.ReceiveID); rp2.AddNew(); rp2.PalletID = pl.PalletID; rp2.ReceiveID = rp.ReceiveID; // calculate the new balance BLL.ItemManufacturer im = new BLL.ItemManufacturer(); //im.LoadDefaultReceiving(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"])); if (dr["BoxLevel"] == DBNull.Value) { dr["BoxLevel"] = 0; } im.LoadIMbyLevel(rd.ItemID, Convert.ToInt32(dr["ManufacturerID"]), Convert.ToInt32(dr["BoxLevel"])); int packqty = (amount / im.QuantityInBasicUnit); rp2.ReservedStock = 0; rp.ReservedStock -= amount; BLL.ReceivePallet.MoveBalance(rp, rp2, amount); //rp2.Balance = amount; //rp.Balance -= rp2.Balance; //rp.Save(); //rp2.Save(); pl.Confirmed = false; pl.Save(); if (rp.Balance == 0) { PalletLocation.GarbageCollection(); } } }