Beispiel #1
0
        public virtual ActionResult ManagePickingArea(string areaId)
        {
            if (string.IsNullOrEmpty(areaId))
            {
                return(Index());
            }
            var area = _service.GetPickingArea(areaId);

            if (area == null)
            {
                ModelState.AddModelError("", string.Format("Area {0} not found.", areaId));
                return(Index());
            }
            var locations = _service.GetPickingAreaLocations(areaId, 500);

            if (locations.Count == 0)
            {
                ModelState.AddModelError("", string.Format("No location in area {0}.", areaId));
                return(RedirectToAction(this.Actions.PickingArea(area.BuildingId)));
            }
            var model = new ManagePickingAreaViewModel
            {
                Matrix           = new PickingAreaLocationCountMatrixViewModel(area),
                AreaId           = areaId,
                ShortName        = area.ShortName,
                BuildingId       = area.BuildingId,
                PickingLocations = (from item in locations
                                    select new PickingLocationModel(item)).ToArray(),
                CountTotalLocations = locations.Select(p => p.CountTotalLocations).First()
            };

            return(View(Views.ManagePickingArea, model));
        }
Beispiel #2
0
        public virtual ActionResult ApplyPickingAreaLocationFilter(string areaId, bool?assignedLocation, bool?emptyLocations, int?assignedSkuId, string locationId)
        {
            if (string.IsNullOrWhiteSpace(areaId))
            {
                return(RedirectToAction(Actions.Index()));
            }
            var area = _service.GetPickingArea(areaId);

            if (area == null)
            {
                ModelState.AddModelError("", string.Format("Area {0} not found.", areaId));
                return(Index());
            }
            var model = new ManagePickingAreaViewModel
            {
                Matrix     = new PickingAreaLocationCountMatrixViewModel(area),
                AreaId     = areaId,
                ShortName  = area.ShortName,
                BuildingId = area.BuildingId
            };

            model.Matrix.AssignedLocationsFilter = assignedLocation;
            model.Matrix.EmptyLocationsFilter    = emptyLocations;
            var locations = _service.GetPickingAreaLocationsOfFilters(areaId, assignedLocation, emptyLocations, assignedSkuId, locationId, 500);

            model.PickingLocations = (from item in locations
                                      select new PickingLocationModel(item)).ToArray();
            if (locations.Count > 0)
            {
                model.CountTotalLocations = locations.Select(p => p.CountTotalLocations).First();
            }
            if (assignedSkuId != null)
            {
                var sku = _service.GetSku(assignedSkuId.Value);
                model.AssignedToSkuFilter = new PickingAreaSkuModel
                {
                    Style     = sku.Style,
                    Color     = sku.Color,
                    Dimension = sku.Dimension,
                    SkuSize   = sku.SkuSize,
                    UpcCode   = sku.UpcCode
                };
            }
            if (!string.IsNullOrWhiteSpace(locationId))
            {
                model.LocationPatternFilter = locationId;
            }
            return(View(Views.ManagePickingArea, model));
        }