Exemplo n.º 1
0
        public CostDetail MakeCostDetail(IQueryable<TaskExecutor> tskExecs, IQueryable<Article> articles, string codTaskExecutor = "")
        {
            CostDetail cv = null;
            ProductPart productPart = null;

            #region Materiale

            if (this.CodProductPartPrintableArticle != null)
            {
                var productPartPrintableArticle = this.ProductPartsPrintableArticle;
                productPart = this.ProductPartsPrintableArticle.ProductPart;

                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.OptionTypeOfTask.CodTypeOfTask.Contains("STAMPA"));

                //il tipo di materiale dipende dalla stampa o dal tipo di prodotto?               
                //productPartPrintabelArticles = productPart.ProductPartPrintableArticles;
            }

            #endregion

            #region Impianto
            if (this.CodProductPartImplantTask != null)
            {
                productPart = this.ProductPartImplantTask.ProductPart;
                //                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.OptionTypeOfTask.CodTypeOfTask.Contains("STAMPA"));
                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.CodProductPartTask == this.CodProductPartImplantTask);

            }


            #endregion

            #region Lavorazione
            //E' una lavorazione!!!!
            String codTypeOfTask = String.Empty;
            if (this.CodProductPartTask != null)
            {
                codTypeOfTask = this.ProductPartTask.OptionTypeOfTask.CodTypeOfTask;
                productPart = this.ProductPartTask.ProductPart;
            }

            #region tavolo di controllo rotolo
            if (codTypeOfTask == "TAVOLOCONTROLLO")
            {
                Console.WriteLine("Tavolo di controllo");
                String codParte = String.Empty;

                tskExecs = TaskExecutor.FilterByTask(tskExecs, codTypeOfTask);

                if (tskExecs.Count() > 0)
                {

                    switch (tskExecs.FirstOrDefault().TypeOfExecutor)
                    {
                        case TaskExecutor.ExecutorType.ControlTableRoll:
                            cv = new ControlTableCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);
                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            break;

                        default:
                            break;

                    }

                    cv.ProductPart = productPart;

                    cv.CodCost = this.CodCost;
                    cv.CodCostDetail = this.CodCost;

                }

            }
            #endregion


            #region serigrafia rotolo!!! ripasso!!!
            if (codTypeOfTask == "SERIGRAFIAROTOLO" || codTypeOfTask == "STAMPAACALDOROTOLO")
            {
                Console.WriteLine("Serigrafia rotolo");
                String codParte = String.Empty;

                tskExecs = TaskExecutor.FilterByTask(tskExecs, codTypeOfTask);

                if (tskExecs.Count() > 0)
                {

                    switch (tskExecs.FirstOrDefault().TypeOfExecutor)
                    {
                        case TaskExecutor.ExecutorType.FlatRoll:
                            cv = new RepassRollCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);
                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            break;

                        default:
                            break;

                    }

                    cv.ProductPart = productPart;

                    cv.CodCost = this.CodCost;
                    cv.CodCostDetail = this.CodCost;

                }

            }
            #endregion

            
            
            #region fustellatura
            if (codTypeOfTask == "FUSTELLATURA" 
                || codTypeOfTask == "TAGLIO"
                || codTypeOfTask == "PLASTIFICATURA"                
                )
            {
                Console.WriteLine("Fustellatura");
                String codParte = String.Empty;

                /* se è una STAMPA 
                 * dovrò selezionare il tipo di macchina anche a seconda del tipo di lavoro
                 * etichette in rotolo, manifesti etc...
                 * per ora carico.
                 */

                tskExecs = TaskExecutor.FilterByTask(tskExecs, codTypeOfTask);

                if (tskExecs.Count() > 0)
                {

                    cv = new PrePostPressCostDetail();
                    cv.TaskCost = this;
                    cv.InitCostDetail(tskExecs, articles);

                    if (cv.TaskExecutors != null)
                    {
                        cv.CodTaskExecutorSelected = tskExecs.FirstOrDefault().CodTaskExecutor;
                    }

                    cv.ProductPart = productPart;

                    cv.CodCost = this.CodCost;
                    cv.CodCostDetail = this.CodCost;

                }

            }
            #endregion

            if (codTypeOfTask == "STAMPA" ||
                codTypeOfTask == "STAMPARIGIDO" ||
                codTypeOfTask == "STAMPAMORBIDO" ||
                codTypeOfTask == "STAMPAOFFeDIGITALE" ||
                codTypeOfTask == "STAMPANEW" ||
                codTypeOfTask == "STAMPAETICHROTOLO")
            {
                String codParte = String.Empty;

                /* se è una STAMPA 
                 * dovrò selezionare il tipo di macchina anche a seconda del tipo di lavoro
                 * etichette in rotolo, manifesti etc...
                 * per ora carico.
                 */

                tskExecs = TaskExecutor.FilterByTask(tskExecs, codTypeOfTask);

                //search selected taskexecutor
                var tskFirst = tskExecs.Where(x => x.CodTaskExecutor == codTaskExecutor).FirstOrDefault();

                if (tskExecs.Count() > 0)
                {
                    switch ((tskFirst != null ? tskFirst : tskExecs.FirstOrDefault()).TypeOfExecutor)
                    {
                        case TaskExecutor.ExecutorType.LithoSheet:
                            cv = new PrintingSheetCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);

                            ((PrintingSheetCostDetail)cv).BuyingFormat =
                                 (((PrintingSheetCostDetail)cv).BuyingFormat == "" || ((PrintingSheetCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingSheetCostDetail)cv).BuyingFormats != null) && (((PrintingSheetCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingSheetCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingSheetCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingSheetCostDetail)cv).PrintingFormat =
                                (((PrintingSheetCostDetail)cv).PrintingFormat == "" || ((PrintingSheetCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingSheetCostDetail)cv).BuyingFormat
                                : ((PrintingSheetCostDetail)cv).PrintingFormat;


                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            break;
                        case TaskExecutor.ExecutorType.LithoRoll:
                            break;
                        case TaskExecutor.ExecutorType.DigitalSheet:
                            cv = new PrintingSheetCostDetail();
                            cv.TaskExecutors = tskExecs.ToList();
                            cv.TaskCost = this;
                            break;
                        case TaskExecutor.ExecutorType.DigitalRoll:
                            break;
                        case TaskExecutor.ExecutorType.PlotterRoll:

                            cv = new PrintingRollCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);


                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            ((PrintingRollCostDetail)cv).BuyingFormat =
                                 (((PrintingRollCostDetail)cv).BuyingFormat == "" || ((PrintingRollCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingRollCostDetail)cv).BuyingFormats != null) && (((PrintingRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingRollCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingRollCostDetail)cv).PrintingFormat =
                                (((PrintingRollCostDetail)cv).PrintingFormat == "" || ((PrintingRollCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingRollCostDetail)cv).BuyingFormat
                                : ((PrintingRollCostDetail)cv).PrintingFormat;


                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            cv.ProductPart = productPart;

                            ((PrintingRollCostDetail)cv).FuzzyAlgo();

                            Console.WriteLine(((PrintingRollCostDetail)cv).BuyingFormats);

                            if (((PrintingRollCostDetail)cv).PrintingFormat == null)
                            {

                                ((PrintingRollCostDetail)cv).BuyingFormat =
                                     (((PrintingRollCostDetail)cv).BuyingFormat == "" || ((PrintingRollCostDetail)cv).BuyingFormat == null) ?
                                     (((PrintingRollCostDetail)cv).BuyingFormats != null) && (((PrintingRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                     : ((PrintingRollCostDetail)cv).BuyingFormat;

                                //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                                ((PrintingRollCostDetail)cv).PrintingFormat =
                                    (((PrintingRollCostDetail)cv).PrintingFormat == "" || ((PrintingRollCostDetail)cv).PrintingFormat == null) ?
                                    ((PrintingRollCostDetail)cv).BuyingFormat
                                    : ((PrintingRollCostDetail)cv).PrintingFormat;
                            }

                            break;


                        case TaskExecutor.ExecutorType.PlotterSheet:
                            cv = new PrintingSheetCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);

                            ((PrintingSheetCostDetail)cv).BuyingFormat =
                                 (((PrintingSheetCostDetail)cv).BuyingFormat == "" || ((PrintingSheetCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingSheetCostDetail)cv).BuyingFormats != null) && (((PrintingSheetCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingSheetCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingSheetCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingSheetCostDetail)cv).PrintingFormat =
                                (((PrintingSheetCostDetail)cv).PrintingFormat == "" || ((PrintingSheetCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingSheetCostDetail)cv).BuyingFormat
                                : ((PrintingSheetCostDetail)cv).PrintingFormat;


                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            break;



                        case TaskExecutor.ExecutorType.Flexo:
                        case TaskExecutor.ExecutorType.FlatRoll:

                            cv = new PrintingZRollCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExecs, articles);

                            cv.SetTaskexecutor(tskExecs, codTaskExecutor);

                            cv.ProductPart = productPart;

                            ((PrintingZRollCostDetail)cv).DieTollerance = 0.5;
                            //qui voglio solo le fustelle flexo e semiroll
                            ((PrintingZRollCostDetail)cv).Dies = articles.OfType<Die>().ToList();

                            //search valid formats
                            ((PrintingZRollCostDetail)cv).FuzzyAlgo();

                            ((PrintingZRollCostDetail)cv).BuyingFormat =
                                 (((PrintingZRollCostDetail)cv).BuyingFormat == "" || ((PrintingZRollCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingZRollCostDetail)cv).BuyingFormats != null) && (((PrintingZRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingZRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingZRollCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingZRollCostDetail)cv).PrintingFormat =
                                (((PrintingZRollCostDetail)cv).PrintingFormat == "" || ((PrintingZRollCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingZRollCostDetail)cv).BuyingFormat
                                : ((PrintingZRollCostDetail)cv).PrintingFormat;



                            break;

                        case TaskExecutor.ExecutorType.PrePostPress:
                            break;
                        case TaskExecutor.ExecutorType.Binding:
                            break;
                        default:
                            break;
                    }

                }
                else
                {
                    //
                    var e = new NoTaskExecutorException();
                    e.Data.Add("CodTypeOfTask", codTypeOfTask);
                    throw e;

                }


                cv.ProductPart = productPart;


                cv.TaskCost = this;
                cv.CodCost = this.CodCost;
                cv.CodCostDetail = this.CodCost;
            }

            #endregion

            return cv;
        }
Exemplo n.º 2
0
        public CostDetail MakeCostDetail(IQueryable<TaskExecutor> tskExec, IQueryable<Article> articles)
        {
            CostDetail cv = null;
            ProductPart productPart = null;

            #region Materiale

            if (this.CodProductPartPrintableArticle != null)
            {
                var productPartPrintableArticle = this.ProductPartsPrintableArticle;
                productPart = this.ProductPartsPrintableArticle.ProductPart;

                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.OptionTypeOfTask.CodTypeOfTask.Contains("STAMPA"));

                //il tipo di materiale dipende dalla stampa o dal tipo di prodotto?               
                //productPartPrintabelArticles = productPart.ProductPartPrintableArticles;
            }

            #endregion

            #region Impianto
            if (this.CodProductPartImplantTask != null)
            {
                productPart = this.ProductPartImplantTask.ProductPart;
                //                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.OptionTypeOfTask.CodTypeOfTask.Contains("STAMPA"));
                var task = productPart.ProductPartTasks.FirstOrDefault(x => x.CodProductPartTask == this.CodProductPartImplantTask);

            }


            #endregion

            #region Lavorazione
            //E' una lavorazione!!!!
            String codTypeOfTask = String.Empty;
            if (this.CodProductPartTask != null)
            {
                codTypeOfTask = this.ProductPartTask.OptionTypeOfTask.CodTypeOfTask;
                productPart = this.ProductPartTask.ProductPart;
            }


            if (codTypeOfTask == "TAVOLOCONTROLLO")
            {
                Console.WriteLine("Tavolo di controllo");
                String codParte = String.Empty;

                /* se è una STAMPA 
                 * dovrò selezionare il tipo di macchina anche a seconda del tipo di lavoro
                 * etichette in rotolo, manifesti etc...
                 * per ora carico.
                 */

                tskExec = TaskExecutor.FilterByTask(tskExec, codTypeOfTask);

                if (tskExec.Count() > 0)
                {

                    switch (tskExec.FirstOrDefault().TypeOfExecutor)
                    {
                        case TaskExecutor.ExecutorType.ControlTableRoll:
                            cv = new PrePostPressCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExec, articles);

                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            break;

                        default:
                            break;

                    }

                    cv.ProductPart = productPart;

                    cv.CodCost = this.CodCost;
                    cv.CodCostDetail = this.CodCost;

                }

            }

            if (codTypeOfTask == "STAMPA" ||
                codTypeOfTask == "STAMPARIGIDO" ||
                codTypeOfTask == "STAMPAMORBIDO" ||
                codTypeOfTask == "STAMPAOFFeDIGITALE" ||
                codTypeOfTask == "STAMPAETICHROTOLO")
            {
                String codParte = String.Empty;

                /* se è una STAMPA 
                 * dovrò selezionare il tipo di macchina anche a seconda del tipo di lavoro
                 * etichette in rotolo, manifesti etc...
                 * per ora carico.
                 */

                tskExec = TaskExecutor.FilterByTask(tskExec, codTypeOfTask);

                if (tskExec.Count() > 0)
                {

                    switch (tskExec.FirstOrDefault().TypeOfExecutor)
                    {
                        case TaskExecutor.ExecutorType.LithoSheet:
                            cv = new PrintingSheetCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExec, articles);

                            ((PrintingSheetCostDetail)cv).BuyingFormat =
                                 (((PrintingSheetCostDetail)cv).BuyingFormat == "" || ((PrintingSheetCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingSheetCostDetail)cv).BuyingFormats != null) && (((PrintingSheetCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingSheetCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingSheetCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingSheetCostDetail)cv).PrintingFormat =
                                (((PrintingSheetCostDetail)cv).PrintingFormat == "" || ((PrintingSheetCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingSheetCostDetail)cv).BuyingFormat
                                : ((PrintingSheetCostDetail)cv).PrintingFormat;



                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            break;
                        case TaskExecutor.ExecutorType.LithoRoll:
                            break;
                        case TaskExecutor.ExecutorType.DigitalSheet:
                            cv = new PrintingSheetCostDetail();
                            cv.TaskExecutors = tskExec.ToList();
                            cv.TaskCost = this;
                            break;
                        case TaskExecutor.ExecutorType.DigitalRoll:
                            break;
                        case TaskExecutor.ExecutorType.PlotterRoll:

                            cv = new PrintingRollCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExec, articles);


                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            ((PrintingRollCostDetail)cv).BuyingFormat =
                                 (((PrintingRollCostDetail)cv).BuyingFormat == "" || ((PrintingRollCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingRollCostDetail)cv).BuyingFormats != null) && (((PrintingRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingRollCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingRollCostDetail)cv).PrintingFormat =
                                (((PrintingRollCostDetail)cv).PrintingFormat == "" || ((PrintingRollCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingRollCostDetail)cv).BuyingFormat
                                : ((PrintingRollCostDetail)cv).PrintingFormat;


                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            cv.ProductPart = productPart;

                            ((PrintingRollCostDetail)cv).FuzzyAlgo();

                            Console.WriteLine(((PrintingRollCostDetail)cv).BuyingFormats);


                            if (((PrintingRollCostDetail)cv).PrintingFormat == null)
                            {

                                ((PrintingRollCostDetail)cv).BuyingFormat =
                                     (((PrintingRollCostDetail)cv).BuyingFormat == "" || ((PrintingRollCostDetail)cv).BuyingFormat == null) ?
                                     (((PrintingRollCostDetail)cv).BuyingFormats != null) && (((PrintingRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                     : ((PrintingRollCostDetail)cv).BuyingFormat;

                                //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                                ((PrintingRollCostDetail)cv).PrintingFormat =
                                    (((PrintingRollCostDetail)cv).PrintingFormat == "" || ((PrintingRollCostDetail)cv).PrintingFormat == null) ?
                                    ((PrintingRollCostDetail)cv).BuyingFormat
                                    : ((PrintingRollCostDetail)cv).PrintingFormat;
                            }

                            break;


                        case TaskExecutor.ExecutorType.PlotterSheet:
                            cv = new PrintingSheetCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExec, articles);

                            ((PrintingSheetCostDetail)cv).BuyingFormat =
                                 (((PrintingSheetCostDetail)cv).BuyingFormat == "" || ((PrintingSheetCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingSheetCostDetail)cv).BuyingFormats != null) && (((PrintingSheetCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingSheetCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingSheetCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingSheetCostDetail)cv).PrintingFormat =
                                (((PrintingSheetCostDetail)cv).PrintingFormat == "" || ((PrintingSheetCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingSheetCostDetail)cv).BuyingFormat
                                : ((PrintingSheetCostDetail)cv).PrintingFormat;

                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            break;


                        case TaskExecutor.ExecutorType.Flexo:
                            cv = new PrintingLabelRollCostDetail();

                            cv.TaskCost = this;
                            cv.InitCostDetail(tskExec, articles);


                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }



                            if (cv.TaskExecutors.FirstOrDefault() != null)
                            {
                                cv.CodTaskExecutorSelected = tskExec.FirstOrDefault().CodTaskExecutor;
                            }

                            cv.ProductPart = productPart;

                            ((PrintingLabelRollCostDetail)cv).FuzzyAlgo();


                            ((PrintingLabelRollCostDetail)cv).BuyingFormat =
                                 (((PrintingLabelRollCostDetail)cv).BuyingFormat == "" || ((PrintingLabelRollCostDetail)cv).BuyingFormat == null) ?
                                 (((PrintingLabelRollCostDetail)cv).BuyingFormats != null) && (((PrintingLabelRollCostDetail)cv).BuyingFormats.Count > 0) ? ((PrintingLabelRollCostDetail)cv).BuyingFormats.FirstOrDefault() : null
                                 : ((PrintingLabelRollCostDetail)cv).BuyingFormat;

                            //TODO: E' da calcolare il formato di stampa a seconda del formato macchina
                            ((PrintingLabelRollCostDetail)cv).PrintingFormat =
                                (((PrintingLabelRollCostDetail)cv).PrintingFormat == "" || ((PrintingLabelRollCostDetail)cv).PrintingFormat == null) ?
                                ((PrintingLabelRollCostDetail)cv).BuyingFormat
                                : ((PrintingLabelRollCostDetail)cv).PrintingFormat;



                            break;

                        case TaskExecutor.ExecutorType.PrePostPress:
                            break;
                        case TaskExecutor.ExecutorType.Binding:
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    //
                    var e = new NoTaskExecutorException();
                    e.Data.Add("CodTypeOfTask", codTypeOfTask);
                    throw e;

                }


                cv.ProductPart = productPart;


                cv.TaskCost = this;
                cv.CodCost = this.CodCost;
                cv.CodCostDetail = this.CodCost;
            }

            #endregion

            return cv;
        }