public ActionResult GetPersonalAssessmentTempResult(string assessment_id, string checker, string check_object)
        {
            //获取本次考核的考核模板
            string templeteId = assessmentApp.GetByAssessmentId(assessment_id).templete_id;
            //根据考核模板获取所有的指标
            //根据模板id查找该模板的所有细项指标
            List <DimensionDetailEntity> dimensionDetailList = dimensionDetailApp.GetTempleteDimensionDetail(templeteId);
            List <string> indicatorsDefineList = new List <string>();

            for (int i = 0; i < dimensionDetailList.Count; i++)
            {
                DimensionDetailEntity entity = dimensionDetailList[i];
                string   formule             = entity.formule;
                string[] arr = formule.Replace('(', '|').Replace(')', '|').Replace('+', '|').Replace('-', '|').Replace('*', '|').Replace('/', '|').Replace('Σ', '|').Split('|');
                for (int j = 0; j < arr.Length; j++)
                {
                    if (!string.IsNullOrEmpty(arr[j]) && !indicatorsDefineList.Contains(arr[j]))
                    {
                        indicatorsDefineList.Add(arr[j]);
                    }
                }
            }
            //根据考核id,考核对象以及指标名称获取当前指标的分数
            //获取最后一个考核人的id
            AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetLastChecker(assessment_id, check_object);
            string lastChecker = string.Empty;

            if (assessmentDetailEntity != null)
            {
                lastChecker = assessmentDetailEntity.checker;
            }
            List <AssessmentIndicatorsValueModel> list = assessmentResultApp.GetAllIndicatorsResult(assessment_id, checker, check_object);

            return(Success("操作成功。", list, list.Count));
        }
Example #2
0
 public void SubmitForm(AssessmentDetailEntity assessmentDetailEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         assessmentDetailEntity.Modify(keyValue);
         service.Update(assessmentDetailEntity);
     }
     else
     {
         assessmentDetailEntity.Create();
         service.Insert(assessmentDetailEntity);
     }
 }
        public ActionResult GetPersonalCheckerResultDetail(string assessment_id, string check_object)
        {
            List <ResultDetailMode> list = new List <ResultDetailMode>();

            List <AssessmentDetailEntity> assessmentDetailEntityList = assessmentDetailApp.GetByAssessmentIdCheckObj(assessment_id, check_object);

            assessmentDetailEntityList = assessmentDetailEntityList.OrderBy(t => t.check_order).ToList();
            List <AssessmentDetailEntity> unCheckedList = assessmentDetailEntityList.FindAll(t => t.finished == 0);
            AssessmentDetailEntity        curItem       = null;

            if (unCheckedList != null && unCheckedList.Count > 0)
            {
                curItem = unCheckedList[0];
            }
            assessmentDetailEntityList.ForEach((t) =>
            {
                ResultDetailMode resultDetailMode = new ResultDetailMode();
                resultDetailMode.is_checked       = t.finished;
                resultDetailMode.check_order      = t.check_order;
                resultDetailMode.checker          = t.checker;
                resultDetailMode.checker_name     = userApp.GetForm(t.checker).F_RealName;
                resultDetailMode.checker_weight   = t.checker_weight;

                AssessmentResultCountEntity assessmentResultCountEntity = assessmentResultCountApp.GetByAssessmentIdCheckerCheckObject(assessment_id, t.checker, t.check_object);
                if (assessmentResultCountEntity != null)
                {
                    resultDetailMode.result = assessmentResultCountEntity.unfixed_score;
                }
                else
                {
                    resultDetailMode.result = 0d;
                }
                if (curItem != null)
                {
                    if (t.id == curItem.id)
                    {
                        resultDetailMode.is_checked_true = 1;
                    }
                    else
                    {
                        resultDetailMode.is_checked_true = 0;
                    }
                }
                else
                {
                    resultDetailMode.is_checked_true = 0;
                }
                list.Add(resultDetailMode);
            });
            return(Success("操作成功。", list, list.Count));
        }
        public ActionResult LaunchPersonalAssessment(string assessment_name, string start_time, string end_time, string templete_id, string checker_object_list, int?need_self_check, double?self_check_weight, string checker_list, string filling_people, string file_name)
        {
            if (assessmentApp.IsExists(assessment_name))
            {
                return(Error("考核名称已存在。"));
            }
            using (var db = new RepositoryBase().BeginTrans())
            {
                List <string> checkerObjectList = KPI.Code.Json.ToObject <List <string> >(checker_object_list);
                FileLog.Debug(checker_object_list);
                List <PersonalAssessmentCheckerModel> checkerList = KPI.Code.Json.ToObject <List <PersonalAssessmentCheckerModel> >(checker_list);
                #region 插入考核发起表
                AssessmentEntity assessmentEntity = new AssessmentEntity();
                string           assessmentId     = Common.GuId();
                assessmentEntity.id = assessmentId;
                assessmentEntity.assessment_name    = assessment_name;
                assessmentEntity.templete_id        = templete_id;
                assessmentEntity.start_time         = DateTime.Parse(start_time);
                assessmentEntity.end_time           = DateTime.Parse(end_time);
                assessmentEntity.assessment_sponsor = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentEntity.assessment_count   = checkerObjectList.Count;
                assessmentEntity.need_self_check    = need_self_check.HasValue ? need_self_check.Value : 0;
                assessmentEntity.assessment_statue  = 0;
                assessmentEntity.assessment_type    = 0;
                assessmentEntity.filing_people      = filling_people;
                assessmentEntity.creator_user_id    = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentEntity.create_time        = DateTime.Now;
                db.Insert <AssessmentEntity>(assessmentEntity);
                #endregion
                #region 插入考核发起详细表
                AssessmentDetailEntity assessmentDetailEntity = null;
                //如果需要自评
                if (assessmentEntity.need_self_check == 1)
                {
                    for (int i = 0; i < checkerObjectList.Count; i++)
                    {
                        string checkObject = checkerObjectList[i];
                        assessmentDetailEntity                   = new AssessmentDetailEntity();
                        assessmentDetailEntity.id                = Common.GuId();
                        assessmentDetailEntity.assessment_id     = assessmentId;
                        assessmentDetailEntity.check_object      = checkObject;
                        assessmentDetailEntity.checker           = checkObject;
                        assessmentDetailEntity.check_order       = 1;
                        assessmentDetailEntity.finished          = 0;
                        assessmentDetailEntity.checker_weight    = self_check_weight;
                        assessmentDetailEntity.check_total_count = checkerList.Count;
                        assessmentDetailEntity.creator_user_id   = OperatorProvider.Provider.GetCurrent().UserId;
                        assessmentDetailEntity.create_time       = DateTime.Now;
                        db.Insert <AssessmentDetailEntity>(assessmentDetailEntity);

                        //插入“自评”任务并且激活
                        SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity();
                        selfTaskDetailEntity.id              = Common.GuId();
                        selfTaskDetailEntity.task_statue     = 1;
                        selfTaskDetailEntity.task_type       = 3;
                        selfTaskDetailEntity.person          = checkObject;
                        selfTaskDetailEntity.task_object     = checkObject;
                        selfTaskDetailEntity.attach          = assessmentId;
                        selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                        selfTaskDetailEntity.create_time     = DateTime.Now;
                        db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity);
                    }
                }
                for (int i = 0; i < checkerList.Count; i++)
                {
                    for (int j = 0; j < checkerObjectList.Count; j++)
                    {
                        PersonalAssessmentCheckerModel checker = checkerList[i];
                        string checkObject = checkerObjectList[j];
                        assessmentDetailEntity                   = new AssessmentDetailEntity();
                        assessmentDetailEntity.id                = Common.GuId();
                        assessmentDetailEntity.assessment_id     = assessmentId;
                        assessmentDetailEntity.check_object      = checkObject;
                        assessmentDetailEntity.checker           = checker.checker_id;
                        assessmentDetailEntity.check_order       = checker.checker_order;
                        assessmentDetailEntity.finished          = 0;
                        assessmentDetailEntity.checker_weight    = checker.checker_weight;
                        assessmentDetailEntity.check_total_count = checkerList.Count;
                        assessmentDetailEntity.creator_user_id   = OperatorProvider.Provider.GetCurrent().UserId;
                        assessmentDetailEntity.create_time       = DateTime.Now;
                        db.Insert <AssessmentDetailEntity>(assessmentDetailEntity);


                        //给所有“考评人”插入考评任务
                        SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity();
                        selfTaskDetailEntity.id = Common.GuId();
                        if (checker.checker_order == 1)//第一个人直接激活任务
                        {
                            selfTaskDetailEntity.task_statue = 1;
                        }
                        else //剩下的人暂时先不激活任务,等待上一个人完成任务后激活下一个人的任务
                        {
                            selfTaskDetailEntity.task_statue = 0;
                        }
                        selfTaskDetailEntity.task_type       = 1;
                        selfTaskDetailEntity.person          = checker.checker_id;
                        selfTaskDetailEntity.task_object     = checkObject;
                        selfTaskDetailEntity.attach          = assessmentId;
                        selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                        selfTaskDetailEntity.create_time     = DateTime.Now;
                        db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity);
                    }
                }
                #endregion

                //给“考核结果审核人插入归档任务”
                SelfTaskDetailEntity fillingSelfTaskDetailEntity = new SelfTaskDetailEntity();
                fillingSelfTaskDetailEntity.id              = Common.GuId();
                fillingSelfTaskDetailEntity.task_statue     = 0;
                fillingSelfTaskDetailEntity.task_type       = 4;
                fillingSelfTaskDetailEntity.person          = filling_people;
                fillingSelfTaskDetailEntity.task_object     = assessmentId;
                fillingSelfTaskDetailEntity.attach          = assessmentId;
                fillingSelfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                fillingSelfTaskDetailEntity.create_time     = DateTime.Now;
                db.Insert <SelfTaskDetailEntity>(fillingSelfTaskDetailEntity);

                PersonalAssessmentImportApp personalAssessmentImportApp = new PersonalAssessmentImportApp(db);
                var data = personalAssessmentImportApp.Scan(file_name, new string[] { assessmentId });
                if (data.Count > 0)
                {
                    return(Error("导入数据存在未处理的错误!"));
                }
                else
                {
                    personalAssessmentImportApp.Import(file_name, assessmentId);
                }
                db.Commit();
            }
            return(Success("操作成功。", null));
        }
        public ActionResult CheckAssessment(string assessment_id, string check_object, string checker_result_list, double?fixed_score, double?unfixed_score, double?total_score, double?checker_weight)
        {
            AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id);

            if (assessmentEntity == null)
            {
                return(Error("此考核不存在。"));
            }
            //if (assessmentEntity.need_self_check == 0) return Error("此考核不需要自评。");
            List <SelfCheckResultModel> resultList = KPI.Code.Json.ToObject <List <SelfCheckResultModel> >(checker_result_list);
            string checker = OperatorProvider.Provider.GetCurrent().UserId;

            using (var db = new RepositoryBase().BeginTrans())
            {
                AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckerCheckObj(assessment_id, checker, check_object);
                assessmentDetailEntity.finished         = 1;
                assessmentDetailEntity.last_modify_time = DateTime.Now;
                db.Update <AssessmentDetailEntity>(assessmentDetailEntity);

                //更新自己的考核任务为已完成
                SelfTaskDetailEntity curTaskDetailEntity = null;
                if (checker == check_object && assessmentDetailApp.IsSelfCheck(assessment_id, checker, check_object))//自评
                {
                    curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 3);
                }
                else
                {
                    curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 1);
                }
                curTaskDetailEntity.task_statue      = 2;
                curTaskDetailEntity.last_modify_time = DateTime.Now;
                db.Update <SelfTaskDetailEntity>(curTaskDetailEntity);

                //保存此考核人对此考核对象的分数
                AssessmentResultCountEntity assessmentResultCountEntity = new AssessmentResultCountEntity();
                assessmentResultCountEntity.id              = Common.GuId();
                assessmentResultCountEntity.assessment_id   = assessment_id;
                assessmentResultCountEntity.checker         = checker;
                assessmentResultCountEntity.checker_weight  = checker_weight;
                assessmentResultCountEntity.check_object    = check_object;
                assessmentResultCountEntity.fixed_score     = fixed_score;
                assessmentResultCountEntity.unfixed_score   = unfixed_score;
                assessmentResultCountEntity.total_score     = fixed_score + unfixed_score;
                assessmentResultCountEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentResultCountEntity.create_time     = DateTime.Now;
                db.Insert <AssessmentResultCountEntity>(assessmentResultCountEntity);

                //如果自己不是该考核对象的最后一个考核人激活下一个人对该考核对象的任务
                if (!assessmentDetailApp.IsLastCheckerToObject(assessment_id, checker, check_object))
                {
                    int nextCheckOrder = assessmentDetailEntity.check_order + 1;
                    AssessmentDetailEntity nextAssessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckOrderCheckObj(assessment_id, check_object, nextCheckOrder);
                    SelfTaskDetailEntity   selfTaskDetailEntity       = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, nextAssessmentDetailEntity.checker, check_object, 1);
                    //激活任务
                    selfTaskDetailEntity.task_statue      = 1;
                    selfTaskDetailEntity.last_modify_time = DateTime.Now;
                    db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity);
                }
                //如果是整个考核的最后一条
                if (assessmentDetailApp.IsLastChecker(assessment_id))
                {
                    //更新整个考核为待归档
                    AssessmentEntity curAssessmentEntity = assessmentApp.GetForm(assessment_id);
                    if (curAssessmentEntity == null)
                    {
                        return(Error("系统未知错误。"));
                    }
                    curAssessmentEntity.assessment_statue = 1;
                    curAssessmentEntity.last_modify_time  = DateTime.Now;
                    db.Update <AssessmentEntity>(curAssessmentEntity);
                    //激活“考核结果审核人”的归档任务
                    SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4);
                    selfTaskDetailEntity.task_statue      = 1;
                    selfTaskDetailEntity.last_modify_time = DateTime.Now;
                    db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity);
                }
                //更新自评项分数
                for (int i = 0; i < resultList.Count; i++)
                {
                    SelfCheckResultModel model = resultList[i];
                    model.indicator_id = indicatorsDefineApp.GetIndicatorByName(model.indicator_name).id;
                    AssessmentResultEntity assessmentResultEntity = assessmentResultApp.GetByAssessmentIdObjIndicatorId(assessment_id, check_object, model.indicator_id);
                    assessmentResultEntity.indicator_value  = model.indicator_value;
                    assessmentResultEntity.last_modify_time = DateTime.Now;
                    db.Update <AssessmentResultEntity>(assessmentResultEntity);
                }
                db.Commit();
            }
            return(Success("操作成功。"));
        }
Example #6
0
        public List <PersonalAssessmentDetailOverviewModel> GetPersonalAssessmentDetail(string assessment_id, string personal_name, string telphone, int?assessment_detail_statue, string check_object, Pagination pagination)
        {
            StringBuilder sqlBuilder = new StringBuilder();

            sqlBuilder.Append("select distinct a.assessment_id,a.check_object,b.assessment_name,c.templete_name,b.start_time,b.end_time,d.F_Id as personal_id,d.F_RealName as personal_name,d.F_MobilePhone as telphone,e.F_FullName as department,d.F_Id as person_id ");
            //sqlBuilder.Append("CASE f.task_statue WHEN 1 THEN 1 ELSE 0 END AS flag ");
            sqlBuilder.Append("from t_kpi_launch_detail a left join t_kpi_launch b on a.assessment_id = b.id ");
            sqlBuilder.Append("left join t_kpi_templete c on b.templete_id = c.id ");
            sqlBuilder.Append("left join sys_user d on a.check_object = d.F_Id ");
            sqlBuilder.Append("left join sys_organize e on d.F_OrganizeId = e.F_Id ");
            //sqlBuilder.Append("LEFT JOIN t_self_task_detail f ON a.assessment_id = f.attach ");
            sqlBuilder.AppendFormat("where a.assessment_id = '{0}' ", assessment_id);
            if (!string.IsNullOrEmpty(personal_name))
            {
                sqlBuilder.AppendFormat(" and d.F_RealName like '%{0}%'", personal_name);
            }
            if (!string.IsNullOrEmpty(telphone))
            {
                sqlBuilder.AppendFormat(" and d.F_MobilePhone like '%{0}%'", telphone);
            }
            if (!string.IsNullOrEmpty(check_object))
            {
                sqlBuilder.AppendFormat(" and d.F_Id = '{0}'", check_object);
            }
            List <PersonalAssessmentDetailOverviewModel> list = service.FindListBySql <PersonalAssessmentDetailOverviewModel>(sqlBuilder.ToString(), pagination).ToList();

            for (int i = 0; i < list.Count; i++)
            {
                PersonalAssessmentDetailOverviewModel model = list[i];

                string checker   = OperatorProvider.Provider.GetCurrent().UserId;
                string sql       = string.Format("select count(*) from t_self_task_detail where attach = '{0}' and person = '{1}' and task_statue = 1 and task_object = '{2}'", assessment_id, checker, model.check_object);
                int    taskCount = service.BasicQueryT <int>(sql);
                model.flag = taskCount;


                sql = string.Format("select a.check_order as check_order,b.F_RealName as checker_name,c.need_self_check as need_self_check from t_kpi_launch_detail a left join sys_user b on a.checker = b.F_Id left join t_kpi_launch c on a.assessment_id = c.id where a.assessment_id = '{0}' and a.check_object = '{1}' and a.finished = 0 order by a.check_order asc limit 0,1", assessment_id, model.check_object);
                PersonalAssessmentDetailModel result = service.BasicQueryT <PersonalAssessmentDetailModel>(sql);
                if (result != null)
                {
                    model.assessment_detail_statue = 0;
                    if (result.need_self_check == 1 && result.check_order == 1)
                    {
                        model.assessment_statue_detail = result.checker_name + "自评中";
                    }
                    else
                    {
                        model.assessment_statue_detail = result.checker_name + "考核中";
                    }
                    model.score = 0d;
                }
                else
                {
                    model.assessment_detail_statue = 1;
                    model.assessment_statue_detail = "已完成";

                    //查询成绩
                    double?totalScore = 0d;
                    List <AssessmentResultCountEntity> assessmentResultCountList = assessmentResultCountApp.GetByAssessmentIdCheckObject(assessment_id, model.check_object);
                    assessmentResultCountList.ForEach((t) =>
                    {
                        AssessmentDetailEntity assessmentDetailEntity = GetByAssessmentIdCheckerCheckObj(t.assessment_id, t.checker, t.check_object);
                        totalScore += assessmentDetailEntity.checker_weight / 100d * (t.unfixed_score + t.fixed_score);
                    });
                    //model.score = totalScore;
                    model.score = (double?)decimal.Round(decimal.Parse(totalScore.ToString()), 2);
                }
            }
            if (assessment_detail_statue.HasValue)
            {
                list = list.FindAll(t => t.assessment_detail_statue == assessment_detail_statue.Value);
            }
            return(list);
        }
        public ActionResult LaunchBranchAssessment(string assessment_name, string start_time, string end_time, string templete_id, string checker_list, string filling_people, string file_name)
        {
            if (assessmentApp.IsExists(assessment_name))
            {
                return(Error("考核名称已存在。"));
            }
            using (var db = new RepositoryBase().BeginTrans())
            {
                //获取“中安金控集团id”
                OrganizeEntity org = organizeApp.GetForm(BlocId);
                //获取所有子公司
                List <OrganizeEntity> branchList = organizeApp.GetListByParentIdOrderById(org.F_Id, CompanyId);
                List <BranchAssessmentCheckerModel> checkerList = KPI.Code.Json.ToObject <List <BranchAssessmentCheckerModel> >(checker_list);
                #region 插入考核发起表
                AssessmentEntity assessmentEntity = new AssessmentEntity();
                string           assessmentId     = Common.GuId();
                assessmentEntity.id = assessmentId;
                assessmentEntity.assessment_name    = assessment_name;
                assessmentEntity.templete_id        = templete_id;
                assessmentEntity.start_time         = DateTime.Parse(start_time);
                assessmentEntity.end_time           = DateTime.Parse(end_time);
                assessmentEntity.assessment_sponsor = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentEntity.assessment_count   = branchList.Count;
                assessmentEntity.assessment_statue  = 0;
                assessmentEntity.assessment_type    = 1;
                assessmentEntity.filing_people      = filling_people;
                assessmentEntity.creator_user_id    = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentEntity.create_time        = DateTime.Now;
                db.Insert <AssessmentEntity>(assessmentEntity);
                #endregion
                #region 插入考核发起详细表
                AssessmentDetailEntity assessmentDetailEntity = new AssessmentDetailEntity();
                for (int i = 0; i < checkerList.Count; i++)
                {
                    for (int j = 0; j < branchList.Count; j++)
                    {
                        BranchAssessmentCheckerModel checker = checkerList[i];
                        OrganizeEntity check_object          = branchList[j];
                        assessmentDetailEntity                   = new AssessmentDetailEntity();
                        assessmentDetailEntity.id                = Common.GuId();
                        assessmentDetailEntity.assessment_id     = assessmentId;
                        assessmentDetailEntity.check_object      = check_object.F_Id;
                        assessmentDetailEntity.checker           = checker.checker_id;
                        assessmentDetailEntity.check_order       = checker.checker_order;
                        assessmentDetailEntity.finished          = 0;
                        assessmentDetailEntity.checker_weight    = 0;
                        assessmentDetailEntity.check_total_count = checkerList.Count;
                        assessmentDetailEntity.creator_user_id   = OperatorProvider.Provider.GetCurrent().UserId;
                        assessmentDetailEntity.create_time       = DateTime.Now;
                        db.Insert <AssessmentDetailEntity>(assessmentDetailEntity);

                        //给所有“考评人”插入考评任务并且激活第一个考评人的任务
                        SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity();
                        selfTaskDetailEntity.id = Common.GuId();
                        if (checker.checker_order == 1)//第一个人直接激活任务
                        {
                            selfTaskDetailEntity.task_statue = 1;
                        }
                        else //剩下的人暂时先不激活任务,等待上一个人完成任务后激活下一个人的任务
                        {
                            selfTaskDetailEntity.task_statue = 0;
                        }
                        selfTaskDetailEntity.task_type       = 1;
                        selfTaskDetailEntity.person          = checker.checker_id;
                        selfTaskDetailEntity.task_object     = check_object.F_Id;
                        selfTaskDetailEntity.attach          = assessmentId;
                        selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                        selfTaskDetailEntity.create_time     = DateTime.Now;
                        db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity);
                    }
                }

                //给“考核结果审核人插入归档任务”

                SelfTaskDetailEntity fillingSelfTaskDetailEntity = new SelfTaskDetailEntity();
                fillingSelfTaskDetailEntity.id              = Common.GuId();
                fillingSelfTaskDetailEntity.task_statue     = 0;
                fillingSelfTaskDetailEntity.task_type       = 4;
                fillingSelfTaskDetailEntity.person          = filling_people;
                fillingSelfTaskDetailEntity.task_object     = assessmentId;
                fillingSelfTaskDetailEntity.attach          = assessmentId;
                fillingSelfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                fillingSelfTaskDetailEntity.create_time     = DateTime.Now;
                db.Insert <SelfTaskDetailEntity>(fillingSelfTaskDetailEntity);

                //导入考核数据
                BranchAssessmentImportApp branchAssessmentImportApp = new BranchAssessmentImportApp(db);
                var data = branchAssessmentImportApp.Scan(file_name, new string[] { assessmentId });
                if (data.Count > 0)
                {
                    return(Error("导入数据存在未处理的错误!"));
                }
                else
                {
                    branchAssessmentImportApp.Import(file_name, assessmentId);
                }
                db.Commit();
            }
            #endregion
            return(Success("操作成功。", null));
        }
        public ActionResult CheckAssessment(string assessment_id, string check_object, double?fixed_score, double?unfixed_score, double?toatal_score, double?checker_weight)
        {
            using (var db = new RepositoryBase().BeginTrans())
            {
                string checker = OperatorProvider.Provider.GetCurrent().UserId;
                //
                AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckerCheckObj(assessment_id, checker, check_object);
                assessmentDetailEntity.finished         = 1;
                assessmentDetailEntity.last_modify_time = DateTime.Now;
                db.Update <AssessmentDetailEntity>(assessmentDetailEntity);

                //保存此考核人对此考核对象的分数
                AssessmentResultCountEntity assessmentResultCountEntity = new AssessmentResultCountEntity();
                assessmentResultCountEntity.id              = Common.GuId();
                assessmentResultCountEntity.assessment_id   = assessment_id;
                assessmentResultCountEntity.checker         = checker;
                assessmentResultCountEntity.checker_weight  = checker_weight;
                assessmentResultCountEntity.check_object    = check_object;
                assessmentResultCountEntity.fixed_score     = fixed_score;
                assessmentResultCountEntity.unfixed_score   = unfixed_score;
                assessmentResultCountEntity.total_score     = fixed_score + unfixed_score;
                assessmentResultCountEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId;
                assessmentResultCountEntity.create_time     = DateTime.Now;
                db.Insert <AssessmentResultCountEntity>(assessmentResultCountEntity);

                //更新自己的考核任务为已完成
                SelfTaskDetailEntity curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 1);
                curTaskDetailEntity.task_statue      = 2;
                curTaskDetailEntity.last_modify_time = DateTime.Now;
                db.Update <SelfTaskDetailEntity>(curTaskDetailEntity);

                //如果自己不是该考核对象的最后一个考核人激活下一个人对该考核对象的任务
                if (!assessmentDetailApp.IsLastCheckerToObject(assessment_id, checker, check_object))
                {
                    int nextCheckOrder = assessmentDetailEntity.check_order + 1;
                    AssessmentDetailEntity nextAssessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckOrderCheckObj(assessment_id, check_object, nextCheckOrder);
                    SelfTaskDetailEntity   curSelfTaskDetailEntity    = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, nextAssessmentDetailEntity.checker, check_object, 1);
                    //激活任务
                    curSelfTaskDetailEntity.task_statue      = 1;
                    curSelfTaskDetailEntity.last_modify_time = DateTime.Now;
                    db.Update <SelfTaskDetailEntity>(curSelfTaskDetailEntity);
                }
                //如果是整个考核的最后一条
                if (assessmentDetailApp.IsLastChecker(assessment_id))//如果是最后一个人对最后一个对象考核
                {
                    //更新整个考核为待归档
                    AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id);
                    if (assessmentEntity == null)
                    {
                        return(Error("系统未知错误。"));
                    }
                    assessmentEntity.assessment_statue = 1;
                    assessmentEntity.last_modify_time  = DateTime.Now;
                    db.Update <AssessmentEntity>(assessmentEntity);
                    //激活“考核结果审核人”的归档任务
                    SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4);
                    selfTaskDetailEntity.task_statue      = 1;
                    selfTaskDetailEntity.last_modify_time = DateTime.Now;
                    db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity);
                }

                db.Commit();
            }
            return(Success("操作成功。", null));
        }