Exemplo n.º 1
0
        public static bool dotTestFunc(int simVersionId)
        {
            int index = 2768;
            int scale = 100;

            try
            {
                List <MODEL.bar_data>       barDataList        = new List <MODEL.bar_data>();
                MODEL.risk_prj_version_info projectVersionInfo = CommonArugment.getProjectVersionInfo.getPrjVersionInfo(simVersionId);
                double maxProjectTime = CommonArugment.getTaskIntance.getMaxPeriod(simVersionId, index);
                double minProjectTime = CommonArugment.getTaskIntance.getMinPeriod(simVersionId, index);

                int range = (int)Math.Ceiling((maxProjectTime - minProjectTime) / scale);

                for (int i = 1; i < scale; ++i)
                {
                    MODEL.bar_data barData = new MODEL.bar_data();
                    barData.ScFrom = i * range + (int)Math.Ceiling(minProjectTime);
                    barData.ScTo   = (i + 1) * range + (int)Math.Ceiling(minProjectTime);
                    barData.ScNum  = CommonArugment.getTaskIntance.dotTest(simVersionId, barData.ScTo, barData.ScFrom, index);
                    barDataList.Add(barData);
                }
                CommonMsg.barDataList = barDataList;
                return(true);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public static bool getOverdueCostRatio(int simVersionId, int scale)
        {
            int range = 0;

            try
            {
                List <MODEL.risk_prj_instance> prjInstanceList = CommonArugment.getProjectInstance.getBySimVersion(simVersionId);
                double maxN1 = CommonArugment.getProjectInstance.findMaxPrjCostBelow(simVersionId, CommonMsg.maxNumber);
                double MinN1 = CommonArugment.getProjectInstance.findMinPrjCostAbove(simVersionId, 0);
                range = (int)Math.Ceiling((maxN1 - MinN1) / scale);
                List <MODEL.bar_data> barDataList = new List <MODEL.bar_data>();
                for (int i = 0; i <= scale; ++i)
                {
                    MODEL.bar_data barData = new MODEL.bar_data();
                    barData.ScFrom = i * range + (int)MinN1;
                    barData.ScTo   = (i + 1) * range + (int)MinN1;
                    barData.ScNum  = CommonArugment.getProjectInstance.getCostCount(simVersionId, (int)Math.Ceiling(maxN1), barData.ScFrom);
                    barData.Ratio  = Convert.ToDouble(barData.ScNum) / prjInstanceList.Count;
                    barDataList.Add(barData);
                }
                CommonMsg.barDataList = barDataList;
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public static bool getBarData(int simVersionId, int scale)
        {
            int    range   = 0;
            double myThink = 0.2;

            try
            {
                List <MODEL.risk_prj_instance> prjInstanceList = CommonArugment.getProjectInstance.getBySimVersion(simVersionId);
                double minN1 = CommonArugment.getProjectInstance.findMinPrjTimeAbove(simVersionId, 0);
                double maxN1 = CommonArugment.getProjectInstance.findMaxPrjTimeBelow(simVersionId, CommonMsg.maxNumber);
                double maxN2 = maxN1;
                while (!isSatisfCreteria(prjInstanceList, maxN2, maxN1, myThink))
                {
                    maxN2 = CommonArugment.getProjectInstance.findMaxPrjTimeBelow(simVersionId, maxN2);
                }
                range = (int)Math.Ceiling((maxN1 - minN1) / scale);
                List <MODEL.bar_data> barDataList = new List <MODEL.bar_data>();
                MODEL.bar_data        barData0    = new MODEL.bar_data();
                barData0.ScFrom = 0;
                barData0.ScTo   = (int)Math.Ceiling(minN1);
                barData0.ScNum  = CommonArugment.getProjectInstance.getCount(simVersionId, barData0.ScTo, barData0.ScFrom);
                barDataList.Add(barData0);
                for (int i = 1; i < scale; ++i)
                {
                    MODEL.bar_data barData = new MODEL.bar_data();
                    barData.ScFrom = i * range + (int)Math.Ceiling(minN1);
                    barData.ScTo   = (i + 1) * range + (int)Math.Ceiling(minN1);
                    barData.ScNum  = CommonArugment.getProjectInstance.getCount(simVersionId, barData.ScTo, barData.ScFrom);
                    barDataList.Add(barData);
                }
                CommonMsg.barDataList = barDataList;
                return(true);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        //public static bool getBarData(int simVersionId, int scale)
        //{
        //        scale = 200;
        //        int range = 0;
        //        double myThink = 0.2;
        //        try
        //        {
        //                List<MODEL.risk_prj_instance> prjInstanceList = CommonArugment.getProjectInstance.getBySimVersion(simVersionId);
        //                double minN1 = prjInstanceList[0].Sim_project_time;
        //                double maxN1 = prjInstanceList[0].Sim_project_time;
        //                double maxN2 = prjInstanceList[0].Sim_project_time;
        //                foreach (MODEL.risk_prj_instance prjInstance in prjInstanceList)
        //                {
        //                        if (prjInstance.Sim_project_time < minN1)
        //                        {
        //                                minN1 = Math.Floor(prjInstance.Sim_project_time);
        //                        }
        //                        if (prjInstance.Sim_project_time > maxN1)
        //                        {
        //                                maxN1 = Math.Floor(prjInstance.Sim_project_time);
        //                        }
        //                }
        //                maxN2 = maxN1;
        //                while (!isSatisfCreteria(prjInstanceList, maxN2, maxN1, myThink))
        //                {
        //                        double res = 0;
        //                        foreach (MODEL.risk_prj_instance prjInstance in prjInstanceList)
        //                        {
        //                                if (prjInstance.Sim_project_time < maxN2 && prjInstance.Sim_project_time > res)
        //                                {
        //                                        res = prjInstance.Sim_project_time;
        //                                }
        //                        }
        //                        maxN2 = res;
        //                }
        //                range = (int)Math.Ceiling((maxN2 - minN1) / scale);
        //                List<MODEL.bar_data> barDataList = new List<MODEL.bar_data>();
        //                MODEL.bar_data barData0 = new MODEL.bar_data();
        //                barData0.ScFrom = 0;
        //                barData0.ScTo = (int)Math.Ceiling(minN1);

        //                barData0.ScNum = CommonArugment.getProjectInstance.getCount(simVersionId, barData0.ScTo, barData0.ScFrom);
        //                barDataList.Add(barData0);
        //                for (int i = 1; i < scale; ++i)
        //                {
        //                        MODEL.bar_data barData = new MODEL.bar_data();
        //                        barData.ScFrom = i * range + (int)Math.Ceiling(minN1);
        //                        barData.ScTo = (i + 1) * range + (int)Math.Ceiling(minN1);
        //                        barData.ScNum = CommonArugment.getProjectInstance.getCount(simVersionId, barData.ScTo, barData.ScFrom);
        //                        barDataList.Add(barData);
        //                }
        //                CommonMsg.barDataList = barDataList;
        //                return true;
        //        } catch (System.Exception ex)
        //        {
        //                throw ex;
        //        }
        //}
        public static bool getResoueceUse(int simVersionId, int scale, int resourceId)
        {
            int range = 0;

            try
            {
                MODEL.risk_prj_version_info     info            = CommonArugment.getProjectVersionInfo.getPrjVersionInfo(simVersionId);
                List <MODEL.risk_prj_instance>  prjInstanceList = CommonArugment.getProjectInstance.getBySimVersion(simVersionId);
                List <MODEL.bar_data>           barDataList     = new List <MODEL.bar_data>();
                List <MODEL.risk_task_instance> taskList        = CommonArugment.getTaskIntance.getVersionTaskInstance(info.Pri_id, simVersionId);
                double Avg_projecttime = 0;
                foreach (MODEL.risk_prj_instance prj in prjInstanceList)
                {
                    Avg_projecttime += prj.Sim_project_time;
                }
                Avg_projecttime = Avg_projecttime / info.Count;

                double maxN1 = Avg_projecttime;
                double MinN1 = 0;
                range = (int)Math.Ceiling((maxN1 - MinN1) / scale);
                for (int i = 0; i <= scale; ++i)
                {
                    MODEL.bar_data bar = new MODEL.bar_data();
                    bar.ScFrom = i * range + (int)MinN1;
                    bar.ScTo   = (i + 1) * range + (int)MinN1;
                    if (bar.ScFrom > Avg_projecttime)
                    {
                        break;
                    }
                    foreach (MODEL.risk_task_instance task in taskList)
                    {
                        if (task.Starttime == -1)    //概要任务跳过
                        {
                            break;
                        }
                        if (task.Starttime >= bar.ScFrom && task.Starttime + task.Task_actual_dur_period <= bar.ScTo)    //第一种 在中间
                        {
                            MODEL.risk_task_resource_assignment ass = CommonArugment.getTaskResAssign.findByTaskAutoIdResId(task.Task_auto_id, resourceId);
                            if (ass != null)
                            {
                                bar.Ratio += (double)ass.Assignment_amount;
                            }
                        }
                        else if (task.Starttime <= bar.ScFrom && task.Starttime + task.Task_actual_dur_period > bar.ScFrom && task.Starttime + task.Task_actual_dur_period < bar.ScTo)    //第二种
                        {
                            MODEL.risk_task_resource_assignment ass = CommonArugment.getTaskResAssign.findByTaskAutoIdResId(task.Task_auto_id, resourceId);
                            if (ass != null)
                            {
                                bar.Ratio += (double)ass.Assignment_amount / task.Task_actual_dur_period * (task.Starttime + task.Task_actual_dur_period - bar.ScFrom);
                            }
                        }
                        else if (task.Starttime > bar.ScFrom && task.Starttime < bar.ScTo && task.Starttime + task.Task_actual_dur_period > bar.ScTo)//第三种
                        {
                            MODEL.risk_task_resource_assignment ass = CommonArugment.getTaskResAssign.findByTaskAutoIdResId(task.Task_auto_id, resourceId);
                            if (ass != null)
                            {
                                bar.Ratio += (double)ass.Assignment_amount / task.Task_actual_dur_period * (bar.ScTo - task.Starttime);
                            }
                        }
                        else if (task.Starttime <= bar.ScFrom && task.Starttime + task.Task_actual_dur_period >= bar.ScTo)    //第四种
                        {
                            MODEL.risk_task_resource_assignment ass = CommonArugment.getTaskResAssign.findByTaskAutoIdResId(task.Task_auto_id, resourceId);
                            if (ass != null)
                            {
                                bar.Ratio += (double)ass.Assignment_amount / task.Task_actual_dur_period * (bar.ScTo - bar.ScFrom);
                            }
                        }
                    }
                    barDataList.Add(bar);
                }
                foreach (MODEL.bar_data bar in barDataList)
                {
                    bar.Ratio = bar.Ratio / info.Count;
                }
                CommonMsg.barDataList = barDataList;
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }