Пример #1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IInOutLineStateMergePatched MapMergePatch(IMergePatchInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new InOutLineStateEventId(c.InOutDocumentNumber, c.SkuId, version);
            IInOutLineStateMergePatched e = NewInOutLineStateMergePatched(stateEventId);
            var s = outerState.InOutLines.Get(c.SkuId);

            e.LineNumber                              = c.LineNumber;
            e.Description                             = c.Description;
            e.LocatorId                               = c.LocatorId;
            e.Product                                 = c.Product;
            e.UomId                                   = c.UomId;
            e.MovementQuantity                        = c.MovementQuantity;
            e.ConfirmedQuantity                       = c.ConfirmedQuantity;
            e.ScrappedQuantity                        = c.ScrappedQuantity;
            e.TargetQuantity                          = c.TargetQuantity;
            e.PickedQuantity                          = c.PickedQuantity;
            e.IsInvoiced                              = c.IsInvoiced;
            e.AttributeSetInstanceId                  = c.AttributeSetInstanceId;
            e.IsDescription                           = c.IsDescription;
            e.Processed                               = c.Processed;
            e.QuantityEntered                         = c.QuantityEntered;
            e.RmaLineNumber                           = c.RmaLineNumber;
            e.ReversalLineNumber                      = c.ReversalLineNumber;
            e.Active                                  = c.Active;
            e.IsPropertyLineNumberRemoved             = c.IsPropertyLineNumberRemoved;
            e.IsPropertyDescriptionRemoved            = c.IsPropertyDescriptionRemoved;
            e.IsPropertyLocatorIdRemoved              = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyProductRemoved                = c.IsPropertyProductRemoved;
            e.IsPropertyUomIdRemoved                  = c.IsPropertyUomIdRemoved;
            e.IsPropertyMovementQuantityRemoved       = c.IsPropertyMovementQuantityRemoved;
            e.IsPropertyConfirmedQuantityRemoved      = c.IsPropertyConfirmedQuantityRemoved;
            e.IsPropertyScrappedQuantityRemoved       = c.IsPropertyScrappedQuantityRemoved;
            e.IsPropertyTargetQuantityRemoved         = c.IsPropertyTargetQuantityRemoved;
            e.IsPropertyPickedQuantityRemoved         = c.IsPropertyPickedQuantityRemoved;
            e.IsPropertyIsInvoicedRemoved             = c.IsPropertyIsInvoicedRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyIsDescriptionRemoved          = c.IsPropertyIsDescriptionRemoved;
            e.IsPropertyProcessedRemoved              = c.IsPropertyProcessedRemoved;
            e.IsPropertyQuantityEnteredRemoved        = c.IsPropertyQuantityEnteredRemoved;
            e.IsPropertyRmaLineNumberRemoved          = c.IsPropertyRmaLineNumberRemoved;
            e.IsPropertyReversalLineNumberRemoved     = c.IsPropertyReversalLineNumberRemoved;
            e.IsPropertyActiveRemoved                 = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Пример #2
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IInOutLineStateMergePatched MapMergePatch(IMergePatchInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new InOutLineEventId(c.InOutDocumentNumber, c.LineNumber, version);
            IInOutLineStateMergePatched e = NewInOutLineStateMergePatched(stateEventId);
            var s = outerState.InOutLines.Get(c.LineNumber);

            e.LocatorId = c.LocatorId;
            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.DamageStatusIds        = c.DamageStatusIds;
            e.Description            = c.Description;
            e.QuantityUomId          = c.QuantityUomId;
            e.MovementQuantity       = c.MovementQuantity;
            e.PickedQuantity         = c.PickedQuantity;
            e.IsInvoiced             = c.IsInvoiced;
            e.Processed                  = c.Processed;
            e.RmaLineNumber              = c.RmaLineNumber;
            e.ReversalLineNumber         = c.ReversalLineNumber;
            e.Active                     = c.Active;
            e.IsPropertyLocatorIdRemoved = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyDamageStatusIdsRemoved        = c.IsPropertyDamageStatusIdsRemoved;
            e.IsPropertyDescriptionRemoved            = c.IsPropertyDescriptionRemoved;
            e.IsPropertyQuantityUomIdRemoved          = c.IsPropertyQuantityUomIdRemoved;
            e.IsPropertyMovementQuantityRemoved       = c.IsPropertyMovementQuantityRemoved;
            e.IsPropertyPickedQuantityRemoved         = c.IsPropertyPickedQuantityRemoved;
            e.IsPropertyIsInvoicedRemoved             = c.IsPropertyIsInvoicedRemoved;
            e.IsPropertyProcessedRemoved          = c.IsPropertyProcessedRemoved;
            e.IsPropertyRmaLineNumberRemoved      = c.IsPropertyRmaLineNumberRemoved;
            e.IsPropertyReversalLineNumberRemoved = c.IsPropertyReversalLineNumberRemoved;
            e.IsPropertyActiveRemoved             = c.IsPropertyActiveRemoved;

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

            foreach (IInOutLineImageCommand innerCommand in c.InOutLineImageCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IInOutLineImageEvent innerEvent = Map(innerCommand, c, version, s);
                e.AddInOutLineImageEvent(innerEvent);
            }

            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Пример #3
0
        public virtual InOutLineStateMergePatchedDto ToInOutLineStateMergePatchedDto(IInOutLineStateMergePatched e)
        {
            var dto = new InOutLineStateMergePatchedDto();

            dto.InOutLineEventId       = e.InOutLineEventId;
            dto.CreatedAt              = e.CreatedAt;
            dto.CreatedBy              = e.CreatedBy;
            dto.Version                = e.Version;
            dto.CommandId              = e.CommandId;
            dto.LocatorId              = e.LocatorId;
            dto.ProductId              = e.ProductId;
            dto.AttributeSetInstanceId = e.AttributeSetInstanceId;
            dto.Description            = e.Description;
            dto.QuantityUomId          = e.QuantityUomId;
            dto.MovementQuantity       = e.MovementQuantity;
            dto.PickedQuantity         = e.PickedQuantity;
            dto.IsInvoiced             = e.IsInvoiced;
            dto.Processed              = e.Processed;
            dto.RmaLineNumber          = e.RmaLineNumber;
            dto.ReversalLineNumber     = e.ReversalLineNumber;
            dto.Active                     = e.Active;
            dto.DamageStatusIds            = e.DamageStatusIds.ToArray();
            dto.IsPropertyLocatorIdRemoved = e.IsPropertyLocatorIdRemoved;
            dto.IsPropertyProductIdRemoved = e.IsPropertyProductIdRemoved;
            dto.IsPropertyAttributeSetInstanceIdRemoved = e.IsPropertyAttributeSetInstanceIdRemoved;
            dto.IsPropertyDamageStatusIdsRemoved        = e.IsPropertyDamageStatusIdsRemoved;
            dto.IsPropertyDescriptionRemoved            = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyQuantityUomIdRemoved          = e.IsPropertyQuantityUomIdRemoved;
            dto.IsPropertyMovementQuantityRemoved       = e.IsPropertyMovementQuantityRemoved;
            dto.IsPropertyPickedQuantityRemoved         = e.IsPropertyPickedQuantityRemoved;
            dto.IsPropertyIsInvoicedRemoved             = e.IsPropertyIsInvoicedRemoved;
            dto.IsPropertyProcessedRemoved          = e.IsPropertyProcessedRemoved;
            dto.IsPropertyRmaLineNumberRemoved      = e.IsPropertyRmaLineNumberRemoved;
            dto.IsPropertyReversalLineNumberRemoved = e.IsPropertyReversalLineNumberRemoved;
            dto.IsPropertyActiveRemoved             = e.IsPropertyActiveRemoved;
            var inOutLineImageEvents = new List <InOutLineImageStateCreatedOrMergePatchedOrRemovedDto>();

            foreach (var ee in e.InOutLineImageEvents)
            {
                InOutLineImageStateCreatedOrMergePatchedOrRemovedDto eeDto = InOutLineImageStateEventDtoConverter.ToInOutLineImageStateEventDto(ee);
                inOutLineImageEvents.Add(eeDto);
            }
            dto.InOutLineImageEvents = inOutLineImageEvents.ToArray();


            return(dto);
        }
Пример #4
0
        public virtual InOutLineStateMergePatchedDto ToInOutLineStateMergePatchedDto(IInOutLineStateMergePatched e)
        {
            var dto = new InOutLineStateMergePatchedDto();

            dto.StateEventId                            = new InOutLineStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt                               = e.CreatedAt;
            dto.CreatedBy                               = e.CreatedBy;
            dto.Version                                 = e.Version;
            dto.CommandId                               = e.CommandId;
            dto.Description                             = e.Description;
            dto.LocatorId                               = e.LocatorId;
            dto.ProductId                               = e.ProductId;
            dto.UomId                                   = e.UomId;
            dto.MovementQuantity                        = e.MovementQuantity;
            dto.ConfirmedQuantity                       = e.ConfirmedQuantity;
            dto.ScrappedQuantity                        = e.ScrappedQuantity;
            dto.TargetQuantity                          = e.TargetQuantity;
            dto.PickedQuantity                          = e.PickedQuantity;
            dto.IsInvoiced                              = e.IsInvoiced;
            dto.AttributeSetInstanceId                  = e.AttributeSetInstanceId;
            dto.IsDescription                           = e.IsDescription;
            dto.Processed                               = e.Processed;
            dto.QuantityEntered                         = e.QuantityEntered;
            dto.RmaLineNumber                           = e.RmaLineNumber;
            dto.ReversalLineNumber                      = e.ReversalLineNumber;
            dto.Active                                  = e.Active;
            dto.IsPropertyDescriptionRemoved            = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyLocatorIdRemoved              = e.IsPropertyLocatorIdRemoved;
            dto.IsPropertyProductIdRemoved              = e.IsPropertyProductIdRemoved;
            dto.IsPropertyUomIdRemoved                  = e.IsPropertyUomIdRemoved;
            dto.IsPropertyMovementQuantityRemoved       = e.IsPropertyMovementQuantityRemoved;
            dto.IsPropertyConfirmedQuantityRemoved      = e.IsPropertyConfirmedQuantityRemoved;
            dto.IsPropertyScrappedQuantityRemoved       = e.IsPropertyScrappedQuantityRemoved;
            dto.IsPropertyTargetQuantityRemoved         = e.IsPropertyTargetQuantityRemoved;
            dto.IsPropertyPickedQuantityRemoved         = e.IsPropertyPickedQuantityRemoved;
            dto.IsPropertyIsInvoicedRemoved             = e.IsPropertyIsInvoicedRemoved;
            dto.IsPropertyAttributeSetInstanceIdRemoved = e.IsPropertyAttributeSetInstanceIdRemoved;
            dto.IsPropertyIsDescriptionRemoved          = e.IsPropertyIsDescriptionRemoved;
            dto.IsPropertyProcessedRemoved              = e.IsPropertyProcessedRemoved;
            dto.IsPropertyQuantityEnteredRemoved        = e.IsPropertyQuantityEnteredRemoved;
            dto.IsPropertyRmaLineNumberRemoved          = e.IsPropertyRmaLineNumberRemoved;
            dto.IsPropertyReversalLineNumberRemoved     = e.IsPropertyReversalLineNumberRemoved;
            dto.IsPropertyActiveRemoved                 = e.IsPropertyActiveRemoved;

            return(dto);
        }
Пример #5
0
 void IInOutLineState.When(IInOutLineStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Пример #6
0
        public virtual void When(IInOutLineStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.LineNumber == null)
            {
                if (e.IsPropertyLineNumberRemoved)
                {
                    this.LineNumber = default(long);
                }
            }
            else
            {
                this.LineNumber = (e.LineNumber != null && e.LineNumber.HasValue) ? e.LineNumber.Value : default(long);
            }

            if (e.Description == null)
            {
                if (e.IsPropertyDescriptionRemoved)
                {
                    this.Description = default(string);
                }
            }
            else
            {
                this.Description = e.Description;
            }

            if (e.LocatorId == null)
            {
                if (e.IsPropertyLocatorIdRemoved)
                {
                    this.LocatorId = default(string);
                }
            }
            else
            {
                this.LocatorId = e.LocatorId;
            }

            if (e.Product == null)
            {
                if (e.IsPropertyProductRemoved)
                {
                    this.Product = default(string);
                }
            }
            else
            {
                this.Product = e.Product;
            }

            if (e.UomId == null)
            {
                if (e.IsPropertyUomIdRemoved)
                {
                    this.UomId = default(string);
                }
            }
            else
            {
                this.UomId = e.UomId;
            }

            if (e.MovementQuantity == null)
            {
                if (e.IsPropertyMovementQuantityRemoved)
                {
                    this.MovementQuantity = default(decimal);
                }
            }
            else
            {
                this.MovementQuantity = (e.MovementQuantity != null && e.MovementQuantity.HasValue) ? e.MovementQuantity.Value : default(decimal);
            }

            if (e.ConfirmedQuantity == null)
            {
                if (e.IsPropertyConfirmedQuantityRemoved)
                {
                    this.ConfirmedQuantity = default(decimal);
                }
            }
            else
            {
                this.ConfirmedQuantity = (e.ConfirmedQuantity != null && e.ConfirmedQuantity.HasValue) ? e.ConfirmedQuantity.Value : default(decimal);
            }

            if (e.ScrappedQuantity == null)
            {
                if (e.IsPropertyScrappedQuantityRemoved)
                {
                    this.ScrappedQuantity = default(decimal);
                }
            }
            else
            {
                this.ScrappedQuantity = (e.ScrappedQuantity != null && e.ScrappedQuantity.HasValue) ? e.ScrappedQuantity.Value : default(decimal);
            }

            if (e.TargetQuantity == null)
            {
                if (e.IsPropertyTargetQuantityRemoved)
                {
                    this.TargetQuantity = default(decimal);
                }
            }
            else
            {
                this.TargetQuantity = (e.TargetQuantity != null && e.TargetQuantity.HasValue) ? e.TargetQuantity.Value : default(decimal);
            }

            if (e.PickedQuantity == null)
            {
                if (e.IsPropertyPickedQuantityRemoved)
                {
                    this.PickedQuantity = default(decimal);
                }
            }
            else
            {
                this.PickedQuantity = (e.PickedQuantity != null && e.PickedQuantity.HasValue) ? e.PickedQuantity.Value : default(decimal);
            }

            if (e.IsInvoiced == null)
            {
                if (e.IsPropertyIsInvoicedRemoved)
                {
                    this.IsInvoiced = default(bool);
                }
            }
            else
            {
                this.IsInvoiced = (e.IsInvoiced != null && e.IsInvoiced.HasValue) ? e.IsInvoiced.Value : default(bool);
            }

            if (e.AttributeSetInstanceId == null)
            {
                if (e.IsPropertyAttributeSetInstanceIdRemoved)
                {
                    this.AttributeSetInstanceId = default(string);
                }
            }
            else
            {
                this.AttributeSetInstanceId = e.AttributeSetInstanceId;
            }

            if (e.IsDescription == null)
            {
                if (e.IsPropertyIsDescriptionRemoved)
                {
                    this.IsDescription = default(bool);
                }
            }
            else
            {
                this.IsDescription = (e.IsDescription != null && e.IsDescription.HasValue) ? e.IsDescription.Value : default(bool);
            }

            if (e.Processed == null)
            {
                if (e.IsPropertyProcessedRemoved)
                {
                    this.Processed = default(bool);
                }
            }
            else
            {
                this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);
            }

            if (e.QuantityEntered == null)
            {
                if (e.IsPropertyQuantityEnteredRemoved)
                {
                    this.QuantityEntered = default(decimal);
                }
            }
            else
            {
                this.QuantityEntered = (e.QuantityEntered != null && e.QuantityEntered.HasValue) ? e.QuantityEntered.Value : default(decimal);
            }

            if (e.RmaLineNumber == null)
            {
                if (e.IsPropertyRmaLineNumberRemoved)
                {
                    this.RmaLineNumber = default(long);
                }
            }
            else
            {
                this.RmaLineNumber = (e.RmaLineNumber != null && e.RmaLineNumber.HasValue) ? e.RmaLineNumber.Value : default(long);
            }

            if (e.ReversalLineNumber == null)
            {
                if (e.IsPropertyReversalLineNumberRemoved)
                {
                    this.ReversalLineNumber = default(long);
                }
            }
            else
            {
                this.ReversalLineNumber = (e.ReversalLineNumber != null && e.ReversalLineNumber.HasValue) ? e.ReversalLineNumber.Value : default(long);
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
Пример #7
0
        public virtual void When(IInOutLineStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.LocatorId == null)
            {
                if (e.IsPropertyLocatorIdRemoved)
                {
                    this.LocatorId = default(string);
                }
            }
            else
            {
                this.LocatorId = e.LocatorId;
            }

            if (e.ProductId == null)
            {
                if (e.IsPropertyProductIdRemoved)
                {
                    this.ProductId = default(string);
                }
            }
            else
            {
                this.ProductId = e.ProductId;
            }

            if (e.AttributeSetInstanceId == null)
            {
                if (e.IsPropertyAttributeSetInstanceIdRemoved)
                {
                    this.AttributeSetInstanceId = default(string);
                }
            }
            else
            {
                this.AttributeSetInstanceId = e.AttributeSetInstanceId;
            }

            if (e.DamageStatusIds == null)
            {
                if (e.IsPropertyDamageStatusIdsRemoved)
                {
                    this.DamageStatusIds = null;
                }
            }
            else
            {
                this.DamageStatusIds = e.DamageStatusIds;
            }

            if (e.Description == null)
            {
                if (e.IsPropertyDescriptionRemoved)
                {
                    this.Description = default(string);
                }
            }
            else
            {
                this.Description = e.Description;
            }

            if (e.QuantityUomId == null)
            {
                if (e.IsPropertyQuantityUomIdRemoved)
                {
                    this.QuantityUomId = default(string);
                }
            }
            else
            {
                this.QuantityUomId = e.QuantityUomId;
            }

            if (e.MovementQuantity == null)
            {
                if (e.IsPropertyMovementQuantityRemoved)
                {
                    this.MovementQuantity = default(decimal);
                }
            }
            else
            {
                this.MovementQuantity = (e.MovementQuantity != null && e.MovementQuantity.HasValue) ? e.MovementQuantity.Value : default(decimal);
            }

            if (e.PickedQuantity == null)
            {
                if (e.IsPropertyPickedQuantityRemoved)
                {
                    this.PickedQuantity = default(decimal);
                }
            }
            else
            {
                this.PickedQuantity = (e.PickedQuantity != null && e.PickedQuantity.HasValue) ? e.PickedQuantity.Value : default(decimal);
            }

            if (e.IsInvoiced == null)
            {
                if (e.IsPropertyIsInvoicedRemoved)
                {
                    this.IsInvoiced = default(bool);
                }
            }
            else
            {
                this.IsInvoiced = (e.IsInvoiced != null && e.IsInvoiced.HasValue) ? e.IsInvoiced.Value : default(bool);
            }

            if (e.Processed == null)
            {
                if (e.IsPropertyProcessedRemoved)
                {
                    this.Processed = default(bool);
                }
            }
            else
            {
                this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool);
            }

            if (e.RmaLineNumber == null)
            {
                if (e.IsPropertyRmaLineNumberRemoved)
                {
                    this.RmaLineNumber = default(string);
                }
            }
            else
            {
                this.RmaLineNumber = e.RmaLineNumber;
            }

            if (e.ReversalLineNumber == null)
            {
                if (e.IsPropertyReversalLineNumberRemoved)
                {
                    this.ReversalLineNumber = default(string);
                }
            }
            else
            {
                this.ReversalLineNumber = e.ReversalLineNumber;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;


            foreach (IInOutLineImageEvent innerEvent in e.InOutLineImageEvents)
            {
                IInOutLineImageState innerState = this.InOutLineImages.Get(innerEvent.GlobalId.SequenceId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IInOutLineImageStateRemoved;
                if (removed != null)
                {
                    this.InOutLineImages.Remove(innerState);
                }
            }
        }