コード例 #1
0
        private void uxButtonContinuePhysical_Click(object sender, EventArgs e)
        {
            try
            {
                DataSetPhysicalInventory dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData);

                EmployeeTableAdapter taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter);
                taEmployee.Fill(dsPhysicalInventory.Employee, uxTextBoxPassword.Text);
                string    OperatorCode;
                Exception ex = null;
                switch (dsPhysicalInventory.Employee.Rows.Count)
                {
                case 1:
                    OperatorCode = dsPhysicalInventory.Employee[0].OperatorCode;
                    break;

                case 0:
                    ex = new Exception("Invalid password.");
                    uxTextBoxPassword.Focus();
                    throw ex;

                default:
                    ex = new Exception("Unknown error validating password.");
                    uxTextBoxPassword.Focus();
                    throw ex;
                }

                PhysicalProgressTableAdapter taPhysicalProgressTableAdapter = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter);
                BeginPhysicalAisle    = uxCBAisle.Text;
                BeginPhysicalShelf    = Int32.Parse(uxCBShelf.Text);
                BeginPhysicalSubshelf = Int32.Parse(uxCBSubshelf.Text);

                cache.RemoveObject(CacheAddress.BeginPhysicalAisle);
                cache.RemoveObject(CacheAddress.BeginPhysicalShelf);
                cache.RemoveObject(CacheAddress.BeginPhysicalSubshelf);
                cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle);
                cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf);
                cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf);

                //  Continue cycle count for specified address.
                taPhysicalProgressTableAdapter.Fill(dsPhysicalInventory.PhysicalProgress, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf);
                cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory);

                Application.Run(new frmScanToLocation());
            }
            catch (SqlException ex)
            {
                foreach (SqlError SQLErr in ex.Errors)
                {
                    MessageBox.Show(SQLErr.Message);
                }
            }
            catch (Exception ex)
            {
                //  Getting exception when loading frmScanToLocation.
                //MessageBox.Show (ex.Message);
            }
        }
コード例 #2
0
        void RefreshProgress()
        {
            try
            {
                Exception ex;

                PutAwayAisle = uxCBAisle.Text;
                PutAwayShelf = Int32.Parse(uxCBShelf.Text);
                if (!(PutAwayShelf > 0))
                {
                    ex = new Exception("Shelf not selected.");
                    uxCBShelf.Focus();
                    throw ex;
                }
                PutAwaySubshelf = Int32.Parse(uxCBSubshelf.Text);
                if (!(PutAwaySubshelf > 0))
                {
                    ex = new Exception("Subshelf not selected.");
                    uxCBSubshelf.Focus();
                    throw ex;
                }

                taPhysicalProgress.Fill(dsPhysicalInventory.PhysicalProgress, PutAwayAisle, PutAwayShelf, PutAwaySubshelf);
                uxGridProgress.DataSource = taPhysicalProgress.GetPhysicalProgressByAddress(PutAwayAisle, PutAwayShelf, PutAwaySubshelf);

                taPhysicalProgressSummary.Fill(dsPhysicalInventory.PhysicalProgressSummary, PutAwayAisle, PutAwayShelf, PutAwaySubshelf);
                switch (dsPhysicalInventory.PhysicalProgressSummary.Rows.Count)
                {
                case 1:
                    uxLabelProgress.Text = dsPhysicalInventory.PhysicalProgressSummary[0].FoundCount.ToString() + " Found, " +
                                           dsPhysicalInventory.PhysicalProgressSummary[0].MissingCount.ToString() + " Missing, " +
                                           dsPhysicalInventory.PhysicalProgressSummary[0].TotalCount.ToString() + " Total";
                    break;

                default:
                    ex = new Exception("Unable to retrieve summary.");
                    throw ex;
                }
            }
            catch (SqlException ex)
            {
                foreach (SqlError SQLErr in ex.Errors)
                {
                    MessageBox.Show(SQLErr.Message);
                }
            }
        }
コード例 #3
0
        private void uxButtonBeginPhysical_Click(object sender, EventArgs e)
        {
            try
            {
                DataSetPhysicalInventory dsPhysicalInventory = (DataSetPhysicalInventory)cache.RetrieveObject(CacheAddress.PhysicalInventoryData);

                EmployeeTableAdapter taEmployee = (EmployeeTableAdapter)cache.RetrieveObject(CacheAddress.EmployeeTableAdapter);
                taEmployee.Fill(dsPhysicalInventory.Employee, uxTextBoxPassword.Text);
                string    OperatorCode;
                Exception ex = null;
                switch (dsPhysicalInventory.Employee.Rows.Count)
                {
                case 1:
                    OperatorCode = dsPhysicalInventory.Employee [0].OperatorCode;
                    break;

                case 0:
                    ex = new Exception("Invalid password.");
                    uxTextBoxPassword.Focus();
                    throw ex;

                default:
                    ex = new Exception("Unknown error validating password.");
                    uxTextBoxPassword.Focus();
                    throw ex;
                }

                PhysicalProgressTableAdapter taPhysicalProgressTableAdapter = (PhysicalProgressTableAdapter)cache.RetrieveObject(CacheAddress.PhysicalProgressTableAdapter);
                BeginPhysicalAisle    = uxCBAisle.Text;
                BeginPhysicalShelf    = Int32.Parse(uxCBShelf.Text);
                BeginPhysicalSubshelf = Int32.Parse(uxCBSubshelf.Text);

                //  Validate before continuing.
                string ValidationMessage = OperatorCode + " will initiate a cycle count on aisle " + BeginPhysicalAisle;
                if (BeginPhysicalShelf == 0)
                {
                    ValidationMessage += " all shelves and";
                }
                else
                {
                    ValidationMessage += " shelf " + BeginPhysicalShelf.ToString() + " and";
                }
                if (BeginPhysicalSubshelf == 0)
                {
                    ValidationMessage += " all positions.";
                }
                else
                {
                    ValidationMessage += " position " + BeginPhysicalSubshelf.ToString() + ".";
                }
                if (MessageBox.Show(ValidationMessage, "Confirmation",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                {
                    ex = new Exception("Operation cancelled.");
                    uxCBAisle.Focus();
                    throw ex;
                }
                cache.RemoveObject(CacheAddress.BeginPhysicalAisle);
                cache.RemoveObject(CacheAddress.BeginPhysicalShelf);
                cache.RemoveObject(CacheAddress.BeginPhysicalSubshelf);
                cache.AddObject(CacheAddress.BeginPhysicalAisle, BeginPhysicalAisle);
                cache.AddObject(CacheAddress.BeginPhysicalShelf, BeginPhysicalShelf);
                cache.AddObject(CacheAddress.BeginPhysicalSubshelf, BeginPhysicalSubshelf);

                //  Begin cycle count for specified address.
                Int32 Result;
                taPhysicalProgressTableAdapter.BeginPhysical_ByAddress(OperatorCode, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf, out Result);
                taPhysicalProgressTableAdapter.Fill(dsPhysicalInventory.PhysicalProgress, BeginPhysicalAisle, BeginPhysicalShelf, BeginPhysicalSubshelf);
                cache.AddObject(CacheAddress.PhysicalInventoryData, dsPhysicalInventory);

                Application.Run(new frmScanToLocation());
            }
            catch (SqlException ex)
            {
                foreach (SqlError SQLErr in ex.Errors)
                {
                    MessageBox.Show(SQLErr.Message);
                }
            }
            catch (Exception ex)
            {
                //  Getting exception when loading frmScanToLocation.
                //MessageBox.Show (ex.Message);
            }
        }