public static TDeleteInOut ToDeleteInOut <TDeleteInOut>(this IInOutState state)
            where TDeleteInOut : IDeleteInOut, new()
        {
            var cmd = new TDeleteInOut();

            cmd.DocumentNumber = state.DocumentNumber;
            cmd.Version        = ((IInOutStateProperties)state).Version;

            return(cmd);
        }
Exemple #2
0
        }// END Map(IRemove... ////////////////////////////

        protected void NewInOutDocumentActionCommandAndExecute(IMergePatchInOut c, IInOutState s, IInOutStateMergePatched e)
        {
            var pCommandHandler = this.InOutDocumentActionCommandHandler;
            var pCmdContent     = c.DocumentAction;
            var pCmd            = new PropertyCommand <string, string> {
                Content = pCmdContent, GetState = () => s.DocumentStatus, SetState = p => e.DocumentStatus = p, OuterCommandType = CommandType.MergePatch
            };

            pCommandHandler.Execute(pCmd);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public IInOutState Get(string id)
        {
            IInOutState state = CurrentSession.Get <InOutState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IInOutState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
Exemple #5
0
        protected void NewInOutDocumentActionCommandAndExecute(ICreateInOut c, IInOutState s, IInOutStateCreated e)
        {
            var pCommandHandler = this.InOutDocumentActionCommandHandler;
            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);
        }
Exemple #6
0
        public IInOutState Get(string id)
        {
            IInOutState state = CurrentSession.Get <InOutState> (id);

            if (state == null)
            {
                state = new InOutState();
                (state as InOutState).DocumentNumber = id;
            }
            return(state);
        }
Exemple #7
0
        public void Save(IInOutState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
Exemple #8
0
        /// <summary>
        /// 生成反转的单据(但不包括行)。
        /// </summary>
        protected virtual ICreateInOut DoCreateReversalInOut(IInOutState inOut)
        {
            var reversalInOut = new CreateInOut();

            //reversalInOut.Organization = inOut.Organization;//?
            //reversalInOut.Client = inOut.Client;
            //reversalInOut.CreatedBy = reversalInOut.UpdatedBy = Context.User;
            //reversalInOut.CreationTime = reversalInOut.UpdateTime = now;

            //生成新的单号:
            reversalInOut.DocumentNumber = "RIO" + SeqIdGenerator.GetNextId();//DocumentNumberGenerator.GetNewDocumentNumber();
            //设置反转关系:
            reversalInOut.ReversalDocumentNumber = inOut.DocumentNumber;
            //inOut.Reversal = reversalInOut;
            ////源单据前向关联到反转单据:
            //inOut.Description = "(" + reversalInOut.DocumentNumber + "<-)";//(1000016<-)
            //反转单据后向关联到源单据:
            reversalInOut.Description = "{->" + inOut.DocumentNumber + ")";//{->1000015)

            //reversalInOut.IsSOTransaction = inOut.IsSOTransaction;
            //reversalInOut. DocumentStatus
            //reversalInOut.Posted = inOut.Posted;//??
            //reversalInOut.Processing = inOut.Processing;
            //reversalInOut.Processed = inOut.Processed;
            reversalInOut.DocumentTypeId = inOut.DocumentTypeId;
            reversalInOut.OrderId        = inOut.OrderId;
            reversalInOut.DateOrdered    = inOut.DateOrdered;
            //reversalInOut.IsPrinted
            reversalInOut.MovementTypeId    = inOut.MovementTypeId;
            reversalInOut.MovementDate      = inOut.MovementDate;
            reversalInOut.BusinessPartnerId = inOut.BusinessPartnerId;
            reversalInOut.WarehouseId       = inOut.WarehouseId;
            //reversalInOut.FreightAmount;
            //reversalInOut.Shipper
            //reversalInOut.ChargeAmount??
            //reversalInOut.DatePrinted;
            //reversalInOut.CreateFrom
            //reversalInOut.GenerateTo
            //reversalInOut.User = inOut.User;
            //reversalInOut.SalesRepresentative
            reversalInOut.NumberOfPackages = inOut.NumberOfPackages;
            //reversalInOut.PickDate
            //reversalInOut.ShipDate
            reversalInOut.TrackingNumber = inOut.TrackingNumber;
            //reversalInOut.DateReceived
            //reversalInOut.IsInTransit
            //reversalInOut.IsApproved;
            //reversalInOut.IsInDispute
            //reversalInOut.Volume = inOut.Volume;
            //reversalInOut.Weight = inOut.Weight;
            //reversalInOut.Rma = inOut.Rma;
            //reversalInOut.IsDropShip = inOut.IsDropShip;
            return(reversalInOut);
        }
Exemple #9
0
 public DtoInOutLineStates(IInOutState outerState, IEnumerable <IInOutLineState> innerStates)
 {
     this._outerState = outerState;
     if (innerStates == null)
     {
         this._innerStates = new IInOutLineState[] { };
     }
     else
     {
         this._innerStates = innerStates;
     }
 }
Exemple #10
0
        protected virtual ICreateInOut CreateReversalInOut(IInOutState inOut)
        {
            var reversalInOut = DoCreateReversalInOut(inOut);

            foreach (var d in inOut.InOutLines)
            {
                var r = DoCreateReversalInOutLine(d);
                reversalInOut.InOutLines.Add(r);
            }

            return(reversalInOut);
        }
        public static TCreateInOut ToCreateInOut <TCreateInOut, TCreateInOutLine>(this IInOutState state)
            where TCreateInOut : ICreateInOut, new()
            where TCreateInOutLine : ICreateInOutLine, new()
        {
            var cmd = new TCreateInOut();

            cmd.Version = ((IInOutStateProperties)state).Version;

            cmd.DocumentNumber            = state.DocumentNumber;
            cmd.IsSOTransaction           = state.IsSOTransaction;
            cmd.Posted                    = state.Posted;
            cmd.Processing                = state.Processing;
            cmd.Processed                 = state.Processed;
            cmd.DocumentType              = state.DocumentType;
            cmd.Description               = state.Description;
            cmd.OrderNumber               = state.OrderNumber;
            cmd.DateOrdered               = state.DateOrdered;
            cmd.IsPrinted                 = state.IsPrinted;
            cmd.MovementType              = state.MovementType;
            cmd.MovementDate              = state.MovementDate;
            cmd.BusinessPartnerId         = state.BusinessPartnerId;
            cmd.WarehouseId               = state.WarehouseId;
            cmd.POReference               = state.POReference;
            cmd.FreightAmount             = state.FreightAmount;
            cmd.ShipperId                 = state.ShipperId;
            cmd.ChargeAmount              = state.ChargeAmount;
            cmd.DatePrinted               = state.DatePrinted;
            cmd.SalesRepresentative       = state.SalesRepresentative;
            cmd.NumberOfPackages          = state.NumberOfPackages;
            cmd.PickDate                  = state.PickDate;
            cmd.ShipDate                  = state.ShipDate;
            cmd.TrackingNumber            = state.TrackingNumber;
            cmd.DateReceived              = state.DateReceived;
            cmd.IsInTransit               = state.IsInTransit;
            cmd.IsApproved                = state.IsApproved;
            cmd.IsInDispute               = state.IsInDispute;
            cmd.Volume                    = state.Volume;
            cmd.Weight                    = state.Weight;
            cmd.RmaNumber                 = state.RmaNumber;
            cmd.ReversalNumber            = state.ReversalNumber;
            cmd.IsDropShip                = state.IsDropShip;
            cmd.DropShipBusinessPartnerId = state.DropShipBusinessPartnerId;
            cmd.Active                    = ((IInOutStateProperties)state).Active;
            foreach (var d in state.InOutLines)
            {
                var c = d.ToCreateInOutLine <TCreateInOutLine>();
                cmd.InOutLines.Add(c);
            }
            return(cmd);
        }
Exemple #12
0
        public IInOutState Get(string id, bool nullAllowed)
        {
            IInOutState state = CurrentSession.Get <InOutState> (id);

            if (!nullAllowed && state == null)
            {
                state = new InOutState();
                (state as InOutState).DocumentNumber = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IInOutState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
Exemple #13
0
        public async Task <IInOutState> GetAsync(string documentNumber)
        {
            IInOutState state         = null;
            var         idObj         = documentNumber;
            var         uriParameters = new InOutUriParameters();

            uriParameters.Id = idObj;

            var req = new InOutGetRequest(uriParameters);

            var resp = await _ramlClient.InOut.Get(req);

            InOutProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToInOutState();
            return(state);
        }
        public void Save(IInOutState state)
        {
            IInOutState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IInOutState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
Exemple #15
0
        protected virtual IInOutLineStateCreated MapCreate(ICreateInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId         = new InOutLineEventId(c.InOutDocumentNumber, c.LineNumber, version);
            IInOutLineStateCreated e = NewInOutLineStateCreated(stateEventId);
            var s = outerState.InOutLines.Get(c.LineNumber, true);

            e.LocatorId = c.LocatorId;
            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.DamageStatusIds        = c.DamageStatusIds;
            e.Description            = c.Description;
            e.QuantityUomId          = c.QuantityUomId;
            e.MovementQuantity       = c.MovementQuantity;
            e.PickedQuantity         = c.PickedQuantity;
            e.IsInvoiced             = c.IsInvoiced;
            e.Processed          = c.Processed;
            e.RmaLineNumber      = c.RmaLineNumber;
            e.ReversalLineNumber = c.ReversalLineNumber;
            e.Active             = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            foreach (ICreateInOutLineImage innerCommand in c.InOutLineImages)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IInOutLineImageStateCreated innerEvent = MapCreate(innerCommand, c, version, s);
                e.AddInOutLineImageEvent(innerEvent);
            }

            return(e);
        }// END Map(ICreate... ////////////////////////////
        public static IInOutCommand ToCreateOrMergePatchInOut <TCreateInOut, TMergePatchInOut, TCreateInOutLine, TMergePatchInOutLine>(this IInOutState state)
            where TCreateInOut : ICreateInOut, new()
            where TMergePatchInOut : IMergePatchInOut, new()
            where TCreateInOutLine : ICreateInOutLine, new()
            where TMergePatchInOutLine : IMergePatchInOutLine, new()
        {
            bool bUnsaved = ((IInOutState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateInOut <TCreateInOut, TCreateInOutLine>());
            }
            else
            {
                return(state.ToMergePatchInOut <TMergePatchInOut, TCreateInOutLine, TMergePatchInOutLine>());
            }
        }
Exemple #17
0
 public InOutLineStates(IInOutState outerState)
 {
     this._inOutState    = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
Exemple #18
0
        protected virtual IInOutLineStateCreated MapCreate(ICreateInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId         = new InOutLineStateEventId(c.InOutDocumentNumber, c.LineNumber, version);
            IInOutLineStateCreated e = NewInOutLineStateCreated(stateEventId);
            var s = outerState.InOutLines.Get(c.LineNumber, true);

            e.Description            = c.Description;
            e.LocatorId              = c.LocatorId;
            e.ProductId              = c.ProductId;
            e.UomId                  = c.UomId;
            e.MovementQuantity       = c.MovementQuantity;
            e.ConfirmedQuantity      = c.ConfirmedQuantity;
            e.ScrappedQuantity       = c.ScrappedQuantity;
            e.TargetQuantity         = c.TargetQuantity;
            e.PickedQuantity         = c.PickedQuantity;
            e.IsInvoiced             = c.IsInvoiced;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.IsDescription          = c.IsDescription;
            e.Processed              = c.Processed;
            e.QuantityEntered        = c.QuantityEntered;
            e.RmaLineNumber          = c.RmaLineNumber;
            e.ReversalLineNumber     = c.ReversalLineNumber;
            e.Active                 = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            return(e);
        }// END Map(ICreate... ////////////////////////////
        public static TMergePatchInOut ToMergePatchInOut <TMergePatchInOut, TCreateInOutLine, TMergePatchInOutLine>(this IInOutState state)
            where TMergePatchInOut : IMergePatchInOut, new()
            where TCreateInOutLine : ICreateInOutLine, new()
            where TMergePatchInOutLine : IMergePatchInOutLine, new()
        {
            var cmd = new TMergePatchInOut();

            cmd.Version = ((IInOutStateProperties)state).Version;

            cmd.DocumentNumber         = state.DocumentNumber;
            cmd.Posted                 = state.Posted;
            cmd.Processed              = state.Processed;
            cmd.Processing             = state.Processing;
            cmd.DocumentTypeId         = state.DocumentTypeId;
            cmd.Description            = state.Description;
            cmd.OrderId                = state.OrderId;
            cmd.DateOrdered            = state.DateOrdered;
            cmd.IsPrinted              = state.IsPrinted;
            cmd.MovementTypeId         = state.MovementTypeId;
            cmd.MovementDate           = state.MovementDate;
            cmd.BusinessPartnerId      = state.BusinessPartnerId;
            cmd.WarehouseId            = state.WarehouseId;
            cmd.POReference            = state.POReference;
            cmd.FreightAmount          = state.FreightAmount;
            cmd.ShipperId              = state.ShipperId;
            cmd.ChargeAmount           = state.ChargeAmount;
            cmd.DatePrinted            = state.DatePrinted;
            cmd.CreatedFrom            = state.CreatedFrom;
            cmd.SalesRepresentativeId  = state.SalesRepresentativeId;
            cmd.NumberOfPackages       = state.NumberOfPackages;
            cmd.PickDate               = state.PickDate;
            cmd.ShipDate               = state.ShipDate;
            cmd.TrackingNumber         = state.TrackingNumber;
            cmd.DateReceived           = state.DateReceived;
            cmd.IsInTransit            = state.IsInTransit;
            cmd.IsApproved             = state.IsApproved;
            cmd.IsInDispute            = state.IsInDispute;
            cmd.RmaDocumentNumber      = state.RmaDocumentNumber;
            cmd.ReversalDocumentNumber = state.ReversalDocumentNumber;
            cmd.Active                 = ((IInOutStateProperties)state).Active;

            if (state.Processing == null)
            {
                cmd.IsPropertyProcessingRemoved = true;
            }
            if (state.DocumentTypeId == null)
            {
                cmd.IsPropertyDocumentTypeIdRemoved = true;
            }
            if (state.Description == null)
            {
                cmd.IsPropertyDescriptionRemoved = true;
            }
            if (state.OrderId == null)
            {
                cmd.IsPropertyOrderIdRemoved = true;
            }
            if (state.DateOrdered == null)
            {
                cmd.IsPropertyDateOrderedRemoved = true;
            }
            if (state.MovementTypeId == null)
            {
                cmd.IsPropertyMovementTypeIdRemoved = true;
            }
            if (state.MovementDate == null)
            {
                cmd.IsPropertyMovementDateRemoved = true;
            }
            if (state.BusinessPartnerId == null)
            {
                cmd.IsPropertyBusinessPartnerIdRemoved = true;
            }
            if (state.WarehouseId == null)
            {
                cmd.IsPropertyWarehouseIdRemoved = true;
            }
            if (state.POReference == null)
            {
                cmd.IsPropertyPOReferenceRemoved = true;
            }
            if (state.ShipperId == null)
            {
                cmd.IsPropertyShipperIdRemoved = true;
            }
            if (state.DatePrinted == null)
            {
                cmd.IsPropertyDatePrintedRemoved = true;
            }
            if (state.CreatedFrom == null)
            {
                cmd.IsPropertyCreatedFromRemoved = true;
            }
            if (state.SalesRepresentativeId == null)
            {
                cmd.IsPropertySalesRepresentativeIdRemoved = true;
            }
            if (state.PickDate == null)
            {
                cmd.IsPropertyPickDateRemoved = true;
            }
            if (state.ShipDate == null)
            {
                cmd.IsPropertyShipDateRemoved = true;
            }
            if (state.TrackingNumber == null)
            {
                cmd.IsPropertyTrackingNumberRemoved = true;
            }
            if (state.DateReceived == null)
            {
                cmd.IsPropertyDateReceivedRemoved = true;
            }
            if (state.RmaDocumentNumber == null)
            {
                cmd.IsPropertyRmaDocumentNumberRemoved = true;
            }
            if (state.ReversalDocumentNumber == null)
            {
                cmd.IsPropertyReversalDocumentNumberRemoved = true;
            }
            foreach (var d in state.InOutLines)
            {
                var c = d.ToCreateOrMergePatchInOutLine <TCreateInOutLine, TMergePatchInOutLine>();
                cmd.InOutLineCommands.Add(c);
            }
            return(cmd);
        }
Exemple #20
0
 public InOutStateDtoWrapper()
 {
     this._state = new InOutState();
 }
 public override IInOutAggregate GetInOutAggregate(IInOutState state)
 {
     return(new InOutAggregate(state));
 }
Exemple #22
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IInOutLineStateMergePatched MapMergePatch(IMergePatchInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new InOutLineStateEventId(c.InOutDocumentNumber, c.SkuId, version);
            IInOutLineStateMergePatched e = NewInOutLineStateMergePatched(stateEventId);
            var s = outerState.InOutLines.Get(c.SkuId);

            e.LineNumber                              = c.LineNumber;
            e.Description                             = c.Description;
            e.LocatorId                               = c.LocatorId;
            e.Product                                 = c.Product;
            e.UomId                                   = c.UomId;
            e.MovementQuantity                        = c.MovementQuantity;
            e.ConfirmedQuantity                       = c.ConfirmedQuantity;
            e.ScrappedQuantity                        = c.ScrappedQuantity;
            e.TargetQuantity                          = c.TargetQuantity;
            e.PickedQuantity                          = c.PickedQuantity;
            e.IsInvoiced                              = c.IsInvoiced;
            e.AttributeSetInstanceId                  = c.AttributeSetInstanceId;
            e.IsDescription                           = c.IsDescription;
            e.Processed                               = c.Processed;
            e.QuantityEntered                         = c.QuantityEntered;
            e.RmaLineNumber                           = c.RmaLineNumber;
            e.ReversalLineNumber                      = c.ReversalLineNumber;
            e.Active                                  = c.Active;
            e.IsPropertyLineNumberRemoved             = c.IsPropertyLineNumberRemoved;
            e.IsPropertyDescriptionRemoved            = c.IsPropertyDescriptionRemoved;
            e.IsPropertyLocatorIdRemoved              = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyProductRemoved                = c.IsPropertyProductRemoved;
            e.IsPropertyUomIdRemoved                  = c.IsPropertyUomIdRemoved;
            e.IsPropertyMovementQuantityRemoved       = c.IsPropertyMovementQuantityRemoved;
            e.IsPropertyConfirmedQuantityRemoved      = c.IsPropertyConfirmedQuantityRemoved;
            e.IsPropertyScrappedQuantityRemoved       = c.IsPropertyScrappedQuantityRemoved;
            e.IsPropertyTargetQuantityRemoved         = c.IsPropertyTargetQuantityRemoved;
            e.IsPropertyPickedQuantityRemoved         = c.IsPropertyPickedQuantityRemoved;
            e.IsPropertyIsInvoicedRemoved             = c.IsPropertyIsInvoicedRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyIsDescriptionRemoved          = c.IsPropertyIsDescriptionRemoved;
            e.IsPropertyProcessedRemoved              = c.IsPropertyProcessedRemoved;
            e.IsPropertyQuantityEnteredRemoved        = c.IsPropertyQuantityEnteredRemoved;
            e.IsPropertyRmaLineNumberRemoved          = c.IsPropertyRmaLineNumberRemoved;
            e.IsPropertyReversalLineNumberRemoved     = c.IsPropertyReversalLineNumberRemoved;
            e.IsPropertyActiveRemoved                 = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Exemple #23
0
 public InOutAggregate(IInOutState state)
 {
     _state = state;
 }
Exemple #24
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected virtual IInOutLineStateEvent Map(IInOutLineCommand c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateInOutLine) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch) ? (c as IMergePatchInOutLine) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveInOutLine) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Exemple #25
0
 public abstract IInOutAggregate GetInOutAggregate(IInOutState state);
Exemple #26
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IInOutAggregate aggregate, IInOutState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IInOutStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IInOutAggregate, IInOutState>(aggregate, state, aggregate.Changes));
     }
 }
Exemple #27
0
 public InOutLineStates(IInOutState outerState)
 {
     this._inOutState = outerState;
 }
Exemple #28
0
 public InOutStateDtoWrapper(IInOutState state)
 {
     this._state = state;
 }
Exemple #29
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IInOutLineStateMergePatched MapMergePatch(IMergePatchInOutLine c, IInOutCommand outerCommand, long version, IInOutState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new InOutLineEventId(c.InOutDocumentNumber, c.LineNumber, version);
            IInOutLineStateMergePatched e = NewInOutLineStateMergePatched(stateEventId);
            var s = outerState.InOutLines.Get(c.LineNumber);

            e.LocatorId = c.LocatorId;
            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.Description            = c.Description;
            e.QuantityUomId          = c.QuantityUomId;
            e.MovementQuantity       = c.MovementQuantity;
            e.PickedQuantity         = c.PickedQuantity;
            e.IsInvoiced             = c.IsInvoiced;
            e.Processed                  = c.Processed;
            e.RmaLineNumber              = c.RmaLineNumber;
            e.ReversalLineNumber         = c.ReversalLineNumber;
            e.Active                     = c.Active;
            e.IsPropertyLocatorIdRemoved = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyDescriptionRemoved            = c.IsPropertyDescriptionRemoved;
            e.IsPropertyQuantityUomIdRemoved          = c.IsPropertyQuantityUomIdRemoved;
            e.IsPropertyMovementQuantityRemoved       = c.IsPropertyMovementQuantityRemoved;
            e.IsPropertyPickedQuantityRemoved         = c.IsPropertyPickedQuantityRemoved;
            e.IsPropertyIsInvoicedRemoved             = c.IsPropertyIsInvoicedRemoved;
            e.IsPropertyProcessedRemoved          = c.IsPropertyProcessedRemoved;
            e.IsPropertyRmaLineNumberRemoved      = c.IsPropertyRmaLineNumberRemoved;
            e.IsPropertyReversalLineNumberRemoved = c.IsPropertyReversalLineNumberRemoved;
            e.IsPropertyActiveRemoved             = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Exemple #30
0
        protected bool IsRepeatedCommand(IInOutCommand command, IEventStoreAggregateId eventStoreAggregateId, IInOutState state)
        {
            bool repeated = false;

            if (((IInOutStateProperties)state).Version > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IInOutEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }