Esempio n. 1
0
 private void locationLookupEdit_Validated(object sender, EventArgs e)
 {
     if (itemLookUpEdit.EditValue != null)
     {
         originalQtyTextEdit.EditValue = ItemsBLL.GetQtyOnHandByID(Session.DefaultSession, Convert.ToInt32(itemLookUpEdit.EditValue), Convert.ToInt32(locationLookUpEdit.EditValue));
     }
 }
Esempio n. 2
0
        private void transferDetailsGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if ((transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn) == null) || Convert.IsDBNull(transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn)))
            {
                return;
            }

            if (e.Column == transferItemGridColumn && !autochange)
            {
                FilterLpns();
            }
            if (e.Column == fullLpnNumberGridColumn && !autochange)
            {
                FilterLots();
            }

            if (e.Column == colTransferLot && e.Value != null)
            {
                float qty = 0;
                qty = ItemsBLL.GetQtyOnHandByID(m_TransfersSession, (int?)transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn), (int)fromLocationLookUpEdit.EditValue, (string)transferDetailsGridView.GetFocusedRowCellValue(colTransferLot), (int?)transferDetailsGridView.GetFocusedRowCellValue(fullLpnNumberGridColumn));
                transferDetailsGridView.SetFocusedRowCellValue(colTransferQuantity, qty);
            }

            if (e.Column == transferItemGridColumn || e.Column == colTransferQuantity || e.Column == colTransferUnits)
            {
                if (Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferQuantity)) > 0 || Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferUnits)) > 0)
                {
                    UpdatePallets();
                }
            }
        }
Esempio n. 3
0
        private void deleteRepositoryItemButtonEdit_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to remove this transfer detail, this can`t be undone?", "Delete Transfer Detail", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No)
            {
                return;
            }

            LocationTransferDetails detail = m_TransfersSession.GetObjectByKey <LocationTransferDetails>(transferDetailsGridView.GetFocusedRowCellValue(colOid));

            if (detail != null)
            {
                int item = Convert.ToInt32(transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn));

                if (detail.TransferQuantity > ItemsBLL.GetQtyOnHandByID(m_TransfersSession, item, Convert.ToInt32(toLocationLookUpEdit.EditValue), detail.TransferLot, detail.FullLpnNumber))
                {
                    MessageBox.Show("You can't delete this transfer detail, it will create a negative stock at the location", "Insufficient Inventory", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }

                detail.Delete();
                if (detail.IsDeleted == false)
                {
                    MessageBox.Show("The transfer detail was not removed.");
                }
                else
                {
                    LocationInventoryBLL.UpdateStock(m_TransfersSession, item, Convert.ToInt32(fromLocationLookUpEdit.EditValue), detail.TransferQuantity, detail.TransferLot, detail.FullLpnNumber);
                    LocationInventoryBLL.UpdateStock(m_TransfersSession, item, Convert.ToInt32(toLocationLookUpEdit.EditValue), detail.TransferQuantity * -1, detail.TransferLot, detail.FullLpnNumber);
                }
            }
            else
            {
                transferDetailsGridView.DeleteRow(transferDetailsGridView.FocusedRowHandle);
            }
        }
Esempio n. 4
0
        private bool ValidateAvailability()
        {
            Dictionary <int, double> totalTransferQuantity = new Dictionary <int, double>();
            double stock = 0;

            if (transferDetailsGridView.GroupCount == 0)
            {
                for (int i = 0; i < transferDetailsGridView.RowCount; i++)
                {
                    if (transferDetailsGridView.IsValidRowHandle(i))
                    {
                        if (ValidateAvailabilityByLine(i, totalTransferQuantity) == false)
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                int i = -1;
                while (transferDetailsGridView.IsValidRowHandle(i))
                {
                    if (transferDetailsGridView.GetChildRowHandle(i, 0) > -1)
                    {
                        //INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of transferDetailsGridView.GetChildRowCount(i) + transferDetailsGridView.GetChildRowHandle(i, 0) for every iteration:
                        int tempVar = transferDetailsGridView.GetChildRowCount(i) + transferDetailsGridView.GetChildRowHandle(i, 0);
                        for (int ci = transferDetailsGridView.GetChildRowHandle(i, 0); ci < tempVar; ci++)
                        {
                            if (ValidateAvailabilityByLine(ci, totalTransferQuantity) == false)
                            {
                                return(false);
                            }
                        }
                    }
                    i -= 1;
                }
            }

            foreach (int product in totalTransferQuantity.Keys)
            {
                stock = ItemsBLL.GetQtyOnHandByID(m_TransfersSession, product, Convert.ToInt32(fromLocationLookUpEdit.EditValue));
                if (stock < totalTransferQuantity[product])
                {
                    MessageBox.Show(string.Format("{0} does only have {1} in stock and your shipping {2}.{3}You must enter first the production.", Session.DefaultSession.GetObjectByKey <Items>(product).ItemCode, stock.ToString(), totalTransferQuantity[product].ToString(), Environment.NewLine), "Stock Verification", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 5
0
        private void itemLookUpEdit_Validated(object sender, EventArgs e)
        {
            if (itemLookUpEdit.EditValue == null)
            {
                return;
            }

            descriptionMemoEdit.Text     = ItemsBLL.GetDescriptionByItemID((int?)itemLookUpEdit.EditValue);
            customerLookUpEdit.EditValue = m_Items.GetCustomerIDByItemID(Convert.ToInt32(itemLookUpEdit.EditValue));

            if (locationLookUpEdit.EditValue != null)
            {
                originalQtyTextEdit.EditValue = ItemsBLL.GetQtyOnHandByID(Session.DefaultSession, Convert.ToInt32(itemLookUpEdit.EditValue), Convert.ToInt32(locationLookUpEdit.EditValue));
            }

            FilterLpns();

            lpnLookUpEdit.EditValue         = null;
            originalLotLookUpEdit.EditValue = null;

            UpdateQtyPerPallet();
        }
Esempio n. 6
0
        private bool ValidateAvailabilityByLine(int i, Dictionary <int, double> totalTransferQuantity)
        {
            double stock            = 0;
            double lotStock         = 0;
            int    transferQuantity = 0;
            Items  item             = null;
            string lot       = null;
            int    LPNNumber = 0;

            lot       = (transferDetailsGridView.GetRowCellValue(i, colTransferLot) == null ? null : Convert.ToString(transferDetailsGridView.GetRowCellValue(i, colTransferLot)));
            item      = Session.DefaultSession.GetObjectByKey <Items>(Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn)), true);
            LPNNumber = Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, fullLpnNumberGridColumn));
            if (LPNNumber == 0)
            {
                MessageBox.Show("LPN Number is invalid", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(false);
            }

            try
            {
                if (!LotCodeValidator.ValidateByItem(item, lot, false))
                {
                    throw new ApplicationException("Item " + item.ItemCode + " & lot # " + lot + " is invalid" + Environment.NewLine + "You must provide a valid lot.");
                }
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(false);
            }

            stock = ItemsBLL.GetQtyOnHandByID(m_TransfersSession, Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn)), Convert.ToInt32(fromLocationLookUpEdit.EditValue));

            lotStock = ItemsBLL.GetQtyOnHandByIDAndLot(m_TransfersSession, Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn)), Convert.ToInt32(fromLocationLookUpEdit.EditValue), lot, LPNNumber);

            if (m_TransfersSession.IsNewObject(transferDetailsGridView.GetRow(i)) == false && ((LocationTransferDetails)transferDetailsGridView.GetRow(i)).HasChanges == false)
            {
                return(true);
            }
            else if (m_TransfersSession.IsNewObject(transferDetailsGridView.GetRow(i)) == false)
            {
                transferQuantity = Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, colTransferQuantity)) - Session.DefaultSession.GetObjectByKey <LocationTransferDetails>(transferDetailsGridView.GetRowCellValue(i, colOid), true).TransferQuantity;
            }
            else
            {
                transferQuantity = Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, colTransferQuantity));
            }

            if (stock < transferQuantity)
            {
                MessageBox.Show($"{item.ItemCode} does only have {stock} in stock and your shipping {transferQuantity}.{Environment.NewLine}You must enter first the production.", "Stock Verification", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(false);
            }

            if (lotStock < transferQuantity)
            {
                MessageBox.Show($"{item.ItemCode} lot# {lot} LPN# {LPNNumber} does only have {lotStock} in stock and your shipping {transferQuantity}.{Environment.NewLine}You must enter first the production.", "Stock Verification", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(false);
            }

            if (totalTransferQuantity.ContainsKey(Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn))))
            {
                totalTransferQuantity[Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn))] += transferQuantity;
            }
            else
            {
                totalTransferQuantity.Add(Convert.ToInt32(transferDetailsGridView.GetRowCellValue(i, transferItemGridColumn)), transferQuantity);
            }

            return(true);
        }