Example #1
0
        protected virtual IItemIssuanceStateCreated MapCreate(ICreateItemIssuance c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId            = new ItemIssuanceEventId(c.ShipmentId, c.ItemIssuanceSeqId, version);
            IItemIssuanceStateCreated e = NewItemIssuanceStateCreated(stateEventId);
            var s = outerState.ItemIssuances.Get(c.ItemIssuanceSeqId, true);

            e.OrderId                = c.OrderId;
            e.OrderItemSeqId         = c.OrderItemSeqId;
            e.ShipGroupSeqId         = c.ShipGroupSeqId;
            e.ProductId              = c.ProductId;
            e.LocatorId              = c.LocatorId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.ShipmentItemSeqId      = c.ShipmentItemSeqId;
            e.FixedAssetId           = c.FixedAssetId;
            e.MaintHistSeqId         = c.MaintHistSeqId;
            e.IssuedDateTime         = c.IssuedDateTime;
            e.IssuedByUserLoginId    = c.IssuedByUserLoginId;
            e.Quantity               = c.Quantity;
            e.CancelQuantity         = c.CancelQuantity;
            e.Active = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
        public virtual ItemIssuanceStateCreatedDto ToItemIssuanceStateCreatedDto(IItemIssuanceStateCreated e)
        {
            var dto = new ItemIssuanceStateCreatedDto();

            dto.ItemIssuanceEventId    = e.ItemIssuanceEventId;
            dto.CreatedAt              = e.CreatedAt;
            dto.CreatedBy              = e.CreatedBy;
            dto.Version                = e.Version;
            dto.CommandId              = e.CommandId;
            dto.OrderId                = e.OrderId;
            dto.OrderItemSeqId         = e.OrderItemSeqId;
            dto.ShipGroupSeqId         = e.ShipGroupSeqId;
            dto.ProductId              = e.ProductId;
            dto.LocatorId              = e.LocatorId;
            dto.AttributeSetInstanceId = e.AttributeSetInstanceId;
            dto.ShipmentItemSeqId      = e.ShipmentItemSeqId;
            dto.FixedAssetId           = e.FixedAssetId;
            dto.MaintHistSeqId         = e.MaintHistSeqId;
            dto.IssuedDateTime         = e.IssuedDateTime;
            dto.IssuedByUserLoginId    = e.IssuedByUserLoginId;
            dto.Quantity               = e.Quantity;
            dto.CancelQuantity         = e.CancelQuantity;
            dto.Active = e.Active;
            return(dto);
        }
Example #3
0
        public virtual void When(IItemIssuanceStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.OrderId = e.OrderId;

            this.OrderItemSeqId = e.OrderItemSeqId;

            this.ShipGroupSeqId = e.ShipGroupSeqId;

            this.ProductId = e.ProductId;

            this.LocatorId = e.LocatorId;

            this.AttributeSetInstanceId = e.AttributeSetInstanceId;

            this.ShipmentItemSeqId = e.ShipmentItemSeqId;

            this.FixedAssetId = e.FixedAssetId;

            this.MaintHistSeqId = e.MaintHistSeqId;

            this.IssuedDateTime = e.IssuedDateTime;

            this.IssuedByUserLoginId = e.IssuedByUserLoginId;

            this.Quantity = e.Quantity;

            this.CancelQuantity = e.CancelQuantity;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Example #4
0
        protected virtual IShipmentStateCreated Map(ICreateShipment c)
        {
            var stateEventId        = new ShipmentEventId(c.ShipmentId, c.Version);
            IShipmentStateCreated e = NewShipmentStateCreated(stateEventId);

            e.ShipmentTypeId        = c.ShipmentTypeId;
            e.StatusId              = c.StatusId;
            e.PrimaryOrderId        = c.PrimaryOrderId;
            e.PrimaryReturnId       = c.PrimaryReturnId;
            e.PrimaryShipGroupSeqId = c.PrimaryShipGroupSeqId;
            e.PicklistBinId         = c.PicklistBinId;
            e.BolNumber             = c.BolNumber;
            e.SealNumber            = c.SealNumber;
            e.VehicleId             = c.VehicleId;
            e.ExternalOrderNumber   = c.ExternalOrderNumber;
            e.Carrier                    = c.Carrier;
            e.DateShipped                = c.DateShipped;
            e.EstimatedReadyDate         = c.EstimatedReadyDate;
            e.EstimatedShipDate          = c.EstimatedShipDate;
            e.EstimatedShipWorkEffId     = c.EstimatedShipWorkEffId;
            e.EstimatedArrivalDate       = c.EstimatedArrivalDate;
            e.EstimatedArrivalWorkEffId  = c.EstimatedArrivalWorkEffId;
            e.LatestCancelDate           = c.LatestCancelDate;
            e.EstimatedShipCost          = c.EstimatedShipCost;
            e.CurrencyUomId              = c.CurrencyUomId;
            e.HandlingInstructions       = c.HandlingInstructions;
            e.OriginFacilityId           = c.OriginFacilityId;
            e.DestinationFacilityId      = c.DestinationFacilityId;
            e.OriginContactMechId        = c.OriginContactMechId;
            e.OriginTelecomNumberId      = c.OriginTelecomNumberId;
            e.DestinationContactMechId   = c.DestinationContactMechId;
            e.DestinationTelecomNumberId = c.DestinationTelecomNumberId;
            e.PartyIdTo                  = c.PartyIdTo;
            e.PartyIdFrom                = c.PartyIdFrom;
            e.AdditionalShippingCharge   = c.AdditionalShippingCharge;
            e.AddtlShippingChargeDesc    = c.AddtlShippingChargeDesc;
            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 (ICreateShipmentImage innerCommand in c.ShipmentImages)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentImageStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentImageEvent(innerEvent);
            }

            foreach (ICreateShipmentItem innerCommand in c.ShipmentItems)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentItemStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentItemEvent(innerEvent);
            }

            foreach (ICreateShipmentReceipt innerCommand in c.ShipmentReceipts)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentReceiptStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddShipmentReceiptEvent(innerEvent);
            }

            foreach (ICreateItemIssuance innerCommand in c.ItemIssuances)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IItemIssuanceStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddItemIssuanceEvent(innerEvent);
            }


            return(e);
        }
Example #5
0
 public virtual void AddItemIssuanceEvent(IItemIssuanceStateCreated e)
 {
     ThrowOnInconsistentEventIds(e);
     this._itemIssuanceEvents[e.ItemIssuanceEventId] = e;
 }
Example #6
0
 void IShipmentStateCreated.AddItemIssuanceEvent(IItemIssuanceStateCreated e)
 {
     this._itemIssuanceEvents.AddItemIssuanceEvent(e);
 }
 void IItemIssuanceState.When(IItemIssuanceStateCreated e)
 {
     throw new NotSupportedException();
 }