private void ReverseUpdateSourceInOut(InOutCommands.DocumentAction c, ICreateInOut reversalInOutInfo) { //源单据前向关联到反转单据: var reversalDocumentNumber = reversalInOutInfo.DocumentNumber; var description = "(" + reversalInOutInfo.DocumentNumber + "<-)";//(1000016<-) Update(c, ar => ((InOutAggregate)ar).Reverse(reversalDocumentNumber, description, c.Version, c.CommandId, c.RequesterId)); }
protected virtual IInOutStateCreated Map(ICreateInOut c) { var stateEventId = new InOutStateEventId(c.DocumentNumber, c.Version); IInOutStateCreated e = NewInOutStateCreated(stateEventId); e.IsSOTransaction = c.IsSOTransaction; NewInOutDocumentActionCommandAndExecute(c, _state, e); e.Posted = c.Posted; e.Processing = c.Processing; e.Processed = c.Processed; e.DocumentType = c.DocumentType; e.Description = c.Description; e.OrderNumber = c.OrderNumber; e.DateOrdered = c.DateOrdered; e.IsPrinted = c.IsPrinted; e.MovementType = c.MovementType; e.MovementDate = c.MovementDate; e.BusinessPartnerId = c.BusinessPartnerId; e.WarehouseId = c.WarehouseId; e.POReference = c.POReference; e.FreightAmount = c.FreightAmount; e.ShipperId = c.ShipperId; e.ChargeAmount = c.ChargeAmount; e.DatePrinted = c.DatePrinted; e.SalesRepresentative = c.SalesRepresentative; e.NumberOfPackages = c.NumberOfPackages; e.PickDate = c.PickDate; e.ShipDate = c.ShipDate; e.TrackingNumber = c.TrackingNumber; e.DateReceived = c.DateReceived; e.IsInTransit = c.IsInTransit; e.IsApproved = c.IsApproved; e.IsInDispute = c.IsInDispute; e.Volume = c.Volume; e.Weight = c.Weight; e.RmaNumber = c.RmaNumber; e.ReversalNumber = c.ReversalNumber; e.IsDropShip = c.IsDropShip; e.DropShipBusinessPartnerId = c.DropShipBusinessPartnerId; e.Active = c.Active; ReflectUtils.CopyPropertyValue("CommandId", c, e); e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var version = c.Version; foreach (ICreateInOutLine innerCommand in c.InOutLines) { ThrowOnInconsistentCommands(c, innerCommand); IInOutLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddInOutLineEvent(innerEvent); } return(e); }
protected void NewInOutDocumentActionCommandAndExecute(ICreateInOut c, IInOutState s, IInOutStateCreated e) { var pCommandHandler = this.InOutDocumentActionCommandHandler; var pCmdContent = c.DocumentAction; var pCmd = new PropertyCommand <DocumentAction, string> { Content = pCmdContent, GetState = () => s.DocumentStatus, SetState = p => e.DocumentStatus = p, OuterCommandType = CommandType.Create }; pCommandHandler.Execute(pCmd); }
protected virtual IInOutStateCreated Map(ICreateInOut c) { var stateEventId = new InOutEventId(c.DocumentNumber, c.Version); IInOutStateCreated e = NewInOutStateCreated(stateEventId); NewInOutDocumentActionCommandAndExecute(c, _state, e); e.Posted = c.Posted; e.Processed = c.Processed; e.Processing = c.Processing; e.DocumentTypeId = c.DocumentTypeId; e.Description = c.Description; e.OrderId = c.OrderId; e.DateOrdered = c.DateOrdered; e.IsPrinted = c.IsPrinted; e.MovementTypeId = c.MovementTypeId; e.MovementDate = c.MovementDate; e.BusinessPartnerId = c.BusinessPartnerId; e.WarehouseId = c.WarehouseId; e.POReference = c.POReference; e.FreightAmount = c.FreightAmount; e.ShipperId = c.ShipperId; e.ChargeAmount = c.ChargeAmount; e.DatePrinted = c.DatePrinted; e.CreatedFrom = c.CreatedFrom; e.SalesRepresentativeId = c.SalesRepresentativeId; e.NumberOfPackages = c.NumberOfPackages; e.PickDate = c.PickDate; e.ShipDate = c.ShipDate; e.TrackingNumber = c.TrackingNumber; e.DateReceived = c.DateReceived; e.IsInTransit = c.IsInTransit; e.IsApproved = c.IsApproved; e.IsInDispute = c.IsInDispute; e.RmaDocumentNumber = c.RmaDocumentNumber; 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 (ICreateInOutLine innerCommand in c.InOutLines) { ThrowOnInconsistentCommands(c, innerCommand); IInOutLineStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddInOutLineEvent(innerEvent); } return(e); }
void IInOutApplicationService.When(ICreateInOut c) { this.When((CreateInOutDto)c); }
public virtual void Create(ICreateInOut c) { IInOutStateCreated e = Map(c); Apply(e); }
public virtual void When(ICreateInOut c) { Update(c, ar => ar.Create(c)); }