Example #1
0
        public virtual ActionResult WaveSkus(int bucketId)
        {
            var bucket  = _service.Value.GetBucket(bucketId);
            var skuList = _service.Value.GetBucketSkuList(bucketId);
            var query   = (from item in skuList
                           select new
            {
                BucketSku = item,
                //Activities = item.Activities.Select(p => new BucketActivityModel(p)),
                //  .Where(p => p.PiecesComplete > 0 || p.PiecesRemaining > 0),
                Areas = item.BucketSkuInAreas.Select(p => p.InventoryArea)
            }).ToList();

            var allAreas = (from sku in skuList
                            from area in sku.BucketSkuInAreas
                            where !string.IsNullOrWhiteSpace(area.InventoryArea.AreaId)
                            select new InventoryAreaModel(area.InventoryArea)
                            ).Distinct(InventoryAreaModelComparer.Instance).ToList();

            var model = new WaveSkuListModel
            {
                Bucket        = new BucketModel(bucket, _service.Value.GetCustomerName(bucket.MaxCustomerId), BucketModelFlags.HideViewerLink),
                BucketSkuList = (from sku in query
                                 select new BucketSkuModel(sku.BucketSku)
                {
                    InventoryByArea = (from area in allAreas
                                       join item in sku.BucketSku.BucketSkuInAreas on area.AreaId equals item.InventoryArea.AreaId into gj
                                       from subitem in gj.DefaultIfEmpty()
                                       select new BucketSkuAreaModel
                    {
                        AreaId = area.AreaId,
                        ShortName = area.ShortName,
                        BuildingId = area.BuildingId,
                        Description = area.Description,
                        BestLocationId = subitem == null ? null : subitem.BestLocationId,
                        InventoryPieces = subitem == null || subitem.InventoryPieces == 0 ? (int?)null : subitem.InventoryPieces,
                        PiecesAtBestLocation = subitem == null ? (int?)null : subitem.PiecesAtBestLocation
                    }).ToList(),
                    //Activities = sku.Activities.ToList()
                })
                                //.OrderBy(p => p.PercentCurrentPieces)
                                .OrderBy(p => p.Style)
                                .ThenBy(p => p.Color)
                                .ThenBy(p => p.Dimension)
                                .ThenBy(p => p.SkuSize)
                                .ToArray(),
                AllAreas = allAreas,
            };

            //return PartialView(this.Views._waveSkusPartial, model);
            return(View(Views.WaveSku, model));
        }
Example #2
0
        public virtual ActionResult WaveSkus(int bucketId)
        {
            var skuList = (from item in _service.GetBucketSkuList(bucketId)
                           select new
            {
                BucketSku = item,
                Activities = item.Activities.Select(p => new BucketActivityModel(p))
                             .Where(p => p.PiecesComplete > 0 || p.PiecesIncomplete > 0),
                Areas = item.BucketSkuInAreas.Select(p => p.InventoryArea)
            }).ToArray();

            var allAreas = (from sku in skuList
                            from area in sku.Areas
                            where !string.IsNullOrWhiteSpace(area.AreaId)
                            select new InventoryAreaModel(area)
                            ).Distinct(InventoryAreaModelComparer.Instance).ToArray();

            var model = new WaveSkuListModel
            {
                BucketSkuList = (from sku in skuList
                                 select new BucketSkuModel
                {
                    Style = sku.BucketSku.Sku.Style,
                    Color = sku.BucketSku.Sku.Color,
                    Dimension = sku.BucketSku.Sku.Dimension,
                    SkuSize = sku.BucketSku.Sku.SkuSize,
                    UpcCode = sku.BucketSku.Sku.UpcCode,
                    SkuId = sku.BucketSku.Sku.SkuId,
                    VwhId = sku.BucketSku.Sku.VwhId,
                    VolumePerDozen = sku.BucketSku.Sku.VolumePerDozen,
                    WeightPerDozen = sku.BucketSku.Sku.WeightPerDozen,
                    OrderedPieces = sku.BucketSku.QuantityOrdered,
                    IsAssignedSku = sku.BucketSku.IsPitchingBucket ? sku.BucketSku.Sku.IsAssignedSku : true,
                    InventoryByArea = (from area in allAreas
                                       join item in sku.BucketSku.BucketSkuInAreas on area.AreaId equals item.InventoryArea.AreaId into gj
                                       from subitem in gj.DefaultIfEmpty()
                                       select new BucketSkuAreaModel
                    {
                        AreaId = area.AreaId,
                        ShortName = area.ShortName,
                        BuildingId = area.BuildingId,
                        Description = area.Description,
                        InventoryPieces = subitem == null || subitem.InventoryPieces == 0 ? (int?)null : subitem.InventoryPieces,
                        QuantityInSmallestCarton = subitem == null ? (int?)null : subitem.PiecesInSmallestCarton
                    }).ToArray(),
                    Activities = sku.Activities.ToArray()
                })
                                .OrderBy(p => p.PercentCurrentPieces)
                                .ThenBy(p => p.Style)
                                .ThenBy(p => p.Color)
                                .ThenBy(p => p.Dimension)
                                .ThenBy(p => p.SkuSize)
                                .ToArray(),
                AllAreas = allAreas,
                BucketId = bucketId,
                //StateFilter = stateFilter,
                //ActivityFilter = activityFilter
            };

            return(PartialView(this.Views._waveSkusPartial, model));
        }