예제 #1
0
        public SchemeDrawingWarehouse(Canvas surface, SchemeData schemeData)
        {
            _schemeData    = schemeData;
            _schemeDrawing = new SchemeDrawing(surface);

            _schemeAddressBlocks = new List <AddressBlock>();
        }
예제 #2
0
        private void InitializeWarehouse()
        {
            _schemeData = new SchemeData("Main1", 23, 7);
            var palletContents = _bc.GetAllPallets(_schemeData.WarehouseName);

            for (int row = 1; row <= _schemeData.CountRows; row++)
            {
                for (int place = 1; place <= _schemeData.CountPlaces; place++)
                {
                    const int countCells  = 3;
                    var       countFloors = row == 23 ? 5 : 4;
                    for (int floor = 1; floor <= countFloors; floor++)
                    {
                        for (int pallet = 1; pallet <= countCells; pallet++)
                        {
                            if (!((place == 1 && (row == 1 || row == 2)) ||
                                  ((place == 1 || place == 7) && row == 23) ||
                                  (place == 4 && (row >= 3 && row <= 22) && floor <= 2)))
                            {
                                var carPartsData = palletContents.Where(c => c.Location.Row == row && c.Location.Place == place &&
                                                                        c.Location.Floor == floor && c.Location.Pallet == pallet)
                                                   .Select(p => new CarPartData
                                {
                                    CarPart       = p.CarPart,
                                    CountCarParts = p.CountCarPart
                                })
                                                   .ToArray();

                                var address = new AddressCell
                                {
                                    Row   = row,
                                    Place = place,
                                    Floor = floor,
                                    Cell  = pallet
                                };
                                _schemeData.AddCell(address, carPartsData);
                            }
                        }
                    }
                }
            }

            for (int row = 0; row <= _schemeData.CountRows - 1; row += 2)
            {
                _schemeData.SetRoad(new SchemeRoad
                {
                    Type        = RoadType.Row,
                    StartRow    = row,
                    FinishRow   = row + 1,
                    StartPlace  = 1,
                    FinishPlace = _schemeData.CountPlaces
                });
            }
        }