private void repositoryItemButtonEdit1_DoubleClick(object sender, EventArgs e)
        {
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            if (gridItemMovementView.FocusedValue != null )
            {
                prev = gridItemMovementView.FocusedValue;
                pl.LoadByPrimaryKey(Convert.ToInt32(gridItemMovementView.FocusedValue));
                if (!pl.IsColumnNull("PalletID"))
                {
                    pallet.GetAllItemsInPallet(pl.PalletID);
                    gridControl2.DataSource = pallet.DefaultView;
                    pallet.GetAllItemsInPalletSKUTotal(pl.PalletID);
                    Label l = new Label();
                    l.Dock = DockStyle.Bottom;

                    XtraForm f = new XtraForm();
                    //gridControl2.Parent = null;
                    f.ShowInTaskbar = false;
                    f.Width = gridControl2.Width;
                    if (pallet.RowCount > 0 && !pallet.IsColumnNull("Total"))
                    {

                        l.Text = string.Format("Total SKU: {0}", pallet.GetColumn("Total").ToString());
                    }
                    else
                    {
                        l.Text = "Total SKU: 0";
                    }
                    f.Controls.Add(l);

                    pallet.LoadByPrimaryKey(pl.PalletID);
                    if (!pallet.IsColumnNull("PalletNo"))
                    {
                        f.Text = String.Format("Pallet Number: {0}", pallet.PalletNo);

                    }
                    f.Controls.Add(gridControl2);

                    f.StartPosition = FormStartPosition.CenterScreen;
                    f.ShowDialog();
                }
            }
        }
コード例 #2
0
        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
                {

                }
            }
        }
コード例 #3
0
        //, string guid)
        private void SavePalletization(ReceiveDoc rec, DataRowView drow)
        {
            if ((rec.Quantity == 0 && !rec.IsColumnNull("ShortageReasonID") && rec.ShortageReasonID == ShortageReasons.Constants.NOT_RECEIVED) || (rec.Quantity == 0 && rec.IsColumnNull("ShortageReasonID")))
            {
                HandleFullNotReceivedAndMultipleBatchPalletlization(rec,drow);
                return;
            }
            string guid;

            BLL.ReceivePallet rp = new ReceivePallet();
            Pallet pallet = new Pallet();
            PalletLocation pl = new PalletLocation();
            ItemUnit itemUnit = new ItemUnit();

            BLL.ItemManufacturer im = new BLL.ItemManufacturer();

            guid = rec.GetColumn("GUID").ToString();
            var isDamaged = Convert.ToBoolean(rec.GetColumn("IsDamaged"));
            //DataRow[] r = _dtPalletizedItemList.Select(string.Format("Index = '{0}'", i));
            DataRow[] r =
                _dtPalletizedItemList.Select(string.Format("GUID = '{0}' AND IsDamaged = {1}", guid, isDamaged));
            if (r.Length > 0)
            {
                foreach (DataRow rw in r)
                {
                    rp.AddNew();
                    rp.IsOriginalReceive = true;
                    if (Convert.ToBoolean(rw["Consolidate"]))
                    {
                        try
                        {
                            DataRow dr =
                                _dtPutAwayPalletized.Select(string.Format("PalletNumber={0}",
                                    Convert.ToInt32(rw["PalletNumber"])))[0]; //Assuming we only need one.
                            if (rw["IsStoredInFreeStorageType"] != null)
                            {
                                if (Convert.ToBoolean(rw["IsStoredInFreeStorageType"]) == true)
                                {
                                    pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
                                }
                            }
                        }
                        catch
                        {
                            pl.LoadByPalletNumber(Convert.ToInt32(rw["PalletNumber"]));
                        }
                        try
                        {
                            rp.PalletID = pl.PalletID;
                            rp.PalletLocationID = pl.ID;
                        }
                        catch
                        {
                            rp.PalletID = GetPalletID(rw["PalletNumber"].ToString());
                            try
                            {
                                rp.PalletLocationID = PalletLocation.GetPalletLocationID(rp.PalletID);
                            }
                            catch
                            {
                                DataRow dr =
                                    _dtPutAwayPalletized.Select(string.Format("PalletNumber={0}",
                                        Convert.ToInt32(rw["PalletNumber"])))[0];
                                pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
                                pl.PalletID = rp.PalletID;
                                pl.Save();
                                rp.PalletLocationID = pl.ID;
                            }
                        }

                        //// if the putaway is on a pick face, increase the amount stored on the pick face
                        //if (pl.StorageTypeID.ToString() == StorageType.PickFace)
                        //{
                        //    PickFace pf = new PickFace();

                        //    pf.LoadPickFaceFor(rec.ItemID, Convert.ToInt32(cboStores.EditValue));
                        //    if (pf.RowCount > 0)
                        //    {
                        //        if (pf.IsColumnNull("Balance"))
                        //        {
                        //            pf.Balance = 0;
                        //        }

                        //        pf.Balance += Convert.ToInt32(rp.Balance);
                        //        pf.Save();
                        //    }
                        //}
                    }
                    else
                    {
                        var palletNumber = Convert.ToInt32(rw["PalletNumber"]);
                        DataRow dr = _dtPutAwayPalletized.Select(string.Format("PalletNumber={0}", palletNumber))[0];
                        //Assuming we only need one.
                        pl.LoadByPrimaryKey(Convert.ToInt32(dr["PutAwayLocation"]));
                        rp.PalletID = GetPalletID(rw["PalletNumber"].ToString());
                        pl.PalletID = rp.PalletID;
                        rp.PalletLocationID = pl.ID; //PalletLocation.GetPalletLocationID(rp.PalletID);
                        pl.Save();
                    }

                    rp.ReservedStock = 0;
                    im.LoadIMbyLevel(Convert.ToInt32(rw["ID"]), Convert.ToInt32(rw["Manufacturer"]),
                        Convert.ToInt32(rw["BoxLevel"]));

                    int qtyPerPack = im.QuantityInBasicUnit;

                    if (rw["UnitID"] != DBNull.Value)
                    {
                        itemUnit.LoadByPrimaryKey(Convert.ToInt32(rw["UnitID"]));
                        qtyPerPack = itemUnit.QtyPerUnit;
                    }

                    rp.ReceivedQuantity = rp.Balance = (Convert.ToDecimal(rw["Pack Qty"]) * Convert.ToDecimal(qtyPerPack));
                    rp.BoxSize = Convert.ToInt32(rw["BoxLevel"]);
                    if (rec.IsColumnNull("PhysicalStoreID") && !rp.IsColumnNull("PalletLocationID"))
                    {
                        PalletLocation l = new PalletLocation();
                        l.LoadByPrimaryKey(rp.PalletLocationID);
                        rec.PhysicalStoreID = (l.PhysicalStoreID);

                        PhysicalStore physicalStore = new PhysicalStore();
                        physicalStore.LoadByPrimaryKey(l.PhysicalStoreID);
                        rec.InventoryPeriodID = physicalStore.CurrentInventoryPeriodID;
                    }

                    if (Convert.ToBoolean(rw["Consolidate"]))
                    {
                        try
                        {
                            // if the putaway is on a pick face, increase the amount stored on the pick face
                            if (pl.StorageTypeID.ToString() == StorageType.PickFace)
                            {
                                PickFace pf = new PickFace();

                                pf.LoadPickFaceFor(rec.ItemID, Convert.ToInt32(lkAccounts.EditValue));
                                if (pf.RowCount > 0)
                                {
                                    if (pf.IsColumnNull("Balance"))
                                    {
                                        pf.Balance = 0;
                                    }

                                    pf.Balance += Convert.ToInt32(rp.Balance);
                                    pf.Save();
                                }
                            }
                        }
                        catch
                        {

                        }
                    }

                }
            }

            //r = _dtPutAwayNonPalletized.Select(string.Format("Index = '{0}'", i));
            string filterQuery = _revDocRelatePalletGuid.ContainsKey(guid)
                ? string.Format("{0} AND IsDamaged = {1}", GetFilterByGuid(_revDocRelatePalletGuid[guid]), isDamaged)
                : string.Format("GUID = '{0}' AND IsDamaged = {1} ", guid, isDamaged);
            r = _dtPutAwayNonPalletized.Select(filterQuery);
            if (r.Length > 0)
            {
                // Save the palletization and the putaway here,// this was supposed to be out of here but it is easlier to implement here.
                foreach (DataRow rw in r)
                {
                    pl.LoadByPrimaryKey(Convert.ToInt32(rw["PutAwayLocation"]));
                    if (pl.IsColumnNull("PalletID"))
                    {
                        pallet.AddNew();
                        pallet.Save();
                    }
                    else
                    {
                        pallet.LoadByPrimaryKey(pl.PalletID);
                    }
                    rp.AddNew();
                    rp.IsOriginalReceive = true;
                    rp.PalletID = pallet.ID;
                    rp.PalletLocationID = pl.ID;
                    // rp.ReceiveID = rec.ID;
                    rp.ReservedStock = 0;
                    im.LoadIMbyLevel(Convert.ToInt32(rw["ID"]), Convert.ToInt32(rw["Manufacturer"]),
                        Convert.ToInt32(rw["BoxLevel"]));

                    int qtyPerPack = im.QuantityInBasicUnit;

                    if (rw["UnitID"] != DBNull.Value)
                    {
                        itemUnit.LoadByPrimaryKey(Convert.ToInt32(rw["UnitID"]));
                        qtyPerPack = itemUnit.QtyPerUnit;
                    }

                    rp.ReceivedQuantity =
                        rp.Balance = (Convert.ToDecimal(rw["Palletized Quantity"]) * Convert.ToDecimal(qtyPerPack));
                    rp.BoxSize = Convert.ToInt32(rw["BoxLevel"]);
                    //Get the putaway location

                    pl.Save();
                    if (pl.IsColumnNull("PalletID"))
                    {
                        pl.PalletID = pallet.ID;
                        pl.Confirmed = false;
                        pl.Save();
                    }
                }
            }
            if (rec.IsColumnNull("PhysicalStoreID") && !rp.IsColumnNull("PalletLocationID"))
            {
                PalletLocation l = new PalletLocation();
                l.LoadByPrimaryKey(rp.PalletLocationID);
                PhysicalStore physicalStore = new PhysicalStore();
                physicalStore.LoadByPrimaryKey(l.PhysicalStoreID);
                rec.PhysicalStoreID = (l.PhysicalStoreID);
                // we can take any of the pallet location physical store. as we have one entry on receiveDoc per Store.
                if (physicalStore.IsColumnNull("CurrentInventoryPeriodID"))
                {
                    XtraMessageBox.Show(string.Format("Please Set InventoryPeriod for '{0}' PhysicalStore!",
                        physicalStore.Name), "Empty InventoryPeriod", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception(string.Format("Please Set InventoryPeriod for '{0}' PhysicalStore!",
                        physicalStore.Name));
                }
                rec.InventoryPeriodID = physicalStore.CurrentInventoryPeriodID;

            }

            rec.Save();
            rp.Rewind();
            while (!rp.EOF)
            {
                rp.ReceiveID = rec.ID;
                rp.MoveNext();
            }
            rp.Save();
            SavePutAwayItems();
        }
コード例 #4
0
        private void PutAwayRecievedItems(bool reset)
        {
            if (_dtPutAwayNonPalletized == null || reset == true)
            {
                // Prep the data tables
                _dtPutAwayNonPalletized = new DataTable();
                _dtPutAwayPalletized = new DataTable();

                _dtPutAwayPalletized.Columns.Add("ID");
                _dtPutAwayPalletized.Columns.Add("Item Name");
                _dtPutAwayPalletized.Columns.Add("PalletNumber");
                _dtPutAwayPalletized.Columns.Add("Expiry Date", typeof(DateTime));
                _dtPutAwayPalletized.Columns.Add("PutAwayLocation");
                _dtPutAwayPalletized.Columns.Add("Consolidate", typeof(bool));
                _dtPutAwayPalletized.Columns.Add("Notes");
                _dtPutAwayPalletized.Columns.Add("Volume");
                _dtPutAwayPalletized.Columns.Add("Stock Code");

                _dtPutAwayNonPalletized.Columns.Add("ID");
                _dtPutAwayNonPalletized.Columns.Add("Item Name");
                _dtPutAwayNonPalletized.Columns.Add("Pack Qty", typeof(decimal));
                _dtPutAwayNonPalletized.Columns.Add("Expiry Date", typeof(DateTime));
                _dtPutAwayNonPalletized.Columns.Add("PutAwayLocation");
                _dtPutAwayNonPalletized.Columns.Add("Batch No");
                _dtPutAwayNonPalletized.Columns.Add("StorageType");
                _dtPutAwayNonPalletized.Columns.Add("BoxLevel", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("Index");
                _dtPutAwayNonPalletized.Columns.Add("BasicUnitPerQ");
                _dtPutAwayNonPalletized.Columns.Add("IsDamaged", typeof(bool));
                _dtPutAwayNonPalletized.Columns.Add("Volume");
                _dtPutAwayNonPalletized.Columns.Add("Manufacturer", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("UnitID", typeof(int));
                _dtPutAwayNonPalletized.Columns.Add("Stock Code");
                _dtPutAwayNonPalletized.Columns.Add("GUID");
                _dtPutAwayNonPalletized.Columns.Add("Palletized Quantity", typeof(decimal));
                // import the neccessary data tables
                _dtPalletizedItemList.DefaultView.Sort = "Ordering, PalletNumber";

                int prevPalletID = 0;
                int palletID = 0;
                DataRow LastDr = null;
                foreach (DataRowView drv in _dtPalletizedItemList.DefaultView)
                {
                    DataRow dr = drv.Row;
                    palletID = Convert.ToInt32(drv["PalletNumber"]);
                    if (palletID != prevPalletID)
                    {
                        _dtPutAwayPalletized.ImportRow(dr);
                        LastDr = _dtPutAwayPalletized.Rows[_dtPutAwayPalletized.Rows.Count - 1];
                        LastDr.EndEdit();
                        if (Convert.ToBoolean(LastDr["Consolidate"]))
                        {
                            int plid;
                            LastDr["PutAwayLocation"] = plid = Convert.ToInt32(drv["PalletNumber"]);
                            PalletLocation plc = new PalletLocation();
                            plc.LoadByPrimaryKey(plid);
                            Pallet plt = new Pallet();
                            plt.LoadByPrimaryKey(plc.PalletID);
                            LastDr["PalletNumber"] = (!plt.IsColumnNull("PalletNo")) ? plt.PalletNo : 0;
                        }
                    }
                    else
                    {
                        // add the volume
                        LastDr["Volume"] = Convert.ToDouble(LastDr["Volume"]) + Convert.ToDouble(dr["Volume"]);
                    }
                    prevPalletID = palletID;
                }
                //int quarantine = PalletLocation.GetQuaranteenPalletLocation();
                foreach (DataRowView drv in _dtNonPalletizedItemList.DefaultView)
                {
                    _dtPutAwayNonPalletized.ImportRow(drv.Row);

                    DataRow dr = _dtPutAwayNonPalletized.Rows[_dtPutAwayNonPalletized.Rows.Count - 1];
                    dr.ClearErrors();
                }
                foreach (DataRowView dr in _dtPutAwayNonPalletized.DefaultView)
                {
                    dr["Palletized Quantity"] = dr["Pack Qty"];
                }

                // Bind the data tables with the grids
                //gridPutAwayPalletized.DataSource = _dtPutAwayPalletized;
                //gridPutAwayPalletizedView.SelectRow(0);
                gridPutAwayNonPalletized.DataSource = _dtPutAwayNonPalletized;
                //gridPutAwayPalletizedView.SelectRow(0);
            }
        }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
        /// <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;
        }