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)); }
public override void When(InOutCommands.DocumentAction c) { if (c.Value == DocumentAction.Complete) { var inOut = AssertDocumentStatus(c.DocumentNumber, DocumentStatusIds.Drafted); var inventoryItemEntries = CompleteInOutCreateInventoryItemEntries(inOut); CreateOrUpdateInventoryItems(inventoryItemEntries); base.When(c); } else if (c.Value == DocumentAction.Reverse) { var srcInOut = AssertDocumentStatus(c.DocumentNumber, DocumentStatusIds.Completed); var reversalInOutInfo = CreateReversalInOutAndCompleteAndClose(c, srcInOut); ReverseUpdateSourceInOut(c, reversalInOutInfo); //base.When(c); } else { base.When(c); } }
private ICreateInOut CreateReversalInOutAndCompleteAndClose(InOutCommands.DocumentAction c, IInOutState inOut) { var createReversalInOut = CreateReversalInOut(inOut); When(createReversalInOut); long firstVersion = 1; When(new InOutCommands.Complete() { DocumentNumber = createReversalInOut.DocumentNumber, Version = firstVersion, CommandId = c.CommandId, RequesterId = c.RequesterId, }); When(new InOutCommands.Close() { DocumentNumber = createReversalInOut.DocumentNumber, Version = firstVersion + 1, CommandId = c.CommandId, RequesterId = c.RequesterId, }); return(createReversalInOut); }
public void When(InOutCommands.DocumentAction c) { throw new NotImplementedException();//todo }