Пример #1
0
        private void ChooseOrderBoxToPack()
        {
            // If orderBoxBeingPacked != null -> throw error
            if (_orderBoxBeingPacked != null)
            {
                throw new InvalidDataException($"{nameof(_orderBoxBeingPacked)} should be null when this is called.");
            }

            // Loop through orderBoxes
            foreach (var orderBox in OrderBoxes)
            {
                // Loop through unpacked lines
                foreach (var line in orderBox.LinesNotPickedIn(_areaCode))
                {
                    // If line matches shelfbox then
                    if (ShelfBoxes.Any(s => Equals(s.Line.Article, line.Article)))
                    {
                        // Create new OrderBoxLineBeingPicked with orderBox and line to be picked
                        _orderBoxBeingPacked = new OrderBoxPickingContainer(orderBox, line);
                        // Listen to orderBoxLineBeingPicked's finishedEvent
                        _orderBoxBeingPacked.OnLinePickedForOrderBox += OrderBoxLineFinishedPacking;

                        // Return, since we have found a pickable line
                        return;
                    }
                }
            }
        }
Пример #2
0
        private void OrderBoxLineFinishedPacking(OrderBox orderBox)
        {
            // Check if any shelfBoxes can be evicted
            MaybeEvictShelfBoxes();

            // Set orderBoxLineBeingPicked to null
            _orderBoxBeingPacked = null;

            // If orderBox is fully packed then
            if (!orderBox.LinesNotPickedIn(_areaCode).Any())
            {
                // Evict orderBox
                EvictOrderBox(orderBox);
            }
        }