示例#1
0
        public virtual IPhysicalInventoryLineState ToPhysicalInventoryLineState()
        {
            var state = new PhysicalInventoryLineState(true);

            state.InventoryItemId = this.InventoryItemId;
            if (this.BookQuantity != null && this.BookQuantity.HasValue)
            {
                state.BookQuantity = this.BookQuantity.Value;
            }
            if (this.CountedQuantity != null && this.CountedQuantity.HasValue)
            {
                state.CountedQuantity = this.CountedQuantity.Value;
            }
            if (this.Processed != null && this.Processed.HasValue)
            {
                state.Processed = this.Processed.Value;
            }
            state.LineNumber = this.LineNumber;
            if (this.ReversalLineNumber != null && this.ReversalLineNumber.HasValue)
            {
                state.ReversalLineNumber = this.ReversalLineNumber.Value;
            }
            state.Description = this.Description;
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.PhysicalInventoryDocumentNumber = this.PhysicalInventoryDocumentNumber;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
示例#2
0
        public virtual IPhysicalInventoryLineState Get(InventoryItemId inventoryItemId, bool forCreation, bool nullAllowed)
        {
            PhysicalInventoryLineId globalId = new PhysicalInventoryLineId(_physicalInventoryState.DocumentNumber, inventoryItemId);

            if (_loadedPhysicalInventoryLineStates.ContainsKey(globalId))
            {
                var state = _loadedPhysicalInventoryLineStates[globalId];
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new PhysicalInventoryLineState(ForReapplying);
                state.PhysicalInventoryLineId = globalId;
                _loadedPhysicalInventoryLineStates.Add(globalId, state);
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = PhysicalInventoryLineStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedPhysicalInventoryLineStates.Add(globalId, state);
                }
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
        }
示例#3
0
 public static CreatePhysicalInventoryLine ToCreatePhysicalInventoryLine(this PhysicalInventoryLineState state)
 {
     return(state.ToCreatePhysicalInventoryLine <CreatePhysicalInventoryLine>());
 }
示例#4
0
 public static MergePatchPhysicalInventoryLine ToMergePatchPhysicalInventoryLine(this PhysicalInventoryLineState state)
 {
     return(state.ToMergePatchPhysicalInventoryLine <MergePatchPhysicalInventoryLine>());
 }
示例#5
0
 public static RemovePhysicalInventoryLine ToRemovePhysicalInventoryLine(this PhysicalInventoryLineState state)
 {
     return(state.ToRemovePhysicalInventoryLine <RemovePhysicalInventoryLine>());
 }
示例#6
0
 public static IPhysicalInventoryLineCommand ToCreateOrMergePatchPhysicalInventoryLine(this PhysicalInventoryLineState state)
 {
     return(state.ToCreateOrMergePatchPhysicalInventoryLine <CreatePhysicalInventoryLine, MergePatchPhysicalInventoryLine>());
 }