public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(this.ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: { ProjectProgress.SetProgress(ProjectId, "90%"); var taskcontract = TaskWork.Search(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Renewal_ContractInfo).FirstOrDefault(); if (taskcontract == null) { info.GenerateSubmitTask(FlowCode.Renewal_ContractInfo); } var taskSiteinfo = TaskWork.Search(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Renewal_SiteInfo).FirstOrDefault(); if (taskSiteinfo == null) { info.GenerateSubmitTask(FlowCode.Renewal_SiteInfo); } ProjectInfo.CompleteMainIfEnable(ProjectId); ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Renewal_Package_Approval); } break; case TaskWorkStatus.K2ProcessDeclined: { ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Renewal, ProjectStatus.Rejected); ProjectInfo.Reject(ProjectId, FlowCode.Renewal_Package); } break; } }
private void UpdateConsInvtCheckingStatus() { if (ReinvenstmentType == 2 || ReinvenstmentType == 1) { ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.MajorLease_ConsInvtChecking, ProjectStatus.Finished); } else { ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.MajorLease_ConsInvtChecking, ProjectStatus.UnFinish); } }
public override void Finish(TaskWorkStatus status, TaskWork task) { switch (status) { case TaskWorkStatus.K2ProcessDeclined: ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.TempClosure, ProjectStatus.Rejected); ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.TempClosure_ClosurePackage, ProjectStatus.Rejected); break; case TaskWorkStatus.K2ProcessApproved: ProjectInfo.FinishNode(ProjectId, FlowCode.TempClosure_ClosurePackage, NodeCode.TempClosure_ClosurePackage_Approve); var closureMemo = new TempClosureMemo(); closureMemo.GenerateClosureMemoTask(ProjectId); var tempClosureReopenMemo = new TempClosureReopenMemo(); tempClosureReopenMemo.GenerateReopenTask(ProjectId); break; } }
public override void Finish(TaskWorkStatus status, TaskWork task) { using (var scope = new TransactionScope()) { switch (status) { case TaskWorkStatus.K2ProcessApproved: var imgInfo = ReimageInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault(); ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_GBMemo, NodeCode.Finish, ProjectStatus.Finished); if (IsInOperation) { ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_ReopenMemo, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_TempClosureMemo, NodeCode.Finish, ProjectStatus.Finished); } else { var taskUrlReopen = string.Format(@"/Reimage/Main#/ReopenMemo?projectId={0}", ProjectId); var taskReopen = imgInfo.GenerateTaskWork(FlowCode.Reimage_ReopenMemo, "Reopen Memo", "Reopen Memo", taskUrlReopen); taskReopen.ActivityName = NodeCode.Start; taskReopen.ActionName = SetTaskActionName(ProjectId); //TaskWork.Add(taskReopen); if (rmgInfo.ReopenDate.HasValue) { ScheduleLog.GenerateTaskSchedule(rmgInfo.ReopenDate.Value.AddDays(-7), taskReopen, ClientCookie.UserCode, ProjectId, FlowCode.Reimage_ReopenMemo, rmgInfo.USCode); } ProjectInfo.Reset(ProjectId, FlowCode.Reimage_ReopenMemo); var taskUrlClosure = string.Format(@"/Reimage/Main#/TempClosureMemo?projectId={0}", ProjectId); var taskClosure = imgInfo.GenerateTaskWork(FlowCode.Reimage_TempClosureMemo, "TempClosure Memo", "TempClosure Memo", taskUrlClosure); taskClosure.ActivityName = NodeCode.Start; taskClosure.ActionName = SetTaskActionName(ProjectId); TaskWork.Add(taskClosure); ProjectInfo.Reset(ProjectId, FlowCode.Reimage_TempClosureMemo); } var consCheckingTask = TaskWork.FirstOrDefault(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Reimage_ConsInvtChecking && e.Status == TaskWorkStatus.UnFinish); var checkingProj = ProjectInfo.FirstOrDefault(e => e.ProjectId == ProjectId && e.FlowCode == FlowCode.Reimage_ConsInvtChecking); if (consCheckingTask == null && checkingProj != null && checkingProj.Status != ProjectStatus.Finished) { var consInvtChecking = new ReimageConsInvtChecking(); consInvtChecking.ProjectId = task.RefID; consInvtChecking.GenerateConsInvtCheckingTask(true); } ProjectInfo.CompleteMainIfEnable(ProjectId); var pmTaskUrl = string.Format(@"/Reimage/Main#/GBMemo/Process/Notify?projectId={0}", ProjectId); var pmTask = imgInfo.GenerateTaskWork(WorkflowCode, "Reimage GBMemo", "Reimage GBMemo", pmTaskUrl); pmTask.ActivityName = "Notify"; pmTask.ActionName = "Notify"; TaskWork.Add(pmTask); GenerateSiteInfoTask(); break; case TaskWorkStatus.K2ProcessDeclined: ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage, ProjectStatus.Rejected); ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage_GBMemo, ProjectStatus.Rejected); break; } scope.Complete(); } }
public override void Finish(TaskWorkStatus status, TaskWork task) { switch (status) { case TaskWorkStatus.K2ProcessDeclined: ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Closure, ProjectStatus.Rejected); //删除未处理完成的任务 var oldTask = TaskWork.Search(i => i.SourceCode == FlowCode.Closure && i.RefID == this.ProjectId && i.Status == TaskWorkStatus.UnFinish).ToArray(); foreach (var taskItem in oldTask) { taskItem.Status = TaskWorkStatus.Cancel; } TaskWork.Update(oldTask); ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Closure_ClosurePackage, ProjectStatus.Rejected); break; case TaskWorkStatus.K2ProcessApproved: //ClosurePackage的最后一步在K2中,但不属于审批 task.ActionName = ""; task.Update(); ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_ClosurePackage, NodeCode.Closure_ClosurePackage_ResourceUpload, ProjectStatus.Finished); //Package流程走完后,在Actor处生成一条任务,供Actor上传Signed Termination Agreement与Signed Package //GenerateSignedPackageTask(ProjectId); if (!TaskWork.Any(i => i.RefID == this.ProjectId && i.SourceCode == FlowCode.Closure && i.TypeCode == FlowCode.Closure_ContractInfo && i.Status != TaskWorkStatus.Cancel)) { TaskWork taskWorkContractInfo = new TaskWork(); taskWorkContractInfo.SourceCode = FlowCode.Closure; taskWorkContractInfo.SourceNameENUS = FlowCode.Closure; taskWorkContractInfo.SourceNameZHCN = "关店流程"; taskWorkContractInfo.Status = TaskWorkStatus.UnFinish; taskWorkContractInfo.StatusNameZHCN = "任务"; taskWorkContractInfo.StatusNameENUS = "任务"; taskWorkContractInfo.RefID = ProjectId; taskWorkContractInfo.Id = Guid.NewGuid(); taskWorkContractInfo.CreateTime = DateTime.Now; //ClosureInfo closure = new ClosureInfo(); var closureInfo = ClosureInfo.GetByProjectId(ProjectId); taskWorkContractInfo.Title = TaskWork.BuildTitle(ProjectId, closureInfo.StoreNameZHCN, closureInfo.StoreNameENUS); taskWorkContractInfo.TypeCode = FlowCode.Closure_ContractInfo; taskWorkContractInfo.TypeNameENUS = "ContractInfo"; taskWorkContractInfo.TypeNameZHCN = "ContractInfo"; taskWorkContractInfo.ReceiverAccount = closureInfo.AssetActorAccount; taskWorkContractInfo.ReceiverNameENUS = closureInfo.AssetActorNameENUS; taskWorkContractInfo.ReceiverNameZHCN = closureInfo.AssetActorNameZHCN; taskWorkContractInfo.Url = SiteInfo.GetProjectHandlerPageUrl(FlowCode.Closure_ContractInfo, closureInfo.ProjectId); taskWorkContractInfo.StoreCode = closureInfo.USCode; taskWorkContractInfo.ActivityName = "Start"; taskWorkContractInfo.Add(); } //为了方便测试,暂时做成Package走完立刻生成ConsInvtChecking和ClourseMemo //var consInvtChecking = new ClosureConsInvtChecking(); //consInvtChecking.GenerateConsInvtCheckingTask(ProjectId); var memo = new ClosureMemo(); memo.GenerateClourseMemoTask(ProjectId); //如果是Complete了的流程,Edit后流程走完需要重新把主流程状态改成Complete ProjectInfo.CompleteMainIfEnable(ProjectId); break; } }