Beispiel #1
0
        internal BucketActivityModel(BucketActivity entity)
        {
            ActivityType     = entity.ActivityType;
            AreaId           = entity.Area.AreaId;
            AreaShortName    = string.IsNullOrWhiteSpace(entity.Area.ShortName) ? entity.Area.AreaId : entity.Area.ShortName;
            AreaDescription  = entity.Area.Description;
            BuildingId       = entity.Area.BuildingId;
            ReplenishAreaId  = entity.Area.ReplenishAreaId;
            PickingDateRange = new DateRange
            {
                From     = entity.MinEndDate,
                To       = entity.MaxEndDate,
                ShowTime = true
            };

            PiecesComplete     = entity.Stats[BoxState.Completed | BoxState.InProgress, PiecesKind.Current] ?? 0;
            PiecesIncomplete   = (entity.Stats[BoxState.InProgress, PiecesKind.Expected] ?? 0) - (entity.Stats[BoxState.InProgress, PiecesKind.Current] ?? 0);
            PiecesBoxesCreated = entity.Stats[BoxState.Cancelled | BoxState.InProgress | BoxState.Completed, PiecesKind.Expected] ?? 0;

            var pcs = (entity.Stats[BoxState.Completed, PiecesKind.Expected] ?? 0) - (entity.Stats[BoxState.Completed, PiecesKind.Current] ?? 0);

            if (pcs > 0)
            {
                UnderPickedPieces = pcs;
            }
            pcs = entity.Stats[BoxState.Cancelled, PiecesKind.Expected] ?? 0;
            if (pcs > 0)
            {
                CancelledPieces = pcs;
            }
        }
Beispiel #2
0
        internal BucketActivityModel(BucketActivity entity)
        {
            ActivityType    = entity.ActivityType;
            AreaId          = entity.Area.AreaId;
            AreaShortName   = string.IsNullOrWhiteSpace(entity.Area.ShortName) ? entity.Area.AreaId : entity.Area.ShortName;
            AreaDescription = entity.Area.Description;
            BuildingId      = entity.Area.BuildingId;
            ReplenishAreaId = entity.Area.ReplenishAreaId;
            if (entity.MinEndDate.HasValue || entity.MaxEndDate.HasValue)
            {
                PickingDateRange = new DateRange
                {
                    From     = entity.MinEndDate,
                    To       = entity.MaxEndDate,
                    ShowTime = true
                };
            }

            PiecesInProgressExpected = entity.Stats[PiecesKind.Expected, BoxState.InProgress];
            PiecesInProgressCurrent  = entity.Stats[PiecesKind.Current, BoxState.InProgress];

            PiecesComplete = entity.Stats[PiecesKind.Current, BoxState.Completed];

            PiecesNotStarted = entity.Stats[PiecesKind.Expected, BoxState.NotStarted];

            PiecesRemaining = new[] {
                entity.Stats[PiecesKind.Expected, BoxState.InProgress],
                entity.Stats[PiecesKind.Expected, BoxState.NotStarted],
                -entity.Stats[PiecesKind.Current, BoxState.InProgress],
                -entity.Stats[PiecesKind.Current, BoxState.NotStarted]
            }.Sum();



            PiecesCancelled = new[] {
                entity.Stats[PiecesKind.Expected, BoxState.Cancelled],
                entity.Stats[PiecesKind.Expected, BoxState.Completed],
                -entity.Stats[PiecesKind.Current, BoxState.Completed],
            }.Sum();


            PiecesBoxesCreated = new[] {
                entity.Stats[PiecesKind.Expected, BoxState.InProgress],
                entity.Stats[PiecesKind.Expected, BoxState.Completed],
                entity.Stats[PiecesKind.Expected, BoxState.NotStarted],
                entity.Stats[PiecesKind.Expected, BoxState.Cancelled]
            }.Sum();

            BoxesInprogress = entity.Stats.GetBoxCounts(new[] { BoxState.InProgress });

            BoxesCancelled = entity.Stats.GetBoxCounts(new[] { BoxState.Cancelled });

            BoxesNotStarted = entity.Stats.GetBoxCounts(new[] { BoxState.NotStarted });

            BoxesComplete = entity.Stats.GetBoxCounts(new[] { BoxState.Completed }) ?? 0;

            BoxesRemaining = (entity.Stats.GetBoxCounts(new[] { BoxState.InProgress, BoxState.NotStarted }) ?? 0);
        }