Ejemplo n.º 1
0
        protected virtual IPhysicalInventoryLineStateCreated MapCreate(ICreatePhysicalInventoryLine c, IPhysicalInventoryCommand outerCommand, long version, IPhysicalInventoryState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new PhysicalInventoryLineEventId(c.PhysicalInventoryDocumentNumber, c.InventoryItemId, version);
            IPhysicalInventoryLineStateCreated e = NewPhysicalInventoryLineStateCreated(stateEventId);
            var s = outerState.PhysicalInventoryLines.Get(c.InventoryItemId, true);

            e.BookQuantity       = c.BookQuantity;
            e.CountedQuantity    = c.CountedQuantity;
            e.Processed          = c.Processed;
            e.LineNumber         = c.LineNumber;
            e.ReversalLineNumber = c.ReversalLineNumber;
            e.Description        = c.Description;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
Ejemplo n.º 2
0
        public virtual void When(IPhysicalInventoryLineStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.BookQuantity = (e.BookQuantity != null && e.BookQuantity.HasValue) ? e.BookQuantity.Value : default(decimal);

            this.CountedQuantity = (e.CountedQuantity != null && e.CountedQuantity.HasValue) ? e.CountedQuantity.Value : default(decimal);

            this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);

            this.LineNumber = e.LineNumber;

            this.ReversalLineNumber = (e.ReversalLineNumber != null && e.ReversalLineNumber.HasValue) ? e.ReversalLineNumber.Value : default(long);

            this.Description = e.Description;

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Ejemplo n.º 3
0
        protected virtual IPhysicalInventoryStateCreated Map(ICreatePhysicalInventory c)
        {
            var stateEventId = new PhysicalInventoryEventId(c.DocumentNumber, c.Version);
            IPhysicalInventoryStateCreated e = NewPhysicalInventoryStateCreated(stateEventId);

            NewPhysicalInventoryDocumentActionCommandAndExecute(c, _state, e);
            e.WarehouseId            = c.WarehouseId;
            e.LocatorIdPattern       = c.LocatorIdPattern;
            e.ProductIdPattern       = c.ProductIdPattern;
            e.Posted                 = c.Posted;
            e.Processed              = c.Processed;
            e.Processing             = c.Processing;
            e.DocumentTypeId         = c.DocumentTypeId;
            e.MovementDate           = c.MovementDate;
            e.Description            = c.Description;
            e.IsApproved             = c.IsApproved;
            e.ApprovalAmount         = c.ApprovalAmount;
            e.IsQuantityUpdated      = c.IsQuantityUpdated;
            e.ReversalDocumentNumber = c.ReversalDocumentNumber;
            e.Active                 = c.Active;
            e.CommandId              = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;

            foreach (ICreatePhysicalInventoryLine innerCommand in c.PhysicalInventoryLines)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IPhysicalInventoryLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddPhysicalInventoryLineEvent(innerEvent);
            }


            return(e);
        }
Ejemplo n.º 4
0
 void IPhysicalInventoryLineState.When(IPhysicalInventoryLineStateCreated e)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 5
0
 void IPhysicalInventoryStateCreated.AddPhysicalInventoryLineEvent(IPhysicalInventoryLineStateCreated e)
 {
     this._physicalInventoryLineEvents.AddPhysicalInventoryLineEvent(e);
 }
        public virtual PhysicalInventoryLineStateCreatedDto ToPhysicalInventoryLineStateCreatedDto(IPhysicalInventoryLineStateCreated e)
        {
            var dto = new PhysicalInventoryLineStateCreatedDto();

            dto.PhysicalInventoryLineEventId = e.PhysicalInventoryLineEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.Version            = e.Version;
            dto.CommandId          = e.CommandId;
            dto.BookQuantity       = e.BookQuantity;
            dto.CountedQuantity    = e.CountedQuantity;
            dto.Processed          = e.Processed;
            dto.LineNumber         = e.LineNumber;
            dto.ReversalLineNumber = e.ReversalLineNumber;
            dto.Description        = e.Description;
            return(dto);
        }
Ejemplo n.º 7
0
 public virtual void AddPhysicalInventoryLineEvent(IPhysicalInventoryLineStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._physicalInventoryLineEvents[e.PhysicalInventoryLineEventId] = e;
 }