public static TCreateInOutLine ToCreateInOutLine <TCreateInOutLine>(this IInOutLineState state) where TCreateInOutLine : ICreateInOutLine, new() { var cmd = new TCreateInOutLine(); cmd.LineNumber = state.LineNumber; cmd.Description = state.Description; cmd.LocatorId = state.LocatorId; cmd.ProductId = state.ProductId; cmd.UomId = state.UomId; cmd.MovementQuantity = state.MovementQuantity; cmd.ConfirmedQuantity = state.ConfirmedQuantity; cmd.ScrappedQuantity = state.ScrappedQuantity; cmd.TargetQuantity = state.TargetQuantity; cmd.PickedQuantity = state.PickedQuantity; cmd.IsInvoiced = state.IsInvoiced; cmd.AttributeSetInstanceId = state.AttributeSetInstanceId; cmd.IsDescription = state.IsDescription; cmd.Processed = state.Processed; cmd.QuantityEntered = state.QuantityEntered; cmd.RmaLineNumber = state.RmaLineNumber; cmd.ReversalLineNumber = state.ReversalLineNumber; cmd.Active = ((IInOutLineStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; return(cmd); }
/// <summary> /// 生成反转的行。 /// </summary> protected virtual ICreateInOutLine DoCreateReversalInOutLine(IInOutLineState inOutLine) { var reversalLine = new CreateInOutLine(); reversalLine.ReversalLineNumber = inOutLine.LineNumber;//设置反转行 //reversalLine.Organization = Context.Organization;//? //reversalLine.UpdatedBy = Context.User; //reversalLine.UpdateTime = now; //reversalLine.CreatedBy = Context.User; //reversalLine.CreationTime = now; reversalLine.ProductId = inOutLine.ProductId; reversalLine.LocatorId = inOutLine.LocatorId; reversalLine.AttributeSetInstanceId = inOutLine.AttributeSetInstanceId; //reversalLine.IsDescription = inOutLine.IsDescription; reversalLine.IsInvoiced = inOutLine.IsInvoiced; reversalLine.LineNumber = inOutLine.LineNumber; //reversalLine.RmaLine = inOutLine.RmaLine; reversalLine.Processed = inOutLine.Processed; //reversalLine.RmaLine = inOutLine.RmaLine; reversalLine.QuantityUomId = inOutLine.QuantityUomId; //数量全部反转? reversalLine.MovementQuantity = -inOutLine.MovementQuantity; //reversalLine.QuantityEntered = -inOutLine.QuantityEntered; //reversalLine.ScrappedQuantity = -inOutLine.ScrappedQuantity; reversalLine.PickedQuantity = -inOutLine.PickedQuantity; //reversalLine.TargetQuantity = -inOutLine.TargetQuantity; return(reversalLine); }
public static TRemoveInOutLine ToRemoveInOutLine <TRemoveInOutLine>(this IInOutLineState state) where TRemoveInOutLine : IRemoveInOutLine, new() { var cmd = new TRemoveInOutLine(); cmd.LineNumber = state.LineNumber; return(cmd); }
public void Delete(IInOutLineState state) { var saveable = state as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(state); }
public void Save(IInOutLineState state) { CurrentSession.SaveOrUpdate(state); var saveable = state as ISaveable; if (saveable != null) { saveable.Save(); } }
public IInOutLineState Get(InOutLineId id) { IInOutLineState state = CurrentSession.Get <InOutLineState>(id); if (state == null) { state = new InOutLineState(); (state as InOutLineState).InOutLineId = id; } return(state); }
public DtoInOutLineImageStates(IInOutLineState outerState, IEnumerable <IInOutLineImageState> innerStates) { this._outerState = outerState; if (innerStates == null) { this._innerStates = new IInOutLineImageState[] { }; } else { this._innerStates = innerStates; } }
public IInOutLineState Get(InOutLineId id, bool nullAllowed) { IInOutLineState state = CurrentSession.Get <InOutLineState>(id); if (!nullAllowed && state == null) { state = new InOutLineState(); (state as InOutLineState).InOutLineId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IInOutLineState state) { IInOutLineState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IInOutLineState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public InOutLineStateDtoWrapper() { this._state = new InOutLineState(); }
public InOutLineStateDtoWrapper(IInOutLineState state) { this._state = state; }
public static TCreateInOutLine ToCreateInOutLine <TCreateInOutLine, TCreateInOutLineImage>(this IInOutLineState state) where TCreateInOutLine : ICreateInOutLine, new() where TCreateInOutLineImage : ICreateInOutLineImage, new() { var cmd = new TCreateInOutLine(); cmd.LineNumber = state.LineNumber; cmd.LocatorId = state.LocatorId; cmd.ProductId = state.ProductId; cmd.AttributeSetInstanceId = state.AttributeSetInstanceId; cmd.Description = state.Description; cmd.QuantityUomId = state.QuantityUomId; cmd.MovementQuantity = state.MovementQuantity; cmd.PickedQuantity = state.PickedQuantity; cmd.IsInvoiced = state.IsInvoiced; cmd.Processed = state.Processed; cmd.RmaLineNumber = state.RmaLineNumber; cmd.ReversalLineNumber = state.ReversalLineNumber; cmd.Active = ((IInOutLineStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; foreach (var d in state.InOutLineImages) { var c = d.ToCreateInOutLineImage <TCreateInOutLineImage>(); cmd.InOutLineImages.Add(c); } return(cmd); }
public virtual void AddToSave(IInOutLineState state) { this._loadedInOutLineStates[state.GlobalId] = state; }
public static TMergePatchInOutLine ToMergePatchInOutLine <TMergePatchInOutLine>(this IInOutLineState state) where TMergePatchInOutLine : IMergePatchInOutLine, new() { var cmd = new TMergePatchInOutLine(); cmd.LineNumber = state.LineNumber; cmd.Description = state.Description; cmd.LocatorId = state.LocatorId; cmd.ProductId = state.ProductId; cmd.UomId = state.UomId; cmd.MovementQuantity = state.MovementQuantity; cmd.ConfirmedQuantity = state.ConfirmedQuantity; cmd.ScrappedQuantity = state.ScrappedQuantity; cmd.TargetQuantity = state.TargetQuantity; cmd.PickedQuantity = state.PickedQuantity; cmd.IsInvoiced = state.IsInvoiced; cmd.AttributeSetInstanceId = state.AttributeSetInstanceId; cmd.IsDescription = state.IsDescription; cmd.Processed = state.Processed; cmd.QuantityEntered = state.QuantityEntered; cmd.RmaLineNumber = state.RmaLineNumber; cmd.ReversalLineNumber = state.ReversalLineNumber; cmd.Active = ((IInOutLineStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.LocatorId == null) { cmd.IsPropertyLocatorIdRemoved = true; } if (state.ProductId == null) { cmd.IsPropertyProductIdRemoved = true; } if (state.UomId == null) { cmd.IsPropertyUomIdRemoved = true; } if (state.AttributeSetInstanceId == null) { cmd.IsPropertyAttributeSetInstanceIdRemoved = true; } return(cmd); }
protected virtual ICreateInventoryItemEntry CreateInventoryItemEntry(IInOutState inOut, IInOutLineState inOutLine) { var entry = new CreateInventoryItemEntry(); entry.InventoryItemId = new InventoryItemId(inOutLine.ProductId, inOutLine.LocatorId, inOutLine.AttributeSetInstanceId); entry.EntrySeqId = SeqIdGenerator.GetNextId(); //DateTime.Now.Ticks; entry.OnHandQuantity = inOutLine.MovementQuantity; // *signum; entry.Source = new InventoryItemSourceInfo(DocumentTypeIds.InOut, inOut.DocumentNumber, inOutLine.LineNumber, 0); return(entry); }
public static IInOutLineCommand ToCreateOrMergePatchInOutLine <TCreateInOutLine, TMergePatchInOutLine>(this IInOutLineState state) where TCreateInOutLine : ICreateInOutLine, new() where TMergePatchInOutLine : IMergePatchInOutLine, new() { bool bUnsaved = ((IInOutLineState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateInOutLine <TCreateInOutLine>()); } else { return(state.ToMergePatchInOutLine <TMergePatchInOutLine>()); } }
}// END Map(IRemove... //////////////////////////// protected virtual IInOutLineImageEvent Map(IInOutLineImageCommand c, IInOutLineCommand outerCommand, long version, IInOutLineState outerState) { var create = (c.CommandType == CommandType.Create) ? (c as ICreateInOutLineImage) : null; if (create != null) { return(MapCreate(create, outerCommand, version, outerState)); } var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchInOutLineImage) : null; if (merge != null) { return(MapMergePatch(merge, outerCommand, version, outerState)); } var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveInOutLineImage) : null; if (remove != null) { return(MapRemove(remove, outerCommand, version)); } throw new NotSupportedException(); }
public void AddToSave(IInOutLineState state) { throw new NotSupportedException(); }
public InOutLineImageStates(IInOutLineState outerState) { this._inOutLineState = outerState; this._forReapplying = outerState.ForReapplying; }
public static TMergePatchInOutLine ToMergePatchInOutLine <TMergePatchInOutLine, TCreateInOutLineImage, TMergePatchInOutLineImage>(this IInOutLineState state) where TMergePatchInOutLine : IMergePatchInOutLine, new() where TCreateInOutLineImage : ICreateInOutLineImage, new() where TMergePatchInOutLineImage : IMergePatchInOutLineImage, new() { var cmd = new TMergePatchInOutLine(); cmd.LineNumber = state.LineNumber; cmd.LocatorId = state.LocatorId; cmd.ProductId = state.ProductId; cmd.AttributeSetInstanceId = state.AttributeSetInstanceId; cmd.Description = state.Description; cmd.QuantityUomId = state.QuantityUomId; cmd.MovementQuantity = state.MovementQuantity; cmd.PickedQuantity = state.PickedQuantity; cmd.IsInvoiced = state.IsInvoiced; cmd.Processed = state.Processed; cmd.RmaLineNumber = state.RmaLineNumber; cmd.ReversalLineNumber = state.ReversalLineNumber; cmd.Active = ((IInOutLineStateProperties)state).Active; cmd.InOutDocumentNumber = state.InOutDocumentNumber; if (state.LocatorId == null) { cmd.IsPropertyLocatorIdRemoved = true; } if (state.ProductId == null) { cmd.IsPropertyProductIdRemoved = true; } if (state.AttributeSetInstanceId == null) { cmd.IsPropertyAttributeSetInstanceIdRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.QuantityUomId == null) { cmd.IsPropertyQuantityUomIdRemoved = true; } if (state.RmaLineNumber == null) { cmd.IsPropertyRmaLineNumberRemoved = true; } if (state.ReversalLineNumber == null) { cmd.IsPropertyReversalLineNumberRemoved = true; } foreach (var d in state.InOutLineImages) { var c = d.ToCreateOrMergePatchInOutLineImage <TCreateInOutLineImage, TMergePatchInOutLineImage>(); cmd.InOutLineImageCommands.Add(c); } return(cmd); }
public virtual void When(IInOutStateCreated e) { ThrowOnWrongEvent(e); this.IsSOTransaction = (e.IsSOTransaction != null && e.IsSOTransaction.HasValue) ? e.IsSOTransaction.Value : default(bool); this.DocumentStatus = e.DocumentStatus; this.Posted = (e.Posted != null && e.Posted.HasValue) ? e.Posted.Value : default(bool); this.Processing = (e.Processing != null && e.Processing.HasValue) ? e.Processing.Value : default(bool); this.Processed = (e.Processed != null && e.Processed.HasValue) ? e.Processed.Value : default(bool); this.DocumentType = (e.DocumentType != null && e.DocumentType.HasValue) ? e.DocumentType.Value : default(int); this.Description = e.Description; this.OrderNumber = e.OrderNumber; this.DateOrdered = e.DateOrdered; this.IsPrinted = (e.IsPrinted != null && e.IsPrinted.HasValue) ? e.IsPrinted.Value : default(bool); this.MovementType = e.MovementType; this.MovementDate = e.MovementDate; this.BusinessPartnerId = e.BusinessPartnerId; this.WarehouseId = e.WarehouseId; this.POReference = e.POReference; this.FreightAmount = (e.FreightAmount != null && e.FreightAmount.HasValue) ? e.FreightAmount.Value : default(Money); this.ShipperId = e.ShipperId; this.ChargeAmount = (e.ChargeAmount != null && e.ChargeAmount.HasValue) ? e.ChargeAmount.Value : default(Money); this.DatePrinted = e.DatePrinted; this.SalesRepresentative = e.SalesRepresentative; this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int); this.PickDate = e.PickDate; this.ShipDate = e.ShipDate; this.TrackingNumber = e.TrackingNumber; this.DateReceived = e.DateReceived; this.IsInTransit = (e.IsInTransit != null && e.IsInTransit.HasValue) ? e.IsInTransit.Value : default(bool); this.IsApproved = (e.IsApproved != null && e.IsApproved.HasValue) ? e.IsApproved.Value : default(bool); this.IsInDispute = (e.IsInDispute != null && e.IsInDispute.HasValue) ? e.IsInDispute.Value : default(bool); this.Volume = (e.Volume != null && e.Volume.HasValue) ? e.Volume.Value : default(decimal); this.Weight = (e.Weight != null && e.Weight.HasValue) ? e.Weight.Value : default(decimal); this.RmaNumber = e.RmaNumber; this.ReversalNumber = e.ReversalNumber; this.IsDropShip = (e.IsDropShip != null && e.IsDropShip.HasValue) ? e.IsDropShip.Value : default(bool); this.DropShipBusinessPartnerId = e.DropShipBusinessPartnerId; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IInOutLineStateCreated innerEvent in e.InOutLineEvents) { IInOutLineState innerState = this.InOutLines.Get(innerEvent.GlobalId.LineNumber, true); innerState.Mutate(innerEvent); } }
public virtual void Remove(IInOutLineState state) { this._removedInOutLineStates.Add(state); }
public virtual void When(IInOutStateMergePatched e) { ThrowOnWrongEvent(e); if (e.IsSOTransaction == null) { if (e.IsPropertyIsSOTransactionRemoved) { this.IsSOTransaction = default(bool); } } else { this.IsSOTransaction = (e.IsSOTransaction != null && e.IsSOTransaction.HasValue) ? e.IsSOTransaction.Value : default(bool); } if (e.DocumentStatus == null) { if (e.IsPropertyDocumentStatusRemoved) { this.DocumentStatus = default(string); } } else { this.DocumentStatus = e.DocumentStatus; } 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.Processing == null) { if (e.IsPropertyProcessingRemoved) { this.Processing = default(bool); } } else { this.Processing = (e.Processing != null && e.Processing.HasValue) ? e.Processing.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.DocumentType == null) { if (e.IsPropertyDocumentTypeRemoved) { this.DocumentType = default(int); } } else { this.DocumentType = (e.DocumentType != null && e.DocumentType.HasValue) ? e.DocumentType.Value : default(int); } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.OrderNumber == null) { if (e.IsPropertyOrderNumberRemoved) { this.OrderNumber = default(string); } } else { this.OrderNumber = e.OrderNumber; } if (e.DateOrdered == null) { if (e.IsPropertyDateOrderedRemoved) { this.DateOrdered = default(DateTime?); } } else { this.DateOrdered = e.DateOrdered; } if (e.IsPrinted == null) { if (e.IsPropertyIsPrintedRemoved) { this.IsPrinted = default(bool); } } else { this.IsPrinted = (e.IsPrinted != null && e.IsPrinted.HasValue) ? e.IsPrinted.Value : default(bool); } if (e.MovementType == null) { if (e.IsPropertyMovementTypeRemoved) { this.MovementType = default(string); } } else { this.MovementType = e.MovementType; } if (e.MovementDate == null) { if (e.IsPropertyMovementDateRemoved) { this.MovementDate = default(DateTime?); } } else { this.MovementDate = e.MovementDate; } if (e.BusinessPartnerId == null) { if (e.IsPropertyBusinessPartnerIdRemoved) { this.BusinessPartnerId = default(string); } } else { this.BusinessPartnerId = e.BusinessPartnerId; } if (e.WarehouseId == null) { if (e.IsPropertyWarehouseIdRemoved) { this.WarehouseId = default(string); } } else { this.WarehouseId = e.WarehouseId; } if (e.POReference == null) { if (e.IsPropertyPOReferenceRemoved) { this.POReference = default(string); } } else { this.POReference = e.POReference; } if (e.FreightAmount == null) { if (e.IsPropertyFreightAmountRemoved) { this.FreightAmount = default(Money); } } else { this.FreightAmount = (e.FreightAmount != null && e.FreightAmount.HasValue) ? e.FreightAmount.Value : default(Money); } if (e.ShipperId == null) { if (e.IsPropertyShipperIdRemoved) { this.ShipperId = default(string); } } else { this.ShipperId = e.ShipperId; } if (e.ChargeAmount == null) { if (e.IsPropertyChargeAmountRemoved) { this.ChargeAmount = default(Money); } } else { this.ChargeAmount = (e.ChargeAmount != null && e.ChargeAmount.HasValue) ? e.ChargeAmount.Value : default(Money); } if (e.DatePrinted == null) { if (e.IsPropertyDatePrintedRemoved) { this.DatePrinted = default(DateTime?); } } else { this.DatePrinted = e.DatePrinted; } if (e.SalesRepresentative == null) { if (e.IsPropertySalesRepresentativeRemoved) { this.SalesRepresentative = default(string); } } else { this.SalesRepresentative = e.SalesRepresentative; } if (e.NumberOfPackages == null) { if (e.IsPropertyNumberOfPackagesRemoved) { this.NumberOfPackages = default(int); } } else { this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int); } if (e.PickDate == null) { if (e.IsPropertyPickDateRemoved) { this.PickDate = default(DateTime?); } } else { this.PickDate = e.PickDate; } if (e.ShipDate == null) { if (e.IsPropertyShipDateRemoved) { this.ShipDate = default(DateTime?); } } else { this.ShipDate = e.ShipDate; } if (e.TrackingNumber == null) { if (e.IsPropertyTrackingNumberRemoved) { this.TrackingNumber = default(string); } } else { this.TrackingNumber = e.TrackingNumber; } if (e.DateReceived == null) { if (e.IsPropertyDateReceivedRemoved) { this.DateReceived = default(DateTime?); } } else { this.DateReceived = e.DateReceived; } if (e.IsInTransit == null) { if (e.IsPropertyIsInTransitRemoved) { this.IsInTransit = default(bool); } } else { this.IsInTransit = (e.IsInTransit != null && e.IsInTransit.HasValue) ? e.IsInTransit.Value : default(bool); } 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.IsInDispute == null) { if (e.IsPropertyIsInDisputeRemoved) { this.IsInDispute = default(bool); } } else { this.IsInDispute = (e.IsInDispute != null && e.IsInDispute.HasValue) ? e.IsInDispute.Value : default(bool); } if (e.Volume == null) { if (e.IsPropertyVolumeRemoved) { this.Volume = default(decimal); } } else { this.Volume = (e.Volume != null && e.Volume.HasValue) ? e.Volume.Value : default(decimal); } if (e.Weight == null) { if (e.IsPropertyWeightRemoved) { this.Weight = default(decimal); } } else { this.Weight = (e.Weight != null && e.Weight.HasValue) ? e.Weight.Value : default(decimal); } if (e.RmaNumber == null) { if (e.IsPropertyRmaNumberRemoved) { this.RmaNumber = default(string); } } else { this.RmaNumber = e.RmaNumber; } if (e.ReversalNumber == null) { if (e.IsPropertyReversalNumberRemoved) { this.ReversalNumber = default(string); } } else { this.ReversalNumber = e.ReversalNumber; } if (e.IsDropShip == null) { if (e.IsPropertyIsDropShipRemoved) { this.IsDropShip = default(bool); } } else { this.IsDropShip = (e.IsDropShip != null && e.IsDropShip.HasValue) ? e.IsDropShip.Value : default(bool); } if (e.DropShipBusinessPartnerId == null) { if (e.IsPropertyDropShipBusinessPartnerIdRemoved) { this.DropShipBusinessPartnerId = default(string); } } else { this.DropShipBusinessPartnerId = e.DropShipBusinessPartnerId; } 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 (IInOutLineStateEvent innerEvent in e.InOutLineEvents) { IInOutLineState innerState = this.InOutLines.Get(innerEvent.GlobalId.LineNumber); innerState.Mutate(innerEvent); var removed = innerEvent as IInOutLineStateRemoved; if (removed != null) { this.InOutLines.Remove(innerState); } } }
}// END Map(ICreate... //////////////////////////// protected virtual IInOutLineImageStateMergePatched MapMergePatch(IMergePatchInOutLineImage c, IInOutLineCommand outerCommand, long version, IInOutLineState outerState) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new InOutLineImageEventId(c.InOutDocumentNumber, c.InOutLineLineNumber, c.SequenceId, version); IInOutLineImageStateMergePatched e = NewInOutLineImageStateMergePatched(stateEventId); var s = outerState.InOutLineImages.Get(c.SequenceId); e.Url = c.Url; e.Active = c.Active; e.IsPropertyUrlRemoved = c.IsPropertyUrlRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); return(e); }// END Map(IMergePatch... ////////////////////////////