private void ReverseUpdateSourceMovement(MovementCommands.DocumentAction c, ICreateMovement reversalMovInfo) { //源单据前向关联到反转单据: var reversalDocumentNumber = reversalMovInfo.DocumentNumber; var description = "(" + reversalMovInfo.DocumentNumber + "<-)";//(1000016<-) Update(c, ar => ((MovementAggregate)ar).Reverse(reversalDocumentNumber, description, c.Version, c.CommandId, c.RequesterId)); }
protected void NewMovementDocumentActionCommandAndExecute(ICreateMovement c, IMovementState s, IMovementStateCreated e) { var pCommandHandler = this.MovementDocumentActionCommandHandler; var pCmdContent = default(string); var pCmd = new PropertyCommand <string, string> { Content = pCmdContent, GetState = () => s.DocumentStatusId, SetState = p => e.DocumentStatusId = p, OuterCommandType = CommandType.Create }; pCmd.Context = this.State; pCommandHandler.Execute(pCmd); }
protected virtual IMovementStateCreated Map(ICreateMovement c) { var stateEventId = new MovementEventId(c.DocumentNumber, c.Version); IMovementStateCreated e = NewMovementStateCreated(stateEventId); NewMovementDocumentActionCommandAndExecute(c, _state, e); e.MovementDate = c.MovementDate; e.Posted = c.Posted; e.Processed = c.Processed; e.Processing = c.Processing; e.DateReceived = c.DateReceived; e.DocumentTypeId = c.DocumentTypeId; e.IsInTransit = c.IsInTransit; e.IsApproved = c.IsApproved; e.ApprovalAmount = c.ApprovalAmount; e.ShipperId = c.ShipperId; e.SalesRepresentativeId = c.SalesRepresentativeId; e.BusinessPartnerId = c.BusinessPartnerId; e.ChargeAmount = c.ChargeAmount; e.CreateFrom = c.CreateFrom; e.FreightAmount = c.FreightAmount; e.ReversalDocumentNumber = c.ReversalDocumentNumber; e.WarehouseIdFrom = c.WarehouseIdFrom; e.WarehouseIdTo = c.WarehouseIdTo; e.Description = c.Description; 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 (ICreateMovementLine innerCommand in c.MovementLines) { ThrowOnInconsistentCommands(c, innerCommand); IMovementLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddMovementLineEvent(innerEvent); } return(e); }
public virtual void When(ICreateMovement c) { Update(c, ar => ar.Create(c)); }
void IMovementApplicationService.When(ICreateMovement c) { this.When((CreateMovementDto)c); }
public virtual void Create(ICreateMovement c) { IMovementStateCreated e = Map(c); Apply(e); }