void Dolgozik(Gep kapottgep) { // mindig az a gép ami kevesebbet dolgozott Gep g = gepek.FirstOrDefault(x => x.naplo.Count == gepek.Min(y => y.naplo.Count)); //előző folyamathoz képest int eltolodas = kapottgep.naplo.Max(); // ezt meg én se értem if (((g.naplo.Count() != 0) ? g.naplo.Max() : 0) > eltolodas) { g.naplo.Add(g.naplo.Max() + g.ido); } else { g.naplo.Add(eltolodas + (g.ido)); } g.hanyadikmenet++; // ha kell itt is továbbpasszol if (kovetkezofolyamat != null) { kovetkezofolyamat.Dolgozik(g); } }
//csak a legelső gépnél kell public void Kezdes(int mennyit) { if (elozofolyamat == null) { for (int i = 0; i < mennyit; i++) { Gep g = gepek.FirstOrDefault(x => x.naplo.Count == gepek.Min(y => y.naplo.Count)); g.naplo.Add(g.ido * g.hanyadikmenet); g.hanyadikmenet++; if (kovetkezofolyamat != null) { //amint kész továbbpasszolja a cuccot kovetkezofolyamat.Dolgozik(g); } } } }
void Hierarchy() { gcs1 = new GepCsoport(null); gcs2 = new GepCsoport(gcs1); gcs3 = new GepCsoport(gcs2); gcs4 = new GepCsoport(gcs3); gcs5 = new GepCsoport(gcs4); gcs6 = new GepCsoport(gcs5); gcs1.kovetkezofolyamat = gcs2; gcs2.kovetkezofolyamat = gcs3; gcs3.kovetkezofolyamat = gcs4; gcs4.kovetkezofolyamat = gcs5; gcs5.kovetkezofolyamat = gcs6; cutter1 = new Gep(); cutter2 = new Gep(); cutter3 = new Gep(); cutter4 = new Gep(); cutter5 = new Gep(); cutter6 = new Gep(); cutter1.name = "cutter1"; cutter2.name = "cutter2"; cutter3.name = "cutter3"; cutter4.name = "cutter4"; cutter5.name = "cutter5"; cutter6.name = "cutter6"; gcs1.gepek.Add(cutter1); gcs1.gepek.Add(cutter2); gcs1.gepek.Add(cutter3); gcs1.gepek.Add(cutter4); gcs1.gepek.Add(cutter5); gcs1.gepek.Add(cutter6); bender1 = new Gep(); bender2 = new Gep(); bender1.name = "bender1"; bender2.name = "bender2"; gcs2.gepek.Add(bender1); gcs2.gepek.Add(bender2); welder1 = new Gep(); welder2 = new Gep(); welder3 = new Gep(); welder1.name = "welder1"; welder2.name = "welder2"; welder3.name = "welder3"; gcs3.gepek.Add(welder1); gcs3.gepek.Add(welder2); gcs3.gepek.Add(welder3); tester1 = new Gep(); tester1.name = "tester1"; gcs4.gepek.Add(tester1); painter1 = new Gep(); painter2 = new Gep(); painter3 = new Gep(); painter4 = new Gep(); painter1.name = "painter1"; painter2.name = "painter2"; painter3.name = "painter3"; painter4.name = "painter4"; gcs5.gepek.Add(painter1); gcs5.gepek.Add(painter2); gcs5.gepek.Add(painter3); gcs5.gepek.Add(painter4); packer1 = new Gep(); packer2 = new Gep(); packer3 = new Gep(); packer1.name = "packer1"; packer2.name = "packer2"; packer3.name = "packer3"; gcs6.gepek.Add(packer1); gcs6.gepek.Add(packer2); gcs6.gepek.Add(packer3); }