Beispiel #1
0
        public virtual ActionResult PartialPickPallet(MasterModelWithPallet model)
        {
            Contract.Requires(this.ModelState.IsValid, "Attributes should prevent invalid model from invoking this action");

            PartialPickPalletViewModel cpvm = new PartialPickPalletViewModel(this.Session);

            cpvm.Sound = 'W';
            return(View(cpvm));
        }
Beispiel #2
0
        public virtual ActionResult PartialPickPalletConfirm(PartialPickPalletViewModel model)
        {
            Contract.Requires(this.ModelState.IsValid, "Attributes should prevent invalid model from invoking this action");
            //TC 25 : Enter empty on confirm Pallet Screen
            if (string.IsNullOrWhiteSpace(model.ConfirmPalletId))
            {
                this.AddStatusMessage("Pallet skipping cancelled");
                return(RedirectToAction(MVC_BoxPick.BoxPick.Home.AcceptCarton()));
            }
            //TC 26 : Enter a different pallet Id on confirm Pallet screen
            if (!model.CurrentPalletId.Equals(model.ConfirmPalletId))
            {
                ModelState.AddModelError("", "The confirmation pallet did not match the original pallet.");
            }

            if (!ModelState.IsValid)
            {
                // Rescan does not match original pallet
                return(RedirectToAction(MVC_BoxPick.BoxPick.Home.AcceptCarton()));
            }
            try
            {
                var removed = _repos.Value.RemoveRemainingBoxesFromPallet(model.ConfirmPalletId);
                this.AddStatusMessage(string.Format("{0} boxes removed from Pallet {1}. Scan new Pallet.",
                                                    removed, model.ConfirmPalletId));

                switch (model.PickMode)
                {
                case PickModeType.ADR:
                    model.Map(null);
                    return(RedirectToAction(this.Actions.Print(model.ConfirmPalletId)));

                case PickModeType.ADREPPWSS:
                    return(RedirectToAction(MVC_BoxPick.BoxPick.Home.AcceptPallet()));

                default:
                    throw new NotImplementedException();
                }
            }
            catch (DbException ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            return(RedirectToAction(MVC_BoxPick.BoxPick.Home.AcceptCarton()));
        }