コード例 #1
0
 internal Machine(MachineType machineType,Product output, List<Production> productTimes)
 {
     this.machineType = machineType;
     this.output = output;
     this.ProductTimes = productTimes;
     AcumalatedTime = 0;
 }
コード例 #2
0
 internal void addNewProduct(string name)
 {
     Product p = new Product(name, tasksToBeAdded);
     tasksToBeAdded = new List<Task>();
     persistence.Database.getDatabase().addNewProduct(p);
 }
コード例 #3
0
        private List<Machine> createMachines()
        {
            List<Machine> machines = new List<Machine>();
            #region Create all resources
            Resource rProduct1 = new Resource("iron", 5, 10);
            List<Resource> product1List = new List<Resource>();
            product1List.Add(rProduct1);

            Resource rProduct2 = new Resource("aluminium", 5, 10);
            List<Resource> product2List = new List<Resource>();
            product2List.Add(rProduct2);

            Resource rProduct3 = new Resource("Copper", 5, 15);
            List<Resource> product3List = new List<Resource>();
            product3List.Add(rProduct3);

            Resource rProduct4 = new Resource("Copper", 5, 35);
            List<Resource> product4List = new List<Resource>();
            product4List.Add(rProduct4);

            Resource rProduct5 = new Resource("Ferrous metal", 10, 15);
            List<Resource> product5List = new List<Resource>();
            product5List.Add(rProduct5);

            Resource rProduct6 = new Resource("Noble metal", 15, 10);
            List<Resource> product6List = new List<Resource>();
            product6List.Add(rProduct6);

            Resource rProduct7 = new Resource("Noble metal", 15, 20);
            List<Resource> product7List = new List<Resource>();
            product7List.Add(rProduct7);

            Resource rProduct8 = new Resource("Silver", 25, 10);
            List<Resource> product8List = new List<Resource>();
            product8List.Add(rProduct8);

            Resource rProduct9 = new Resource("Silver", 25, 20);
            List<Resource> product9List = new List<Resource>();
            product9List.Add(rProduct9);

            Resource rProduct10 = new Resource("Gold", 30, 5);
            List<Resource> product10List = new List<Resource>();
            product10List.Add(rProduct10);

            Resource rProduct11 = new Resource("Gold", 35, 10);
            List<Resource> product11List = new List<Resource>();
            product11List.Add(rProduct11);

            Resource rProduct12 = new Resource("Gold", 35, 15);
            List<Resource> product12List = new List<Resource>();
            product12List.Add(rProduct12);

            Resource rProduct13 = new Resource("Lead", 5, 15);
            List<Resource> product13List = new List<Resource>();
            product13List.Add(rProduct13);

            Resource rProduct14 = new Resource("Lead", 5, 25);
            List<Resource> product14List = new List<Resource>();
            product14List.Add(rProduct14);

            Resource rProduct15 = new Resource("Zinc", 10, 20);
            List<Resource> product15List = new List<Resource>();
            product15List.Add(rProduct15);

            #endregion
            #region Create all machines
            Machine machine1 = new Machine(Machine.MachineType.stopMachines, null, new List<Production>());
            Machine machine2 = new Machine(Machine.MachineType.stopMachines, null, new List<Production>());
            Machine machine3 = new Machine(Machine.MachineType.stopMachines, null, new List<Production>());
            Machine machine4 = new Machine(Machine.MachineType.weldingMachine, null, new List<Production>());
            Machine machine5 = new Machine(Machine.MachineType.weldingMachine, null, new List<Production>());
            Machine machine6 = new Machine(Machine.MachineType.bendingMachine, null, new List<Production>());
            Machine machine7 = new Machine(Machine.MachineType.laserCutter, null, new List<Production>());
            Machine machine8 = new Machine(Machine.MachineType.MachineShears, null, new List<Production>());
            Machine machine9 = new Machine(Machine.MachineType.CNCMillingMachine, null, new List<Production>());
            Machine machine10 = new Machine(Machine.MachineType.CNCMillingMachine, null, new List<Production>());
            Machine machine11 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());
            Machine machine12 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());
            Machine machine13 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());
            Machine machine14 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());
            Machine machine15 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());
            Machine machine16 = new Machine(Machine.MachineType.InstallingBenches, null, new List<Production>());

            #endregion 
            machines.Add(machine1);
            machines.Add(machine2);
            machines.Add(machine3);
            machines.Add(machine4);
            machines.Add(machine5);
            machines.Add(machine6);
            machines.Add(machine7);
            machines.Add(machine8);
            machines.Add(machine9);
            machines.Add(machine10);
            machines.Add(machine11);
            machines.Add(machine12);
            machines.Add(machine13);
            machines.Add(machine14);
            machines.Add(machine15);
            machines.Add(machine16);

            #region tasks og products
            List<Task> tasks = new List<Task>();
            Task task1 = new Task(Machine.MachineType.stopMachines, 4); //machine 1, 2 or 3
            tasks.Add(task1);
            Product product1 = new Product("Grate 1", tasks); //et færdig product som firmaet kan lave

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.stopMachines, 5); //machine 1, 2 or 3
            tasks.Add(task1);
            Product product2 = new Product("Grate 2", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.stopMachines, 5); //machine 1, 2 or 3
            tasks.Add(task1);
            Product product3 = new Product("Grate 3", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.weldingMachine, 5); //machine 4 or 5 molding
            tasks.Add(task1);
            Product product4 = new Product("Grate 4", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.weldingMachine, 2); //machine 4 or 5 molding
            tasks.Add(task1);
            Product product5 = new Product("Grate 5", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.bendingMachine, 3); //machine 6 bending 
            tasks.Add(task1);
            Product product6 = new Product("Grate 6", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.laserCutter, 10); //machine 7 lasercutter
            tasks.Add(task1);
            Product product7 = new Product("Grate 7", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.MachineShears, 12); //machine 8 shears
            tasks.Add(task1);
            Product product8 = new Product("Grate 8", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.CNCMillingMachine, 15); //machine 9 milling
            tasks.Add(task1);
            Product product9 = new Product("Grate 9", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.CNCMillingMachine, 20); //machine 10 milling
            tasks.Add(task1);
            Product product10 = new Product("Grate 10", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.InstallingBenches, 8); //machine 11,12,13,14,15 or 16 machine work bench
            tasks.Add(task1);
            Product product11 = new Product("Grate 11", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.InstallingBenches, 10);//machine 11,12,13,14,15 or 16 machine work bench
            tasks.Add(task1);
            Product product12 = new Product("Grate 12", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.InstallingBenches, 15);//machine 11,12,13,14,15 or 16 machine work bench
            tasks.Add(task1);
            Product product13 = new Product("Grate 13", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.InstallingBenches, 10);//machine 11,12,13,14,15 or 16 machine work bench
            tasks.Add(task1);
            Product product14 = new Product("Grate 14", tasks);

            tasks = new List<Task>();
            task1 = new Task(Machine.MachineType.InstallingBenches, 5);//machine 11,12,13,14,15 or 16 machine work bench
            tasks.Add(task1);
            Product product15 = new Product("Grate 15", tasks);

            #endregion
            products.Add(product1);
            products.Add(product2);
            products.Add(product3);
            products.Add(product4);
            products.Add(product5);
            products.Add(product6);
            products.Add(product7);
            products.Add(product8);
            products.Add(product9);
            products.Add(product10);
            products.Add(product11);
            products.Add(product12);
            products.Add(product13);
            products.Add(product14);
            products.Add(product15);
            return machines;
        }