public override void Finish(TaskWorkStatus status, TaskWork task) { using (var scope = new TransactionScope()) { switch (status) { case TaskWorkStatus.K2ProcessApproved: ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_Approve, ProjectStatus.Finished); //ProjectInfo.UpdateProjectStatus(this.ProjectId, FlowCode.Closure_WOCheckList, ProjectStatus.Finished); //如果是从ClosurePackage Edit之后撤回Task的,添加ClosurePackage的Task if (TaskWork.Count(i => i.RefID == task.RefID && i.TypeCode == FlowCode.Closure_ClosurePackage && i.Status == TaskWorkStatus.Cancel) > 0) { if (ProjectInfo.Any(e => e.ProjectId == task.RefID && e.Status == ProjectStatus.Finished && e.FlowCode == FlowCode.Closure_LegalReview)) { var package = new ClosurePackage(); package.GeneratePackageTask(task.RefID); } } //如果是从ExecutiveSummary Edit之后撤回Task的,添加ExecutiveSummary的Task else if (TaskWork.Count(i => i.RefID == task.RefID && i.TypeCode == FlowCode.Closure_ExecutiveSummary && i.Status == TaskWorkStatus.Cancel) > 0) { var executiveSummary = new ClosureExecutiveSummary(); executiveSummary.GenerateExecutiveSummaryTask(task.RefID); } break; } scope.Complete(); } }
public override void Finish(TaskWorkStatus status, TaskWork task) { using (var scope = new TransactionScope()) { switch (status) { case TaskWorkStatus.K2ProcessApproved: //ClosureTool的最后一步在K2中,但不属于审批 task.ActionName = ""; task.Update(); ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_ClosureTool, NodeCode.Closure_ClosureTool_Generate, ProjectStatus.Finished); if (!ClosureExecutiveSummary.Any(i => i.ProjectId == this.ProjectId && i.IsHistory == false)) { var esEntity = new ClosureExecutiveSummary(); esEntity.ProjectId = this.ProjectId; esEntity.Id = Guid.NewGuid(); esEntity.CreateTime = DateTime.Now; esEntity.CreatorAccount = ClientCookie.UserCode; ClosureExecutiveSummary.Add(esEntity); } break; } scope.Complete(); } }
/// <summary> /// Edit准备 /// </summary> /// <param name="projectId"></param> /// <returns></returns> public bool PreEdit(string projectId) { //如果流程已经到了ClosurePackage审批环节就不能Edit if (ProjectInfo.IsFlowStarted(projectId, FlowCode.Closure_ClosurePackage)) { return(false); } else { #region ExecutiveSummary撤回 var needWidthDraw = TaskWork.Count(i => i.TypeCode == FlowCode.Closure_ExecutiveSummary && i.RefID == projectId && i.Status == TaskWorkStatus.UnFinish) > 0; if (needWidthDraw) { //任务取消 var taskList = TaskWork.Search(i => i.TypeCode == FlowCode.Closure_ExecutiveSummary && i.RefID == projectId && i.Status != TaskWorkStatus.Cancel).ToArray(); foreach (var taskItem in taskList) { taskItem.Status = TaskWorkStatus.Cancel; } if (taskList.Length > 0) { TaskWork.Update(taskList); } //ExecutiveSummary数据isHistory置成true var executiveSummary = ClosureExecutiveSummary.Search(i => i.ProjectId == projectId && i.IsHistory == false).ToArray(); foreach (var exItem in executiveSummary) { exItem.IsHistory = true; exItem.LastUpdateTime = DateTime.Now; exItem.LastUpdateUserAccount = ClientCookie.UserCode; exItem.LastUpdateUserNameENUS = ClientCookie.UserNameENUS; exItem.LastUpdateUserNameZHCN = ClientCookie.UserNameZHCN; } if (executiveSummary.Length > 0) { ClosureExecutiveSummary.Update(executiveSummary); } } #endregion #region Package撤回 needWidthDraw = TaskWork.Count(i => i.TypeCode == FlowCode.Closure_ClosurePackage && i.RefID == projectId && i.Status == TaskWorkStatus.UnFinish) > 0; if (needWidthDraw) { //任务取消 var taskList = TaskWork.Search(i => i.TypeCode == FlowCode.Closure_ClosurePackage && i.RefID == projectId && i.Status != TaskWorkStatus.Cancel).ToArray(); foreach (var taskItem in taskList) { taskItem.Status = TaskWorkStatus.Cancel; } if (taskList.Length > 0) { TaskWork.Update(taskList); } //Package数据isHistory置成true var package = ClosurePackage.Search(i => i.ProjectId == projectId && i.IsHistory == false).ToArray(); foreach (var pacItem in package) { pacItem.IsHistory = true; pacItem.LastUpdateTime = DateTime.Now; pacItem.LastUpdateUserAccount = ClientCookie.UserCode; } if (package.Length > 0) { ClosurePackage.Update(package); } } #endregion return(true); } }