Esempio n. 1
0
        public ProductieClusters helperGenerateProductionCluster2(string[] readedLine)
        {
            ProductieClusters nieuw = PCL.Find(x => x.productieclusternaam == readedLine[0]);
            BeerType          bt    = beerType.Find(x => x.beerName == readedLine[1]);

            nieuw.addTypeCapacity(bt, readedLine[2]);
            return(nieuw);
        }
Esempio n. 2
0
        public void DoWeHaverawMaterials(RawMaterials rm, double btamount, BeerType bt)
        {
            int    Productie = PCL.Find(x => x.productieclusternaam == bt.prducl).typecapacity.Find(y => y.Key.beerName == bt.beerName).Value;
            double nodig     = Math.Ceiling((bt.howMuchToBuyNL + bt.howMuchToBuyBE + bt.howMuchToBuySW + bt.howMuchToBuyFR) * 1.0 / Productie);

            while (rm.voorraad < ((nodig * Productie) * btamount))
            {
                goBuyRawMaterial(rm, btamount, bt);
            }
        }
Esempio n. 3
0
        public void goBuyRawMaterial(RawMaterials rm, double btamount, BeerType bt)
        {
            int    Productie = PCL.Find(x => x.productieclusternaam == bt.prducl).typecapacity.Find(y => y.Key.beerName == bt.beerName).Value;
            double nodig     = Math.Ceiling((bt.howMuchToBuyNL + bt.howMuchToBuyBE + bt.howMuchToBuySW + bt.howMuchToBuyFR) * 1.0 / Productie);

            while (rm.voorraad < ((nodig * Productie) * btamount))
            {
                rm.voorraad += rm.minOrderAmount;
                totalcostQ0 += (rm.minOrderAmount * rm.priceBuy);
                rm.amountBoughtThisQuarter += rm.minOrderAmount;
            }
        }
Esempio n. 4
0
        public List <BeerType> GenerateBeerType()
        {
            BeerType     nieuw;
            StreamReader sr = new StreamReader("beerType.csv");
            string       invoer;

            invoer = sr.ReadLine();
            string[] readedLine;
            while ((invoer = sr.ReadLine()) != null)
            {
                readedLine = invoer.Replace('.', ',').Split(';');
                nieuw      = new BeerType(readedLine, rawMaterials);
                beerType.Add(nieuw);
            }
            return(beerType);
        }
Esempio n. 5
0
        public void addTypeCapacity(BeerType bt, string cap)
        {
            KeyValuePair <BeerType, int> kvp = new KeyValuePair <BeerType, int>(bt, int.Parse(cap));

            typecapacity.Add(kvp);
        }
Esempio n. 6
0
        public void ProduceBeer(BeerType bt)
        {
            if (bt.malt != 0)
            {
                DoWeHaverawMaterials(rawMaterials[0], bt.malt, bt);
            }
            if (bt.naturalWater != 0)
            {
                DoWeHaverawMaterials(rawMaterials[1], bt.naturalWater, bt);
            }
            if (bt.hops != 0)
            {
                DoWeHaverawMaterials(rawMaterials[2], bt.hops, bt);
            }
            if (bt.munichMalt != 0)
            {
                DoWeHaverawMaterials(rawMaterials[3], bt.munichMalt, bt);
            }
            if (bt.caramelMalt != 0)
            {
                DoWeHaverawMaterials(rawMaterials[4], bt.caramelMalt, bt);
            }
            if (bt.wheat != 0)
            {
                DoWeHaverawMaterials(rawMaterials[5], bt.wheat, bt);
            }
            if (bt.rye != 0)
            {
                DoWeHaverawMaterials(rawMaterials[6], bt.rye, bt);
            }
            if (bt.maize != 0)
            {
                DoWeHaverawMaterials(rawMaterials[7], bt.maize, bt);
            }
            if (bt.caneSugar != 0)
            {
                DoWeHaverawMaterials(rawMaterials[8], bt.caneSugar, bt);
            }
            if (bt.coriander != 0)
            {
                DoWeHaverawMaterials(rawMaterials[9], bt.coriander, bt);
            }
            if (bt.orangePeel != 0)
            {
                DoWeHaverawMaterials(rawMaterials[10], bt.orangePeel, bt);
            }
            while (bt.howMuchToBuyNL + bt.howMuchToBuyBE + bt.howMuchToBuySW + bt.howMuchToBuyFR > bt.voorraad)
            {
                int GaIkNuProduceren = PCL.Find(x => x.productieclusternaam == bt.prducl).typecapacity.Find(y => y.Key.beerName == bt.beerName).Value;

                if (bt.malt != 0)
                {
                    rawMaterials[0].voorraad -= (GaIkNuProduceren * bt.malt);
                }
                if (bt.naturalWater != 0)
                {
                    rawMaterials[1].voorraad -= (GaIkNuProduceren * bt.naturalWater);
                }
                if (bt.hops != 0)
                {
                    rawMaterials[2].voorraad -= (GaIkNuProduceren * bt.hops);
                }
                if (bt.munichMalt != 0)
                {
                    rawMaterials[3].voorraad -= (GaIkNuProduceren * bt.munichMalt);
                }
                if (bt.caramelMalt != 0)
                {
                    rawMaterials[4].voorraad -= (GaIkNuProduceren * bt.caramelMalt);
                }
                if (bt.wheat != 0)
                {
                    rawMaterials[5].voorraad -= (GaIkNuProduceren * bt.wheat);
                }
                if (bt.rye != 0)
                {
                    rawMaterials[6].voorraad -= (GaIkNuProduceren * bt.rye);
                }
                if (bt.maize != 0)
                {
                    rawMaterials[7].voorraad -= (GaIkNuProduceren * bt.maize);
                }
                if (bt.caneSugar != 0)
                {
                    rawMaterials[8].voorraad -= (GaIkNuProduceren * bt.caneSugar);
                }
                if (bt.coriander != 0)
                {
                    rawMaterials[9].voorraad -= (GaIkNuProduceren * bt.coriander);
                }
                if (bt.orangePeel != 0)
                {
                    rawMaterials[10].voorraad -= (GaIkNuProduceren * bt.orangePeel);
                }
                bt.voorraad += GaIkNuProduceren;
                totalcostQ0 += PCL.Find(x => x.productieclusternaam == bt.prducl).leasePrice;
            }
            bt.producedforNL = bt.howMuchToBuyNL;
            bt.producedforBE = bt.howMuchToBuyBE;
            bt.producedforSW = bt.howMuchToBuySW;
            bt.producedforFR = bt.howMuchToBuyFR;
            bt.voorraad     -= (bt.howMuchToBuyNL + bt.howMuchToBuyBE + bt.howMuchToBuySW + bt.howMuchToBuyFR);
        }