private void Create() { string Id = Request["Id"]; Project pEnt = Project.Find(Id); IList <ProjectUser> puEnts = ProjectUser.FindAllByProperty(ProjectUser.Prop_ProjectId, Id); pEnt.Status = "已下达"; pEnt.DoUpdate(); foreach (ProjectUser puEnt in puEnts) { ExamineTask etEnt = new ExamineTask(); etEnt.ProjectId = Id; etEnt.ProjectUserId = puEnt.Id;//str ProjectUser 的主键 etEnt.MajorName = puEnt.MajorName; etEnt.PlanBackTime = Convert.ToDateTime(Request["BackTime"]); etEnt.State = "未结束"; etEnt.CreateId = WebPortalService.CurrentUserInfo.UserID; etEnt.CreateName = WebPortalService.CurrentUserInfo.UserID; etEnt.CreateTime = DateTime.Now; etEnt.DoCreate(); Expert eEnt = Expert.Find(puEnt.UserId); //发送邮件 try { //string url = "http://192.168.15.81:7007/ConsultationManage/ExamineOpinionEdit.aspx?ExamineTaskId=" + etEnt.Id; //PhoneMessage.SendWebMail("*****@*****.**", eEnt.Email, "审查任务", "项目名称:【" + pEnt.ProjectName + "】 专业:" + eEnt.MajorName + ",填写审查意见请点击此链接:" + url, "fpxt", "000000", "mail.nerin.com"); } catch (Exception ex) { } } }
private void Recycle() { string Result = "T"; string id = Request["id"]; IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ProjectId, id); foreach (ExamineTask etEnt in etEnts) { IList <ExamineOpinion> eoEnts = ExamineOpinion.FindAllByProperty(ExamineOpinion.Prop_ExamineTaskId, etEnt.Id); if (eoEnts.Count > 0) { Result = "F"; break; } } if (Result == "T") { ExamineTask.DeleteAll("ProjectId='" + id + "'"); pEnt = Project.Find(id); pEnt.Status = "已创建"; pEnt.TaskQuan = 0; pEnt.DoUpdate(); } Response.Write("{success: true ,Result:'" + Result + "'}"); Response.End(); }
private void DoSelect() { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!string.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { //case "StartTime": // where += " and StartTime>'" + item.Value + "' "; // break; //case "EndTime": // where += " and EndTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; // break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%'"; break; } } } sql = @"select *,(select count(Id) from BJKY_Examine..CustomIndicator where IndicatorSecondId=IndicatorScore.IndicatorSecondId and Year='{0}' and StageType='{1}' and CreateId='{2}') as SubQuan from BJKY_Examine..IndicatorScore where ExamineTaskId='{3}' " + where; ExamineTask etEnt = ExamineTask.Find(TaskId); ExamineStage esEnt = ExamineStage.Find(etEnt.ExamineStageId); sql = string.Format(sql, esEnt.Year, esEnt.StageType, etEnt.BeUserId, TaskId); PageState.Add("DataList", GetPageData(sql, SearchCriterion)); PageState.Add("TaskInfo", etEnt); }
private void DoSelect() { ExamineStageResult esrEnt = ExamineStageResult.Find(ExamineStageResultId); string where = ""; if (SearchCriterion.Orders.Count == 0) { SearchCriterion.SetOrder("ToUserName", true); where = " ExamineStageId='{0}' and State='3' and BeUserId='{1}'"; } else { where = " ExamineStageId='{0}' and State='3' and BeUserId='{1}'"; } where = string.Format(where, esrEnt.ExamineStageId, esrEnt.UserId); IList <ExamineTask> etEnts = ExamineTask.FindAll(SearchCriterion, Expression.Sql(where)); PageState.Add("DataList", etEnts); if (!string.IsNullOrEmpty(esrEnt.ExamineStageId))//有些考核结果是手动填报的 因此需要加判断 有无考核阶段和明细 { ExamineStage esEnt = ExamineStage.Find(esrEnt.ExamineStageId); PageState.Add("ExamineStage", esEnt); } PageState.Add("BeUserName", esrEnt.UserName); }
private void DoSelect() { string where = ""; foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches) { if (!string.IsNullOrEmpty(item.Value.ToString())) { switch (item.PropertyName) { //case "StartTime": // where += " and StartTime>'" + item.Value + "' "; // break; //case "EndTime": // where += " and EndTime<='" + (item.Value.ToString()).Replace(" 0:00:00", " 23:59:59") + "' "; // break; default: where += " and " + item.PropertyName + " like '%" + item.Value + "%'"; break; } } } sql = @"select A.*,B.PersonFirstIndicatorName,B.Weight,B.IndicatorType,B.SortIndex from BJKY_Examine..CustomFirstIndicatorScore as A left join BJKY_Examine..PersonFirstIndicator as B on A.PersonFirstIndicatorId=B.Id where ExamineTaskId='{0}' " + where; ExamineTask etEnt = ExamineTask.Find(TaskId); sql = string.Format(sql, TaskId); PageState.Add("DataList", DataHelper.QueryDictList(sql)); PageState.Add("TaskInfo", etEnt); }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); ToUserId = RequestData.Get <string>("ToUserId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); } switch (RequestActionString) { case "delete": IList <string> taskIds = RequestData.GetList <string>("taskIds"); foreach (string taskId in taskIds) { ExamineTask etEnt = ExamineTask.Find(taskId); etEnt.DoDelete(); } esEnt.TaskQuan = esEnt.TaskQuan - taskIds.Count; esEnt.DoUpdate(); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { ExamineStageId = RequestData.Get <string>("ExamineStageId"); if (!string.IsNullOrEmpty(ExamineStageId)) { esEnt = ExamineStage.Find(ExamineStageId); //如果考核阶段的状态是已生成 任务状态是0 如果是已启动 任务状态为1 state = esEnt.State == 1 ? "0" : "1"; } switch (RequestActionString) { case "AmendTask": //需要添加的任务 ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); int addQuan = ttEnts.Count; foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ExamineTask etEnt = new ExamineTask("", ttEnt.ExamineStageId, ttEnt.ToUserId, ttEnt.ToUserName, ttEnt.ToDeptId, ttEnt.ToDeptName, ttEnt.ToRoleCode, ttEnt.ToRoleName, ttEnt.BeUserId, ttEnt.BeUserName, ttEnt.BeDeptId, ttEnt.BeDeptName, ttEnt.BeRoleCode, ttEnt.BeRoleName, null, state, ttEnt.Tag, null, UserInfo.UserID, UserInfo.Name, System.DateTime.Now, ttEnt.ExamineIndicatorId, ttEnt.ExamineRelationId); etEnt.DoCreate(); ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); int reduceQuan = etEnts.Count; foreach (ExamineTask etEnt in etEnts) { etEnt.DoDelete(); } esEnt.TaskQuan = esEnt.TaskQuan + addQuan - reduceQuan; esEnt.DoUpdate(); PageState.Add("Result", "增补任务数量:【" + addQuan.ToString() + "】 删除任务数量:【" + reduceQuan.ToString() + "】!"); break; case "CancelAmendTask": ttEnts = TempTask.FindAllByProperties(TempTask.Prop_ExamineStageId, ExamineStageId, TempTask.Prop_AmendState, "+"); foreach (TempTask ttEnt in ttEnts) //特殊任务也连同判断了 { ttEnt.DoDelete(); } etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, ExamineTask.Prop_AmendState, "-"); foreach (ExamineTask etEnt in etEnts) { etEnt.AmendState = null; etEnt.DoUpdate(); } break; default: DoSelect(); break; } }
private void LaunchExamine() { // 如果是部门级考核 启动时需要把自定义指标状态置为3 if (esEnt.ExamineType == "部门级考核") { sql = @"select A.* from BJKY_Examine..DeptExamineRelation as A left join BJKY_Examine..ExamineStageDetail as B on A.Id=B.ExamineRelationId where B.ExamineStageId='" + esEnt.Id + "'";//找到部门考核关系里面的所有被考核人 查找他们的自定义指标 IList <EasyDictionary> dicsRelation = DataHelper.QueryDictList(sql); string beUserIds = ""; string beUserNames = ""; foreach (EasyDictionary dic in dicsRelation) { beUserIds += dic.Get <string>("BeUserIds") + ","; beUserNames += dic.Get <string>("BeUserNames") + ","; } string[] userIdArray = null; if (!string.IsNullOrEmpty(beUserIds)) { userIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int j = 0; j < userIdArray.Length; j++) { IList <CustomIndicator> ciEnts = CustomIndicator.FindAllByProperties("CreateId", userIdArray[j], "Year", esEnt.Year, "StageType", esEnt.StageType); if (ciEnts.Count > 0) { ciEnts[0].State = "3";//启动考核的时候将自定义指标的状态改为3 已结束 ciEnts[0].DoUpdate(); } } IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); foreach (ExamineTask etEnt in etEnts) { etEnt.State = "1";//任务状态 etEnt.DoUpdate(); } esEnt.State = 2; esEnt.DoUpdate(); PageState.Add("Result", "T"); } else//院级考核 { IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); foreach (ExamineTask etEnt in etEnts) { etEnt.State = "1";//任务状态 etEnt.DoUpdate(); } esEnt.State = 2; esEnt.DoUpdate(); PageState.Add("Result", "T"); } }
private void SubmitTask() { IList <string> taskIds = RequestData.GetList <string>("taskIds"); if (taskIds.Count > 0) { foreach (string str in taskIds) { ExamineTask etEnt = ExamineTask.Find(str); etEnt.State = "2"; etEnt.DoUpdate(); } } }
private void CreateTask() { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id); foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds; string toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { //2013-12-5追加功能 生成考核任务的时候针对每一个考核对象,自动创建本阶段考核的自定义考核指标 CreateCustomIndicator(beUserIdArray[i], beUserNameArray[i], esEnt, esdEnt); for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; string[] bedept = Utility.GetDeptInfo(beUserIdArray[i]); etEnt.BeDeptId = bedept[0]; etEnt.BeDeptName = bedept[1]; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; string[] todept = Utility.GetDeptInfo(toUserIdArray[j]); etEnt.ToDeptId = todept[0]; etEnt.ToDeptName = todept[1]; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } } }
private void IniPage() { JObject jo = new JObject(); string ZhuCeUsers = ""; string SheJiUsers = ""; string ExamineTaskId = Request["ExamineTaskId"]; eEnt = ExamineTask.Find(ExamineTaskId); //审查任务 Project pEnt = Project.Find(eEnt.ProjectId); //项目 ProjectUser puEnt = ProjectUser.Find(eEnt.ProjectUserId); //项目人员 IList <ExamineOpinion> eoEnts = ExamineOpinion.FindAllByProperty(ExamineOpinion.Prop_ExamineTaskId, ExamineTaskId); //看意见有几条 IList <KanChaSheJi> kEnts = KanChaSheJi.FindAllByProperties(KanChaSheJi.Prop_ProjectId, pEnt.Id, KanChaSheJi.Prop_MajorName, eEnt.MajorName); //勘察设计人员 foreach (KanChaSheJi kEnt in kEnts) { if (!string.IsNullOrEmpty(kEnt.SealNo)) { ZhuCeUsers += kEnt.UserName; } else { SheJiUsers += kEnt.UserName; } } IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty("SortIndex", SysEnumeration.Prop_ParentID, "b640c40c-e2a9-41a8-bd28-d8ff9d71ff70"); jo.Add("ExamineTaskId", ExamineTaskId); jo.Add("ZiXunCode", pEnt.ZiXunCode); jo.Add("ProjectName", pEnt.ProjectName); jo.Add("ZhuCeUsers", ZhuCeUsers); jo.Add("SheJiUsers", SheJiUsers); jo.Add("Stage", seEnts[eoEnts.Count].Name); jo.Add("MajorName", eEnt.MajorName); jo.Add("ShenChaUserId", eEnt.ProjectUserId); jo.Add("ShenChaUserName", puEnt.UserName); jo.Add("FuHeUserId", puEnt.ShenHeId); jo.Add("FuHeUserName", puEnt.ShenHeName); jo.Add("ShenChaOrganization", "江西瑞林工程咨询有限公司"); if (seEnts[eoEnts.Count].Name == "初审") { string StartTime = eEnt.CreateTime.ToString().Replace("}", "").Replace("{", ""); jo.Add("StartTime", StartTime); } string str = JsonHelper.GetJsonString(jo); Response.Write("{success:true,data:" + str + " }"); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { string id = Request["id"]; ExamineOpinion eoEnt = ExamineOpinion.Find(id); lbStage.InnerHtml = "(" + eoEnt.Stage + ")"; lbStartYear.InnerHtml = eoEnt.StartTime.Value.Year + ""; lbStartMonth.InnerHtml = eoEnt.StartTime.Value.Month + ""; lbStartDay.InnerHtml = eoEnt.StartTime.Value.Day + ""; ExamineTask etEnt = ExamineTask.Find(eoEnt.ExamineTaskId); Project pEnt = Project.Find(etEnt.ProjectId); lbZiXunCode.InnerHtml = pEnt.ZiXunCode; lbMajorName.InnerHtml = etEnt.MajorName; string ZhuCeUsers = ""; string SheJiUsers = ""; IList <KanChaSheJi> kcsjEnts = KanChaSheJi.FindAllByProperties(KanChaSheJi.Prop_ProjectId, pEnt.Id, KanChaSheJi.Prop_MajorName, etEnt.MajorName); foreach (KanChaSheJi kcsjEnt in kcsjEnts) { if (!string.IsNullOrEmpty(kcsjEnt.SealNo)) { ZhuCeUsers += (string.IsNullOrEmpty(ZhuCeUsers) ? "" : ",") + kcsjEnt.UserName; } else { SheJiUsers += (string.IsNullOrEmpty(SheJiUsers) ? "" : ",") + kcsjEnt.UserName; } } lbZhuCeUsers.InnerHtml = ZhuCeUsers; lbSheJiUsers.InnerHtml = SheJiUsers; lbProjectName.InnerHtml = pEnt.ProjectName; lbExamineOpinions.InnerHtml = eoEnt.ExamineOpinions; lbQiangTiao.InnerHtml = eoEnt.QiangTiao + ""; lbJiangZhuSheJi.InnerHtml = eoEnt.JiangZhuSheJi + ""; lbFangHuo.InnerHtml = eoEnt.FangHuo + ""; lbSheBei.InnerHtml = eoEnt.SheBei + ""; lbJiChu.InnerHtml = eoEnt.JiChu + ""; lbJiGouSheJi.InnerHtml = eoEnt.JiGouSheJi + ""; lbKangZhenSheJi.InnerHtml = eoEnt.KangZhenSheJi + ""; lbJiaGu.InnerHtml = eoEnt.JiaGu + ""; lbShenChaUserName.InnerHtml = eoEnt.ShenChaUserName; lbFuHeUserName.InnerHtml = eoEnt.FuHeUserName; lbEndTime.InnerHtml = eoEnt.EndTime.Value.Year + "年" + eoEnt.EndTime.Value.Month + "月" + eoEnt.EndTime.Value.Day + "日"; }
private void AmendTask() { IList <TempTask> ttEnts = TempTask.FindAllByProperty(TempTask.Prop_ExamineStageId, ExamineStageId); IList <ExamineTask> etEnts = null; foreach (TempTask ttEnt in ttEnts) { if (esEnt.StageType == "院级考核") { etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, "BeUserId", ttEnt.BeUserId, "BeRoleCode", ttEnt.BeRoleCode, "BeDeptId", ttEnt.BeDeptId, "ToUserId", ttEnt.ToUserId, "ToRoleCode", ttEnt.ToRoleCode); } else { etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_ExamineStageId, ExamineStageId, "BeUserId", ttEnt.BeUserId, "BeDeptId", ttEnt.BeDeptId, "ToUserId", ttEnt.ToUserId); } if (etEnts.Count > 0) { ttEnt.AmendState = "-"; } else { ttEnt.AmendState = "+"; } ttEnt.DoUpdate(); } etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, ExamineStageId); foreach (ExamineTask etEnt in etEnts) { if (esEnt.StageType == "院级考核") { ttEnts = TempTask.FindAllByProperties("ExamineStageId", ExamineStageId, "BeUserId", etEnt.BeUserId, "BeRoleCode", etEnt.BeRoleCode, "BeDeptId", etEnt.BeDeptId, "ToUserId", etEnt.ToUserId, "ToRoleCode", etEnt.ToRoleCode); } else { ttEnts = TempTask.FindAllByProperties("ExamineStageId", ExamineStageId, "BeUserId", etEnt.BeUserId, "BeDeptId", etEnt.BeDeptId, "ToUserId", etEnt.ToUserId); } if (ttEnts.Count == 0) { etEnt.AmendState = "-"; } etEnt.DoUpdate(); } sql = "delete BJKY_Examine..TempTask where ExamineStageId='" + ExamineStageId + "' and AmendState='-'"; DataHelper.ExecSql(sql); }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); } switch (RequestActionString) { case "delete": string ids = RequestData.Get <string>("ids"); sql = "delete BJKY_Examine..ExamineTask where PatIndex('%'+id+'%','" + ids + "')>0"; DataHelper.ExecSql(sql); break; case "canceltask": if (esEnt.State == 1) { sql = "delete BJKY_Examine..ExamineTask where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); sql = "delete BJKY_Examine..CustomIndicator where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); esEnt.TaskQuan = 0; esEnt.State = 0; esEnt.DoUpdate(); } break; case "createtask": if (esEnt.State == 0) { CreateExamineTask(); //同时创建自定义的考核指标 esEnt.State = 1; //更新考核阶段状态为1 已生成 etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); esEnt.TaskQuan = etEnts.Count; esEnt.DoUpdate(); } break; default: DoSelect(); break; } }
private void CancelLaunch() //撤销启动 { if (esEnt.ExamineType == "部门级考核") //撤销启动的时候 如果是部门级考核 需要将考核对象的自定义指标状态设置为2 也就是可以还填写自我评价 { sql = @"select A.* from BJKY_Examine..DeptExamineRelation as A left join BJKY_Examine..ExamineStageDetail as B on A.Id=B.ExamineRelationId where B.ExamineStageId='" + esEnt.Id + "'"; //找到部门考核关系里面的所有被考核人 查找他们的自定义指标 IList <EasyDictionary> dicsRelation = DataHelper.QueryDictList(sql); string beUserIds = ""; string beUserNames = ""; foreach (EasyDictionary dic in dicsRelation) { beUserIds += dic.Get <string>("BeUserIds") + ","; beUserNames += dic.Get <string>("BeUserNames") + ","; } string[] userIdArray = null; if (!string.IsNullOrEmpty(beUserIds)) { userIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int j = 0; j < userIdArray.Length; j++) { IList <CustomIndicator> ciEnts = CustomIndicator.FindAllByProperties("CreateId", userIdArray[j], "Year", esEnt.Year, "StageType", esEnt.StageType); if (ciEnts.Count > 0) { ciEnts[0].State = "2"; ciEnts[0].DoUpdate(); } } } IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id); foreach (ExamineTask etEnt in etEnts) { IList <IndicatorScore> isEnts = IndicatorScore.FindAllByProperty(IndicatorScore.Prop_ExamineTaskId, etEnt.Id); foreach (IndicatorScore isEnt in isEnts) { isEnt.DoDelete(); } etEnt.DoDelete(); } esEnt.TaskQuan = 0; esEnt.State = 0; esEnt.DoUpdate(); }
protected void Page_Load(object sender, EventArgs e) { Index = RequestData.Get <string>("Index"); ExamineStageId = RequestData.Get <string>("ExamineStageId"); BeRoleCode = RequestData.Get <string>("BeRoleCode"); ToRoleCode = RequestData.Get <string>("ToRoleCode"); switch (RequestActionString) { case "TakeBack": IList <ExamineTask> etEnts = ExamineTask.FindAllByProperties("ExamineStageId", ExamineStageId, "ToUserId", UserInfo.UserID, "BeRoleCode", BeRoleCode, "ToRoleCode", ToRoleCode); foreach (ExamineTask etEnt in etEnts) { etEnt.State = "1"; etEnt.DoUpdate(); } break; default: DoSelect(); break; } }
private void SaveSubScore() { string ExamineTaskId = RequestData.Get <string>("ExamineTaskId"); ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); string IndicatorSecondId = RequestData.Get <string>("IndicatorSecondId"); decimal SubScore = RequestData.Get <decimal>("SubScore"); //decimal Score = RequestData.Get<decimal>("Score"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, ExamineTaskId, IndicatorScore.Prop_IndicatorSecondId, IndicatorSecondId); if (insEnts.Count > 0)//更新 { insEnts[0].SubScore = SubScore; insEnts[0].DoUpdate(); } else//创建 { IndicatorScore insEnt = new IndicatorScore(); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); IndicatorFirst ifEnt = IndicatorFirst.Find(isEnt.IndicatorFirstId); string tooltip = "!" + ifEnt.CustomColumn + "#" + isEnt.ToolTip;//加入#号前面的字符是为了标识该指标下有自定义指标,有明细分 insEnt.ExamineTaskId = ExamineTaskId; insEnt.IndicatorFirstId = isEnt.IndicatorFirstId; insEnt.IndicatorFirstName = isEnt.IndicatorFirstName; insEnt.FirstMaxScore = ifEnt.MaxScore; insEnt.FirstSortIndex = ifEnt.SortIndex; insEnt.IndicatorSecondId = isEnt.Id; insEnt.IndicatorSecondName = isEnt.IndicatorSecondName; insEnt.SecondMaxScore = isEnt.MaxScore; insEnt.SecondSortIndex = isEnt.SortIndex; insEnt.SubScore = SubScore; insEnt.ToolTip = tooltip; insEnt.DoCreate(); } sql = "select isnull(SUM(SubScore),0) FROM BJKY_Examine..IndicatorScore WHERE ExamineTaskId = '" + ExamineTaskId + "'"; etEnt.Score = DataHelper.QueryValue <decimal>(sql); etEnt.DoUpdate(); PageState.Add("Score", etEnt.Score); }
private void SaveSubScore() { string ExamineTaskId = RequestData.Get <string>("ExamineTaskId"); ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); string IndicatorSecondId = RequestData.Get <string>("IndicatorSecondId"); decimal SubScore = RequestData.Get <decimal>("SubScore"); decimal Score = RequestData.Get <decimal>("Score"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, ExamineTaskId, IndicatorScore.Prop_IndicatorSecondId, IndicatorSecondId); if (insEnts.Count > 0)//更新 { insEnts[0].SubScore = SubScore; insEnts[0].DoUpdate(); } else//创建 { IndicatorScore insEnt = new IndicatorScore(); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); IndicatorFirst ifEnt = IndicatorFirst.Find(isEnt.IndicatorFirstId); string tooltip = "!" + ifEnt.InsteadColumn + "#" + isEnt.ToolTip;//加入#号前面的字符是为了验证经营开发正职 部分要素分是由人力资源部打的 insEnt.ExamineTaskId = ExamineTaskId; insEnt.IndicatorFirstId = isEnt.IndicatorFirstId; insEnt.IndicatorFirstName = isEnt.IndicatorFirstName; insEnt.FirstMaxScore = ifEnt.MaxScore; insEnt.FirstSortIndex = ifEnt.SortIndex; insEnt.IndicatorSecondId = isEnt.Id; insEnt.IndicatorSecondName = isEnt.IndicatorSecondName; insEnt.SecondMaxScore = isEnt.MaxScore; insEnt.SecondSortIndex = isEnt.SortIndex; insEnt.SubScore = SubScore; insEnt.ToolTip = tooltip; insEnt.DoCreate(); etEnt.Score = Score; etEnt.DoUpdate(); } etEnt.Score = Score; etEnt.DoUpdate(); }
private void CreateSpecialTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt) //特例 如果被考对象经营目标单位正职 还需要推送一部分任务到 人力资源部 工作业绩打分人 { if (esdEnt.BeRoleCode == "BeBusinessDeptLeader") { IList <PersonConfig> pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, "HRAchievementWritor"); IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty(IndicatorFirst.Prop_InsteadColumn, "T");//配置考核项中。 确实有人力资源打分项 if (pcEnts.Count > 0 && ifEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { string[] beUserIdArray = new string[] { }; if (!string.IsNullOrEmpty(beUserIds)) { beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(beUserNames)) { beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beDeptIdArray = new string[] { }; if (!string.IsNullOrEmpty(beDeptIds)) { beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] beDeptNameArray = new string[] { }; if (!string.IsNullOrEmpty(beDeptNames)) { beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] toUserIdArray = new string[] { }; if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { toUserIdArray = pcEnts[0].ClerkIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(pcEnts[0].ClerkNames)) { toUserNameArray = pcEnts[0].ClerkNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeRoleCode = esdEnt.BeRoleCode; etEnt.BeRoleName = esdEnt.BeRoleName; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; if (i <= beDeptIdArray.Length - 1) { etEnt.BeDeptId = beDeptIdArray[i]; } if (i <= beDeptNameArray.Length - 1) { etEnt.BeDeptName = beDeptNameArray[i]; } etEnt.ToRoleCode = "HRAchievementWritor"; etEnt.ToRoleName = ifEnts[0].IndicatorFirstName + "填报人"; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; sql = @" select Id,GroupName from BJKY_Examine..PersonConfig where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')"; sql = string.Format(sql, toUserIdArray[j]); IList <EasyDictionary> dics3 = DataHelper.QueryDictList(sql); if (dics3.Count > 0) { etEnt.ToDeptId = dics3[0].Get <string>("Id"); etEnt.ToDeptName = dics3[0].Get <string>("GroupName"); } etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.Tag = "1"; etEnt.DoCreate(); } } } } } } }
protected void Page_Load(object sender, EventArgs e) { string action = Request["action"]; string ExamineTaskId = Request["ExamineTaskId"]; string id = Request["id"]; string sql = ""; DataTable dt = null; ExamineTask eEnt = null; ExamineOpinion eoEnt = null; Project pEnt = null; JObject jo = null; string ZhuCeUsers = ""; string SheJiUsers = ""; ProjectUser puEnt = null; IList <KanChaSheJi> kEnts = null; string templatepath = ConfigurationManager.AppSettings["TemplatePath"].ToString(); switch (action) { case "loadtimes": IList <ExamineOpinion> eoEnts = ExamineOpinion.FindAllByProperty(ExamineOpinion.Prop_CreateTime, ExamineOpinion.Prop_ExamineTaskId, ExamineTaskId); sql = "select Id,Stage from NCRL_SP..ExamineOpinion where ExamineTaskId='" + ExamineTaskId + "' order by CreateTime asc"; dt = DataHelper.QueryDataTable(sql); jo = new JObject(); eEnt = ExamineTask.Find(ExamineTaskId); //审查任务 pEnt = Project.Find(eEnt.ProjectId); //项目 puEnt = ProjectUser.Find(eEnt.ProjectUserId); //项目人员 kEnts = KanChaSheJi.FindAllByProperties(KanChaSheJi.Prop_ProjectId, pEnt.Id, KanChaSheJi.Prop_MajorName, eEnt.MajorName); //勘察设计人员 foreach (KanChaSheJi kEnt in kEnts) { if (!string.IsNullOrEmpty(kEnt.SealNo)) { ZhuCeUsers += kEnt.UserName; } else { SheJiUsers += kEnt.UserName; } } jo.Add("ExamineTaskId", ExamineTaskId); jo.Add("ZiXunCode", pEnt.ZiXunCode); jo.Add("ProjectName", pEnt.ProjectName); jo.Add("ZhuCeUsers", ZhuCeUsers); jo.Add("SheJiUsers", SheJiUsers); jo.Add("MajorName", eEnt.MajorName); jo.Add("ShenChaUserId", eEnt.ProjectUserId); jo.Add("ShenChaUserName", puEnt.UserName); jo.Add("FuHeUserId", puEnt.ShenHeId); jo.Add("FuHeUserName", puEnt.ShenHeName); jo.Add("ShenChaOrganization", "江西瑞林工程咨询有限公司"); jo.Add("Id", eoEnts[0].Id); jo.Add("Stage", eoEnts[0].Stage); jo.Add("StartTime", eoEnts[0].StartTime.Value.ToString("yyyy-MM-dd")); jo.Add("EndTime", eoEnts[0].EndTime.Value.ToString("yyyy-MM-dd")); jo.Add("JiangZhuSheJi", eoEnts[0].JiangZhuSheJi); jo.Add("FangHuo", eoEnts[0].FangHuo); jo.Add("SheBei", eoEnts[0].SheBei); jo.Add("JiGouSheJi", eoEnts[0].JiGouSheJi); jo.Add("KangZhenSheJi", eoEnts[0].KangZhenSheJi); jo.Add("JiaGu", eoEnts[0].JiaGu); jo.Add("QiangTiao", eoEnts[0].QiangTiao); jo.Add("ExamineOpinions", eoEnts[0].ExamineOpinions); Response.Write("{success:true,formdata:" + JsonHelper.GetJsonString(jo) + ",rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}"); Response.End(); break; case "loadopinion": eoEnt = ExamineOpinion.Find(id); jo = new JObject(); eEnt = ExamineTask.Find(eoEnt.ExamineTaskId); //审查任务 pEnt = Project.Find(eEnt.ProjectId); //项目 puEnt = ProjectUser.Find(eEnt.ProjectUserId); //项目人员 kEnts = KanChaSheJi.FindAllByProperties(KanChaSheJi.Prop_ProjectId, pEnt.Id, KanChaSheJi.Prop_MajorName, eEnt.MajorName); //勘察设计人员 foreach (KanChaSheJi kEnt in kEnts) { if (!string.IsNullOrEmpty(kEnt.SealNo)) { ZhuCeUsers += kEnt.UserName; } else { SheJiUsers += kEnt.UserName; } } jo.Add("ExamineTaskId", eEnt.Id); jo.Add("ZiXunCode", pEnt.ZiXunCode); jo.Add("ProjectName", pEnt.ProjectName); jo.Add("ZhuCeUsers", ZhuCeUsers); jo.Add("SheJiUsers", SheJiUsers); jo.Add("MajorName", eEnt.MajorName); jo.Add("ShenChaUserId", eEnt.ProjectUserId); jo.Add("ShenChaUserName", puEnt.UserName); jo.Add("FuHeUserId", puEnt.ShenHeId); jo.Add("FuHeUserName", puEnt.ShenHeName); jo.Add("ShenChaOrganization", "江西瑞林工程咨询有限公司"); jo.Add("Id", eoEnt.Id); jo.Add("Stage", eoEnt.Stage); jo.Add("StartTime", eoEnt.StartTime.Value.ToString("yyyy-MM-dd")); jo.Add("EndTime", eoEnt.EndTime.Value.ToString("yyyy-MM-dd")); jo.Add("JiangZhuSheJi", eoEnt.JiangZhuSheJi); jo.Add("FangHuo", eoEnt.FangHuo); jo.Add("SheBei", eoEnt.SheBei); jo.Add("JiGouSheJi", eoEnt.JiGouSheJi); jo.Add("KangZhenSheJi", eoEnt.KangZhenSheJi); jo.Add("JiaGu", eoEnt.JiaGu); jo.Add("QiangTiao", eoEnt.QiangTiao); jo.Add("ExamineOpinions", eoEnt.ExamineOpinions); Response.Write("{success:true,formdata:" + JsonHelper.GetJsonString(jo) + "}"); Response.End(); break; case "saveopinion": ExamineOpinion oriEnt = ExamineOpinion.Find(id); eoEnt = JsonHelper.GetObject <ExamineOpinion>(Request["formdata"]); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(Request["formdata"]); oriEnt = DataHelper.MergeData <ExamineOpinion>(oriEnt, eoEnt, dic.Keys); oriEnt.DoUpdate(); Response.Write("{success:true}"); Response.End(); break; case "export_shenchajilu": try { eoEnt = ExamineOpinion.Find(id); eEnt = ExamineTask.Find(eoEnt.ExamineTaskId); pEnt = Project.Find(eEnt.ProjectId); Document srcDoc = new Document(templatepath + "审查记录表.doc"); BookmarkCollection marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { if (ContainProperty(eoEnt, marks[j].Name)) { marks[j].Text = eoEnt.GetValue(marks[j].Name) + ""; } } if (marks["StartYear"] != null) { marks["StartYear"].Text = eoEnt.StartTime.Value.Year + ""; } if (marks["StartMonth"] != null) { marks["StartMonth"].Text = eoEnt.StartTime.Value.Month + ""; } if (marks["StartDay"] != null) { marks["StartDay"].Text = eoEnt.StartTime.Value.Day + ""; } if (marks["EndYear"] != null) { marks["EndYear"].Text = eoEnt.EndTime.Value.Year + ""; } if (marks["EndMonth"] != null) { marks["EndMonth"].Text = eoEnt.EndTime.Value.Month + ""; } if (marks["EndDay"] != null) { marks["EndDay"].Text = eoEnt.EndTime.Value.Day + ""; } kEnts = KanChaSheJi.FindAllByProperties(KanChaSheJi.Prop_ProjectId, pEnt.Id, KanChaSheJi.Prop_MajorName, eEnt.MajorName); //勘察设计人员 foreach (KanChaSheJi kEnt in kEnts) { if (!string.IsNullOrEmpty(kEnt.SealNo)) { ZhuCeUsers += kEnt.UserName; } else { SheJiUsers += kEnt.UserName; } } if (marks["MajorName"] != null) { marks["MajorName"].Text = eEnt.MajorName; } if (marks["ZhuCeName"] != null) { marks["ZhuCeName"].Text = ZhuCeUsers; } if (marks["SheJiName"] != null) { marks["SheJiName"].Text = SheJiUsers; } if (marks["ZiXunCode"] != null) { marks["ZiXunCode"].Text = pEnt.ZiXunCode; } if (marks["ProjectName"] != null) { marks["ProjectName"].Text = pEnt.ProjectName; } string filename = pEnt.ProjectName.Replace("#", "") + "_审查记录表_" + eEnt.MajorName + "_" + eoEnt.Stage + ".doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(pEnt, filename); Response.Write("{success:true}"); Response.End(); } catch { Response.Write("{success:false}"); Response.End(); } break; case "delete": string ExamineOpinionId = Request["ExamineOpinionId"]; sql = " delete from NCRL_SP..ExamineOpinion where ID='" + ExamineOpinionId + "'"; DataHelper.ExecSql(sql); int ExamineOpinionCount = ExamineOpinion.FindAll().Where(S => S.ExamineTaskId == ExamineTaskId).Count(); Response.Write("{success:true,ExamineOpinionCount:" + ExamineOpinionCount + "}"); Response.End(); break; } }
private void EndExamine() { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { ExamineStageResult esrEnt = new ExamineStageResult(); esrEnt.ExamineStageId = esEnt.Id; esrEnt.UserId = beUserIdArray[i]; esrEnt.UserName = beUserNameArray[i]; string[] bedept = Utility.GetDeptInfo(beUserIdArray[i]); esrEnt.DeptId = bedept[0]; esrEnt.DeptName = bedept[1]; esrEnt.StageType = esEnt.StageType; esrEnt.Year = esEnt.Year; //分别计算上级 同级 下级评分 if (!string.IsNullOrEmpty(derEnt.UpLevelUserIds))//如果有上级考核人 { // IList<UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", derEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细 decimal subScore = 0; // if (ubEnts.Count > 0)//如果存在人员权重 // { // foreach (UserBalance ubEnt in ubEnts) // { // if (ubEnt.Balance > 0) // { // sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' // and BeUserId='{1}' and ToUserId ='{2}'"; // sql = string.Format(sql, esEnt.Id, beUserIdArray[i], ubEnt.ToUserId); // subScore += DataHelper.QueryValue<decimal>(sql) * (ubEnt.Balance.Value / 100); // } // } // } // else // { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.UpLevelUserIds); subScore = DataHelper.QueryValue <decimal>(sql); // } esrEnt.UpAvgScore = subScore; } if (!string.IsNullOrEmpty(derEnt.SameLevelUserIds))//如果有同级考核人 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.SameLevelUserIds); esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql); } if (!string.IsNullOrEmpty(derEnt.DownLevelUserIds))//如果有下级考核人 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.DownLevelUserIds); esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql); } decimal score = 0; //这里需要考虑一种特例就是 权重配好了 但可能没人给他打分 就是有权重 无分的现象 这个时候该权重不计入总权重 int upWeight = 0; int sameWeight = 0; int downWeight = 0; if (derEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0) { upWeight = derEnt.UpLevelWeight.Value; } if (derEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0) { sameWeight = derEnt.SameLevelWeight.Value; } if (derEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0) { downWeight = derEnt.DownLevelWeight.Value; } int totalWeight = upWeight + sameWeight + downWeight; if (upWeight > 0 && esrEnt.UpAvgScore > 0) { score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value; } if (sameWeight > 0 && esrEnt.SameAvgScore > 0) { score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value; } if (downWeight > 0 && esrEnt.DownAvgScore > 0) { score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value; } esrEnt.Score = score; esrEnt.SortIndex = i + 1; esrEnt.DoCreate(); } } IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id);//更改任务状态 foreach (ExamineTask etEnt in etEnts) { //0 表示已生成的任务 1 表示已启动的任务 可以打分 if (etEnt.State == "2") //提交的任务 { etEnt.State = "3"; //已结束的任务 } else { etEnt.State = "4";//已作废的任务 } etEnt.DoUpdate(); } if (esEnt.StageType == "4") { CaculateYearResult(); } esEnt.State = 3; // 0: '已创建', 1: '已生成', 2: '已启动', 3: '已结束' esEnt.DoUpdate(); PageState.Add("Result", "T"); }
private void DoSelect() { if (Index == "0") { sql = @"select * from BJKY_Examine..ExamineTask where State='1' and ExamineStageId='{0}' and ToUserId='{1}' and ExamineRelationId='{2}' order by BeDeptName,BeUserName "; sql = string.Format(sql, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (Index == "1") { sql = @"select * from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and ToUserId='{1}' and ExamineRelationId='{2}' order by BeDeptName,BeUserName"; sql = string.Format(sql, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (Index == "2") { sql = @"select * from BJKY_Examine..ExamineTask where State='3' and ExamineStageId='{0}' and ToUserId='{1}' and ExamineRelationId='{2}' order by BeDeptName,BeUserName"; sql = string.Format(sql, ExamineStageId, UserInfo.UserID, ExamineRelationId); } if (!string.IsNullOrEmpty(id))//单任务查看明细 { ExamineTask etEnt = ExamineTask.Find(id); ExamineStageId = etEnt.ExamineStageId; sql = @"select * from BJKY_Examine..ExamineTask where Id='" + id + "'"; } IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);//找到所有符合条件的任务 if (dics.Count > 0) { if (Index != "2") { DataTable dt = new DataTable(); DataColumn dc = new DataColumn("Id"); dt.Columns.Add(dc); dc = new DataColumn("BeUserName"); dt.Columns.Add(dc); dc = new DataColumn("BeDeptName"); dt.Columns.Add(dc); dc = new DataColumn("Score"); dt.Columns.Add(dc); dc = new DataColumn("Tag"); dt.Columns.Add(dc); DataTable dt1 = new DataTable();//这个表专门用来存储一级指标名称和各2级指标数量 DataColumn dc1 = new DataColumn("IndicatorFirstName"); dt1.Columns.Add(dc1); dc1 = new DataColumn("SecondCount"); dt1.Columns.Add(dc1); ExamineIndicator eiEnt = ExamineIndicator.Find(dics[0].Get <string>("ExamineIndicatorId")); IList <IndicatorFirst> ifEnts = IndicatorFirst.FindAllByProperty("SortIndex", IndicatorFirst.Prop_ExamineIndicatorId, eiEnt.Id); foreach (IndicatorFirst ifEnt in ifEnts) { IList <IndicatorSecond> isEnts = IndicatorSecond.FindAllByProperty("SortIndex", IndicatorSecond.Prop_IndicatorFirstId, ifEnt.Id); DataRow dr1 = dt1.NewRow(); dr1["IndicatorFirstName"] = ifEnt.IndicatorFirstName + "(" + ifEnt.MaxScore + ")"; dr1["SecondCount"] = isEnts.Count; if (isEnts.Count > 0) { dt1.Rows.Add(dr1);//防止只有一级指标无2级指标。 } foreach (IndicatorSecond isEnt in isEnts) { string standard = "!" + ifEnt.InsteadColumn + "#" + isEnt.ToolTip; //加入#号前面的字符是为了验证经营开发正职 部分要素分是由人力资源部打的 dc = new DataColumn(isEnt.Id + isEnt.IndicatorSecondName + "(" + isEnt.MaxScore + ")" + standard); //列名有多种信息组合而成。便于前台取对应的值 dt.Columns.Add(dc); //循环2级指标构建剩余列 } } IList <EasyDictionary> secDics = null; if (dics.Count > 0)//通过任务的指标Id找到其下所有 的二级指标 { sql = @"select A.Id, a.IndicatorSecondName,B.InsteadColumn,A.ToolTip,A.MaxScore from BJKY_Examine..IndicatorSecond A left join BJKY_Examine..IndicatorFirst B on A.IndicatorFirstId=B.Id where B.ExamineIndicatorid='{0}' " ; sql = string.Format(sql, dics[0].Get <string>("ExamineIndicatorId")); secDics = DataHelper.QueryDictList(sql); } foreach (EasyDictionary dic in dics)//通过任务构建行记录 { DataRow dr = dt.NewRow(); dr["Id"] = dic.Get <string>("Id"); dr["BeUserName"] = dic.Get <string>("BeUserName"); dr["BeDeptName"] = dic.Get <string>("BeDeptName"); dr["Score"] = dic.Get <string>("Score"); dr["Tag"] = dic.Get <string>("Tag"); foreach (EasyDictionary secDic in secDics) { string standard = "!" + secDic.Get <string>("InsteadColumn") + "#" + secDic.Get <string>("ToolTip"); IList <IndicatorScore> insEnts = IndicatorScore.FindAllByProperties(IndicatorScore.Prop_ExamineTaskId, dic.Get <string>("Id"), IndicatorScore.Prop_IndicatorSecondId, secDic.Get <string>("Id")); if (insEnts.Count > 0) { dr[secDic.Get <string>("Id") + secDic.Get <string>("IndicatorSecondName") + "(" + secDic.Get <string>("MaxScore") + ")" + standard] = insEnts[0].SubScore; } //if (standard.IndexOf("T") > 0) //{ // sql = @"select Top 1 Score from BJKY_Examine..ExamineTask where BeUserId='{0}' and ToUserId='D2564369-7FFE-45A5-8830-14EE3A8833F7'"; // sql = string.Format(sql, dic.Get<string>("BeUserId")); // dr[secDic.Get<string>("Id") + secDic.Get<string>("IndicatorSecondName") + "(" + secDic.Get<string>("MaxScore") + ")" + standard] = DataHelper.QueryValue<decimal>(sql); //} } dt.Rows.Add(dr); } PageState.Add("DataList", dt); PageState.Add("ColumnData", dt.Columns); PageState.Add("DataList1", dt1); } else { InitialHistoryScore(dics); } ExamineStage esEnt = ExamineStage.Find(ExamineStageId); string stageType = ""; if (esEnt.StageType != "4") { stageType = "第" + esEnt.StageType + "季度"; } else { stageType = "年度"; } PageState.Add("Title", esEnt.Year + stageType + "考核评分表"); } }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>"); Response.End(); } string templatepath = ConfigurationManager.AppSettings["TemplatePath"].ToString(); string action = Request["action"]; string id = Request["id"]; Document srcDoc = null; BookmarkCollection marks = null; IList <EasyDictionary> dics = null; string filename = ""; if (!string.IsNullOrEmpty(id)) { pEnt = Project.Find(id); } switch (action) { case "loadproject": string ProjectName = Request["ProjectName"]; if (!string.IsNullOrEmpty(ProjectName)) { where = "and ProjectName like '%" + ProjectName + "%' "; } sql = @"select * from NCRL_SP..Project where BelongCmp = 'ZX' " + where; dt = DataHelper.QueryDataTable(GetPageSql(sql)); Response.Write("{rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + ",total:" + totalProperty + "}"); Response.End(); break; case "delete": Delete(); break; case "Recycle": Recycle(); break; case "loadexportfile": sql = "select Id,Name,CreateTime from FileItem where ProjectId='" + id + "' and Path='导出' order by CreateTime asc"; dt = DataHelper.QueryDataTable(sql); Response.Write("{innerrows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}"); Response.End(); break; case "export_opinioncover": //意见封面 try { srcDoc = new Document(templatepath + "审查意见封面.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } filename = pEnt.ProjectName.Replace("#", "") + "_审查意见封面.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch { Response.Write("{success:false}"); } Response.End(); break; case "exporthegeshu": srcDoc = new Document(templatepath + "审查合格书_市政工程_房屋建筑.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } sql = @"select a.MajorName,(select top 1 SortIndex from SysEnumeration where ParentId='b640c40c-e2a9-41a8-bd28-d8ff9d71ff94' and Name=a.MajorName) as SortIndex from NCRL_SP..ProjectUser a where a.ProjectId='" + pEnt.Id + "' order by SortIndex asc"; dics = DataHelper.QueryDictList(sql); int i = 1; foreach (EasyDictionary dic in dics) { if (dic.Get <string>("MajorName") != "勘察") { if (marks["Major" + i] != null) { marks["Major" + i].Text = dic.Get <string>("MajorName"); } i++; } } filename = pEnt.ProjectName.Replace("#", "") + "_审查合格书.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); break; case "export_beiandengjibiao": try { srcDoc = new Document(templatepath + "附件10施工图设计文件审查备案登记表.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } if (marks["Layer"] != null) { marks["Layer"].Text = "地上层数:" + pEnt.UpperLayers + (string.IsNullOrEmpty(pEnt.DownLayers) ? "" : "地下层数:" + pEnt.DownLayers); } if (marks["KanChaIfBeiAn"] != null) { marks["KanChaIfBeiAn"].Text = string.IsNullOrEmpty(pEnt.KanChaUnitBeiAnNo) ? "否" : "是"; } if (marks["SheJiIfBeiAn"] != null) { marks["SheJiIfBeiAn"].Text = string.IsNullOrEmpty(pEnt.SheJiUnitBeiAnNo) ? "否" : "是"; } sql = @"select a.*,(select top 1 SortIndex from NCRL_Portal..SysEnumeration where Name=a.MajorName and ParentId='b640c40c-e2a9-41a8-bd28-d8ff9d71ff94') as SortIndex from NCRL_SP..KanChaSheJi a where a.ProjectId='" + pEnt.Id + "' order by SortIndex asc"; dics = DataHelper.QueryDictList(sql); //勘察设计人员 int index = 1; foreach (EasyDictionary dic in dics) { if (dic.Get <string>("Position") == "注册土木工程师(岩土)") { if (marks["ZhuCeYanTuName"] != null) { marks["ZhuCeYanTuName"].Text = dic.Get <string>("UserName"); } if (marks["ZhuCeYanTuSealNo"] != null) { marks["ZhuCeYanTuSealNo"].Text = dic.Get <string>("SealNo"); } if (marks["ZhuCeYanTuShenFenZheng"] != null) { marks["ZhuCeYanTuShenFenZheng"].Text = dic.Get <string>("ShenFenZhengNo"); } } else if (dic.Get <string>("Position") == "一级注册建筑师") { if (marks["ZhuCeJianZaoShiName"] != null) { marks["ZhuCeJianZaoShiName"].Text = dic.Get <string>("UserName"); } if (marks["ZhuCeJianZaoShiSealNo"] != null) { marks["ZhuCeJianZaoShiSealNo"].Text = dic.Get <string>("SealNo"); } if (marks["ZhuCeJianZaoShiShenFenZheng"] != null) { marks["ZhuCeJianZaoShiShenFenZheng"].Text = dic.Get <string>("ShenFenZhengNo"); } } else if (dic.Get <string>("Position") == "一级注册结构师") { if (marks["ZhuCeJieGouShiName"] != null) { marks["ZhuCeJieGouShiName"].Text = dic.Get <string>("UserName"); } if (marks["ZhuCeJieGouShiSealNo"] != null) { marks["ZhuCeJieGouShiSealNo"].Text = dic.Get <string>("SealNo"); } if (marks["ZhuCeJieGouShiShenFenZheng"] != null) { marks["ZhuCeJieGouShiShenFenZheng"].Text = dic.Get <string>("ShenFenZhengNo"); } } else { if (marks["SheJi_MajorName" + index] != null) { marks["SheJi_MajorName" + index].Text = dic.Get <string>("MajorName"); } if (marks["SheJi_UserName" + index] != null) { marks["SheJi_UserName" + index].Text = dic.Get <string>("UserName"); } index++; } } sql = @"select a.*,(select top 1 SortIndex from NCRL_Portal..SysEnumeration where Name=a.MajorName and ParentId='b640c40c-e2a9-41a8-bd28-d8ff9d71ff94') as SortIndex ,b.StampNo as QianZhangStampNo,c.StampNo as ShenHeStampNo from NCRL_SP..ProjectUser a left join NCRL_SP..Expert b on b.Id=a.QianZhangId left join NCRL_SP..Expert c on c.Id=a.ShenHeId where a.ProjectId='" + pEnt.Id + "' order by SortIndex asc"; dics = DataHelper.QueryDictList(sql); index = 1; foreach (EasyDictionary dic in dics) { if (marks["ShenTu_MajorName" + index] != null) { marks["ShenTu_MajorName" + index].Text = dic.Get <string>("MajorName"); } if (marks["ShenTu_UserName" + index] != null) { marks["ShenTu_UserName" + index].Text = dic.Get <string>("QianZhangName"); } if (marks["ShenTu_SealNo" + index] != null) { marks["ShenTu_SealNo" + index].Text = dic.Get <string>("QianZhangStampNo"); } if (marks["FuHe_UserName" + index] != null) { marks["FuHe_UserName" + index].Text = dic.Get <string>("ShenHeName"); } if (marks["FuHe_SealNo" + index] != null) { marks["FuHe_SealNo" + index].Text = dic.Get <string>("ShenHeStampNo"); } index++; } //写入备案登记表信息 IList <BeiAn_Project> bapEnts = BeiAn_Project.FindAllByProperty(BeiAn_Project.Prop_ProjectId, pEnt.Id); if (bapEnts.Count > 0) { for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty_Object(bapEnts[0], mark.Name)) { mark.Text = bapEnts[0].GetValue(mark.Name) + ""; } } } filename = pEnt.ProjectName.Replace("#", "") + "_审查备案登记表.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch { Response.Write("{success:false}"); } Response.End(); break; case "export_shenchabaogao": try { if (pEnt.ProjectType == "房屋建筑") { srcDoc = new Document(templatepath + "房屋建筑_审查报告.doc"); } if (pEnt.ProjectType == "市政工程") { srcDoc = new Document(templatepath + "市政工程_审查报告.doc"); } if (pEnt.ProjectType == "基坑支护") { srcDoc = new Document(templatepath + "基坑支护_审查报告.doc"); } marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } IList <ShenChaReport> scrEnts = ShenChaReport.FindAllByProperty(ShenChaReport.Prop_ProjectId, pEnt.Id); if (scrEnts.Count > 0) { for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty_Object(scrEnts[0], mark.Name)) { mark.Text = scrEnts[0].GetValue(mark.Name) + ""; } } } if (marks["Layer"] != null) { marks["Layer"].Text = "地上层数:" + pEnt.UpperLayers + (string.IsNullOrEmpty(pEnt.DownLayers) ? "" : "地下层数:" + pEnt.DownLayers); } if (marks["ProjectName1"] != null) { marks["ProjectName1"].Text = pEnt.ProjectName; } if (marks["JianSheUnit1"] != null) { marks["JianSheUnit1"].Text = pEnt.JianSheUnit; } filename = pEnt.ProjectName.Replace("#", "") + "_审查报告.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_kanchashenchabaogao": try { srcDoc = new Document(templatepath + "江西省工程勘察审查报告书.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } IList <ShenChaReport_KanCha> scrkEnts = ShenChaReport_KanCha.FindAllByProperty(ShenChaReport_KanCha.Prop_ProjectId, pEnt.Id); if (scrkEnts.Count > 0) { for (int j = 0; j < marks.Count; j++) { if (ContainProperty_Object(scrkEnts[0], marks[j].Name)) { marks[j].Text = scrkEnts[0].GetValue(marks[j].Name) + ""; } } } if (marks["ProjectName2"] != null) { marks["ProjectName2"].Text = pEnt.ProjectName; } if (marks["JianSheUnit2"] != null) { marks["JianSheUnit2"].Text = pEnt.JianSheUnit; } filename = pEnt.ProjectName.Replace("#", "") + "_工程勘察审查报告.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "exportqingkuangjilu": try { srcDoc = new Document(templatepath + "附件6房屋建筑和市政基础设施工程施工图设计文件审查情况记录.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } filename = pEnt.ProjectName.Replace("#", "") + "_审查情况记录.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_shenchahuizong": try { srcDoc = new Document(templatepath + "审查情况汇总.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { Bookmark mark = marks[j]; if (ContainProperty(pEnt, mark.Name)) { mark.Text = pEnt.GetValue(mark.Name) + ""; } } if (marks["ProjectType2"] != null) { marks["ProjectType2"].Text = pEnt.ProjectType; } if (marks["Layer"] != null) { marks["Layer"].Text = "地上层数:" + pEnt.UpperLayers + (string.IsNullOrEmpty(pEnt.DownLayers) ? "" : "地下层数:" + pEnt.DownLayers); } //找到项目人员 排除勘察专业的 sql = @"select a.*,(select top 1 SortIndex from NCRL_Portal..SysEnumeration where Name=a.MajorName and ParentId='b640c40c-e2a9-41a8-bd28-d8ff9d71ff94') as SortIndex from NCRL_SP..ProjectUser a where a.ProjectId='" + pEnt.Id + "' order by SortIndex asc"; dics = DataHelper.QueryDictList(sql); int index = 1; foreach (EasyDictionary dic in dics) { if (dic.Get <string>("MajorName") != "勘察") { if (marks["MajorName" + index] != null) { marks["MajorName" + index].Text = dic.Get <string>("MajorName"); } if (marks["QianZhangName" + index] != null) { marks["QianZhangName" + index].Text = dic.Get <string>("QianZhangName"); } index++; } } sql = @"select isnull(sum(QiangTiao),0) from NCRL_SP..ExamineOpinion where ExamineTaskId in ( select Id from NCRL_SP..ExamineTask where ProjectId='" + pEnt.Id + "')"; if (marks["QiangTiao"] != null) { marks["QiangTiao"].Text = DataHelper.QueryValue(sql) + ""; } filename = pEnt.ProjectName.Replace("#", "") + "_审查情况汇总.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_shenchahuizong_kancha": //审查情况汇总表_工程勘察 try { srcDoc = new Document(templatepath + "审查情况汇总表_工程勘察.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { if (ContainProperty(pEnt, marks[j].Name)) { marks[j].Text = pEnt.GetValue(marks[j].Name) + ""; } } if (marks["QianZhangName"] != null) //找到勘察专业的签章专家 { IList <ProjectUser> puEnts = ProjectUser.FindAllByProperties(ProjectUser.Prop_ProjectId, pEnt.Id, ProjectUser.Prop_MajorName, "勘察"); if (puEnts.Count > 0) { marks["QianZhangName"].Text = puEnts[0].QianZhangName; } } if (marks["QiangTiao"] != null) //找到勘察专业的强条 { IList <ExamineTask> etEnts = ExamineTask.FindAllByProperties(ExamineTask.Prop_MajorName, "勘察", ExamineTask.Prop_ProjectId, pEnt.Id); if (etEnts.Count > 0) { sql = "select isnull(sum(QiangTiao),0) from NCRL_SP..ExamineOpinion where ExamineTaskId='" + etEnts[0].Id + "'"; marks["QiangTiao"].Text = DataHelper.QueryValue <Int32>(sql) + ""; } } filename = pEnt.ProjectName.Replace("#", "") + "_工程勘察审查情况汇总表.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_kangzhen": try { srcDoc = new Document(templatepath + "抗震设防监管表.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { if (ContainProperty(pEnt, marks[j].Name)) { marks[j].Text = pEnt.GetValue(marks[j].Name) + ""; } } IList <KangZhen_Project> kzpEnts = KangZhen_Project.FindAllByProperty(KangZhen_Project.Prop_ProjectId, pEnt.Id); if (kzpEnts.Count > 0) { for (int j = 0; j < marks.Count; j++) { if (ContainProperty_Object(kzpEnts[0], marks[j].Name)) { marks[j].Text = kzpEnts[0].GetValue <string>(marks[j].Name); } } } if (pEnt.Property == "新建" && marks["XinJian"] != null) { marks["XinJian"].Text = "√"; } if (pEnt.Property == "改建" && marks["GaiJian"] != null) { marks["GaiJian"].Text = "√"; } if (pEnt.Property == "扩建" && marks["KuoJian"] != null) { marks["KuoJian"].Text = "√"; } filename = pEnt.ProjectName.Replace("#", "") + "_抗震设防专项审查监管表.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_zhongshenyijianbiao": try { srcDoc = new Document(templatepath + "附件5_终审意见表.doc"); marks = srcDoc.Range.Bookmarks; for (int j = 0; j < marks.Count; j++) { if (ContainProperty(pEnt, marks[j].Name)) { marks[j].Text = pEnt.GetValue(marks[j].Name) + ""; } } IList <ZhongShenOpinion_Project> zsopEnts = ZhongShenOpinion_Project.FindAllByProperty(ZhongShenOpinion_Project.Prop_ProjectId, pEnt.Id); if (zsopEnts.Count > 0) { for (int j = 0; j < marks.Count; j++) { if (ContainProperty_Object(zsopEnts[0], marks[j].Name)) { marks[j].Text = zsopEnts[0].GetValue(marks[j].Name) + ""; } } } filename = pEnt.ProjectName.Replace("#", "") + "_终审意见表.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; case "export_subproject": //导出子项 try { srcDoc = new Document(templatepath + "子项目明细表.doc"); marks = srcDoc.Range.Bookmarks; IList <SubProject> suEnts = SubProject.FindAllByProperty(SubProject.Prop_ProjectId, pEnt.Id); for (int j = 0; j < suEnts.Count; j++) { foreach (PropertyInfo pi in SubProject.AllProperties) { if (marks[pi.Name + (j + 1)] != null) { marks[pi.Name + (j + 1)].Text = suEnts[j].GetValue(pi.Name) + ""; } } } if (marks["ProjectName"] != null) { marks["ProjectName"].Text = pEnt.ProjectName; } filename = pEnt.ProjectName.Replace("#", "") + "_子项目明细表.doc"; srcDoc.Save(@"D:\RW\Files\AppFiles\Portal\Default\" + filename); UpdateFileItem(filename); Response.Write("{success:true}"); } catch (Exception ex) { Response.Write("{success:false}"); } Response.End(); break; } }
private void CreateTask(string beUserIds, string beUserNames, string beDeptIds, string beDeptNames, ExamineStageDetail esdEnt, string toRoleCode, string toRoleName) { string toUserIds = ""; string toUserNames = ""; string toDeptIds = ""; string toDeptNames = ""; string sql = ""; string[] array = null; DataTable dt = new DataTable(); IList <PersonConfig> pcEnts = null; switch (toRoleCode) //对所有的考核对象进行判断 确定参与考核打分的人员 { case "DirectorSecretary": //院长书记 case "DeputyDirector": //副院长 case "EnterpriseDirector": //如果上级里面有控股企业董事长和监事长 case "EnterpriseDeputyDirector": pcEnts = PersonConfig.FindAllByProperty(PersonConfig.Prop_GroupCode, toRoleCode); if (pcEnts.Count > 0) { if (!string.IsNullOrEmpty(pcEnts[0].ClerkIds)) { toUserIds = pcEnts[0].ClerkIds; toUserNames = pcEnts[0].ClerkNames; toDeptIds = pcEnts[0].ClerkGroupIds; toDeptNames = pcEnts[0].ClerkGroupNames; } } break; case "ExcutiveDeptLeader": //职能服务部门正职 sql = @"select FirstLeaderIds as UserIds,FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "BusinessDeptLeader": //经营目标单位正职 sql = @"select FirstLeaderIds as UserIds, FirstLeaderNames as UserNames,FirstLeaderGroupIds as DeptIds,FirstLeaderGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "ExcutiveDeptClerkDelegate": //职能部门员工代表 sql = @"select InstituteClerkDelegateIds as UserIds,InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='职能服务部门' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; case "BusinessDeptClerkDelegate": //经营单位员工代表 sql = @"select InstituteClerkDelegateIds as UserIds, InstituteClerkDelegateNames as UserNames,InstituteClerkDelegateGroupIds as DeptIds,InstituteClerkDelegateGroupNames as DeptNames from BJKY_Examine..PersonConfig where GroupType='经营目标单位' and Id in (select GroupID from BJKY_Examine..ExamineStageDeptDetail where ExamineStageId='" + esEnt.Id + "')"; array = GetUserIdAndName(DataHelper.QueryDictList(sql)); toUserIds = array[0]; toUserNames = array[1]; toDeptIds = array[2]; toDeptNames = array[3]; break; } string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { }; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; string[] toDeptIdArray = new string[] { }; string[] toDeptNameArray = new string[] { }; if (!string.IsNullOrEmpty(beUserIds)) { beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beUserNames)) { beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptIds)) { beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptNames)) { beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toUserNames)) { toUserNameArray = toUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toDeptIds)) { toDeptIdArray = toDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(toDeptNames)) { toDeptNameArray = toDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } #region for (int i = 0; i < beUserIdArray.Length; i++) { for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j])//防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); etEnt.ExamineStageId = esEnt.Id; etEnt.BeRoleCode = esdEnt.BeRoleCode; etEnt.BeRoleName = esdEnt.BeRoleName; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; if (i <= beDeptIdArray.Length - 1) { etEnt.BeDeptId = beDeptIdArray[i]; } if (i <= beDeptNameArray.Length - 1) { etEnt.BeDeptName = beDeptNameArray[i]; } etEnt.ToRoleCode = toRoleCode; etEnt.ToRoleName = toRoleName; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; etEnt.ToDeptId = toDeptIdArray[j]; etEnt.ToDeptName = toDeptNameArray[j]; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } #endregion }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); if (!string.IsNullOrEmpty(id)) { esEnt = ExamineStage.Find(id); } switch (RequestActionString) { case "UpdatePathLevel": IList <SysGroup> sgEnts = SysGroup.FindAll(); foreach (SysGroup sgEnt in sgEnts) { if (!string.IsNullOrEmpty(sgEnt.Path)) { string[] array = sgEnt.Path.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); sgEnt.PathLevel = array.Length; sgEnt.DoUpdate(); } } break; case "CreateTask": esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); bool allowStart = true; //确认考核对象 考核关系 考核指标 配置是否齐全 if (esdEnts.Count == 0) { allowStart = false; } else { foreach (ExamineStageDetail esdEnt in esdEnts) { if (string.IsNullOrEmpty(esdEnt.ExamineRelationId) || string.IsNullOrEmpty(esdEnt.ExamineIndicatorId)) { allowStart = false; break; } } } if (allowStart) { CreateTask(); //生成考核任务 esEnt.State = 1; //更新考核阶段状态为 etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); esEnt.TaskQuan = etEnts.Count; esEnt.DoUpdate(); PageState.Add("Result", "考核任务生成成功!"); } else { PageState.Add("Result", "考核任务生成失败!请检查考核对象、考核关系、考核指标是否配置完整!"); } break; case "TakeBack": etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, id); foreach (ExamineTask etEnt in etEnts) { etEnt.DoDelete(); } //删除所有的自定义指标 sql = "delete BJKY_Examine..CustomIndicator where ExamineStageId='" + id + "'"; DataHelper.ExecSql(sql); esEnt.State = 0; esEnt.TaskQuan = 0; esEnt.DoUpdate(); PageState.Add("Result", "T"); break; case "JudgeCustomIndicator": if (esEnt.ExamineType == "部门级考核") { sql = @"select A.* from BJKY_Examine..DeptExamineRelation as A left join BJKY_Examine..ExamineStageDetail as B on A.Id=B.ExamineRelationId where B.ExamineStageId='" + esEnt.Id + "'";//找到部门考核关系里面的所有被考核人 查找他们的自定义指标 IList <EasyDictionary> dicsRelation = DataHelper.QueryDictList(sql); string beUserIds = ""; string beUserNames = ""; foreach (EasyDictionary dic in dicsRelation) { beUserIds += dic.Get <string>("BeUserIds") + ","; beUserNames += dic.Get <string>("BeUserNames") + ","; } string[] userIdArray = null; if (!string.IsNullOrEmpty(beUserIds)) { userIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } bool allowLaunch = true; for (int i = 0; i < userIdArray.Length; i++) { IList <CustomIndicator> ciEnts = CustomIndicator.FindAllByProperties("CreateId", userIdArray[i], "Year", esEnt.Year, "StageType", esEnt.StageType, "Result", "同意"); if (ciEnts.Count == 0) { allowLaunch = false; break; } } PageState.Add("Result", allowLaunch == true ? "T" : "F"); } else { PageState.Add("Result", "T"); } break; case "Launch": //生成考核任务 LaunchExamine(); break; case "CancelLaunch": CancelLaunch(); break; case "EndExamine": EndExamine(); break; case "delete": IList <ExamineStageDeptDetail> esddEnts = ExamineStageDeptDetail.FindAllByProperty(ExamineStageDeptDetail.Prop_ExamineStageId, id); foreach (ExamineStageDeptDetail esddEnt in esddEnts) { esddEnt.DoDelete(); } esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); foreach (ExamineStageDetail esdEnt in esdEnts) { esdEnt.DoDelete(); } esEnt.DoDelete(); break; default: DoSelect(); break; } }
private void EndExamine() { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, id); #region 院级考核算分 if (esEnt.ExamineType == "院级考核") { string beUserIds = string.Empty;//存储被考核对象具体的人 string beUserNames = string.Empty; string beDeptIds = string.Empty; string beDeptNames = string.Empty; foreach (ExamineStageDetail esdEnt in esdEnts)//循环考核对象 { string[] array = GetBeUsersInfo(esdEnt); beUserIds = array[0]; beUserNames = array[1]; beDeptIds = array[2]; beDeptNames = array[3]; //人+部门+被考核对象CODE就可以找到这个其下所有的任务 不能单纯按人查。因为有特例。一个人在在多个部门任职 string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; string[] beDeptIdArray = new string[] { }; string[] beDeptNameArray = new string[] { }; if (!string.IsNullOrEmpty(beUserIds))//防止部分角色下无人 { beUserIdArray = beUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beUserNames)) { beUserNameArray = beUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptIds)) { beDeptIdArray = beDeptIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } if (!string.IsNullOrEmpty(beDeptNames)) { beDeptNameArray = beDeptNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } ExamineRelation erEnt = ExamineRelation.Find(esdEnt.ExamineRelationId); string UpLevelCode = ""; string SameLevelCode = ""; string DownLevelCode = ""; if (!string.IsNullOrEmpty(erEnt.UpLevelCode)) { string[] upArray = erEnt.UpLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int n = 0; n < upArray.Length; n++) { if (n != upArray.Length - 1) { UpLevelCode += "'" + upArray[n] + "',"; } else { UpLevelCode += "'" + upArray[n] + "'"; } } } if (!string.IsNullOrEmpty(erEnt.SameLevelCode)) { string[] sameArray = erEnt.SameLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int n = 0; n < sameArray.Length; n++) { if (n != sameArray.Length - 1) { SameLevelCode += "'" + sameArray[n] + "',"; } else { SameLevelCode += "'" + sameArray[n] + "'"; } } } if (!string.IsNullOrEmpty(erEnt.DownLevelCode)) { string[] downArray = erEnt.DownLevelCode.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int n = 0; n < downArray.Length; n++) { if (n != downArray.Length - 1) { DownLevelCode += "'" + downArray[n] + "',"; } else { DownLevelCode += "'" + downArray[n] + "'"; } } } #region 开始计算个人成绩 for (int i = 0; i < beUserIdArray.Length; i++) { ExamineStageResult esrEnt = new ExamineStageResult(); esrEnt.ExamineStageId = esEnt.Id; esrEnt.BeRoleCode = esdEnt.BeRoleCode; esrEnt.BeRoleName = esdEnt.BeRoleName; esrEnt.UserId = beUserIdArray[i]; esrEnt.UserName = beUserNameArray[i]; esrEnt.DeptId = beDeptIdArray[i]; esrEnt.DeptName = beDeptNameArray[i]; esrEnt.StageType = esEnt.StageType; esrEnt.Year = esEnt.Year; //分别计算上级 同级 下级评分 decimal tempScore = 0; string subBalanceUserIds = ""; int subBalanceWeightTotal = 0; if (esdEnt.BeRoleCode == "BeBusinessDeptLeader")//经营目标单位正职 (有一部分特殊任务) 需要计算特殊分 Tag='1' { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and Tag='1'"; sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]); tempScore = DataHelper.QueryValue <decimal>(sql); } if (!string.IsNullOrEmpty(UpLevelCode))//如果有上级考核对象 { //因为考核关系有时候需要把级别权重拆分到人分权重 不能单独取所有上级的平均分 //20130430 已更新到如下代码 IList <UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", erEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细 foreach (UserBalance ubEnt in ubEnts) { if (ubEnt.Balance > 0) { subBalanceUserIds += ubEnt.ToUserId + ","; subBalanceWeightTotal += ubEnt.Balance.Value; } } decimal subScore = 0; if (subBalanceWeightTotal < 100) //如果人员权重没有将100的总权重分配完 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + UpLevelCode + ") and PatIndex('%ToUserId%','{4}')= 0"; //去掉已分配人员权重的人 sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], subBalanceUserIds); if (DataHelper.QueryValue <decimal>(sql) > 0) { foreach (UserBalance ubEnt in ubEnts) { if (ubEnt.Balance > 0) { sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and ToUserId='{4}'"; sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], ubEnt.ToUserId); subScore += DataHelper.QueryValue <decimal>(sql) * (ubEnt.Balance.Value / 100); } } esrEnt.UpAvgScore = subScore + (DataHelper.QueryValue <decimal>(sql) * (100 - subBalanceWeightTotal) / 100) + tempScore; } else //如果没有其他的分数,但权重又没有分配完 { foreach (UserBalance ubEnt in ubEnts) { if (ubEnt.Balance > 0) { sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and ToUserId='{4}'"; sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i], ubEnt.ToUserId); subScore += DataHelper.QueryValue <decimal>(sql) * (ubEnt.Balance.Value / subBalanceWeightTotal); } } esrEnt.UpAvgScore = subScore + tempScore; } } else//如果人员权重已经满100,这个时候不计算已打分但未分配子权重的人员提交的考核任务 { esrEnt.UpAvgScore = subScore + tempScore; } } if (!string.IsNullOrEmpty(SameLevelCode))//如果有同级考核对象 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + SameLevelCode + ")"; sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]); esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql) + tempScore; } if (!string.IsNullOrEmpty(DownLevelCode))//如果有下级考核对象 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeRoleCode='{1}' and BeDeptId='{2}' and BeUserId='{3}' and ToRoleCode in (" + DownLevelCode + ")"; sql = string.Format(sql, esEnt.Id, esdEnt.BeRoleCode, beDeptIdArray[i], beUserIdArray[i]); esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql) + tempScore; } decimal score = 0; //这里需要考虑一种特例就是 权重配好了 但可能没人给他打分 就是有权重 无分的现象 这个时候该权重不计入总权重 int upWeight = 0; int sameWeight = 0; int downWeight = 0; if (erEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0) { upWeight = erEnt.UpLevelWeight.Value; } if (erEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0) { sameWeight = erEnt.SameLevelWeight.Value; } if (erEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0) { downWeight = erEnt.DownLevelWeight.Value; } int totalWeight = upWeight + sameWeight + downWeight; if (upWeight > 0 && esrEnt.UpAvgScore > 0) { score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value; } if (sameWeight > 0 && esrEnt.SameAvgScore > 0) { score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value; } if (downWeight > 0 && esrEnt.DownAvgScore > 0) { score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value; } esrEnt.Score = score; esrEnt.SortIndex = i + 1; esrEnt.DoCreate(); } #endregion } } #endregion #region 部门级考核 else //部门级考核关联的是部门级考核关系 { foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { ExamineStageResult esrEnt = new ExamineStageResult(); esrEnt.ExamineStageId = esEnt.Id; esrEnt.UserId = beUserIdArray[i]; esrEnt.UserName = beUserNameArray[i]; esrEnt.DeptId = esEnt.LaunchDeptId; esrEnt.DeptName = esEnt.LaunchDeptName; esrEnt.StageType = esEnt.StageType; esrEnt.Year = esEnt.Year; //分别计算上级 同级 下级评分 if (!string.IsNullOrEmpty(derEnt.UpLevelUserIds))//如果有上级考核人 { // IList<UserBalance> ubEnts = UserBalance.FindAllByProperties("ExamineRelationId", derEnt.Id, "ToRoleCode", "UpLevel");//该考核关系下 上级考核的人员权重明细 decimal subScore = 0; // if (ubEnts.Count > 0)//如果存在人员权重 // { // foreach (UserBalance ubEnt in ubEnts) // { // if (ubEnt.Balance > 0) // { // sql = @"select top 1 Score from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' // and BeUserId='{1}' and ToUserId ='{2}'"; // sql = string.Format(sql, esEnt.Id, beUserIdArray[i], ubEnt.ToUserId); // subScore += DataHelper.QueryValue<decimal>(sql) * (ubEnt.Balance.Value / 100); // } // } // } // else // { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.UpLevelUserIds); subScore = DataHelper.QueryValue <decimal>(sql); // } esrEnt.UpAvgScore = subScore; } if (!string.IsNullOrEmpty(derEnt.SameLevelUserIds))//如果有同级考核人 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.SameLevelUserIds); esrEnt.SameAvgScore = DataHelper.QueryValue <decimal>(sql); } if (!string.IsNullOrEmpty(derEnt.DownLevelUserIds))//如果有下级考核人 { sql = @"select avg(isnull(Score,0)) from BJKY_Examine..ExamineTask where State='2' and ExamineStageId='{0}' and BeUserId='{1}' and PatIndex('%'+ToUserId+'%','{2}')>0"; sql = string.Format(sql, esEnt.Id, beUserIdArray[i], derEnt.DownLevelUserIds); esrEnt.DownAvgScore = DataHelper.QueryValue <decimal>(sql); } decimal score = 0; //这里需要考虑一种特例就是 权重配好了 但可能没人给他打分 就是有权重 无分的现象 这个时候该权重不计入总权重 int upWeight = 0; int sameWeight = 0; int downWeight = 0; if (derEnt.UpLevelWeight > 0 && esrEnt.UpAvgScore > 0) { upWeight = derEnt.UpLevelWeight.Value; } if (derEnt.SameLevelWeight > 0 && esrEnt.SameAvgScore > 0) { sameWeight = derEnt.SameLevelWeight.Value; } if (derEnt.DownLevelWeight > 0 && esrEnt.DownAvgScore > 0) { downWeight = derEnt.DownLevelWeight.Value; } int totalWeight = upWeight + sameWeight + downWeight; if (upWeight > 0 && esrEnt.UpAvgScore > 0) { score += (((decimal)upWeight / (decimal)totalWeight) * esrEnt.UpAvgScore).Value; } if (sameWeight > 0 && esrEnt.SameAvgScore > 0) { score += (((decimal)sameWeight / (decimal)totalWeight) * esrEnt.SameAvgScore).Value; } if (downWeight > 0 && esrEnt.DownAvgScore > 0) { score += (((decimal)downWeight / (decimal)totalWeight) * esrEnt.DownAvgScore).Value; } esrEnt.Score = score; esrEnt.SortIndex = i + 1; esrEnt.DoCreate(); } } } #endregion IList <ExamineTask> etEnts = ExamineTask.FindAllByProperty(ExamineTask.Prop_ExamineStageId, esEnt.Id); //更改任务状态 foreach (ExamineTask etEnt in etEnts) { //0 表示已生成的任务 1 表示已启动的任务 可以打分 if (etEnt.State == "2") //提交的任务 { etEnt.State = "3"; //已结束的任务 } else { etEnt.State = "4";//已作废的任务 } etEnt.DoUpdate(); } if (esEnt.StageType == "4") { CaculateYearResult(); } esEnt.State = 3; // 0: '已创建', 1: '已生成', 2: '已启动', 3: '已结束' esEnt.DoUpdate(); PageState.Add("Result", "T"); }
private void DoSelect() { sql = @"select A.Id,A.PersonFirstIndicatorId, A.PersonSecondIndicatorName,A.Weight,A.SortIndex, A.ToolTip,A.SelfRemark, B.IndicatorType,B.PersonFirstIndicatorName, B.Weight as FirstWeight, B.SortIndex as FirstIndex ,C.Summary, (select top 1 CustomScore from BJKY_Examine..CustomFirstIndicatorScore where ExamineTaskId='{5}' and PersonFirstIndicatorId=B.Id) as Score from BJKY_Examine..PersonSecondIndicator as A left join BJKY_Examine..PersonFirstIndicator as B on A.PersonFirstIndicatorId=B.Id left join BJKY_Examine..CustomIndicator as C on B.CustomIndicatorId=C.Id where C.CreateId='{0}' and C.Year='{1}' and C.StageType='{2}' and C.DeptId='{3}' and C.IndicatorSecondId='{4}' and C.Result='同意' order by B.IndicatorType desc ,B.Id asc,A.SortIndex asc"; ExamineTask etEnt = ExamineTask.Find(ExamineTaskId); ExamineStage esEnt = ExamineStage.Find(etEnt.ExamineStageId); sql = string.Format(sql, etEnt.BeUserId, esEnt.Year, esEnt.StageType, esEnt.LaunchDeptId, IndicatorSecondId, ExamineTaskId); IList <EasyDictionary> dics0 = DataHelper.QueryDictList(sql); IList <EasyDictionary> dics1 = new List <EasyDictionary>(); string temp = ""; foreach (EasyDictionary dic0 in dics0) { EasyDictionary dic1 = new EasyDictionary(); if (temp != dic0.Get <string>("PersonFirstIndicatorId")) { temp = dic0.Get <string>("PersonFirstIndicatorId"); dic1.Add("PersonFirstIndicatorId", dic0.Get <string>("PersonFirstIndicatorId")); dic1.Add("IndicatorType", dic0.Get <string>("IndicatorType")); dic1.Add("PersonFirstIndicatorName", dic0.Get <string>("PersonFirstIndicatorName")); dic1.Add("FirstWeight", dic0.Get <string>("FirstWeight")); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", dic0.Get <string>("Score")); dic1.Add("Summary", dic0.Get <string>("Summary")); } else { dic1.Add("PersonFirstIndicatorId", ""); dic1.Add("IndicatorType", ""); dic1.Add("PersonFirstIndicatorName", ""); dic1.Add("FirstWeight", ""); dic1.Add("Id", dic0.Get <string>("Id")); dic1.Add("PersonSecondIndicatorName", dic0.Get <string>("PersonSecondIndicatorName")); dic1.Add("Weight", dic0.Get <string>("Weight")); dic1.Add("ToolTip", dic0.Get <string>("ToolTip")); dic1.Add("SelfRemark", dic0.Get <string>("SelfRemark")); dic1.Add("Score", ""); dic1.Add("Summary", dic0.Get <string>("Summary")); } dics1.Add(dic1); } PageState.Add("DataList", dics1); IndicatorSecond isEnt = IndicatorSecond.Find(IndicatorSecondId); var obj = new { DeptName = etEnt.BeDeptName, IndicatorSecondName = isEnt.IndicatorSecondName, MaxScore = isEnt.MaxScore, BeUserName = etEnt.BeUserName }; PageState.Add("BaseInfo", obj); }
private void CreateExamineTask() // { IList <ExamineStageDetail> esdEnts = ExamineStageDetail.FindAllByProperty(ExamineStageDetail.Prop_ExamineStageId, esEnt.Id); //if (esEnt.ExamineType == "院级考核") //{ // foreach (ExamineStageDetail esdEnt in esdEnts) // { // string beUserIds = string.Empty;//存储被考核对象具体的人 // string beUserNames = string.Empty; // string beDeptIds = string.Empty; // string beDeptNames = string.Empty; // string[] array = GetBeUsersInfo(esdEnt); // beUserIds = array[0]; // beUserNames = array[1]; // beDeptIds = array[2]; // beDeptNames = array[3]; // ExamineRelation erEnt = ExamineRelation.Find(esdEnt.ExamineRelationId); // ConfirmPara(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt, erEnt); // CreateSpecialTask(beUserIds, beUserNames, beDeptIds, beDeptNames, esdEnt); // } //} //else//部门级考核 //{ foreach (ExamineStageDetail esdEnt in esdEnts) { DeptExamineRelation derEnt = DeptExamineRelation.Find(esdEnt.ExamineRelationId); string[] beUserIdArray = new string[] { }; string[] beUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(derEnt.BeUserIds)) { beUserIdArray = derEnt.BeUserIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); beUserNameArray = derEnt.BeUserNames.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } string toUserIds = derEnt.UpLevelUserIds + "," + derEnt.SameLevelUserIds + "," + derEnt.DownLevelUserIds; string toUserNames = derEnt.UpLevelUserNames + "," + derEnt.SameLevelUserNames + "," + derEnt.DownLevelUserNames; string[] toUserIdArray = new string[] { }; string[] toUserNameArray = new string[] { }; if (!string.IsNullOrEmpty(toUserIds)) { toUserIdArray = toUserIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); toUserNameArray = toUserNames.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); } for (int i = 0; i < beUserIdArray.Length; i++) { //2013-12-5追加功能 生成考核任务的时候针对每一个考核对象,自动创建本阶段考核的自定义考核指标 CreateCustomIndicator(beUserIdArray[i], beUserNameArray[i], esEnt, esdEnt); for (int j = 0; j < toUserIdArray.Length; j++) { if (beUserIdArray[i] != toUserIdArray[j]) //防止一个人身兼两职。自己对自己不能打分 { ExamineTask etEnt = new ExamineTask(); //部门级考核不存在角色的概念。直接对人生成任务 etEnt.ExamineStageId = esEnt.Id; etEnt.BeUserId = beUserIdArray[i]; etEnt.BeUserName = beUserNameArray[i]; etEnt.BeDeptId = esEnt.LaunchDeptId; etEnt.BeDeptName = esEnt.LaunchDeptName; etEnt.ToUserId = toUserIdArray[j]; etEnt.ToUserName = toUserNameArray[j]; etEnt.ToDeptId = esEnt.LaunchDeptId; etEnt.ToDeptName = esEnt.LaunchDeptName; etEnt.ExamineRelationId = esdEnt.ExamineRelationId; etEnt.ExamineIndicatorId = esdEnt.ExamineIndicatorId; etEnt.State = "0"; etEnt.DoCreate(); } } } // } } }