protected virtual IPhysicalInventoryStateMergePatched Map(IMergePatchPhysicalInventory c) { var stateEventId = new PhysicalInventoryEventId(c.DocumentNumber, c.Version); IPhysicalInventoryStateMergePatched e = NewPhysicalInventoryStateMergePatched(stateEventId); 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.IsPropertyWarehouseIdRemoved = c.IsPropertyWarehouseIdRemoved; e.IsPropertyLocatorIdPatternRemoved = c.IsPropertyLocatorIdPatternRemoved; e.IsPropertyProductIdPatternRemoved = c.IsPropertyProductIdPatternRemoved; e.IsPropertyPostedRemoved = c.IsPropertyPostedRemoved; e.IsPropertyProcessedRemoved = c.IsPropertyProcessedRemoved; e.IsPropertyProcessingRemoved = c.IsPropertyProcessingRemoved; e.IsPropertyDocumentTypeIdRemoved = c.IsPropertyDocumentTypeIdRemoved; e.IsPropertyMovementDateRemoved = c.IsPropertyMovementDateRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyIsApprovedRemoved = c.IsPropertyIsApprovedRemoved; e.IsPropertyApprovalAmountRemoved = c.IsPropertyApprovalAmountRemoved; e.IsPropertyIsQuantityUpdatedRemoved = c.IsPropertyIsQuantityUpdatedRemoved; e.IsPropertyReversalDocumentNumberRemoved = c.IsPropertyReversalDocumentNumberRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (IPhysicalInventoryLineCommand innerCommand in c.PhysicalInventoryLineCommands) { ThrowOnInconsistentCommands(c, innerCommand); IPhysicalInventoryLineEvent innerEvent = Map(innerCommand, c, version, _state); e.AddPhysicalInventoryLineEvent(innerEvent); } return(e); }
void IPhysicalInventoryState.When(IPhysicalInventoryStateMergePatched e) { throw new NotSupportedException(); }
public virtual void When(IPhysicalInventoryStateMergePatched e) { ThrowOnWrongEvent(e); if (e.DocumentStatusId == null) { if (e.IsPropertyDocumentStatusIdRemoved) { this.DocumentStatusId = default(string); } } else { this.DocumentStatusId = e.DocumentStatusId; } if (e.WarehouseId == null) { if (e.IsPropertyWarehouseIdRemoved) { this.WarehouseId = default(string); } } else { this.WarehouseId = e.WarehouseId; } if (e.LocatorIdPattern == null) { if (e.IsPropertyLocatorIdPatternRemoved) { this.LocatorIdPattern = default(string); } } else { this.LocatorIdPattern = e.LocatorIdPattern; } if (e.ProductIdPattern == null) { if (e.IsPropertyProductIdPatternRemoved) { this.ProductIdPattern = default(string); } } else { this.ProductIdPattern = e.ProductIdPattern; } if (e.Posted == null) { if (e.IsPropertyPostedRemoved) { this.Posted = default(bool); } } else { this.Posted = (e.Posted != null && e.Posted.HasValue) ? e.Posted.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.Processing == null) { if (e.IsPropertyProcessingRemoved) { this.Processing = default(string); } } else { this.Processing = e.Processing; } if (e.DocumentTypeId == null) { if (e.IsPropertyDocumentTypeIdRemoved) { this.DocumentTypeId = default(string); } } else { this.DocumentTypeId = e.DocumentTypeId; } if (e.MovementDate == null) { if (e.IsPropertyMovementDateRemoved) { this.MovementDate = default(DateTime?); } } else { this.MovementDate = e.MovementDate; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.IsApproved == null) { if (e.IsPropertyIsApprovedRemoved) { this.IsApproved = default(bool); } } else { this.IsApproved = (e.IsApproved != null && e.IsApproved.HasValue) ? e.IsApproved.Value : default(bool); } if (e.ApprovalAmount == null) { if (e.IsPropertyApprovalAmountRemoved) { this.ApprovalAmount = default(decimal); } } else { this.ApprovalAmount = (e.ApprovalAmount != null && e.ApprovalAmount.HasValue) ? e.ApprovalAmount.Value : default(decimal); } if (e.IsQuantityUpdated == null) { if (e.IsPropertyIsQuantityUpdatedRemoved) { this.IsQuantityUpdated = default(bool); } } else { this.IsQuantityUpdated = (e.IsQuantityUpdated != null && e.IsQuantityUpdated.HasValue) ? e.IsQuantityUpdated.Value : default(bool); } if (e.ReversalDocumentNumber == null) { if (e.IsPropertyReversalDocumentNumberRemoved) { this.ReversalDocumentNumber = default(string); } } else { this.ReversalDocumentNumber = e.ReversalDocumentNumber; } 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 (IPhysicalInventoryLineEvent innerEvent in e.PhysicalInventoryLineEvents) { IPhysicalInventoryLineState innerState = this.PhysicalInventoryLines.Get(innerEvent.GlobalId.InventoryItemId); innerState.Mutate(innerEvent); var removed = innerEvent as IPhysicalInventoryLineStateRemoved; if (removed != null) { this.PhysicalInventoryLines.Remove(innerState); } } }
public virtual void MergePatch(IMergePatchPhysicalInventory c) { IPhysicalInventoryStateMergePatched e = Map(c); Apply(e); }
public virtual PhysicalInventoryStateMergePatchedDto ToPhysicalInventoryStateMergePatchedDto(IPhysicalInventoryStateMergePatched e) { var dto = new PhysicalInventoryStateMergePatchedDto(); dto.PhysicalInventoryEventId = e.PhysicalInventoryEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.DocumentStatusId = e.DocumentStatusId; dto.WarehouseId = e.WarehouseId; dto.LocatorIdPattern = e.LocatorIdPattern; dto.ProductIdPattern = e.ProductIdPattern; dto.Posted = e.Posted; dto.Processed = e.Processed; dto.Processing = e.Processing; dto.DocumentTypeId = e.DocumentTypeId; dto.MovementDate = e.MovementDate; dto.Description = e.Description; dto.IsApproved = e.IsApproved; dto.ApprovalAmount = e.ApprovalAmount; dto.IsQuantityUpdated = e.IsQuantityUpdated; dto.ReversalDocumentNumber = e.ReversalDocumentNumber; dto.Active = e.Active; dto.IsPropertyDocumentStatusIdRemoved = e.IsPropertyDocumentStatusIdRemoved; dto.IsPropertyWarehouseIdRemoved = e.IsPropertyWarehouseIdRemoved; dto.IsPropertyLocatorIdPatternRemoved = e.IsPropertyLocatorIdPatternRemoved; dto.IsPropertyProductIdPatternRemoved = e.IsPropertyProductIdPatternRemoved; dto.IsPropertyPostedRemoved = e.IsPropertyPostedRemoved; dto.IsPropertyProcessedRemoved = e.IsPropertyProcessedRemoved; dto.IsPropertyProcessingRemoved = e.IsPropertyProcessingRemoved; dto.IsPropertyDocumentTypeIdRemoved = e.IsPropertyDocumentTypeIdRemoved; dto.IsPropertyMovementDateRemoved = e.IsPropertyMovementDateRemoved; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyIsApprovedRemoved = e.IsPropertyIsApprovedRemoved; dto.IsPropertyApprovalAmountRemoved = e.IsPropertyApprovalAmountRemoved; dto.IsPropertyIsQuantityUpdatedRemoved = e.IsPropertyIsQuantityUpdatedRemoved; dto.IsPropertyReversalDocumentNumberRemoved = e.IsPropertyReversalDocumentNumberRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; var physicalInventoryLineEvents = new List <PhysicalInventoryLineStateCreatedOrMergePatchedOrRemovedDto>(); foreach (var ee in e.PhysicalInventoryLineEvents) { PhysicalInventoryLineStateCreatedOrMergePatchedOrRemovedDto eeDto = PhysicalInventoryLineStateEventDtoConverter.ToPhysicalInventoryLineStateEventDto(ee); physicalInventoryLineEvents.Add(eeDto); } dto.PhysicalInventoryLineEvents = physicalInventoryLineEvents.ToArray(); return(dto); }