Пример #1
0
        public bool DeleteReceivingDetail(Session session, int detailID)
        {
            ReceivingDetail detail       = session.GetObjectByKey <ReceivingDetail>(detailID);
            int             rowsAffected = 0;
            int             itemID       = 0;
            int             quantity     = 0;
            int             locationID   = 0;
            int             units        = 0;
            int?            lpn          = null;
            string          lot          = null;

            if (detail != null)
            {
                itemID     = detail.ReceivDetItemID.ItemID;
                units      = detail.intUnits;
                quantity   = detail.ReceivDetQty;
                locationID = session.GetObjectByKey <Receiving>(detail.ReceivMainID.ReceivID).ReceivingLocation.Oid;
                lpn        = detail.ReceivDetLPN;
                lot        = detail.ReceivDetLot;
                session.Delete(detail);
            }

            ItemsBLL items = new ItemsBLL();

            items.UpdateStock(session, itemID, quantity * -1, false, locationID, lot, lpn);

            return(true);
        }
Пример #2
0
        public bool InsertDetails(Session session, int receivingID, int?itemID, string lot, int?quantity, int?units, float?pallets, string reason, DateTime?expirationDate)
        {
            SPG.ReturnDetDataTable details      = new SPG.ReturnDetDataTable();
            SPG.ReturnDetRow       returnDetail = details.NewReturnDetRow();

            returnDetail.ReceiveMainID   = receivingID;
            returnDetail.ReturnDetItemID = itemID.Value;
            if (string.IsNullOrEmpty(lot))
            {
                returnDetail.SetReturnDetLotNull();
            }
            else
            {
                returnDetail.ReturnDetLot = lot;
            }
            returnDetail.ReturnDetQty = quantity.Value;
            if (!units.HasValue)
            {
                returnDetail.SetintUnitsNull();
            }
            else
            {
                returnDetail.intUnits = units.Value;
            }
            if (!pallets.HasValue)
            {
                returnDetail.SetsngPalletsNull();
            }
            else
            {
                returnDetail.sngPallets = pallets.Value;
            }
            if (string.IsNullOrEmpty(reason))
            {
                returnDetail.SetReasonNull();
            }
            else
            {
                returnDetail.Reason = reason;
            }
            if (expirationDate.HasValue)
            {
                returnDetail.ExpirationDate = expirationDate.Value;
            }
            else
            {
                returnDetail.SetExpirationDateNull();
            }

            details.AddReturnDetRow(returnDetail);
            int rowsAffected = Adapter.Update(details);

            if (rowsAffected == 1)
            {
                ItemsBLL items = new ItemsBLL();
                items.UpdateStock(session, itemID.Value, quantity.Value, false, session.GetObjectByKey <Receiving>(receivingID).ReceivingLocation.Oid);
            }

            return(rowsAffected == 1);
        }
Пример #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);
            }
        }
Пример #4
0
        public bool DeleteReturnDetail(Session session, int detailID)
        {
            SPG.ReturnDetDataTable details = Adapter.GetReturnDetByID(detailID);
            int rowsAffected = 0;
            int itemID       = 0;
            int quantity     = 0;
            int locationID   = 0;

            if (details.Count() == 1)
            {
                SPG.ReturnDetRow returnDetail = (SPG.ReturnDetRow)details.Rows[0];
                itemID       = returnDetail.ReturnDetItemID;
                quantity     = returnDetail.ReturnDetQty;
                locationID   = session.GetObjectByKey <Receiving>(returnDetail.ReceiveMainID).ReceivingLocation.Oid;
                rowsAffected = Adapter.Delete(detailID, returnDetail.ts);
            }

            if (rowsAffected == 1)
            {
                ItemsBLL items = new ItemsBLL();
                items.UpdateStock(session, itemID, quantity * -1, false, locationID);
            }

            //Return true if precisely one row was deleted, otherwise return false.
            return(rowsAffected == 1);
        }
Пример #5
0
        private void InventoryAdjustmentXtraForm_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            CheckPermissions();

            //Dim fullLPN As String


            //fullLPN = CustomersBLL.GetLPNPrefix(7) & Strings.Right("0000000000" & "", Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString))

            //lpnLookUpEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
            //lpnLookUpEdit.Properties.DisplayFormat.FormatString = CustomersBLL.GetLPNPrefix(7) & "{0:D" & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & "}"
            //lpnXpView.Properties.Add(New ViewProperty("LPN", SortDirection.None, "'" & CustomersBLL.GetLPNPrefix(7) & "' + RIGHT(CONCAT('0000000000',LPNNumber)," & Len(CustomersBLL.GetCustomer(7, Session.DefaultSession).LastLPNNumber.ToString) & ")", True, True))
            m_Items      = new ItemsBLL();
            m_Customers  = new CustomersBLL();
            m_Adjustment = new InventoryAdjustmentBLL();

            PrepareNewRecord();

            SetDefaultViewFilter();
            FillAdjustmentView();

            FilterLpns();

            Cursor = Cursors.Default;
        }
Пример #6
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));
     }
 }
Пример #7
0
        public void BindPoolControls(int poolID)
        {
            m_ItemPoolSession.DropIdentityMap();

            ItemPool pool = m_ItemPoolSession.GetObjectByKey <ItemPool>(poolID, true);

            m_CurrentPoolID              = pool;
            codeTextEdit.Text            = pool.PoolCode;
            customerLookUpEdit.EditValue = pool.PoolCustomerID.CustomerID;
            customerLookUpEdit.Enabled   = false;
            descriptionMemoEdit.Text     = pool.PoolDescription;

            poolDetailsXpCollection.Criteria = new BinaryOperator(ItemPoolDetails.Fields.ItemPoolID, m_CurrentPoolID.Oid, BinaryOperatorType.Equal);

            poolDetailsXpCollection.Reload();

            if ((customerLookUpEdit.EditValue == null ? null : Convert.ToString(customerLookUpEdit.EditValue)) == customerLookUpEdit.Properties.NullText)
            {
                itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID(null, "RM", true, m_ItemPoolSession);
            }
            else
            {
                itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID((int?)customerLookUpEdit.EditValue, "RM", true, m_ItemPoolSession);
            }
        }
Пример #8
0
        public void UpdatePallets()
        {
            double units   = ItemsBLL.GetCaseQuantity(Convert.ToInt32(transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn)));
            float  pallets = Convert.ToSingle(((ViewRecord)itemRepositoryItemLookUpEdit.GetDataSourceRowByKeyValue(transferDetailsGridView.GetFocusedRowCellValue(transferItemGridColumn)))[3]); //CasesPerPallet

            if (Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferQuantity)) < 1)
            {
                if (units != 0)
                {
                    transferDetailsGridView.SetFocusedRowCellValue(colTransferQuantity, Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferUnits)) * units);
                }
                else
                {
                    transferDetailsGridView.SetFocusedRowCellValue(colTransferQuantity, 0);
                }
            }

            //calculate the quantity
            if (Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferUnits)) == 0)
            {
                if (units != 0)
                {
                    transferDetailsGridView.SetFocusedRowCellValue(colTransferUnits, Math.Ceiling(Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferQuantity)) / units));
                }
            }

            if (pallets != 0)
            {
                transferDetailsGridView.SetFocusedRowCellValue(colTransferPallets, Convert.ToDouble(transferDetailsGridView.GetFocusedRowCellValue(colTransferUnits)) / pallets);
            }
            else
            {
                transferDetailsGridView.SetFocusedRowCellValue(colTransferPallets, 0);
            }
        }
Пример #9
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();
                }
            }
        }
Пример #10
0
        private void addBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            m_CurrentPoolID              = new ItemPool(m_ItemPoolSession);
            codeTextEdit.Text            = null;
            customerLookUpEdit.EditValue = null;
            customerLookUpEdit.Enabled   = true;
            descriptionMemoEdit.Text     = null;

            poolDetailsXpCollection.Criteria = new BinaryOperator(ItemPoolDetails.Fields.ItemPoolID, m_CurrentPoolID.Oid, BinaryOperatorType.Equal);
            poolDetailsXpCollection.Reload();

            if ((customerLookUpEdit.EditValue == null ? null : Convert.ToString(customerLookUpEdit.EditValue)) == customerLookUpEdit.Properties.NullText)
            {
                itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID(null, "RM", true, m_ItemPoolSession);
            }
            else
            {
                itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID((int?)customerLookUpEdit.EditValue, "RM", true, m_ItemPoolSession);
            }

            Utilities.MakeFormReadOnly(poolXtraTabPage, false);
            poolDetailsGridView.OptionsBehavior.Editable = true;
            poolSearchGridControl.Enabled = false;
            CheckPermissions();

            cancelBarButtonItem.Enabled = true;
            saveBarButtonItem.Enabled   = true;
            editBarButtonItem.Enabled   = false;
            addBarButtonItem.Enabled    = false;
            deleteBarButtonItem.Enabled = false;
            deleteGridColumn.Visible    = false;
        }
Пример #11
0
        public static bool DeleteInventory(Session session, int id)
        {
            //Dim inventory As SPG.InventoryDataTable = Adapter.GetInventoryByID(id)
            //Dim rowsAffected As Integer = 0
            //Dim inventorySession As Session = session
            session.DropIdentityMap();

            int       item       = 0;
            int       quantity   = 0;
            int       locationID = 0;
            Inventory production = session.GetObjectByKey <Inventory>(id);

            //If inventory.Count = 1 Then
            if (production == null)
            {
                return(false);
            }
            else if (production.Shipment != null)
            {
                MessageBox.Show("The selected record can't be deleted, it was already shipped.");
                return(true);
            }

            //Dim inventoryRecord As SPG.InventoryRow = CType(Inventory.Rows(0), SPG.InventoryRow)
            InventoryBOMsBLL inventoryBOM = new InventoryBOMsBLL();

            item       = production.InventoryItemID.ItemID;
            quantity   = production.InventoryQuantity;
            locationID = production.ProductionLocation.Oid;
            InventoryBOMsBLL.DeleteInventoryBOMByInventoryID(session, id);
            DeleteInventoryConsumption(production, session);
            DeleteProductionProjectDetails(session, production);
            //rowsAffected = Adapter.Delete(id, inventoryRecord.ts)
            try
            {
                production.Delete();

                //If rowsAffected = 1 Then
                //If production.IsDeleted Then
                ItemsBLL items = new ItemsBLL();
                items.UpdateStock(session, item, quantity * -1, true, locationID);
                //End If

                //Return true if precisely one row was deleted, otherwise return false.
                //Return rowsAffected = 1

                //Return production.IsDeleted
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #12
0
 private void customerLookUpEdit_EditValueChanged(object sender, EventArgs e)
 {
     if ((customerLookUpEdit.EditValue == null ? null : Convert.ToString(customerLookUpEdit.EditValue)) == customerLookUpEdit.Properties.NullText)
     {
         itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID(null, "RM", true, m_ItemPoolSession);
     }
     else
     {
         itemRepositoryItemLookUpEdit.DataSource = ItemsBLL.GetItemCodeAndIDsByTypesAndCustomerID((int?)customerLookUpEdit.EditValue, "RM", true, m_ItemPoolSession);
     }
 }
Пример #13
0
        public bool InsertInventoryAdjustment(int adjustmentID, DateTime adjustmentDate, int customer, int item, float originalQuantity, float?newQuantity, string reason, int locationID, string OriginalLot, string NewLot, int?LPN, DateTime?Expr, bool IsNewInventory = true)
        {
            //Dim adjustments As SPG.InventoryAdjustmentDataTable = New SPG.InventoryAdjustmentDataTable
            //Dim adjustment As SPG.InventoryAdjustmentRow = adjustments.NewInventoryAdjustmentRow()

            //adjustment.AdjustmentID = adjustmentID

            InventoryAdjustment adjustment = new InventoryAdjustment(Session.DefaultSession)
            {
                AdjustmentID = adjustmentID
            };

            //adjustment.AdjustmentDate = CDate(Format(adjustmentDate, "D"))
            //adjustment.Customer = customer
            //adjustment.ItemID = item
            //adjustment.OriginalQuantity = originalQuantity
            //adjustment.NewCount = newQuantity
            //adjustment.Reason = reason

            SetInventoryAdjustmentFields(adjustmentDate, customer, item, originalQuantity, newQuantity, reason, locationID, OriginalLot, NewLot, LPN, adjustment);
            adjustment.strEnteredBy = Properties.Settings.Default.UserName;
            adjustment.dtmEnteredOn = DateTime.Now;

            try
            {
                adjustment.Save();
            }
            catch (Exception ex)
            {
                return(false);
            }

            //adjustments.AddInventoryAdjustmentRow(adjustment)
            //Dim rowsAffected As Integer = Adapter.Update(adjustments)

            //If rowsAffected = 1 Then
            ItemsBLL items = new ItemsBLL();

            if (!string.IsNullOrEmpty(NewLot))
            {
                items.UpdateStock(Session.DefaultSession, item, originalQuantity * -1, false, locationID, OriginalLot, LPN, Expr, IsNewInventory);
                items.UpdateStock(Session.DefaultSession, item, originalQuantity, false, locationID, NewLot, LPN, Expr, IsNewInventory);
            }
            else
            {
                items.UpdateStock(Session.DefaultSession, item, (newQuantity ?? 0) - originalQuantity, false, locationID, OriginalLot, LPN, Expr);
            }
            //End If

            //Return rowsAffected = 1
            return(true);
        }
Пример #14
0
 private void AddLpnSimpleButton_Click(object sender, EventArgs e)
 {
     if (((int?)itemLookUpEdit.EditValue).HasValue && ((int?)locationLookUpEdit.EditValue).HasValue && !m_newLpn)
     {
         int      lpn   = LPNLabel.GetNextLPNNumber(7);
         ItemsBLL items = new ItemsBLL();
         items.UpdateStock(Session.DefaultSession, Convert.ToInt32(itemLookUpEdit.EditValue), 0, false, Convert.ToInt32(locationLookUpEdit.EditValue), "", lpn);
         lpnXpView.Reload();
         lpnLookUpEdit.EditValue = lpn;
         FilterLots();
         m_newLpn = true;
     }
 }
Пример #15
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);
        }
Пример #16
0
        public static bool DeleteInventoryAdjustment(int id)
        {
            //Dim adjustments As SPG.InventoryAdjustmentDataTable = Adapter.GetInventoryAdjustmentByID(id)
            //Dim rowsAffected As Integer = 0
            int    item       = 0;
            int    locationID = 0;
            int?   LPN        = null;
            float  quantity   = 0;
            string oldlot     = null;
            string newlot     = null;

            //If adjustments.Count = 1 Then
            //    Dim adjustment As SPG.InventoryAdjustmentRow = CType(adjustments.Rows(0), SPG.InventoryAdjustmentRow)

            InventoryAdjustment adjustment = Session.DefaultSession.GetObjectByKey <InventoryAdjustment>(id);

            if (adjustment == null)
            {
                return(false);
            }
            item       = adjustment.AdjustmentItem.ItemID;
            quantity   = adjustment.OriginalQuantity - (adjustment.NewCount ?? 0);
            locationID = adjustment.InventoryLocation.Oid;
            LPN        = adjustment.LPN;
            newlot     = adjustment.NewLot;
            oldlot     = adjustment.OriginalLot;
            //rowsAffected = Adapter.Delete(id, adjustment.rv)
            //End If

            try
            {
                adjustment.Delete();
                ItemsBLL items = new ItemsBLL();
                if (!string.IsNullOrEmpty(newlot))
                {
                    items.UpdateStock(Session.DefaultSession, item, quantity * -1, false, locationID, newlot, LPN);
                    items.UpdateStock(Session.DefaultSession, item, quantity, false, locationID, oldlot, LPN);
                }
                else
                {
                    items.UpdateStock(Session.DefaultSession, item, quantity, false, locationID, oldlot, LPN);
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #17
0
        public void UpdateQtyPerPallet()
        {
            double CasesPerPallet  = 0;
            double QuantityPerUnit = 0;
            int    itemId          = Convert.ToInt32(itemLookUpEdit.EditValue);

            QuantityPerUnit = ItemsBLL.GetCaseQuantity(itemId);
            CasesPerPallet  = m_Items.GetCasesPerPallet(itemId);

            //UnitsPerPltTextEdit.EditValue = CasesPerPallet;
            QtyPerPltTextEdit.EditValue = (CasesPerPallet * QuantityPerUnit);

            //if(!string.IsNullOrEmpty(QtyTextEdit.Text))
            //    UnitsTextEdit.EditValue = Math.Ceiling(Convert.ToDouble(QtyTextEdit.Text) / QuantityPerUnit);
        }
Пример #18
0
        private void CustomersXtraForm_Load(object sender, EventArgs e)
        {
            Cursor             = Cursors.WaitCursor;
            m_Customer         = new CustomersBLL();
            m_CustomersItems   = new ItemsBLL();
            m_Receiving        = new ReceivingsBLL();
            m_ReceivingDetails = new ReceivingDetailsBLL();
            m_Production       = new ProductionBLL();
            m_Shippings        = new ShippingsBLL();
            m_UserPermissions  = new UserPermissionsBLL();

            m_CustomersSession = new Session(MyDataLayers.SPGDataLayer);
            m_CustomersSession.TrackPropertiesModifications  = true;
            m_CustomersSession.OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException;

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_CustomersSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_CustomersSession;
                }
            }

            BindCustomerSearch();
            customerShiftsXpCollection.Criteria = new BinaryOperator(CustomerShifts.Fields.Customer, null, BinaryOperatorType.Equal);
            customerPlantsXpCollection.Criteria = new BinaryOperator(CustomerPlants.Fields.Customer, null, BinaryOperatorType.Equal);

            Utilities.MakeFormReadOnly(generalXtraTabPage, true);
            addRelatedCustomerGroupControl.Enabled          = false;
            customerPlantsGridView.OptionsBehavior.Editable = false;
            customerShiftsGridView.OptionsBehavior.Editable = false;
            deleteGridColumn.Visible = false;
            deleteCustomerPlantGridColumn.Visible = false;
            deleteCustomerShiftGridColumn.Visible = false;
            customerSearchGridControl.Enabled     = true;

            Cursor = Cursors.Default;
        }
Пример #19
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();
        }
Пример #20
0
        public int InsertDetails(Session session, int receivingID, Items item, string lot, int?quantity, int?units, int?LPN, DateTime?expirationDate)
        {
            ReceivingDetail detail = new ReceivingDetail(session);

            detail.ReceivMainID    = session.GetObjectByKey <Receiving>(receivingID);
            detail.ReceivDetItemID = item;
            detail.intUnits        = units.Value;
            detail.ReceivDetQty    = quantity.Value;
            detail.ExpirationDate  = expirationDate;
            detail.ReceivDetLPN    = LPN;
            detail.ReceivDetLot    = lot;

            detail.Save();


            ItemsBLL items      = new ItemsBLL();
            int      locationID = session.GetObjectByKey <Receiving>(receivingID).ReceivingLocation.Oid;

            items.UpdateStock(session, item.ItemID, quantity.Value, false, locationID, lot, LPN, expirationDate);

            return(detail.ReceivDetID);
        }
Пример #21
0
        private void AddPalletsSimpleButton_Click(object sender, EventArgs e)
        {
            if (!ValidateAddLPN())
            {
                return;
            }
            originalQtyTextEdit.EditValue = QtyTextEdit.EditValue;
            newQtyTextEdit.EditValue      = QtyTextEdit.EditValue;
            newLotTextEdit.EditValue      = LotTextEdit.EditValue;

            //m_newLpn = false;
            if (((int?)itemLookUpEdit.EditValue).HasValue && ((int?)locationLookUpEdit.EditValue).HasValue && !m_newLpn)
            {
                ItemsBLL items = new ItemsBLL();
                items.UpdateStock(Session.DefaultSession, Convert.ToInt32(itemLookUpEdit.EditValue), 0, false, Convert.ToInt32(locationLookUpEdit.EditValue), LotTextEdit.Text, null, null, false);
                lpnXpView.Reload();

                FilterLots();
                m_newLpn = true;
            }
            saveSimpleButton.Tag = null;
            AddLpns();
        }
Пример #22
0
        public bool DeleteShippingDetail(Session session, int detailID)
        {
            SPG.ShippingDetailsDataTable details = Adapter.GetDetailsByDetailID(detailID);
            int    rowsAffected  = 0;
            int    itemID        = 0;
            int    quantity      = 0;
            int    locationID    = 0;
            string lot           = null;
            string fullLPNNumber = null;

            if (details.Count() == 1)
            {
                SPG.ShippingDetailsRow shippingDetail = (SPG.ShippingDetailsRow)details.Rows[0];
                itemID        = shippingDetail.ShipDetItemID;
                quantity      = shippingDetail.ShipDetDetQty;
                lot           = shippingDetail.ShipDetLot;
                fullLPNNumber = shippingDetail.FullLPNNumber;
                locationID    = session.GetObjectByKey <Shipping>(shippingDetail.ShipDetMainID).ShippingLocation.Oid;
                rowsAffected  = Adapter.Delete(detailID, shippingDetail.ts);
            }

            if (rowsAffected == 1)
            {
                ItemsBLL items = new ItemsBLL();
                if (fullLPNNumber.StartsWith(CustomersBLL.GetLPNPrefix(7)))
                {
                    items.UpdateStock(session, itemID, quantity, false, locationID, lot, int.Parse(fullLPNNumber.Replace(CustomersBLL.GetLPNPrefix(7), "")));
                }
                else
                {
                    items.UpdateStock(session, itemID, quantity, false, locationID);
                }
            }

            //Return true if precisely one row was deleted, otherwise return false.
            return(rowsAffected == 1);
        }
Пример #23
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);
        }
Пример #24
0
        private void ProductionXtraForm_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            m_ProductionSession = new Session(MyDataLayers.SPGDataLayer)
            {
                TrackPropertiesModifications  = true,
                OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException
            };

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_ProductionSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_ProductionSession;
                }
            }

            m_Items      = new ItemsBLL();
            m_Production = new ProductionBLL();
            m_Shift      = new ShiftsBLL();
            m_Machines   = new MachinesLinesBLL();
            m_Customers  = new CustomersBLL();

            LookUpColumnInfo shiftNameColumn = new LookUpColumnInfo()
            {
                Caption   = "Shift",
                FieldName = "ShiftName"
            };

            shiftLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftLookUpEdit.Properties.ValueMember   = "ShiftID";

            shiftFilterLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftFilterLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftFilterLookUpEdit.Properties.ValueMember   = "ShiftID";

            //Dim machineNameColumn As Controls.LookUpColumnInfo = New Controls.LookUpColumnInfo() With {.Caption = "Machine Line", .FieldName = "MachineLineName"}

            //Me.machineLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineLookUpEdit.Properties.ValueMember = "MachineLineID"

            //Me.machineFilterLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineFilterLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineFilterLookUpEdit.Properties.ValueMember = "MachineLineID"

            FillDropDowns();

            PrepareNewRecord();
            if (DateTime.Now.TimeOfDay < new TimeSpan(9, 0, 0))
            {
                productionDateEdit.DateTime = DateTime.Today.AddDays(-1);
            }
            else
            {
                productionDateEdit.DateTime = DateTime.Today;
            }

            SetDefaultViewFilter();
            FillProductionView();

            Cursor = Cursors.Default;
        }
Пример #25
0
 private void itemLookUpEdit_Validated(System.Object sender, EventArgs e)
 {
     descriptionMemoEdit.Text = ItemsBLL.GetDescriptionByItemID((int?)itemLookUpEdit.EditValue);
     uomTextEdit.Text         = ItemsBLL.GetUOMByItemID((int?)itemLookUpEdit.EditValue);
 }
Пример #26
0
        private void expectedDetailXrLabel_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            //= m_IntervalHoursMinusBreak * Convert.ToDouble(GetCurrentColumnValue("ExpectedProduction"))
            if (m_MachineStandard == 0)
            {
                m_Expected = Convert.ToDouble(GetCurrentColumnValue("ExpectedProduction")) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour) / ItemsBLL.GetQuantityPerUnit(Convert.ToInt32(GetCurrentColumnValue("ProdMainItemID")));
            }
            else
            {
                m_Expected = m_MachineStandard * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour) / ItemsBLL.GetQuantityPerUnit(Convert.ToInt32(GetCurrentColumnValue("ProdMainItemID")));
            }

            expectedDetailXrLabel.Text = m_Expected.ToString("#,#");
            m_TotalExpected           += m_Expected;
        }
Пример #27
0
        public Inventory UpdateInventory(Session session, int inventoryID, DateTime inventoryDate, int item, int quantity, float?pallets, string po, string lot, int?shift, int?pallet, DateTime?expirationDate, int locationID, string note)
        {
            //Dim inventory As SPG.InventoryDataTable = Adapter.GetInventoryByID(inventoryID)

            //If inventory.Count = 0 Then
            Change    change     = new Change();
            Inventory production = session.GetObjectByKey <Inventory>(inventoryID);

            if (production == null)
            {
                //It is a new Production Record
                change = new Change()
                {
                    PropertyName = Inventory.Fields.InventoryID.PropertyName,
                    PrevValue    = "<NULL>",
                    NewValue     = inventoryID.ToString()
                };
                changes.Add(change);
                return(InsertInventory(session, inventoryID, inventoryDate, item, quantity, pallets, po, lot, shift, pallet, expirationDate, locationID, note));
            }

            //Dim inventoryRecord As SPG.InventoryRow = inventory(0)
            int  originalQuantity = 0;
            int  newQuantity      = 0;
            bool itemChanged      = false;

            //Dim originalRecord As Object() = inventoryRecord.ItemArray

            //inventoryRecord.InventoryDate = CDate(Format(inventoryDate, "D"))
            int originalItem = production.InventoryItemID.ItemID;

            if (originalItem != item)
            {
                itemChanged = true;
            }
            else
            {
                itemChanged = false;
            }
            //inventoryRecord.InventoryItemID = item
            originalQuantity = production.InventoryQuantity;
            newQuantity      = production.InventoryQuantity - quantity;
            //inventoryRecord.InventoryQuantity = quantity
            //inventoryRecord.InventoryPallets = pallets.Value
            //inventoryRecord.PO = po
            //inventoryRecord.Lot = lot
            //If shift.HasValue AndAlso shift.Value > 0 Then
            //    inventoryRecord.Shift = shift.Value
            //Else
            //    inventoryRecord.SetShiftNull()
            //End If
            //If pallet.HasValue AndAlso pallet.Value > 0 Then
            //    inventoryRecord.Pallet = pallet.Value
            //Else
            //    inventoryRecord.SetPalletNull()
            //End If
            //If expirationDate.HasValue Then
            //    inventoryRecord.ExpirationDate = expirationDate.Value
            //Else
            //    inventoryRecord.SetExpirationDateNull()
            //End If

            change = new Change()
            {
                PropertyName = Inventory.Fields.InventoryID.PropertyName,
                PrevValue    = production.InventoryID.ToString(),
                NewValue     = production.InventoryID.ToString()
            };
            changes.Add(change);
            SetInventoryFields(session, inventoryDate, item, quantity, pallets, po, lot, shift, pallet, expirationDate, locationID, note, production);

            //If Not IsNothing(originalRecord) Then
            //    Me.UpdateAuditTrail(inventoryRecord, originalRecord)
            //End If

            try
            {
                production.Save();
            }
            catch (Exception ex)
            {
                return(null);
            }

            UpdateAuditTrail();

            //Dim rowsAffected As Integer = Adapter.Update(inventoryRecord)

            //If rowsAffected = 1 Then
            ItemsBLL items = new ItemsBLL();

            //Dim inventoryBOM As InventoryBOMsBLL = New InventoryBOMsBLL
            if (itemChanged == true)
            {
                items.UpdateStock(session, originalItem, inventoryID, originalQuantity * -1, true, locationID);
                InventoryBOMsBLL.DeleteInventoryBOMByInventoryID(session, inventoryID);
                InventoryBOMsBLL.AddInventoryBOMByItemID(session, item, production);
                items.UpdateStock(session, item, quantity, true, locationID);
            }
            else
            {
                if (newQuantity != 0)                 //there was a change in the quantity
                {
                    items.UpdateStock(session, item, inventoryID, newQuantity * -1, true, locationID);
                }
            }
            //End If

            //Return rowsAffected = 1
            return(production);
        }
Пример #28
0
        public Inventory InsertInventory(Session session, int inventoryID, DateTime?inventoryDate, int?item, int?quantity, float?pallets, string po, string lot, int?shift, int?pallet, DateTime?expirationDate, int locationID, string note)
        {
            //Dim inventory As SPG.InventoryDataTable = New SPG.InventoryDataTable
            //Dim inventoryRecord As SPG.InventoryRow = inventory.NewInventoryRow()

            //inventoryRecord.InventoryID = inventoryID

            Inventory production = new Inventory(session)
            {
                InventoryID     = inventoryID,
                InventoryItemID = session.GetObjectByKey <Items>(item.Value)
            };

            //inventoryRecord.InventoryDate = CDate(Format(inventoryDate, "D"))
            //inventoryRecord.InventoryItemID = item.Value
            //inventoryRecord.InventoryQuantity = quantity.Value
            //inventoryRecord.InventoryPallets = pallets.Value
            //inventoryRecord.PO = po
            //inventoryRecord.Lot = lot
            //If shift.HasValue AndAlso shift.Value > 0 Then
            //    inventoryRecord.Shift = shift.Value
            //Else
            //    inventoryRecord.SetShiftNull()
            //End If
            if (pallet.HasValue == false || pallet.Value <= 0)
            {
                //    inventoryRecord.Pallet = pallet.Value
                //Else
                pallet = GetNewPalletNumber(session, Convert.ToDateTime(inventoryDate), item.Value, shift.Value);
            }
            //If expirationDate.HasValue() Then
            //    inventoryRecord.ExpirationDate = expirationDate.Value
            //Else
            //    inventoryRecord.SetExpirationDateNull()
            //End If
            SetInventoryFields(session, inventoryDate.Value, item.Value, quantity.Value, pallets, po, lot, shift, pallet, expirationDate, locationID, note, production);
            production.strEnteredBy = Properties.Settings.Default.UserName;
            production.dtmEnteredOn = DateTime.Now;

            try
            {
                production.Save();
            }
            catch (Exception ex)
            {
                return(null);
            }

            //inventory.AddInventoryRow(inventoryRecord)
            //Dim rowsAffected As Integer = Adapter.Update(inventory)

            //If rowsAffected = 1 Then
            ItemsBLL items = new ItemsBLL();

            items.UpdateStock(session, item.Value, quantity.Value, true, locationID);
            InventoryBOMsBLL inventoryBOM = new InventoryBOMsBLL();

            InventoryBOMsBLL.AddInventoryBOMByItemID(session, item.Value, production);
            //End If

            //Return rowsAffected = 1

            return(production);
        }
Пример #29
0
        public bool UpdateReturnDetails(Session session, int?detailID, int receivingID, int?itemID, string lot, int?quantity, int?units, float?pallets, string reason, DateTime?expirationDate)
        {
            if (!itemID.HasValue)
            {
                throw new ApplicationException("You must provide return item.");
            }

            if (!quantity.HasValue)
            {
                throw new ApplicationException("You must provide the Quantity returned.");
            }

            SPG.ReturnDetDataTable details = Adapter.GetReturnDetByID(detailID.Value);

            if (details.Count() == 0)
            {
                //It is a new Detail
                return(InsertDetails(session, receivingID, itemID, lot, quantity, units, pallets, reason, expirationDate));
            }

            SPG.ReturnDetRow returnDetail = details[0];
            int  originalItem             = 0;
            int  originalQuantity         = 0;
            int  newQuantity = 0;
            bool itemChanged = false;

            object[] originalRecord = returnDetail.ItemArray;

            originalItem = returnDetail.ReturnDetItemID;
            if (itemID.HasValue && originalItem != itemID.Value)
            {
                itemChanged = true;
            }
            returnDetail.ReturnDetItemID = itemID.Value;
            if (string.IsNullOrEmpty(lot))
            {
                returnDetail.SetReturnDetLotNull();
            }
            else
            {
                returnDetail.ReturnDetLot = lot;
            }
            originalQuantity          = returnDetail.ReturnDetQty;
            newQuantity               = returnDetail.ReturnDetQty - quantity.Value;
            returnDetail.ReturnDetQty = quantity.Value;
            if (!units.HasValue)
            {
                returnDetail.SetintUnitsNull();
            }
            else
            {
                returnDetail.intUnits = units.Value;
            }
            if (!pallets.HasValue)
            {
                returnDetail.SetsngPalletsNull();
            }
            else
            {
                returnDetail.sngPallets = pallets.Value;
            }
            if (string.IsNullOrEmpty(reason))
            {
                returnDetail.SetReasonNull();
            }
            else
            {
                returnDetail.Reason = reason;
            }
            if (expirationDate.HasValue)
            {
                returnDetail.ExpirationDate = expirationDate.Value;
            }
            else
            {
                returnDetail.SetExpirationDateNull();
            }

            if (!(originalRecord == null))
            {
                UpdateAuditTrail(returnDetail, originalRecord);
            }

            int rowsAffected = Adapter.Update(returnDetail);

            if (rowsAffected == 1)
            {
                ItemsBLL items      = new ItemsBLL();
                int      locationID = session.GetObjectByKey <Receiving>(receivingID).ReceivingLocation.Oid;
                if (itemChanged == true)
                {
                    items.UpdateStock(session, originalItem, originalQuantity * -1, false, locationID);
                    items.UpdateStock(session, itemID.Value, quantity.Value, false, locationID);
                }
                else
                {
                    if (newQuantity != 0)
                    {
                        items.UpdateStock(session, itemID.Value, newQuantity * -1, false, locationID);
                    }
                }
            }

            return(rowsAffected == 1);
        }
Пример #30
0
        public int UpdateReceivingDetails(Session session, int?detailID, int receivingID, int?itemID, string lot, int?quantity, int?units, int?LPN, DateTime?expirationDate)
        {
            if (!itemID.HasValue)
            {
                throw new ApplicationException("You must provide receiving item.");
            }

            if (!quantity.HasValue || !units.HasValue)
            {
                throw new ApplicationException("You must provide the amount of quamtity\\units received.");
            }

            if (LPN == null)
            {
                throw new ApplicationException("LPN is blank.");
            }

            Items item = session.GetObjectByKey <Items>(itemID.Value, true);

            if (!LotCodeValidator.ValidateByItem(item, lot, true))
            {
                throw new ApplicationException("Item " + item.ItemCode + " & lot # " + lot + " is invalid" + Environment.NewLine + "You must provide a valid lot.");
            }


            ReceivingDetail detail = session.GetObjectByKey <ReceivingDetail>(detailID);

            if (detail == null)
            {
                //It is a new Detail
                return(InsertDetails(session, receivingID, item, lot, quantity, units, LPN, expirationDate));
            }

            bool itemChanged = false;

            ReceivingDetail originalDetail = null;
            Cloner          cloner         = new Cloner();

            originalDetail = (ReceivingDetail)cloner.CloneTo(detail, typeof(ReceivingDetail));

            if (itemID.HasValue && originalDetail.ReceivDetItemID.ItemID != itemID)
            {
                itemChanged = true;
            }

            detail.ReceivDetItemID = item;
            detail.intUnits        = units.Value;
            detail.ReceivDetQty    = quantity.Value;
            detail.ExpirationDate  = expirationDate;
            detail.ReceivDetLPN    = LPN;
            detail.ReceivDetLot    = lot;


            if (!(originalDetail == null))
            {
                UpdateAuditTrail(detail, originalDetail);
            }

            session.Save(detail);

            if (!detail.Equals(originalDetail))
            {
                ItemsBLL items      = new ItemsBLL();
                int      locationID = session.GetObjectByKey <Receiving>(receivingID).ReceivingLocation.Oid;
                items.UpdateStock(session, originalDetail.ReceivDetItemID.ItemID, null, originalDetail.ReceivDetQty * -1, false, locationID, originalDetail.ReceivDetLot, LPN);

                items.UpdateStock(session, itemID.Value, quantity.Value, false, locationID, lot, LPN, expirationDate);
            }

            return(detail.ReceivDetID);
        }