Ejemplo n.º 1
0
        public static MvcHtmlString CreateList(this HtmlHelper html, nesting_plan p)
        {
            StringBuilder result = new StringBuilder();
            TagBuilder    Div2   = new TagBuilder("div");

            Div2.MergeAttribute("style", "position:relative; width:1000px;" + " " + "height:"
                                + "500px");

            TagBuilder Div1 = new TagBuilder("div");

            Div1.MergeAttribute("class", p.number.ToString());
            int max_x = 0;
            int K     = 3;

            foreach (part_nesting y in p.list_parts_nesting)
            {
                if ((y.x + y.Length) > max_x)
                {
                    max_x = (y.x + y.Length);
                }
            }


            if (max_x < 2000 && max_x > 1000)
            {
                K = 3;
            }


            int Legnth = max_x / K;
            int Height = (int)p.width / K;

            Div1.MergeAttribute("style", "position:absolute; Top=0; Left=0; width:" + Legnth.ToString() + "px;" + " " + "height:"
                                + Height.ToString() + "px;" + " " + "border: 1px double black; background:green");
            foreach (part_nesting y in p.list_parts_nesting)
            {
                TagBuilder Div    = new TagBuilder("Div");
                int        Top    = y.y / K;
                int        Left   = y.x / K;
                int        Length = y.Length / K;
                int        width  = y.width / K;
                Div.MergeAttribute("style", "position:absolute; bottom:" + Top.ToString() + "px;"
                                   + " " + "left:" + Left.ToString() + "px;" + " " + "width:" + Length.ToString() + "px;" + " " + "height:" +
                                   width.ToString() + "px;" + "border: 1px double black; margin:1px; background:blue");



                Div1.InnerHtml += Div.ToString();
            }
            Div2.InnerHtml += Div1.ToString();


            result.Append(Div2.ToString());
            return(new MvcHtmlString(result.ToString()));
        }
Ejemplo n.º 2
0
        public void KartaRaskroj_Rendering_View()
        {
            //Arrang
            nesting_plan ns = new nesting_plan();

            ns.width = 1250;
            NestingController nestingContr = new NestingController();
            //Act
            PartialViewResult view_karta = nestingContr.KartaRaskroj(ns);
            //Assert
            nesting_plan ns_in = (nesting_plan)view_karta.Model;

            Assert.AreEqual(1250, ns.width);
        }
Ejemplo n.º 3
0
        public data_order Arrang()
        {
            //Arrang
            data_order order1 = new data_order();

            order1.name = "USA";
            order1.note = "Proba";
            Material mat1 = new Material
            {
                index       = 1,
                type        = "Балка",
                name        = "Б1",
                Description = "8",
                Dlina       = 11750,
                Cena        = 40
            };
            Material mat2 = new Material
            {
                index       = 2,
                type        = "Лист",
                name        = "г/к",
                Description = "16",

                Dlina = 6000,
                Cena  = 40
            };

            Sheet scheet1 = new Sheet {
                MatID = 1, length = 11750, quantity = 100
            };
            Sheet scheet2 = new Sheet {
                MatID = 2, length = 6000, width = 1500, thick = 10, quantity = 100
            };

            mat1.AddSheet(scheet1);
            mat2.AddSheet(scheet2);
            part Part1 = new part
            {
                index    = 2,
                Length   = 500,
                number   = 101,
                quantitu = 20,
                rotate   = 1,
                thick    = 10,
                width    = 600
            };
            part Part2 = new part
            {
                index    = 2,
                Length   = 300,
                number   = 102,
                quantitu = 40,
                rotate   = 1,
                thick    = 10,
                width    = 400
            };
            nesting_plan karta_raskroj = new nesting_plan
            {
                number     = 1,
                length     = 6000,
                width      = 1500,
                thick      = 10,
                quantitu   = 1,
                cut_length = 35.1
            };
            part_nesting pn1 = new part_nesting
            {
                Number = 101,
                x      = 0,
                y      = 0
            };
            part_nesting pn2 = new part_nesting
            {
                Number = 101,
                x      = 500,
                y      = 0
            };
            part_nesting pn3 = new part_nesting
            {
                Number = 101,
                x      = 500,
                y      = 600
            };
            part_nesting pn4 = new part_nesting
            {
                Number = 101,
                x      = 0,
                y      = 600
            };

            karta_raskroj.AddPartNesting(pn1);
            karta_raskroj.AddPartNesting(pn2);
            karta_raskroj.AddPartNesting(pn3);
            karta_raskroj.AddPartNesting(pn4);
            Cut cut1 = new Cut {
                x1 = 500, x2 = 500, y1 = 1500, y2 = 0, type = TypeM.main
            };
            Cut cut2 = new Cut {
                x1 = 0, x2 = 500, y1 = 600, y2 = 600
            };
            Cut cut3 = new Cut {
                x1 = 0, x2 = 500, y1 = 1200, y2 = 1200
            };

            mat2.AddItem(Part1);
            mat2.AddItem(Part2);
            karta_raskroj.AddCut(cut1);
            karta_raskroj.AddCut(cut2);
            karta_raskroj.AddCut(cut3);
            mat2.AddNesting(karta_raskroj);
            order1.AddMat(mat1);
            order1.AddMat(mat2);
            return(order1);
        }
Ejemplo n.º 4
0
 // карта раскроя
 public PartialViewResult KartaRaskroj(nesting_plan karta_raskroj)
 {
     return(PartialView(karta_raskroj));
 }