Ejemplo n.º 1
0
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, int makereadis, double running)
        {
            double total;
            total = Convert.ToDouble(StartingCost1, Thread.CurrentThread.CurrentUICulture);            
            total += Convert.ToDouble(StartingCost2, Thread.CurrentThread.CurrentUICulture) * --starts;

            if (UseDifferentCostPerUnit??false)
            {
                var step = steps.OfType<CostPerRunStep>().Where(x => x.FromUnit <= running && x.ToUnit >= running).FirstOrDefault();
                if (step != null)
                {
                    total += Convert.ToDouble(step.CostPerUnit, Thread.CurrentThread.CurrentUICulture) * running;
                }
                else
                {
                    total += Convert.ToDouble(CostPerUnit, Thread.CurrentThread.CurrentUICulture) * running;
                }
               // throw new NotImplementedException();
            }
            else
            {
                total += Convert.ToDouble(CostPerUnit, Thread.CurrentThread.CurrentUICulture) * running;
            }

            CostAndTime ct = new CostAndTime { Cost = total, Time = new TimeSpan(0,0,0) };

            return ct;
        }
        //starts = 1 per avviamento, i successivi son
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts,double retroStarts,  double rollChanges, int tracks, double running)
        {
            TimeSpan totalTimeA;
            totalTimeA = this.StartingTime1 ?? TimeSpan.Zero;

            for (int i = 0; i < rollChanges && rollChanges != double.PositiveInfinity; i++)
            {
                totalTimeA += (StartingTime2 ?? TimeSpan.Zero);
            }

            for (int i = 0; i < tracks; i++)
            {
                totalTimeA += (StartingTimePerColor ?? TimeSpan.Zero);
            }

            var costA = CostPerHourStarting;
            var totalA = (totalTimeA.TotalMinutes) / 60 * Convert.ToDouble(costA, Thread.CurrentThread.CurrentUICulture);


            var avrR = AvarageRunPerHour;

            var stepR = this.steps.OfType<AvarageRunPerRunStep>().Where(x => x.FromUnit <= running && x.ToUnit >= running).FirstOrDefault();

            if (stepR != null)
            {
                //leggo il costo differente per ciascun colore
                avrR = stepR.AvarageRunPerHour == null ? avrR : stepR.AvarageRunPerHour;
            }

            TimeSpan totalTimeR = TimeSpan.Zero;
            if (avrR == null)
            {
                totalTimeR = TimeSpan.Zero;
            }
            else
            {
                //minuti //nella flexo AvarageRunPerHour = m/sec
                var tot = (running / avrR ?? 1);
                totalTimeR += TimeSpan.FromMinutes(tot);
            }

            //leggo il costo differente per ciascun colore
            var costH = CostPerHourRunning;

            var step = this.steps.OfType<CostPerColorStep>().Where(x => x.FromUnit == tracks).FirstOrDefault();

            if (step != null)
            {
                //leggo il costo differente per ciascun colore
                costH = step.CostPerUnit == null ? costH : step.CostPerUnit.ToString();
            }

            var totalR = (totalTimeR.TotalMinutes) / 60 * Convert.ToDouble(costH, Thread.CurrentThread.CurrentUICulture);

            CostAndTime ct = new CostAndTime { Cost = totalA + totalR, Time = totalTimeA + totalTimeR };

            return ct;
        }
Ejemplo n.º 3
0
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, double mq)
        {

            double costMq = 0;

            if (codOptionTypeOfTask.Contains("BASSA"))
            {
                costMq += Convert.ToDouble(CostUVLow, Thread.CurrentThread.CurrentUICulture);
            }

            if (codOptionTypeOfTask.Contains("ALTA"))
            {
                costMq += Convert.ToDouble(CostUVHight, Thread.CurrentThread.CurrentUICulture);
            }

            if (codOptionTypeOfTask.Contains("MEDIA"))
            {
                costMq += Convert.ToDouble(CostUVMed, Thread.CurrentThread.CurrentUICulture);
            }

            if (codOptionTypeOfTask.Contains("W"))
            {
                costMq += Convert.ToDouble(CostWhite, Thread.CurrentThread.CurrentUICulture);
            }

            if (codOptionTypeOfTask.Contains("DN"))
            {
                costMq *= 2;
                costMq += Convert.ToDouble(CostWhite, Thread.CurrentThread.CurrentUICulture);                
            }

            var total = Convert.ToDouble(StartingCost1, Thread.CurrentThread.CurrentUICulture) +
                Convert.ToDouble(StartingCost2, Thread.CurrentThread.CurrentUICulture) * (starts - 1) +
                costMq * mq;

            CostAndTime ct = new CostAndTime { Cost = total ,Time = new TimeSpan(0,0,0) };

            return ct;

        }
Ejemplo n.º 4
0
        public override double UnitCost(double qta)
        {
            if (!IsValid)
            {
                return 0;
            }


            double totCostInk = 0;

            double quantita = 0;
            quantita = Math.Ceiling(qta * (GainForRun ?? 1));

            var mqTot = CalculatedMq ?? 0;

            //List<ProductPartPrintRollOption> optSeris = new List<ProductPartPrintRollOption>();
            ////serigraphy options where we can find the inks and types
            //foreach (var item in this.TaskCost.ProductPartTask.ProductPartTaskOptions.OfType<ProductPartPrintRollOption>())
            //{
            //    optSeris.Add((ProductPartPrintRollOption)item);
            //}

            //foreach (var item in optSeris)
            //{
            //    int mqPrint = 0;
            //    mqPrint = Convert.ToInt32(Math.Ceiling(mqTot * (item.Overlay ?? 0) / 100));

            //    //var seriSpec = option
            //    var inkSpec = _articles.OfType<Ink>().FirstOrDefault(x => x.ArticleName == item.Ink);
            //    var typeSeri = (Anilox)_articles.OfType<Anilox>().FirstOrDefault(x => x.ArticleName == item.TypeOfTaskPrint);

            //    if (inkSpec != null && typeSeri != null)
            //    {
            //        int ltTot = Convert.ToInt32(Math.Ceiling(mqPrint / Convert.ToDouble(typeSeri.GainMqPerLt ?? 1)));
            //        totCostInk += ltTot * Convert.ToDouble(inkSpec.ArticleCosts.OfType<NoPrintableArticleCostKg>().FirstOrDefault().CostPerKg, Thread.CurrentThread.CurrentUICulture);
            //    }
            //}


            //devo usare gli avvimaneti, la tiratura totale e i mq
            //passarli ad un metodo della macchina corrente e mi restituisce il costo totale che dividerò per
            //la quantità!!!!

            double total = 0;
            TimeSpan time = new TimeSpan(0, 0, 0);
            CostAndTime totalCT = new CostAndTime();
            try
            {
                try
                {
                    var colors = TaskExecutor.GetColorFR(TaskCost.ProductPartTask.CodOptionTypeOfTask);

                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(
                        TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, colors, 0, Quantity(qta),0);
                }

                catch (NotImplementedException)
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, Quantity(qta));
                }

                Error = (Error != null && Error != 0 && Error != 2) ? 0 : Error;
                //calcolo del tempo e del costo

                total = totalCT.Cost;

                total += totCostInk;
                CalculatedTime = totalCT.Time;
            }
            catch (NullReferenceException)
            {
                total = 0;
                Error = 2;
            }

            return (total) / Quantity(qta);

        }
Ejemplo n.º 5
0
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, PrintingColor colors, int makereadies, double running, double weight)
        {
            Double totalCostR = new Double();
            var totalCostA = Convert.ToDouble(this.StartingCost1 ?? "0");

            //avviamenti successivi
            for (int i = 0; i < starts - 1; i++)
            {
                totalCostA += Convert.ToDouble(this.StartingCost2 ?? "0");
            }

            Nullable<double> costUnit = null;
            Nullable<double> costUnitBW = null;
            Nullable<double> deficitRate = null;

            if (UseDifferentDeficitOnCostForWeightStep ?? false)
            {
                try
                {
                    deficitRate = Convert.ToDouble(steps.OfType<DeficitForWeightStep>().Where(x => x.FromUnit <= weight && weight <= x.ToUnit).FirstOrDefault().DeficitRate);
                }
                catch (NullReferenceException)
                {
                    deficitRate = 0;
                }
            }
            else
            {
                deficitRate = 0;
            }

            #region cost color
            if (UseDifferentCostPerUnit ?? false)
            {
                try
                {
                    var c = steps.OfType<CostPerRunStep>().Where(x => x.FromUnit <= running && running <= x.ToUnit).FirstOrDefault().CostPerUnit;
                    costUnit = Convert.ToDouble(c);
                }
                catch (NullReferenceException)
                {
                    costUnit = Convert.ToDouble(CostPerUnit??"0");
                }
            }
            else
            {
                costUnit = Convert.ToDouble(CostPerUnit ?? "0");
            }
            #endregion

            if (costUnit == null)
            {
                totalCostR = 0;
            }
            else
            {
                costUnit = costUnit - ((costUnit / 100) * (long)(deficitRate ?? 0));
            }

            totalCostR = costUnit ?? 0;

            var totalA = (totalCostA);
            var totalR = (totalCostR * running);

            CostAndTime ct = new CostAndTime { Cost = totalA + totalR, Time = new TimeSpan(0,0,0) };

            return ct;
        }
Ejemplo n.º 6
0
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, int makereadis, double running)
        {

            double total;

            if (!(codOptionTypeOfTask.Contains("BW")))
            {

                total = Convert.ToDouble(StartingCost1, Thread.CurrentThread.CurrentUICulture);
                total += Convert.ToDouble(StartingCost2, Thread.CurrentThread.CurrentUICulture) * --starts;

                if (UseDifferentCostPerUnit ?? false)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    total += Convert.ToDouble(CostPerUnit, Thread.CurrentThread.CurrentUICulture) * running;
                }
            }
            else
            {

                total = Convert.ToDouble(StartingCost1BW, Thread.CurrentThread.CurrentUICulture);
                total += Convert.ToDouble(StartingCost2BW, Thread.CurrentThread.CurrentUICulture) * --starts;

                if (UseDifferentCostPerUnit ?? false)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    total += Convert.ToDouble(CostPerUnitBW, Thread.CurrentThread.CurrentUICulture) * running;
                }

            }

            CostAndTime ct = new CostAndTime { Cost = total, Time = new TimeSpan(0,0,0) };

            return ct;

        }
Ejemplo n.º 7
0
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, PrintingColor colors, int makereadies, double running, double weight)
        {
            TimeSpan totalTimeR = new TimeSpan(0, 0, 0);
            var totalTimeA = this.StartingTime1 ?? TimeSpan.Zero;

            //avviamenti successivi
            for (int i = 0; i < starts-1; i++)
            {
                totalTimeA += (StartingTime2 ?? TimeSpan.Zero);
            }

            //avviamento a colore
            for (int i = 0; i < colors.cToPrintT; i++)
            {
                totalTimeA += (StartingTimePerColor ?? TimeSpan.Zero);
            }

            Nullable<long> avarage = null ;
            Nullable<double> deficitRate = null;



            if (UseDifferentDeficitForWeightStep ?? false)
            {
                try
                {
                    deficitRate = Convert.ToDouble(steps.OfType<DeficitForWeightStep>().Where(x => x.FromUnit <= weight && weight <= x.ToUnit).FirstOrDefault().DeficitRate);
                }
                catch (NullReferenceException)
                {
                    deficitRate = 0;
                }
            }
            else
            {
                deficitRate = 0;
            }



            if (UseDifferentRunPerHour ?? false)
            {
                try
                {
                    avarage = steps.OfType<AvarageRunPerRunStep>().Where(x => x.FromUnit <= running && running <= x.ToUnit).FirstOrDefault().AvarageRunPerHour;                

                }
                catch (NullReferenceException)
                {
                    avarage = AvarageRunPerHour;
                }
            }
            else
            {
                avarage = AvarageRunPerHour;
            }

            if (avarage == null)
            {
                totalTimeR = TimeSpan.Zero;
            }
            else
            {
                avarage = avarage - ((avarage / 100) * (long) (deficitRate??0));
                
                //ore
                var tot = (running / avarage);
                var hour = (double)Math.Truncate((decimal)tot);
                var min = (double)Math.Truncate((decimal)((tot - hour) * 60));
                totalTimeR += TimeSpan.FromHours(hour) + TimeSpan.FromMinutes(min);
            }


            var costA = CostPerHourStarting;
            var totalA = (totalTimeA.TotalMinutes) / 60 * Convert.ToDouble(costA, Thread.CurrentThread.CurrentUICulture);

            var totalR = (totalTimeR.TotalMinutes) / 60 * Convert.ToDouble(CostPerHourRunning, Thread.CurrentThread.CurrentUICulture);

            CostAndTime ct = new CostAndTime { Cost = totalA + totalR, Time = totalTimeA + totalTimeR };

            return ct;
        }
Ejemplo n.º 8
0
        public override double UnitCost(double qta)
        {
            if (!IsValid)
            {
                return 0;
            }

            //devo usare gli avvimaneti, la tiratura totale e i mq
            //passarli ad un metodo della macchina corrente e mi restituisce il costo totale che dividerò per
            //la quantità!!!!

            double total = 0;
            TimeSpan time = new TimeSpan(0, 0, 0);
            CostAndTime totalCT = new CostAndTime();
            try
            {
                try
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, 0, Quantity(qta));
                }
                catch (NotImplementedException)
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, Quantity(qta));
                }

                Error = (Error != null && Error != 0 && Error != 2) ? 0 : Error;
                //calcolo del tempo e del costo
                total = totalCT.Cost;
                CalculatedTime = totalCT.Time;

            }
            catch (NullReferenceException)
            {
                total = 0;
                Error = 2;
            }

            return (total) / Quantity(qta);

        }
Ejemplo n.º 9
0
        //starts = 1 per avviamento, i successivi son
        public override CostAndTime GetCost(string codOptionTypeOfTask, double starts, double retroStarts, double rollChanges, int colors, double running)
        {

            TimeSpan totalTimeA = TimeSpan.Zero;
            TimeSpan totalTimeR = TimeSpan.Zero;

            double costA =0;

            var totalA = (totalTimeA.TotalMinutes) / 60 * costA;

            Nullable<long> avrR = AvarageRunPerHour ?? 0;
            string costH = CostPerHourRunning;


            if (codOptionTypeOfTask.Contains("STAMPAETIC"))
            {
                totalTimeA = this.StartingTime1 ?? TimeSpan.Zero;

                for (int i = 0; i < rollChanges; i++)
                {
                    totalTimeA += (StartingTime2 ?? TimeSpan.Zero);
                }

                for (int i = 0; i < colors; i++)
                {
                    totalTimeA += (StartingTimePerColor ?? TimeSpan.Zero);
                }

                for (int i = 0; i < retroStarts; i++)
                {
                    totalTimeA += (StartingTimeRetro ?? TimeSpan.Zero);
                }

                costA = Convert.ToDouble(CostPerHourStarting, Thread.CurrentThread.CurrentUICulture);
//                var totalA = (totalTimeA.TotalMinutes) / 60 * Convert.ToDouble(costA, Thread.CurrentThread.CurrentUICulture);

                var stepR = this.steps.OfType<AvarageRunPerRunStep>().Where(x => x.FromUnit <= running && x.ToUnit >= running).FirstOrDefault();

                if (stepR != null)
                {
                    //leggo il costo differente per ciascun colore
                    avrR = stepR.AvarageRunPerHour == null ? avrR : stepR.AvarageRunPerHour;
                }

                if (avrR == null)
                {
                    totalTimeR = TimeSpan.Zero;
                }
                else
                {
                    //minuti //nella flexo AvarageRunPerHour = m/sec
                    var tot = (running / avrR ?? 1);
                    totalTimeR += TimeSpan.FromMinutes(tot);
                }

                var step = this.steps.OfType<CostPerColorStep>().Where(x => x.FromUnit == colors).FirstOrDefault();

                if (step != null)
                {
                    //leggo il costo differente per ciascun colore
                    costH = step.CostPerUnit == null ? costH : step.CostPerUnit.ToString();
                }

            }


            if (codOptionTypeOfTask.Contains("SERIGRAFIA"))
            {
                totalTimeA = TimeSpan.Zero;
                for (int i = 0; i < colors; i++)
                {
                    totalTimeA += (StartingTimeSerigraphy ?? TimeSpan.Zero);
                }

                costA = Convert.ToDouble(CostPerHourStartingSerigraphy, Thread.CurrentThread.CurrentUICulture);
            }


            if (codOptionTypeOfTask.Contains("STAMPAACALDO"))
            {
                totalTimeA =  TimeSpan.Zero;
                for (int i = 0; i < colors; i++)
                {
                    totalTimeA += (StartingTimeFoilStamping ?? TimeSpan.Zero);
                }

                costA = Convert.ToDouble(CostPerHourStartingFoilStamping, Thread.CurrentThread.CurrentUICulture);
            }




            if (codOptionTypeOfTask.Contains("SERIGRAFIA"))
            {
                avrR=  AvarageRunPerHourSerigraphy;
                costH = CostPerHourRunningSerigraphy;                
            }


            if (codOptionTypeOfTask.Contains("STAMPAACALDO"))
            {
                avrR = AvarageRunPerHourFoilStamping;
                costH = CostPerHourRunningFoilStamping;
            }

            //run
            if (avrR == null | avrR == 0)
            {
                totalTimeR = TimeSpan.Zero;
            }
            else
            {
                //minuti //nella flexo AvarageRunPerHour = m/sec
                var tot = (running / avrR ?? 1);
                totalTimeR += TimeSpan.FromHours(tot);
            }

            var totalR = (totalTimeR.TotalMinutes) / 60 * Convert.ToDouble(costH, Thread.CurrentThread.CurrentUICulture);
            CostAndTime ct = new CostAndTime { Cost = totalA + totalR, Time = totalTimeA + totalTimeR };

            return ct;
        }
Ejemplo n.º 10
0
        public override double UnitCost(double qta)
        {

            #region read and calculate Ink --> totCostInk

            totCostInk = 0;

            double quantita = 0;
            quantita = Math.Ceiling(qta * (GainForRun ?? 1));

            var fto = this.TaskCost.ProductPartTask.ProductPart.FormatOpened;
            var mqTot = (fto.GetSide1() * fto.GetSide2() / 10000) * qta;


            if (this.TypeOfRepass == 0)
            {
                List<ProductPartSerigraphyOption> optSeris = new List<ProductPartSerigraphyOption>();
                //serigraphy options where we can find the inks and types
                foreach (var item in this.TaskCost.ProductPartTask.ProductPartTaskOptions.OfType<ProductPartSerigraphyOption>())
                {
                    optSeris.Add((ProductPartSerigraphyOption)item);
                }

                foreach (var item in optSeris)
                {

                    int mqPrint = 0;
                    mqPrint = Convert.ToInt32(Math.Ceiling(mqTot * (item.Overlay ?? 0) / 100));

                    //var seriSpec = option
                    var inkSpec = _articles.OfType<Ink>().FirstOrDefault(x => x.ArticleName == item.InkSerigraphy);
                    var typeSeri = (Mesh)_articles.OfType<Mesh>().FirstOrDefault(x => x.ArticleName == item.TypeOfTaskSerigraphy);

                    if (inkSpec != null && typeSeri != null)
                    {
                        int ltTot = Convert.ToInt32(Math.Ceiling(mqPrint / Convert.ToDouble(typeSeri.GainMqPerLt ?? 1)));
                        totCostInk += ltTot * Convert.ToDouble(inkSpec.ArticleCosts.OfType<NoPrintableArticleCostKg>().FirstOrDefault().CostPerKg, Thread.CurrentThread.CurrentUICulture);
                    }
                }

            }
            else
            {
                List<ProductPartHotPrintingOption> optSeris = new List<ProductPartHotPrintingOption>();
                //serigraphy options where we can find the inks and types
                foreach (var item in this.TaskCost.ProductPartTask.ProductPartTaskOptions.OfType<ProductPartHotPrintingOption>())
                {
                    optSeris.Add((ProductPartHotPrintingOption)item);
                }

                foreach (var item in optSeris)
                {
                    int mqPrint = 0;
                    mqPrint = Convert.ToInt32(mqTot);

                    //var seriSpec = option
                    var foilSpec = _articles.OfType<Foil>().FirstOrDefault(x => x.ArticleName == item.Foil);

                    if (foilSpec != null)
                    {
                        totCostInk += mqPrint * Convert.ToDouble(foilSpec.ArticleCosts.OfType<NoPrintableArticleCostMq>().FirstOrDefault().CostPerMq, Thread.CurrentThread.CurrentUICulture);
                    }
                }
            }


            #endregion

            if (!IsValid)
            {
                return 0;
            }

            RollChanges = 0;

            //devo usare gli avvimaneti, la tiratura totale e i mq
            //passarli ad un metodo della macchina corrente e mi restituisce il costo totale che dividerò per
            //la quantità!!!!
            double total = 0;

            total = totCostInk;

            TimeSpan time = new TimeSpan(0, 0, 0);
            CostAndTime totalCT = new CostAndTime();

            try
            {
                try
                {
                    var x = TaskExecutor.GetColorFR(TaskCost.ProductPartTask.CodOptionTypeOfTask);
                    var costCalcolous = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault();

                    totalCT = costCalcolous.GetCost(
                        TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, x.cToPrintR, RollChanges ?? 0, (int)(x.cToPrintT + x.cToPrintTNoImplant), running: Quantity(qta));
                }
                catch (NotImplementedException)
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1,  Quantity(qta));
                }
                Error = (Error != null && Error != 0 && Error != 2) ? 0 : Error;

                //calcolo del tempo e del costo
                total = totCostInk;
                total += totalCT.Cost;
                CalculatedTime = totalCT.Time;

            }
            catch (NullReferenceException)
            {
                total = 0;
                Error = 2;
            }

            if (TaskCost.Quantity != null)
            {
                return total / Quantity(qta);
            }
            else
            {
                return 0;
            }

        }
Ejemplo n.º 11
0
        public override double UnitCost(double qta)
        {
            if (!IsValid)
            {
                return 0;
            }

            try
            {
                var labelPerRoll = ((ProductPartSingleLabelRoll)this.Printers.FirstOrDefault().ProductPart).LabelsPerRoll;
                if (labelPerRoll != null)
                {
                    RollChanges = (qta / labelPerRoll) / this.Printers.FirstOrDefault().ProductPartPrinting.CalculatedSide1Gain;
                }
            }
            catch (Exception)
            {
                RollChanges = 0;
                //throw;
            }


            //devo usare gli avvimaneti, la tiratura totale e i mq
            //passarli ad un metodo della macchina corrente e mi restituisce il costo totale che dividerò per
            //la quantità!!!!
            double total = 0;
            TimeSpan time = new TimeSpan(0, 0, 0);
            CostAndTime totalCT = new CostAndTime();

            //try to relink taskexecutor
            if (TaskexEcutorSelected == null)
            {
                TaskexEcutorSelected = TaskExecutors.SingleOrDefault(x=>x.CodTaskExecutor == CodTaskExecutorSelected);
            }

            try
            {
                try
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, 1,0, RollChanges ?? 0, (int)(Starts ?? 0), Quantity(qta));
                }
                catch (NotImplementedException)
                {
                    totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(TaskCost.ProductPartTask.CodOptionTypeOfTask, Starts ?? 1, Quantity(qta));
                }
                Error = (Error != null && Error != 0 && Error != 2) ? 0 : Error;

                //calcolo del tempo e del costo
                total = totalCT.Cost;
                CalculatedTime = totalCT.Time;

            }
            catch (NullReferenceException)
            {
                total = 0;
                Error = 2;
            }

            if (TaskCost.Quantity != null)
            {
                return total / Quantity(qta);

            }
            else
            {
                return 0;
            }

        }
Ejemplo n.º 12
0
        public override double UnitCost(double qta)
        {
            if (!IsValid)
            {
                return 0;
            }

            //devo usare gli avvimaneti, la tiratura totale e i mq
            //passarli ad un metodo della macchina corrente e mi restituisce il costo totale che dividerò per
            //la quantità!!!!
            double total = 0;
            TimeSpan time = new TimeSpan(0, 0, 0);
            CostAndTime totalCT = new CostAndTime();

            try
            {
                totalCT = TaskexEcutorSelected.SetTaskExecutorEstimatedOn.FirstOrDefault().GetCost(codOptionTypeOfTask: TaskCost.ProductPartTask.CodOptionTypeOfTask, starts: Starts ?? 1, makereadis: 0, colors: new PrintingColor(), running: Quantity(qta), weight: 0);
                Error = (Error != null && Error != 0 && Error != 2) ? 0 : Error;

                //calcolo del tempo e del costo
                total = totalCT.Cost;
                CalculatedTime = totalCT.Time;

            }
            catch (NullReferenceException)
            {
                total = 0;
                Error = 2;
            }

            if (TaskCost.Quantity != null)
            {
                return total / Quantity(qta);

            }
            else
            {
                return 0;
            }

        }