Пример #1
0
        public void OnTransferClaimResponse(TransferClaimResponse response)
        {
            if (State == LotAllocationState.FAILED)
            {
                return;
            }
            PickingAttempt.Free();

            if (response.Status == TransferClaimResponseStatus.ACCEPTED)
            {
                //Not our claim anymore
                ClaimId = null;
                State   = LotAllocationState.ALLOCATED;

                PickingTask.SetResult(new LotPickResult {
                    Accepted = true
                });
            }
            else
            {
                State = LotAllocationState.FAILED;
                PickingTask.SetResult(new LotPickResult
                {
                    Accepted = false
                });
            }
        }
Пример #2
0
 public void Handle(IGluonSession session, TransferClaimResponse claimResponse)
 {
     if (claimResponse.Type == Protocol.Gluon.Model.ClaimType.LOT)
     {
         Lots.OnTransferClaimResponse(claimResponse);
     }
 }
Пример #3
0
        public void OnTransferClaimResponse(TransferClaimResponse response)
        {
            if (response.Type != Protocol.Gluon.Model.ClaimType.LOT)
            {
                return;
            }

            uint?location;

            if (response.ClaimId != 0)
            {
                using (var da = DAFactory.Get)
                {
                    location = da.Lots.Get(response.EntityId)?.location;
                }
            }
            else
            {
                location = (uint)response.EntityId;
            }
            if (location == null)
            {
                return;
            }

            var allocation = Get(location.Value);

            lock (allocation)
            {
                allocation.OnTransferClaimResponse(response);
                if (allocation.State == LotAllocationState.FAILED)
                {
                    //Failed, remove
                    var removedAllocation = Remove(location.Value);
                }
            }

            //Touches the db so do this outside of the lock
            if (allocation.State == LotAllocationState.FAILED)
            {
                allocation.Free();
            }
        }