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; } }
public void Submit() { string strFlowCode = FlowCode.TempClosure; string strNodeCode = NodeCode.Finish; string strTypeCode = FlowCode.TempClosure_ReopenMemo; using (var scope = new TransactionScope()) { Save(); var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, strFlowCode, strTypeCode); if (task != null) { task.Status = TaskWorkStatus.K2ProcessApproved; task.ActivityName = "Finish"; string taskUrl = "/" + strFlowCode + "/Main#/ReopenMemo/Process/View?projectId=" + ProjectId; task.Url = taskUrl; task.FinishTime = DateTime.Now; TaskWork.Update(task); ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.TempClosure_ReopenMemo_Input); ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.TempClosure_ReopenMemo_Send, ProjectStatus.Finished); //ProjectInfo.FinishNode(ProjectId, strTypeCode, strNodeCode); ProjectInfo.CompleteMainIfEnable(ProjectId); } scope.Complete(); } }
public override void Finish(TaskWorkStatus status, TaskWork task) { using (var scope = new TransactionScope()) { switch (status) { case TaskWorkStatus.K2ProcessApproved: ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Finish); ProjectInfo.CompleteMainIfEnable(ProjectId); break; } scope.Complete(); } }
public static void Submit(ReopenMemo memo) { string strFlowCode = ""; string strInputNodeCode = ""; string strSendNodeCode = ""; string strTypeCode = ""; if (memo.ProjectId.ToLower().IndexOf("rebuild") != -1) { strFlowCode = FlowCode.Rebuild; strInputNodeCode = NodeCode.Rebuild_ReopenMemo_Input; strSendNodeCode = NodeCode.Rebuild_ReopenMemo_Send; strTypeCode = FlowCode.Rebuild_ReopenMemo; } else if (memo.ProjectId.ToLower().IndexOf("reimage") != -1) { strFlowCode = FlowCode.Reimage; strInputNodeCode = NodeCode.Reimage_ReopenMemo_Input; strSendNodeCode = NodeCode.Reimage_ReopenMemo_SendMemo; strTypeCode = FlowCode.Reimage_ReopenMemo; } using (var scope = new TransactionScope()) { SaveReopenMemo(memo); if (memo.ProjectId.ToLower().IndexOf("rebuild") != -1 || memo.ProjectId.ToLower().IndexOf("reimage") != -1) { var task = TaskWork.GetTaskWork(memo.ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, strFlowCode, strTypeCode); if (task != null) { task.Status = TaskWorkStatus.K2ProcessApproved; task.ActivityName = "Finish"; task.FinishTime = DateTime.Now; string taskUrl = "/" + strFlowCode + "/Main#/ReopenMemo/Process/View?projectId=" + memo.ProjectId; task.Url = taskUrl; TaskWork.Update(task); ProjectInfo.FinishNode(memo.ProjectId, strTypeCode, strInputNodeCode); ProjectInfo.FinishNode(memo.ProjectId, strTypeCode, strSendNodeCode); ProjectInfo.CompleteMainIfEnable(memo.ProjectId); } } else { AttachmentsMemoProcessInfo.UpdateNotifyDate(memo.ProjectId, FlowCode.ReopenMemo); } scope.Complete(); } }
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; } }
public void Submit() { string strFlowCode = FlowCode.TempClosure; string strNodeCode = NodeCode.Finish; string strTypeCode = FlowCode.TempClosure_ClosureMemo; if (ProjectId.ToLower().IndexOf("rebuild") != -1) { strFlowCode = FlowCode.Rebuild; //strNodeCode = NodeCode.Finish; strTypeCode = FlowCode.Rebuild_TempClosureMemo; } else if (ProjectId.ToLower().IndexOf("reimage") != -1) { strFlowCode = FlowCode.Reimage; //strNodeCode = NodeCode.Finish; strTypeCode = FlowCode.Reimage_TempClosureMemo; } using (var scope = new TransactionScope()) { Save(); if (ProjectId.ToLower().IndexOf("majorlease") != -1 || ProjectId.ToLower().IndexOf("renewal") != -1) { AttachmentsMemoProcessInfo.UpdateNotifyDate(ProjectId, FlowCode.ClosureMemo); } else { var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, strFlowCode, strTypeCode); if (task != null) { task.Status = TaskWorkStatus.K2ProcessApproved; task.ActivityName = "Finish"; string taskUrl = "/" + strFlowCode + "/Main#/ClosureMemo/Process/View?projectId=" + ProjectId; if (ProjectId.ToLower().IndexOf("rebuild") != -1 || ProjectId.ToLower().IndexOf("reimage") != -1) { taskUrl = "/" + strFlowCode + "/Main#/TempClosureMemo/Process/View?projectId=" + ProjectId; } task.Url = taskUrl; task.FinishTime = DateTime.Now; TaskWork.Update(task); if (ProjectId.ToLower().IndexOf("rebuild") != -1) { ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.Rebuild_TempClosureMemo_Input); ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.Rebuild_TempClosureMemo_Send, ProjectStatus.Finished); } else if (ProjectId.ToLower().IndexOf("reimage") != -1) { ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.Reimage_TempClosureMemo_Input); ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.Reimage_TempClosureMemo_Send, ProjectStatus.Finished); } else { //TempClosure ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.TempClosure_ClosureMemo_Input); ProjectInfo.FinishNode(ProjectId, strTypeCode, NodeCode.TempClosure_ClosureMemo_Send, ProjectStatus.Finished); } ProjectInfo.CompleteMainIfEnable(ProjectId); } } scope.Complete(); } }
public void Submit(List <ProjectContractRevision> revisions, string flowCode) { revisions = revisions ?? new List <ProjectContractRevision>(); using (TransactionScope tranScope = new TransactionScope()) { StoreContractInfo contractInfo = this.ToStoreContractInfo(); ProjectContractRevision reInfo = new ProjectContractRevision(); #region 初始化项目的Revision信息 reInfo.Id = Guid.NewGuid(); reInfo.ProjectId = this.ProjectId; Guid srId = Guid.NewGuid(); reInfo.ProjectContractId = this.Id; reInfo.RevisionId = srId; reInfo.StoreContractInfoId = contractInfo.Id; reInfo.StoreID = this.StoreId; reInfo.StoreCode = this.StoreCode; reInfo.LeaseRecapID = this.LeaseRecapID; reInfo.ChangeDate = DateTime.Now; if (flowCode == FlowCode.MajorLease_ContractInfo) { MajorLeaseInfo info = MajorLeaseInfo.Search(e => e.ProjectId == ProjectId).FirstOrDefault(); reInfo.Rent = info.ChangeRentalType.HasValue && info.ChangeRentalType.Value ? "Y" : null; reInfo.Size = info.ChangeRedLineType.HasValue && info.ChangeRedLineType.Value ? "Y" : null; reInfo.LeaseTerm = info.ChangeLeaseTermType.HasValue && info.ChangeLeaseTermType.Value ? "Y" : null; reInfo.Entity = info.ChangeLandlordType.HasValue && info.ChangeLandlordType.Value ? "Y" : null; reInfo.Others = info.ChangeOtherType.HasValue && info.ChangeOtherType.Value ? "Y" : null; reInfo.RentStructureOld = info.OldRentalStructure; reInfo.RentStructureNew = info.NewRentalStructure; reInfo.RedlineAreaOld = info.OldChangeRedLineRedLineArea.HasValue ? info.OldChangeRedLineRedLineArea.ToString() : null; reInfo.RedlineAreaNew = info.NewChangeRedLineRedLineArea.HasValue ? info.NewChangeRedLineRedLineArea.ToString() : null; reInfo.LeaseChangeExpiryOld = info.OldChangeLeaseTermExpiraryDate; reInfo.LeaseChangeExpiryNew = info.NewChangeLeaseTermExpiraryDate; reInfo.LandlordOld = info.OldLandlord; reInfo.LandlordNew = info.NewLandlord; reInfo.OthersDescription = info.Others; reInfo.Description = info.LeaseChangeDescription; } else if (flowCode == FlowCode.Rebuild_ContractInfo) { RebuildPackage info = RebuildPackage.GetRebuildPackageInfo(ProjectId); reInfo.Rent = info.ChangeRentalType.HasValue && info.ChangeRentalType.Value ? "Y" : null; reInfo.Size = info.ChangeRedLineType.HasValue && info.ChangeRedLineType.Value ? "Y" : null; reInfo.LeaseTerm = info.ChangeLeaseTermType.HasValue && info.ChangeLeaseTermType.Value ? "Y" : null; reInfo.Entity = info.ChangeLandlordType.HasValue && info.ChangeLandlordType.Value ? "Y" : null; reInfo.Others = info.ChangeOtherType.HasValue && info.ChangeOtherType.Value ? "Y" : null; reInfo.RentStructureOld = info.OldRentalStructure; reInfo.RentStructureNew = info.NewRentalStructure; reInfo.RedlineAreaOld = info.OldChangeRedLineRedLineArea.HasValue ? info.OldChangeRedLineRedLineArea.ToString() : null; reInfo.RedlineAreaNew = info.NewChangeRedLineRedLineArea.HasValue ? info.NewChangeRedLineRedLineArea.ToString() : null; reInfo.LeaseChangeExpiryOld = info.OldChangeLeaseTermExpiraryDate; reInfo.LeaseChangeExpiryNew = info.NewChangeLeaseTermExpiraryDate; reInfo.LandlordOld = info.OldLandlord; reInfo.LandlordNew = info.NewLandlord; reInfo.OthersDescription = info.Others; reInfo.Description = info.LeaseChangeDescription; } #endregion if (this.EditMode == "EDIT") { if (flowCode == FlowCode.Closure_ContractInfo) { revisions = revisions.OrderBy(r => r.ChangeDate).ToList(); revisions.ForEach(r => { var sr = r.ToStoreContractRevision(); sr.Save(); r.RevisionId = sr.Id; //回写到ContractInfo中 if (sr.Rent == "Y") { this.RentStructure = sr.RentStructureNew; } if (sr.Size == "Y") { this.TotalLeasedArea = sr.RedlineAreaNew; } if (sr.LeaseTerm == "Y") { this.EndDate = sr.LeaseChangeExpiryNew; } if (sr.Entity == "Y") { this.PartyAFullName = sr.LandlordNew; } }); contractInfo = this.ToStoreContractInfo(); var sRIds = revisions.Select(e => e.RevisionId).ToList(); StoreContractRevision.Delete(e => e.StoreContractInfoId == contractInfo.Id && !sRIds.Contains(e.Id)); this.Save(revisions); } else { this.Save(); reInfo.Save(); var sr = reInfo.ToStoreContractRevision(); sr.Id = srId; sr.Save(); } contractInfo.Update(); } else { contractInfo.Id = Guid.NewGuid(); contractInfo.CreatedTime = DateTime.Now; contractInfo.Add(); this.ContractInfoId = contractInfo.Id; if (Any(e => e.Id == this.Id)) { this.Update(); } else { this.Add(); } //新增时不需要带入修订信息 ProjectContractRevision.Delete(r => r.ProjectContractId == this.Id); //if (flowCode != FlowCode.Renewal_ContractInfo) //{ // reInfo.StoreContractInfoId = contractInfo.Id; // reInfo.Save(); // var sr = reInfo.ToStoreContractRevision(); // sr.Id = srId; // sr.Save(); //} } //关闭任务 var task = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.TypeCode.Contains("ContractInfo") && e.RefID == this.ProjectId); if (task != null) { task.Finish(); } var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == this.ProjectId && e.FlowCode.Contains("ContractInfo")); ProjectInfo.FinishNode(this.ProjectId, projectInfo.FlowCode, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.CompleteMainIfEnable(this.ProjectId); if (projectInfo.FlowCode == FlowCode.Renewal_ContractInfo) { if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_SiteInfo)) { ProjectProgress.SetProgress(ProjectId, "100%"); } } tranScope.Complete(); } }