Ejemplo n.º 1
0
        public static TDeleteShipment ToDeleteShipment <TDeleteShipment>(this IShipmentState state)
            where TDeleteShipment : IDeleteShipment, new()
        {
            var cmd = new TDeleteShipment();

            cmd.ShipmentId = state.ShipmentId;
            cmd.Version    = ((IShipmentStateProperties)state).Version;

            return(cmd);
        }
Ejemplo n.º 2
0
        public IShipmentState Get(string id)
        {
            IShipmentState state = CurrentSession.Get <ShipmentState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
Ejemplo n.º 3
0
        protected virtual ICreateInventoryItemEntry CreateInventoryItemEntry(IShipmentState shipment, IShipmentReceiptState lineReceipt)
        {
            var targetLocatorId = WarehouseUtils.GetReceivingLocatorId(shipment.DestinationFacilityId);
            var entry           = new CreateInventoryItemEntry();

            entry.InventoryItemId = new InventoryItemId(lineReceipt.ProductId, targetLocatorId, lineReceipt.AttributeSetInstanceId);
            entry.EntrySeqId      = SeqIdGenerator.GetNextId();   //DateTime.Now.Ticks;
            entry.OnHandQuantity  = lineReceipt.AcceptedQuantity; // *signum;
            entry.Source          = new InventoryItemSourceInfo(DocumentTypeIds.Shipment, shipment.ShipmentId, lineReceipt.ReceiptSeqId, 0);
            return(entry);
        }
Ejemplo n.º 4
0
 public DtoItemIssuanceStates(IShipmentState outerState, IEnumerable <IItemIssuanceState> innerStates)
 {
     this._outerState = outerState;
     if (innerStates == null)
     {
         this._innerStates = new IItemIssuanceState[] { };
     }
     else
     {
         this._innerStates = innerStates;
     }
 }
Ejemplo n.º 5
0
 public DtoShipmentReceiptStates(IShipmentState outerState, IEnumerable <IShipmentReceiptState> innerStates)
 {
     this._outerState = outerState;
     if (innerStates == null)
     {
         this._innerStates = new IShipmentReceiptState[] { };
     }
     else
     {
         this._innerStates = innerStates;
     }
 }
Ejemplo n.º 6
0
        public IShipmentState Get(string id, bool nullAllowed)
        {
            IShipmentState state = CurrentSession.Get <ShipmentState> (id);

            if (!nullAllowed && state == null)
            {
                state = new ShipmentState();
                (state as ShipmentState).ShipmentId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public async Task <IShipmentState> GetAsync(string shipmentId)
        {
            IShipmentState state         = null;
            var            idObj         = shipmentId;
            var            uriParameters = new ShipmentUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentGetRequest(uriParameters);

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

            ShipmentProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToShipmentState();
            return(state);
        }
Ejemplo n.º 8
0
        public void Save(IShipmentState state)
        {
            IShipmentState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
Ejemplo n.º 9
0
 public override IShipmentAggregate GetShipmentAggregate(IShipmentState state)
 {
     return(new ShipmentAggregate(state));
 }
Ejemplo n.º 10
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IItemIssuanceStateMergePatched MapMergePatch(IMergePatchItemIssuance c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ItemIssuanceEventId(c.ShipmentId, c.ItemIssuanceSeqId, version);
            IItemIssuanceStateMergePatched e = NewItemIssuanceStateMergePatched(stateEventId);
            var s = outerState.ItemIssuances.Get(c.ItemIssuanceSeqId);

            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.IsPropertyOrderIdRemoved                = c.IsPropertyOrderIdRemoved;
            e.IsPropertyOrderItemSeqIdRemoved         = c.IsPropertyOrderItemSeqIdRemoved;
            e.IsPropertyShipGroupSeqIdRemoved         = c.IsPropertyShipGroupSeqIdRemoved;
            e.IsPropertyProductIdRemoved              = c.IsPropertyProductIdRemoved;
            e.IsPropertyLocatorIdRemoved              = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyShipmentItemSeqIdRemoved      = c.IsPropertyShipmentItemSeqIdRemoved;
            e.IsPropertyFixedAssetIdRemoved           = c.IsPropertyFixedAssetIdRemoved;
            e.IsPropertyMaintHistSeqIdRemoved         = c.IsPropertyMaintHistSeqIdRemoved;
            e.IsPropertyIssuedDateTimeRemoved         = c.IsPropertyIssuedDateTimeRemoved;
            e.IsPropertyIssuedByUserLoginIdRemoved    = c.IsPropertyIssuedByUserLoginIdRemoved;
            e.IsPropertyQuantityRemoved               = c.IsPropertyQuantityRemoved;
            e.IsPropertyCancelQuantityRemoved         = c.IsPropertyCancelQuantityRemoved;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Ejemplo n.º 11
0
        }// END Map(IRemove... ////////////////////////////

        protected virtual IItemIssuanceEvent Map(IItemIssuanceCommand c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateItemIssuance) : null;

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

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

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

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

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 12
0
        public static TCreateShipment ToCreateShipment <TCreateShipment, TCreateShipmentImage, TCreateShipmentItem, TCreateShipmentReceipt, TCreateShipmentReceiptImage, TCreateItemIssuance>(this IShipmentState state)
            where TCreateShipment : ICreateShipment, new()
            where TCreateShipmentImage : ICreateShipmentImage, new()
            where TCreateShipmentItem : ICreateShipmentItem, new()
            where TCreateShipmentReceipt : ICreateShipmentReceipt, new()
            where TCreateShipmentReceiptImage : ICreateShipmentReceiptImage, new()
            where TCreateItemIssuance : ICreateItemIssuance, new()
        {
            var cmd = new TCreateShipment();

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

            cmd.ShipmentId            = state.ShipmentId;
            cmd.ShipmentTypeId        = state.ShipmentTypeId;
            cmd.StatusId              = state.StatusId;
            cmd.PrimaryOrderId        = state.PrimaryOrderId;
            cmd.PrimaryReturnId       = state.PrimaryReturnId;
            cmd.PrimaryShipGroupSeqId = state.PrimaryShipGroupSeqId;
            cmd.PicklistBinId         = state.PicklistBinId;
            cmd.BolNumber             = state.BolNumber;
            cmd.SealNumber            = state.SealNumber;
            cmd.VehicleId             = state.VehicleId;
            cmd.ExternalOrderNumber   = state.ExternalOrderNumber;
            cmd.Carrier                    = state.Carrier;
            cmd.DateShipped                = state.DateShipped;
            cmd.EstimatedReadyDate         = state.EstimatedReadyDate;
            cmd.EstimatedShipDate          = state.EstimatedShipDate;
            cmd.EstimatedShipWorkEffId     = state.EstimatedShipWorkEffId;
            cmd.EstimatedArrivalDate       = state.EstimatedArrivalDate;
            cmd.EstimatedArrivalWorkEffId  = state.EstimatedArrivalWorkEffId;
            cmd.LatestCancelDate           = state.LatestCancelDate;
            cmd.EstimatedShipCost          = state.EstimatedShipCost;
            cmd.CurrencyUomId              = state.CurrencyUomId;
            cmd.HandlingInstructions       = state.HandlingInstructions;
            cmd.OriginFacilityId           = state.OriginFacilityId;
            cmd.DestinationFacilityId      = state.DestinationFacilityId;
            cmd.OriginContactMechId        = state.OriginContactMechId;
            cmd.OriginTelecomNumberId      = state.OriginTelecomNumberId;
            cmd.DestinationContactMechId   = state.DestinationContactMechId;
            cmd.DestinationTelecomNumberId = state.DestinationTelecomNumberId;
            cmd.PartyIdTo                  = state.PartyIdTo;
            cmd.PartyIdFrom                = state.PartyIdFrom;
            cmd.AdditionalShippingCharge   = state.AdditionalShippingCharge;
            cmd.AddtlShippingChargeDesc    = state.AddtlShippingChargeDesc;
            cmd.Active = ((IShipmentStateProperties)state).Active;
            foreach (var d in state.ShipmentImages)
            {
                var c = d.ToCreateShipmentImage <TCreateShipmentImage>();
                cmd.ShipmentImages.Add(c);
            }
            foreach (var d in state.ShipmentItems)
            {
                var c = d.ToCreateShipmentItem <TCreateShipmentItem>();
                cmd.ShipmentItems.Add(c);
            }
            foreach (var d in state.ShipmentReceipts)
            {
                var c = d.ToCreateShipmentReceipt <TCreateShipmentReceipt, TCreateShipmentReceiptImage>();
                cmd.ShipmentReceipts.Add(c);
            }
            foreach (var d in state.ItemIssuances)
            {
                var c = d.ToCreateItemIssuance <TCreateItemIssuance>();
                cmd.ItemIssuances.Add(c);
            }
            return(cmd);
        }
Ejemplo n.º 13
0
 public abstract IShipmentAggregate GetShipmentAggregate(IShipmentState state);
Ejemplo n.º 14
0
        protected virtual IList <ICreateInventoryItemEntry> ConfirmAllItemsReceivedCreateInventoryItemEntries(IShipmentState shipment, IEnumerable <IShipmentReceiptState> receipts)
        {
            var entries = new List <ICreateInventoryItemEntry>();

            foreach (var d in receipts)
            {
                var e = CreateInventoryItemEntry(shipment, d);
                entries.Add(e);
            }
            return(entries);
        }
Ejemplo n.º 15
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IShipmentAggregate aggregate, IShipmentState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IShipmentStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IShipmentAggregate, IShipmentState>(aggregate, state, aggregate.Changes));
     }
 }
Ejemplo n.º 16
0
 public ShipmentImageStates(IShipmentState outerState)
 {
     this._shipmentState = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
Ejemplo n.º 17
0
 public ShipmentStateDtoWrapper(IShipmentState state)
 {
     this._state = state;
 }
Ejemplo n.º 18
0
 public ShipmentStateDtoWrapper()
 {
     this._state = new ShipmentState();
 }
Ejemplo n.º 19
0
        protected bool IsRepeatedCommand(IShipmentCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentState state)
        {
            bool repeated = false;

            if (((IShipmentStateProperties)state).Version > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IShipmentEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
Ejemplo n.º 20
0
 public ItemIssuanceStates(IShipmentState outerState)
 {
     this._shipmentState = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
Ejemplo n.º 21
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentImageStateMergePatched MapMergePatch(IMergePatchShipmentImage c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentImageEventId(c.ShipmentId, c.SequenceId, version);
            IShipmentImageStateMergePatched e = NewShipmentImageStateMergePatched(stateEventId);
            var s = outerState.ShipmentImages.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... ////////////////////////////
Ejemplo n.º 22
0
        private ICreateOrMergePatchOrRemoveShipmentReceipt CreateOrUpdateShipmentReceipt(ShipmentCommands.ReceiveItem c, IShipmentState shipment, IShipmentItemState shipmentItem)
        {
            ICreateOrMergePatchOrRemoveShipmentReceipt updateReceipt = null;
            var receiptSeqId = c.ShipmentItemSeqId;
            var receipt      = shipment.ShipmentReceipts.Get(receiptSeqId, false, true);

            if (receipt == null)
            {
                updateReceipt = new CreateShipmentReceipt();
            }
            else
            {
                updateReceipt = new MergePatchShipmentReceipt();
            }

            var prdState = GetProductState(shipmentItem.ProductId);

            string attrSetInstId = AttributeSetInstanceUtils.CreateAttributeSetInstance(AttributeSetService, AttributeSetInstanceApplicationService,
                                                                                        prdState.AttributeSetId, c.AttributeSetInstance);

            if (_log.IsDebugEnabled)
            {
                _log.Debug("Create attribute set instance, id: " + attrSetInstId);
            }

            updateReceipt.AttributeSetInstanceId = attrSetInstId;

            updateReceipt.ReceiptSeqId      = receiptSeqId;
            updateReceipt.ShipmentItemSeqId = shipmentItem.ShipmentItemSeqId;
            updateReceipt.ProductId         = shipmentItem.ProductId;
            updateReceipt.AcceptedQuantity  = c.AcceptedQuantity;
            updateReceipt.RejectedQuantity  = c.RejectedQuantity;
            updateReceipt.DamagedQuantity   = c.DamagedQuantity;
            updateReceipt.DamageStatusIds   = c.DamageStatusIds;
            updateReceipt.DamageReasonId    = c.DamageReasonId;
            updateReceipt.ReceivedBy        = c.RequesterId;
            return(updateReceipt);
        }
Ejemplo n.º 23
0
 public ShipmentAggregate(IShipmentState state)
 {
     _state = state;
 }
Ejemplo n.º 24
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentItemStateMergePatched MapMergePatch(IMergePatchShipmentItem c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentItemEventId(c.ShipmentId, c.ShipmentItemSeqId, version);
            IShipmentItemStateMergePatched e = NewShipmentItemStateMergePatched(stateEventId);
            var s = outerState.ShipmentItems.Get(c.ShipmentItemSeqId);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.Quantity = c.Quantity;
            e.ShipmentContentDescription = c.ShipmentContentDescription;
            e.Active = c.Active;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyQuantityRemoved = c.IsPropertyQuantityRemoved;
            e.IsPropertyShipmentContentDescriptionRemoved = c.IsPropertyShipmentContentDescriptionRemoved;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Ejemplo n.º 25
0
        }// END Map(IMergePatch... ////////////////////////////

        protected virtual IShipmentReceiptEvent Map(IShipmentReceiptCommand c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateShipmentReceipt) : null;

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

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

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

            throw new NotSupportedException();
        }
Ejemplo n.º 26
0
        public static IShipmentCommand ToCreateOrMergePatchShipment <TCreateShipment, TMergePatchShipment, TCreateShipmentItem, TMergePatchShipmentItem, TCreateShipmentReceipt, TMergePatchShipmentReceipt, TCreateItemIssuance, TMergePatchItemIssuance>(this IShipmentState state)
            where TCreateShipment : ICreateShipment, new()
            where TMergePatchShipment : IMergePatchShipment, new()
            where TCreateShipmentItem : ICreateShipmentItem, new()
            where TMergePatchShipmentItem : IMergePatchShipmentItem, new()
            where TCreateShipmentReceipt : ICreateShipmentReceipt, new()
            where TMergePatchShipmentReceipt : IMergePatchShipmentReceipt, new()
            where TCreateItemIssuance : ICreateItemIssuance, new()
            where TMergePatchItemIssuance : IMergePatchItemIssuance, new()
        {
            bool bUnsaved = ((IShipmentState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateShipment <TCreateShipment, TCreateShipmentItem, TCreateShipmentReceipt, TCreateItemIssuance>());
            }
            else
            {
                return(state.ToMergePatchShipment <TMergePatchShipment, TCreateShipmentItem, TMergePatchShipmentItem, TCreateShipmentReceipt, TMergePatchShipmentReceipt, TCreateItemIssuance, TMergePatchItemIssuance>());
            }
        }
Ejemplo n.º 27
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentReceiptStateMergePatched MapMergePatch(IMergePatchShipmentReceipt c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentReceiptEventId(c.ShipmentId, c.ReceiptSeqId, version);
            IShipmentReceiptStateMergePatched e = NewShipmentReceiptStateMergePatched(stateEventId);
            var s = outerState.ShipmentReceipts.Get(c.ReceiptSeqId);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.LocatorId            = c.LocatorId;
            e.ShipmentItemSeqId    = c.ShipmentItemSeqId;
            e.ShipmentPackageSeqId = c.ShipmentPackageSeqId;
            e.OrderId                    = c.OrderId;
            e.OrderItemSeqId             = c.OrderItemSeqId;
            e.ReturnId                   = c.ReturnId;
            e.ReturnItemSeqId            = c.ReturnItemSeqId;
            e.RejectionReasonId          = c.RejectionReasonId;
            e.DamageStatusIds            = c.DamageStatusIds;
            e.DamageReasonId             = c.DamageReasonId;
            e.ReceivedBy                 = c.ReceivedBy;
            e.DatetimeReceived           = c.DatetimeReceived;
            e.ItemDescription            = c.ItemDescription;
            e.AcceptedQuantity           = c.AcceptedQuantity;
            e.RejectedQuantity           = c.RejectedQuantity;
            e.DamagedQuantity            = c.DamagedQuantity;
            e.Active                     = c.Active;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyLocatorIdRemoved            = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyShipmentItemSeqIdRemoved    = c.IsPropertyShipmentItemSeqIdRemoved;
            e.IsPropertyShipmentPackageSeqIdRemoved = c.IsPropertyShipmentPackageSeqIdRemoved;
            e.IsPropertyOrderIdRemoved           = c.IsPropertyOrderIdRemoved;
            e.IsPropertyOrderItemSeqIdRemoved    = c.IsPropertyOrderItemSeqIdRemoved;
            e.IsPropertyReturnIdRemoved          = c.IsPropertyReturnIdRemoved;
            e.IsPropertyReturnItemSeqIdRemoved   = c.IsPropertyReturnItemSeqIdRemoved;
            e.IsPropertyRejectionReasonIdRemoved = c.IsPropertyRejectionReasonIdRemoved;
            e.IsPropertyDamageStatusIdsRemoved   = c.IsPropertyDamageStatusIdsRemoved;
            e.IsPropertyDamageReasonIdRemoved    = c.IsPropertyDamageReasonIdRemoved;
            e.IsPropertyReceivedByRemoved        = c.IsPropertyReceivedByRemoved;
            e.IsPropertyDatetimeReceivedRemoved  = c.IsPropertyDatetimeReceivedRemoved;
            e.IsPropertyItemDescriptionRemoved   = c.IsPropertyItemDescriptionRemoved;
            e.IsPropertyAcceptedQuantityRemoved  = c.IsPropertyAcceptedQuantityRemoved;
            e.IsPropertyRejectedQuantityRemoved  = c.IsPropertyRejectedQuantityRemoved;
            e.IsPropertyDamagedQuantityRemoved   = c.IsPropertyDamagedQuantityRemoved;
            e.IsPropertyActiveRemoved            = c.IsPropertyActiveRemoved;

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

            foreach (IShipmentReceiptImageCommand innerCommand in c.ShipmentReceiptImageCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentReceiptImageEvent innerEvent = Map(innerCommand, c, version, s);
                e.AddShipmentReceiptImageEvent(innerEvent);
            }

            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Ejemplo n.º 28
0
        public static TMergePatchShipment ToMergePatchShipment <TMergePatchShipment, TCreateShipmentItem, TMergePatchShipmentItem, TCreateShipmentReceipt, TMergePatchShipmentReceipt, TCreateItemIssuance, TMergePatchItemIssuance>(this IShipmentState state)
            where TMergePatchShipment : IMergePatchShipment, new()
            where TCreateShipmentItem : ICreateShipmentItem, new()
            where TMergePatchShipmentItem : IMergePatchShipmentItem, new()
            where TCreateShipmentReceipt : ICreateShipmentReceipt, new()
            where TMergePatchShipmentReceipt : IMergePatchShipmentReceipt, new()
            where TCreateItemIssuance : ICreateItemIssuance, new()
            where TMergePatchItemIssuance : IMergePatchItemIssuance, new()
        {
            var cmd = new TMergePatchShipment();

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

            cmd.ShipmentId                 = state.ShipmentId;
            cmd.ShipmentTypeId             = state.ShipmentTypeId;
            cmd.StatusId                   = state.StatusId;
            cmd.PrimaryOrderId             = state.PrimaryOrderId;
            cmd.PrimaryReturnId            = state.PrimaryReturnId;
            cmd.PrimaryShipGroupSeqId      = state.PrimaryShipGroupSeqId;
            cmd.PicklistBinId              = state.PicklistBinId;
            cmd.EstimatedReadyDate         = state.EstimatedReadyDate;
            cmd.EstimatedShipDate          = state.EstimatedShipDate;
            cmd.EstimatedShipWorkEffId     = state.EstimatedShipWorkEffId;
            cmd.EstimatedArrivalDate       = state.EstimatedArrivalDate;
            cmd.EstimatedArrivalWorkEffId  = state.EstimatedArrivalWorkEffId;
            cmd.LatestCancelDate           = state.LatestCancelDate;
            cmd.EstimatedShipCost          = state.EstimatedShipCost;
            cmd.CurrencyUomId              = state.CurrencyUomId;
            cmd.HandlingInstructions       = state.HandlingInstructions;
            cmd.OriginFacilityId           = state.OriginFacilityId;
            cmd.DestinationFacilityId      = state.DestinationFacilityId;
            cmd.OriginContactMechId        = state.OriginContactMechId;
            cmd.OriginTelecomNumberId      = state.OriginTelecomNumberId;
            cmd.DestinationContactMechId   = state.DestinationContactMechId;
            cmd.DestinationTelecomNumberId = state.DestinationTelecomNumberId;
            cmd.PartyIdTo                  = state.PartyIdTo;
            cmd.PartyIdFrom                = state.PartyIdFrom;
            cmd.AdditionalShippingCharge   = state.AdditionalShippingCharge;
            cmd.AddtlShippingChargeDesc    = state.AddtlShippingChargeDesc;
            cmd.Active = ((IShipmentStateProperties)state).Active;

            if (state.ShipmentTypeId == null)
            {
                cmd.IsPropertyShipmentTypeIdRemoved = true;
            }
            if (state.StatusId == null)
            {
                cmd.IsPropertyStatusIdRemoved = true;
            }
            if (state.PrimaryOrderId == null)
            {
                cmd.IsPropertyPrimaryOrderIdRemoved = true;
            }
            if (state.PrimaryReturnId == null)
            {
                cmd.IsPropertyPrimaryReturnIdRemoved = true;
            }
            if (state.PrimaryShipGroupSeqId == null)
            {
                cmd.IsPropertyPrimaryShipGroupSeqIdRemoved = true;
            }
            if (state.PicklistBinId == null)
            {
                cmd.IsPropertyPicklistBinIdRemoved = true;
            }
            if (state.EstimatedReadyDate == null)
            {
                cmd.IsPropertyEstimatedReadyDateRemoved = true;
            }
            if (state.EstimatedShipDate == null)
            {
                cmd.IsPropertyEstimatedShipDateRemoved = true;
            }
            if (state.EstimatedShipWorkEffId == null)
            {
                cmd.IsPropertyEstimatedShipWorkEffIdRemoved = true;
            }
            if (state.EstimatedArrivalDate == null)
            {
                cmd.IsPropertyEstimatedArrivalDateRemoved = true;
            }
            if (state.EstimatedArrivalWorkEffId == null)
            {
                cmd.IsPropertyEstimatedArrivalWorkEffIdRemoved = true;
            }
            if (state.LatestCancelDate == null)
            {
                cmd.IsPropertyLatestCancelDateRemoved = true;
            }
            if (state.EstimatedShipCost == null)
            {
                cmd.IsPropertyEstimatedShipCostRemoved = true;
            }
            if (state.CurrencyUomId == null)
            {
                cmd.IsPropertyCurrencyUomIdRemoved = true;
            }
            if (state.HandlingInstructions == null)
            {
                cmd.IsPropertyHandlingInstructionsRemoved = true;
            }
            if (state.OriginFacilityId == null)
            {
                cmd.IsPropertyOriginFacilityIdRemoved = true;
            }
            if (state.DestinationFacilityId == null)
            {
                cmd.IsPropertyDestinationFacilityIdRemoved = true;
            }
            if (state.OriginContactMechId == null)
            {
                cmd.IsPropertyOriginContactMechIdRemoved = true;
            }
            if (state.OriginTelecomNumberId == null)
            {
                cmd.IsPropertyOriginTelecomNumberIdRemoved = true;
            }
            if (state.DestinationContactMechId == null)
            {
                cmd.IsPropertyDestinationContactMechIdRemoved = true;
            }
            if (state.DestinationTelecomNumberId == null)
            {
                cmd.IsPropertyDestinationTelecomNumberIdRemoved = true;
            }
            if (state.PartyIdTo == null)
            {
                cmd.IsPropertyPartyIdToRemoved = true;
            }
            if (state.PartyIdFrom == null)
            {
                cmd.IsPropertyPartyIdFromRemoved = true;
            }
            if (state.AdditionalShippingCharge == null)
            {
                cmd.IsPropertyAdditionalShippingChargeRemoved = true;
            }
            if (state.AddtlShippingChargeDesc == null)
            {
                cmd.IsPropertyAddtlShippingChargeDescRemoved = true;
            }
            foreach (var d in state.ShipmentItems)
            {
                var c = d.ToCreateOrMergePatchShipmentItem <TCreateShipmentItem, TMergePatchShipmentItem>();
                cmd.ShipmentItemCommands.Add(c);
            }
            foreach (var d in state.ShipmentReceipts)
            {
                var c = d.ToCreateOrMergePatchShipmentReceipt <TCreateShipmentReceipt, TMergePatchShipmentReceipt>();
                cmd.ShipmentReceiptCommands.Add(c);
            }
            foreach (var d in state.ItemIssuances)
            {
                var c = d.ToCreateOrMergePatchItemIssuance <TCreateItemIssuance, TMergePatchItemIssuance>();
                cmd.ItemIssuanceCommands.Add(c);
            }
            return(cmd);
        }
Ejemplo n.º 29
0
        protected virtual IShipmentReceiptStateCreated MapCreate(ICreateShipmentReceipt c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentReceiptEventId(c.ShipmentId, c.ReceiptSeqId, version);
            IShipmentReceiptStateCreated e = NewShipmentReceiptStateCreated(stateEventId);
            var s = outerState.ShipmentReceipts.Get(c.ReceiptSeqId, true);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.LocatorId            = c.LocatorId;
            e.ShipmentItemSeqId    = c.ShipmentItemSeqId;
            e.ShipmentPackageSeqId = c.ShipmentPackageSeqId;
            e.OrderId           = c.OrderId;
            e.OrderItemSeqId    = c.OrderItemSeqId;
            e.ReturnId          = c.ReturnId;
            e.ReturnItemSeqId   = c.ReturnItemSeqId;
            e.RejectionReasonId = c.RejectionReasonId;
            e.DamageStatusId    = c.DamageStatusId;
            e.DamageReasonId    = c.DamageReasonId;
            e.ReceivedBy        = c.ReceivedBy;
            e.DatetimeReceived  = c.DatetimeReceived;
            e.ItemDescription   = c.ItemDescription;
            e.AcceptedQuantity  = c.AcceptedQuantity;
            e.RejectedQuantity  = c.RejectedQuantity;
            e.DamagedQuantity   = c.DamagedQuantity;
            e.Active            = c.Active;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////