Пример #1
0
        private void BindPickFaceDetailAndReplenismehmnent()
        {
            DataRow  dr = gridPickFaceStockLevelView.GetFocusedDataRow();
            PickFace pf = new PickFace();

            _palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);
            _designatedItemID = Convert.ToInt32(dr["DesignatedItem"]);

            _pickFaceID = Convert.ToInt32(dr["ID"]);

            int storeID = Convert.ToInt32(cmbLogicalStore.EditValue);

            gridPickFaceDetails.DataSource     = pf.GetDetailItemsFor(_pickFaceID, _palletLocationID);
            gridReplenishmentChoice.DataSource = pf.GetReplenishmentListFor(_designatedItemID, storeID);
        }
Пример #2
0
        private void tpDelete_Click(object sender, EventArgs e)
        {
            DataRow dr = gridViewBinCard.GetFocusedDataRow();

            if (Convert.ToInt32(dr["Precedance"]) != 3)
            {
                XtraMessageBox.Show("You cannot delete this");
                return;
            }
            if (CurrentContext.LoggedInUser.UserType == UserType.Constants.DISTRIBUTION_MANAGER_WITH_DELETE)
            {
                if (
                    XtraMessageBox.Show(
                        "Are you sure you want to delete this transaction? You will not be able to undo this.",
                        "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    MyGeneration.dOOdads.TransactionMgr tranMgr =
                        MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();

                    try
                    {
                        tranMgr.BeginTransaction();

                        ReceiveDoc    rdoc = new ReceiveDoc();
                        ReceivePallet rp   = new ReceivePallet();
                        IssueDoc      idoc = new IssueDoc();

                        PickListDetail pld     = new PickListDetail();
                        int            issueID = Convert.ToInt32(dr["ID"]);
                        //pld.LoadByOrderAndItem(Convert.ToInt32(dr["OrderID"]), Convert.ToInt32(dr["ItemID"]),
                        //                       Convert.ToInt32(dr["Quantity"]));
                        idoc.LoadByPrimaryKey(issueID);
                        pld.LoadByPrimaryKey(idoc.PLDetailID);

                        string RefNo = idoc.RefNo;

                        rdoc.LoadByPrimaryKey(idoc.RecievDocID);


                        //if (pld.RowCount == 0)
                        //{
                        //    pld.LoadByOrderAndItem(Convert.ToInt32(dr["OrderID"]), Convert.ToInt32(dr["ItemID"]));
                        //}

                        rp.LoadByPrimaryKey(pld.ReceivePalletID);
                        PalletLocation pl = new PalletLocation();
                        pl.loadByPalletID(rp.PalletID);

                        if (pl.RowCount == 0)
                        {
                            pl.LoadByPrimaryKey(pld.PalletLocationID);
                            if (pl.IsColumnNull("PalletID"))
                            {
                                pl.PalletID = rp.PalletID;
                                pl.Save();
                            }
                            //rp.LoadNonZeroRPByReceiveID(rdoc.ID);
                        }


                        if (rp.RowCount == 0)
                        {
                            XtraMessageBox.Show("You cannot delete this item, please contact the administrator", "Error");
                            return;
                        }
                        if (rp.RowCount > 0)
                        {
                            rdoc.QuantityLeft += idoc.Quantity;
                            rp.Balance        += idoc.Quantity;
                            pld.QuantityInBU   = 0;


                            // are we adding it the pick face?
                            // if so add it to the balance of the pick face also
                            pl.loadByPalletID(rp.PalletID);

                            if (pl.RowCount == 0)
                            {
                                PutawayLocation plocation = new PutawayLocation(rdoc.ItemID);

                                // we don't have a location for this yet,
                                // select a new location
                                //PutawayLocataion pl = new PutawayLocataion();
                                if (plocation.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                                {
                                    pl.LoadByPrimaryKey(plocation.PalletLocationID);
                                    if (pl.RowCount > 0)
                                    {
                                        pl.PalletID = rp.PalletID;
                                        pl.Save();
                                    }
                                }
                            }

                            if (pl.RowCount > 0)
                            {
                                PickFace pf = new PickFace();
                                pf.LoadByPalletLocation(pl.ID);
                                if (pf.RowCount > 0)
                                {
                                    pf.Balance += Convert.ToInt32(idoc.Quantity);
                                    pf.Save();
                                }


                                IssueDocDeleted.AddNewLog(idoc, CurrentContext.UserId);
                                idoc.MarkAsDeleted();
                                rdoc.Save();
                                rp.Save();
                                idoc.Save();


                                // now refresh the window
                                XtraMessageBox.Show("Issue Deleted!", "Confirmation", MessageBoxButtons.OK,
                                                    MessageBoxIcon.Information);
                                tranMgr.CommitTransaction();
                                //TODO: refresh the list
                                // gridViewReferences_FocusedRowChanged(null, null);
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show(
                                "This delete is not successfull because a free pick face location was not selected. please select a free location and try again.",
                                "Error Deleteing issue transaction", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            tranMgr.RollbackTransaction();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("This delete is not successfull", "Warning ...", MessageBoxButtons.OK,
                                            MessageBoxIcon.Warning);
                        tranMgr.RollbackTransaction();
                    }
                }
            }
            else
            {
                XtraMessageBox.Show(
                    "You cannot delete this transaction because you don't have previlage. Please contact the administrator if you thing this is an error.",
                    "Delete is not allowed");
            }
        }
Пример #3
0
        private void OnReplenishClicked(object sender, EventArgs e)
        {
            PalletLocation pl  = new PalletLocation();
            PickFace       pf  = new PickFace();
            DataRow        dr  = gridPickFaceStockLevelView.GetFocusedDataRow();
            DataRow        dr2 = gridReplenishmentChoiceView.GetFocusedDataRow();

            if (dr2 != null)
            {
                // check if the replenishment is from allowed location.
                //
                if (!Convert.ToBoolean(dr2["CanReplenish"]))
                {
                    XtraMessageBox.Show("Please choose replenishment from the first to expire items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }


                pl.LoadByPrimaryKey(_palletLocationID);
                pf.LoadByPrimaryKey(_pickFaceID);
                if (pf.IsColumnNull("Balance"))
                {
                    pf.Balance = 0;
                }

                if (pl.IsColumnNull("PalletID"))
                {
                    Pallet pallet = new Pallet();
                    pallet.AddNew();
                    pallet.StorageTypeID = Convert.ToInt32(StorageType.PickFace);
                    pallet.Save();
                    pl.PalletID = pallet.ID;
                    pl.Save();
                }

                ReceivePallet rp  = new ReceivePallet();
                ReceivePallet rp2 = new ReceivePallet();
                ReceiveDoc    rd  = new ReceiveDoc();
                rp.LoadByPrimaryKey(Convert.ToInt32(dr2["ReceivePalletID"]));
                rp2.AddNew();
                rp2.IsOriginalReceive = false;
                rp2.PalletID          = pl.PalletID;
                rp2.ReceiveID         = rp.ReceiveID;
                rp2.BoxSize           = rp.BoxSize;

                // calculate the new balance
                BLL.ItemManufacturer im = new BLL.ItemManufacturer();
                im.LoadIMbyLevel(_designatedItemID, Convert.ToInt32(dr2["ManufacturerID"]), Convert.ToInt32(dr2["BoxSize"]));
                if (rp.IsColumnNull("ReservedStock"))
                {
                    rp.ReservedStock = 0;
                }
                //if (rp.Balance - rp.ReservedStock < im.QuantityInBasicUnit )
                //{
                //    XtraMessageBox.Show("You cannot replenish the pick face from this location because the items are reserved for Issue. Please replenish from another receive.","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                //    return;
                //}
                BLL.ItemManufacturer imff = new BLL.ItemManufacturer();
                imff.LoadOuterBoxForItemManufacturer(im.ItemID, im.ManufacturerID);
                if (imff.PackageLevel > im.PackageLevel && rp.Balance < imff.QuantityInBasicUnit)
                {
                    rp2.Balance = rp.Balance;
                }
                else if (rp.Balance - rp.ReservedStock > im.QuantityInBasicUnit)
                {
                    rp2.ReceivedQuantity = rp2.Balance = im.QuantityInBasicUnit;
                }
                else
                {
                    rp2.Balance = rp.Balance;
                }
                rp2.ReservedStock = 0;
                rp.Balance       -= rp2.Balance;
                if (rp.IsColumnNull("ReceivedQuantity"))
                {
                    rp.ReceivedQuantity = rp.Balance + rp2.Balance;
                }
                rp.ReceivedQuantity -= rp2.Balance;
                rp.Save();
                rp2.Save();
                pl.Confirmed = false;
                pl.Save();
                pf.Balance += Convert.ToInt32(rp2.Balance);
                pf.Save();
                PalletLocation pl2 = new PalletLocation();
                pl2.LoadLocationForPallet(rp.PalletID);
                rd.LoadByPrimaryKey(rp2.ReceiveID);
                // Now update the screen accordingly.
                dr["Balance"] = pf.Balance;// Convert.ToInt32(dr["Balance"]) + rp2.Balance;

                InternalTransfer it = new InternalTransfer();

                it.AddNew();
                it.ItemID               = _designatedItemID;
                it.BoxLevel             = im.PackageLevel;
                it.ExpireDate           = rd.ExpDate;
                it.BatchNumber          = rd.BatchNo;
                it.ManufacturerID       = im.ManufacturerID;
                it.FromPalletLocationID = pl2.ID;
                it.ToPalletLocationID   = _palletLocationID;
                it.IssuedDate           = DateTimeHelper.ServerDateTime;
                it.QtyPerPack           = im.QuantityInBasicUnit;
                it.Packs        = 1;
                it.ReceiveDocID = rp.ReceiveID;
                it.QuantityInBU = it.Packs * it.QtyPerPack;
                it.Type         = "PickFace";
                it.Status       = 0;
                it.Save();

                BindPickFaceDetailAndReplenismehmnent();
                XtraMessageBox.Show("Your Pick Face is updated, please print the replenishment list and confirm the stock movement", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #4
0
        private void radioLogicalStore_SelectedIndexChanged(object sender, EventArgs e)
        {
            PickFace pf = new PickFace();

            gridPickFaceStockLevel.DataSource = pf.GetPickFaceStockLevel(Convert.ToInt32(cmbLogicalStore.EditValue));
        }
        public static void DeleteIssueDoc(int issueID)
        {
            MyGeneration.dOOdads.TransactionMgr tranMgr =
                MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();

            try
            {
                tranMgr.BeginTransaction();


                var pld  = new PickListDetail();
                var rdoc = new ReceiveDoc();
                var rp   = new ReceivePallet();
                var idoc = new IssueDoc();

                idoc.LoadByPrimaryKey(issueID);
                pld.LoadByPrimaryKey(idoc.PLDetailID);
                rdoc.LoadByPrimaryKey(idoc.RecievDocID);

                rp.LoadByPrimaryKey(pld.ReceivePalletID);
                var pl = new PalletLocation();
                pl.loadByPalletID(rp.PalletID);

                if (pl.RowCount == 0)
                {
                    pl.LoadByPrimaryKey(pld.PalletLocationID);
                    if (pl.IsColumnNull("PalletID"))
                    {
                        pl.PalletID = rp.PalletID;
                        pl.Save();
                    }
                }


                if (rp.RowCount == 0)
                {
                    XtraMessageBox.Show("You cannot delete this item, please contact the administrator", "Error");
                    return;
                }
                if (rp.RowCount > 0)
                {
                    // in error cases this could lead to a number greater than the received quantity
                    // instead of being an error, it should just delete the respective issue and
                    // adjust the remaining quantity to the received quantity.
                    if (rdoc.QuantityLeft + idoc.Quantity > rdoc.Quantity)
                    {
                        rdoc.QuantityLeft = rp.Balance = rdoc.Quantity;
                    }
                    else
                    {
                        rdoc.QuantityLeft += idoc.Quantity;
                        rp.Balance        += idoc.Quantity;
                    }

                    //Delete from picklistDetail and add to pickListDetailDeleted
                    PickListDetailDeleted.AddNewLog(pld, BLL.CurrentContext.UserId);
                    pld.MarkAsDeleted();

                    // are we adding it the pick face?
                    // if so add it to the balance of the pick face also
                    pl.loadByPalletID(rp.PalletID);

                    if (pl.RowCount == 0)
                    {
                        var plocation = new PutawayLocation(rdoc.ItemID);

                        // we don't have a location for this yet,
                        // select a new location
                        //PutawayLocataion pl = new PutawayLocataion();
                        if (plocation.ShowDialog() == DialogResult.OK)
                        {
                            pl.LoadByPrimaryKey(plocation.PalletLocationID);
                            if (pl.RowCount > 0)
                            {
                                pl.PalletID = rp.PalletID;
                                pl.Save();
                            }
                        }
                    }

                    if (pl.RowCount > 0)
                    {
                        var pf = new PickFace();
                        pf.LoadByPalletLocation(pl.ID);
                        if (pf.RowCount > 0)
                        {
                            pf.Balance += Convert.ToInt32(idoc.Quantity);
                            pf.Save();
                        }


                        IssueDocDeleted.AddNewLog(idoc, CurrentContext.UserId);
                        idoc.MarkAsDeleted();
                        rdoc.Save();
                        rp.Save();
                        idoc.Save();
                        pld.Save();


                        // now refresh the window
                        XtraMessageBox.Show("Issue Deleted!", "Confirmation", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information);
                        tranMgr.CommitTransaction();
                    }
                }
                else
                {
                    XtraMessageBox.Show(
                        "This delete is not successfull because a free pick face location was not selected. please select a free location and try again.",
                        "Error Deleteing issue transaction", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tranMgr.RollbackTransaction();
                }
            }
            catch
            {
                XtraMessageBox.Show("This delete is not successfull", "Warning ...", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                tranMgr.RollbackTransaction();
            }
        }
        private void SaveHubDetails()
        {
            if (isStorageTypeChanged)
            {
                isStorageTypeChanged = false;
                BLL.ItemPrefferedLocation ipl = new ItemPrefferedLocation();
                ipl.LoadByItemID(itemId);
                while (!ipl.EOF)
                {
                    ipl.MarkAsDeleted();
                    ipl.MoveNext();
                }
                ipl.Save();
            }


            Item itm = new Item();

            if (cmbStorageType.SelectedValue != null)
            {
                if (cmbStorageType.SelectedValue.ToString() == StorageType.BulkStore)
                {
                    // store the stacked storage settings
                    itm.LoadByPrimaryKey(itemId);
                    itm.IsStackStored = chkIsStackStored.Checked;
                    itm.Save();

                    if (lstPreferredPalletLocation.ItemCount > 0)
                    {
                        //Items itm = new Items();

                        // save near expiry trigger point

                        ItemPrefferedLocation ipr = new ItemPrefferedLocation();
                        DataView dv = (DataView)lstPreferredPalletLocation.DataSource;
                        foreach (DataRowView drv in dv)
                        {
                            ipr.SaveNewItemPreferredRack(itemId, Convert.ToInt32(drv["ID"]), false);
                        }
                    }
                    // store pickface settings
                    pf.Rewind();
                    PickFace pfc = new PickFace();
                    while (!pf.EOF)
                    {
                        pf.AcceptChanges();
                        if (!pf.IsColumnNull("PalletLocationID"))
                        {
                            pfc.SavePickFaceLocation(itemId, pf.PalletLocationID, pf.LogicalStore);
                        }
                        else
                        {
                            pfc.LoadPickFaceFor(itemId, pf.LogicalStore);
                            if (pfc.RowCount > 0 && (pfc.IsColumnNull("Balance") || pfc.Balance == 0))
                            {
                                pfc.ClearPickFaceFor(itemId, pfc.LogicalStore);
                            }
                            else
                            {
                                //TODO: show the error message for the user
                            }
                        }
                        pf.MoveNext();
                    }
                }
                else
                {
                    // Save the fixed locations
                    var      ipr = new ItemPrefferedLocation();
                    DataView dv  = (DataView)lstPreferredPalletLocation.DataSource;
                    if (dv != null)
                    {
                        foreach (DataRowView drv in dv)
                        {
                            ipr.SaveNewItemPreferredRack(itemId, Convert.ToInt32(drv["ID"]), true);
                        }
                    }
                }

                itm.LoadByPrimaryKey(itemId);
                itm.StorageTypeID     = int.Parse(cmbStorageType.SelectedValue.ToString());
                itm.NearExpiryTrigger = Convert.ToDouble(numNearExpiryTrigger.Value);
                itm.Save();
            }
        }
Пример #7
0
        private void BindPalletLocationForEdit(object sender, EventArgs e)
        {
            // Keep the reference of the current popup control so that the cancel logic works just fine.
            CurrentPopup = (PopupContainerEdit)sender;
            //Get the selected row
            DataRow dr = detailView.GetFocusedDataRow();
            int     palletLocationID = Convert.ToInt32(dr["PalletLocationID"]);
            // Enable and disable optional fields
            String SType = dr["STI"].ToString();

            if (SType == "")
            {
                SType = dr["ShelfStorageType"].ToString();
            }
            cmbFixedPrefered.Enabled = true;

            if (SType == StorageType.BulkStore)
            {
                //lstPreferedItems.Visible = true;
                //lblPreferredItem.Visible = true;
                //cmbFixedPrefered.Enabled = false;
                lblFixedPickItem.Visible = false;
                cmbFixedPrefered.Visible = false;
            }

            else if (SType == StorageType.PickFace)
            {
                lblFixedPickItem.Text = "Pick Item";

                lstPreferedItems.Visible = false;
                lblPreferredItem.Visible = false;

                cmbFixedPrefered.Properties.DataSource = Item.GetItems(StorageType.BulkStore);
                PickFace pf = new PickFace();
                pf.LoadByPalletLocation(palletLocationID);
                if (pf.RowCount > 0 && !pf.IsColumnNull("DesignatedItem"))
                {
                    cmbFixedPrefered.EditValue = pf.DesignatedItem;
                }
                else
                {
                    cmbFixedPrefered.EditValue = null;
                }
                lblFixedPickItem.Visible = true;
                cmbFixedPrefered.Visible = true;
            }
            else
            {
                cmbFixedPrefered.Properties.DataSource = Item.GetItems(dr["STI"].ToString());

                BLL.ItemPrefferedLocation ipl = new ItemPrefferedLocation();
                ipl.LoadByRackID(palletLocationID);
                if (ipl.RowCount > 0)
                {
                    cmbFixedPrefered.EditValue = ipl.ItemID;
                }
                else
                {
                    cmbFixedPrefered.EditValue = null;
                }
                lblFixedPickItem.Text    = "Fixed Item";
                lblFixedPickItem.Visible = true;
                cmbFixedPrefered.Visible = true;
                lstPreferedItems.Visible = false;
                lblPreferredItem.Visible = false;
            }

            // Bind the available variables
            txtPalletLocationLabel.Text = dr["Label"].ToString();
            chkEnabled.Checked          = Convert.ToBoolean(dr["IsEnabled"]);
        }
Пример #8
0
        public void DeleteAnIssue(int issueDociD)
        {
            ReceiveDoc    rdoc = new ReceiveDoc();
            ReceivePallet rp   = new ReceivePallet();
            IssueDoc      idoc = new IssueDoc();

            idoc.LoadByPrimaryKey(issueDociD);

            if (idoc.IsThereSRM)
            {
                throw new Exception("There is an SRM for this issue.  You can't void it.");
            }

            PickListDetail pld = new PickListDetail();

            //pld.LoadByOrderAndItem(idoc.OrderID, idoc.ItemID, idoc.NoOfPack);
            pld.LoadByPrimaryKey(idoc.PLDetailID);

            string RefNo = idoc.RefNo;

            rdoc.LoadByPrimaryKey(idoc.RecievDocID);

            //if (pld.RowCount == 0)
            //{
            //    pld.LoadByOrderAndItem(idoc.OrderID, idoc.ItemID);
            //}

            rp.LoadByReceiveDocID(idoc.RecievDocID);
            PalletLocation pl = new PalletLocation();

            pl.loadByPalletID(rp.PalletID);

            if (pl.RowCount == 0)
            {
                pl.LoadByPrimaryKey(pld.PalletLocationID);
                if (pl.IsColumnNull("PalletID"))
                {
                    pl.PalletID = rp.PalletID;
                    pl.Save();
                }
            }


            if (rp.RowCount == 0)
            {
                XtraMessageBox.Show("You cannot delete this item, please contact the administrator", "Error");
                return;
            }
            if (rp.RowCount > 0)
            {
                rdoc.QuantityLeft += idoc.Quantity;
                rp.Balance        += idoc.Quantity;

                //Delete from picklistDetail and add to pickListDetailDeleted
                PickListDetailDeleted.AddNewLog(pld, BLL.CurrentContext.UserId);
                pld.MarkAsDeleted();

                // are we adding it the pick face?
                // if so add it to the balance of the pick face also
                pl.loadByPalletID(rp.PalletID);

                if (pl.RowCount == 0)
                {
                    PutawayLocation plocation = new PutawayLocation(rdoc.ItemID);

                    // we don't have a location for this yet,
                    // select a new location
                    //PutawayLocataion pl = new PutawayLocataion();
                    if (plocation.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        pl.LoadByPrimaryKey(plocation.PalletLocationID);
                        if (pl.RowCount > 0)
                        {
                            pl.PalletID = rp.PalletID;
                            pl.Save();
                        }
                    }
                }

                if (pl.RowCount > 0)
                {
                    PickFace pf = new PickFace();
                    pf.LoadByPalletLocation(pl.ID);
                    if (pf.RowCount > 0)
                    {
                        pf.Balance += Convert.ToInt32(idoc.Quantity);
                        pf.Save();
                    }


                    IssueDocDeleted.AddNewLog(idoc, CurrentContext.UserId);
                    idoc.MarkAsDeleted();
                    rdoc.Save();
                    rp.Save();
                    idoc.Save();
                    pld.Save();
                }
                else
                {
                    XtraMessageBox.Show(
                        "This delete is not successful because a free pick face location was not selected. please select a free location and try again.", "Error Deleteing issue transaction", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }