Exemplo n.º 1
0
        public async Task <bool> IsMatch(string brand, string cardNumber, string transportNumber)
        {
            int i = 0;

            _size  = 0;
            _value = 0;
            _items.Clear();
            ILocationGrain grain = ClusterClient.Default.GetGrain <ILocationGrain>(Name);

            foreach (IcCustomerInventory item in _inventoryList)
            {
                i = i + 1;
                if (item.IsMatch(brand, cardNumber, transportNumber))
                {
                    _size = _size + ((IGoods)item).Size;
                    if (_items.Count == 0)
                    {
                        _value = await grain.GetUnloadValue(brand, cardNumber, transportNumber);
                    }
                    _items.Add(item);
                    item.ResetValue((int)Math.Round(Math.Sqrt((_value * _value + (double)i * i * 81 / (_inventoryList.Count * _inventoryList.Count)) / 2)));
                }
            }

            return(_items.Count > 0);
        }
Exemplo n.º 2
0
        public async Task Load(string brand, string cardNumber, string transportNumber, int weight,
                               string locationArea, string locationAlley, string locationOrdinal)
        {
            string              location      = AppConfig.FormatLocation(locationArea, locationAlley, locationOrdinal);
            ILocationGrain      locationGrain = ClusterClient.Default.GetGrain <ILocationGrain>(location);
            IcCustomerInventory inventory     = IcCustomerInventory.New(Database.Default,
                                                                        IcCustomerInventory.Set(p => p.CustomerId, Owner.Owner.Owner.Id).
                                                                        Set(p => p.Brand, brand).
                                                                        Set(p => p.CardNumber, cardNumber).
                                                                        Set(p => p.TransportNumber, transportNumber).
                                                                        Set(p => p.Weight, weight).
                                                                        Set(p => p.LocationArea, locationArea).
                                                                        Set(p => p.LocationAlley, locationAlley).
                                                                        Set(p => p.LocationOrdinal, locationOrdinal).
                                                                        Set(p => p.StackOrdinal, await locationGrain.GetStackOrdinal()));

            inventory.InsertSelf();
            await locationGrain.Refresh();

            Add(inventory);
        }