示例#1
0
		public Job Convert(List<CuttingScheme> schemes)
		{
			Job result = new Job();
			Int32 cuttingIndex = 0;
            Dictionary<Sheet, LC4.Sheet> map = new Dictionary<Sheet, LC4.Sheet>();
			foreach (CuttingScheme scheme in schemes)
			{
                Plan plan = new Plan();
                plan.Name = (cuttingIndex + 1).ToString("00000");
                plan.LaneType = LaneType.Plate;
                plan.Size = scheme.Height; // поперечный размер
                plan.Length = scheme.Width; // продольный размер
                plan.SizeType = SizeType.Changeable;
                plan.NurVonVorneAbarbeiten = true;
                plan.TotalAmount = scheme.Repetitions;

                // создаём промежуточную полосу в случае когда первый рез является продольным
                Lane rootLane;
                if (scheme.RootSection.NestedSections.First.Value.CutType == CutType.Horizontal)
                {
                    rootLane = new Lane();
                    rootLane.Size = scheme.Width;
                    rootLane.LaneType = LaneType.Lane;
                    rootLane.SizeType = SizeType.Fixed;
                }
                else
                {
                    rootLane = plan;
                }

                // указываем плиту на которой происходит раскрой
                LC4.Sheet sheet;
                Lage lage = new Lage();
                if (!map.TryGetValue(scheme.Sheet, out sheet))
                {
                    sheet = new LC4.Sheet();
                    // в scheme ширина и высота указывается относительно экрана
                    sheet.Length = scheme.Sheet.Width;
                    sheet.Width = scheme.Sheet.Height;
                    sheet.Thickness = scheme.Sheet.Thickness;
                    sheet.Amount = 0;
                    map.Add(scheme.Sheet, sheet);
                    result.Sheets.Add(sheet);
                }
                lage.Amount = scheme.Repetitions;
                lage.BaseDetail = sheet;
                sheet.Amount += scheme.Repetitions;
                lage.Quality = "";
                plan.Lagen.Add(lage);

                // добавляем вложенные полосы
                AddSubLanes(plan, scheme.RootSection.NestedSections);

                Statistics stat = scheme.CalcStatistics();
				plan.Information.TotalSquare = (double)scheme.Sheet.Width * (double)scheme.Sheet.Height;
				plan.Information.DustSquare = stat.DustSquare;
				plan.Information.ScrapsSquare = stat.ScrapsSquare + stat.UndefinitesSquare;
				plan.Information.ScrapPercent = (plan.Information.DustSquare + plan.Information.ScrapsSquare) / plan.Information.TotalSquare * 100.0;
				plan.Information.DetailsCount = stat.DetailsCount;
				plan.Information.DetailsSquare = stat.DetailsSquare;
				plan.Information.RemainsCount = stat.RemainsCount;
				plan.Information.RemainsSquare = stat.RemainsSquare;

				result.Plans.Add(plan);
				cuttingIndex++;
			}
			return result;
		}
示例#2
0
        public Job Convert(List <CuttingScheme> schemes)
        {
            Job   result       = new Job();
            Int32 cuttingIndex = 0;
            Dictionary <Sheet, LC4.Sheet> map = new Dictionary <Sheet, LC4.Sheet>();

            foreach (CuttingScheme scheme in schemes)
            {
                Plan plan = new Plan();
                plan.Name     = (cuttingIndex + 1).ToString("00000");
                plan.LaneType = LaneType.Plate;
                plan.Size     = scheme.Height; // поперечный размер
                plan.Length   = scheme.Width;  // продольный размер
                plan.SizeType = SizeType.Changeable;
                plan.NurVonVorneAbarbeiten = true;
                plan.TotalAmount           = scheme.Repetitions;

                // создаём промежуточную полосу в случае когда первый рез является продольным
                Lane rootLane;
                if (scheme.RootSection.NestedSections.First.Value.CutType == CutType.Horizontal)
                {
                    rootLane          = new Lane();
                    rootLane.Size     = scheme.Width;
                    rootLane.LaneType = LaneType.Lane;
                    rootLane.SizeType = SizeType.Fixed;
                }
                else
                {
                    rootLane = plan;
                }

                // указываем плиту на которой происходит раскрой
                LC4.Sheet sheet;
                Lage      lage = new Lage();
                if (!map.TryGetValue(scheme.Sheet, out sheet))
                {
                    sheet = new LC4.Sheet();
                    // в scheme ширина и высота указывается относительно экрана
                    sheet.Length    = scheme.Sheet.Width;
                    sheet.Width     = scheme.Sheet.Height;
                    sheet.Thickness = scheme.Sheet.Thickness;
                    sheet.Amount    = 0;
                    map.Add(scheme.Sheet, sheet);
                    result.Sheets.Add(sheet);
                }
                lage.Amount     = scheme.Repetitions;
                lage.BaseDetail = sheet;
                sheet.Amount   += scheme.Repetitions;
                lage.Quality    = "";
                plan.Lagen.Add(lage);

                // добавляем вложенные полосы
                AddSubLanes(plan, scheme.RootSection.NestedSections);

                Statistics stat = scheme.CalcStatistics();
                plan.Information.TotalSquare   = (double)scheme.Sheet.Width * (double)scheme.Sheet.Height;
                plan.Information.DustSquare    = stat.DustSquare;
                plan.Information.ScrapsSquare  = stat.ScrapsSquare + stat.UndefinitesSquare;
                plan.Information.ScrapPercent  = (plan.Information.DustSquare + plan.Information.ScrapsSquare) / plan.Information.TotalSquare * 100.0;
                plan.Information.DetailsCount  = stat.DetailsCount;
                plan.Information.DetailsSquare = stat.DetailsSquare;
                plan.Information.RemainsCount  = stat.RemainsCount;
                plan.Information.RemainsSquare = stat.RemainsSquare;

                result.Plans.Add(plan);
                cuttingIndex++;
            }
            return(result);
        }