public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_LLNegotiation, NodeCode.Finish, ProjectStatus.Finished); if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_Letter)) { ProjectProgress.SetProgress(ProjectId, "30%"); if (info.NeedProjectCostEst) { if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_ConsInfo)) { info.GenerateSubmitTask(FlowCode.Renewal_ConsInfo); } } else { ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_ConsInfo, NodeCode.Finish, ProjectStatus.Finished); if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_Tool)) { info.GenerateSubmitTask(FlowCode.Renewal_Tool); } } } break; case TaskWorkStatus.K2ProcessDeclined: break; } }
public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: ProjectProgress.SetProgress(ProjectId, "50%"); ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_Analysis, NodeCode.Finish, ProjectStatus.Finished); if (info.RenewalYears > 2) { if (!ProjectInfo.FlowHaveTask(ProjectId, FlowCode.Renewal_ClearanceReport)) { info.GenerateSubmitTask(FlowCode.Renewal_ClearanceReport); } } else { ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ClearanceReport); if (!ProjectInfo.FlowHaveTask(ProjectId, FlowCode.Renewal_ConfirmLetter)) { info.GenerateSubmitTask(FlowCode.Renewal_ConfirmLetter); } } break; case TaskWorkStatus.K2ProcessDeclined: break; } }
public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(this.ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: { using (TransactionScope tranScope = new TransactionScope()) { ProjectProgress.SetProgress(ProjectId, "40%"); ProjectInfo.FinishNode(ProjectId, this.WorkflowCode, NodeCode.Finish); var anlysisProj = ProjectInfo.FirstOrDefault(e => e.FlowCode == FlowCode.Renewal_Analysis && e.Status == ProjectStatus.UnFinish && e.ProjectId == ProjectId); if (anlysisProj != null) { info.GenerateSubmitTask(FlowCode.Renewal_Analysis); } else { //Renewal Tool重新Edit并完成后,系统自动重新生成一次Renewal Analysis文件 var anlysis = RenewalAnalysis.Get(ProjectId); if (anlysis != null) { anlysis.GenerateAttachment(); } } tranScope.Complete(); } } break; } }
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 comment, Action onExecuting = null) { var actor = ProjectUsers.GetProjectUser(this.ProjectId, ProjectUserRoleCode.AssetActor); var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, FlowCode.Renewal, WorkflowCode); var dataFields = SetWorkflowDataFields(task); var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields); if (procInstId > 0) { using (TransactionScope tranScope = new TransactionScope()) { task.Finish(); this.ProcInstId = procInstId; this.CreateTime = DateTime.Now; this.CreateUserAccount = ClientCookie.UserCode; this.Update(); var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode); project.CreateUserAccount = ClientCookie.UserCode; project.Update(); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, procInstId, ProjectCommentStatus.Submit ); } if (onExecuting != null) { onExecuting(); } ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Renewal_Letter_Upload); ProjectProgress.SetProgress(ProjectId, "20%"); tranScope.Complete(); } } }
public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(this.ProjectId); Log4netHelper.WriteErrorLog(status.ToString()); switch (status) { case TaskWorkStatus.K2ProcessApproved: { Log4netHelper.WriteErrorLog("111111111"); ProjectProgress.SetProgress(ProjectId, "80%"); info.GenerateSubmitTask(FlowCode.Renewal_Package); ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Approval, ProjectStatus.Finished); Log4netHelper.WriteErrorLog("22222222"); } break; } }
public override void Finish(TaskWorkStatus status, TaskWork task) { var info = RenewalInfo.Get(ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: ProjectProgress.SetProgress(ProjectId, "60%"); ProjectInfo.FinishNode(ProjectId, this.WorkflowCode, NodeCode.Finish, ProjectStatus.Finished); if (!ProjectInfo.FlowHaveTask(ProjectId, FlowCode.Renewal_ConfirmLetter)) { info.GenerateSubmitTask(FlowCode.Renewal_ConfirmLetter); } break; case TaskWorkStatus.K2ProcessDeclined: break; } }
public override void Finish(TaskWorkStatus status, TaskWork task) { switch (status) { case TaskWorkStatus.K2ProcessApproved: { ProjectInfo.FinishNode(ProjectId, this.WorkflowCode, NodeCode.Finish); ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_LLNegotiation, NodeCode.Renewal_LLNegotiation_ConfirmLetter); if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_ConsInfo)) { var info = RenewalInfo.Get(task.RefID); if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_LLNegotiation)) { ProjectProgress.SetProgress(ProjectId, "30%"); if (info.NeedProjectCostEst) { if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_ConsInfo)) { info.GenerateSubmitTask(FlowCode.Renewal_ConsInfo); } } else { ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_ConsInfo, NodeCode.Finish, ProjectStatus.Finished); if (!ProjectInfo.IsFlowStarted(ProjectId, FlowCode.Renewal_Tool)) { info.GenerateSubmitTask(FlowCode.Renewal_Tool); } } } } TaskWork.Finish(t => t.TypeCode == this.WorkflowCode && t.RefID == this.ProjectId && t.Status == TaskWorkStatus.UnFinish); } break; } }
public static void Create(PostCreateWorkflow <RenewalInfo> postCreateRenewal) { using (TransactionScope tranScope = new TransactionScope()) { var usCode = postCreateRenewal.Entity.USCode; var store = StoreBasicInfo.GetStorInfo(usCode); var projectId = ProjectInfo.CreateMainProject(FlowCode.Renewal, usCode, NodeCode.Start, ClientCookie.UserCode); postCreateRenewal.Entity.Id = Guid.NewGuid(); postCreateRenewal.Entity.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Entity.CreateTime = DateTime.Now; postCreateRenewal.Entity.StoreNameENUS = store.NameENUS; postCreateRenewal.Entity.StoreNameZHCN = store.NameZHCN; postCreateRenewal.Entity.AssetRepAccount = postCreateRenewal.Team.AssetRep.UserAccount; postCreateRenewal.Entity.AssetRepNameENUS = postCreateRenewal.Team.AssetRep.UserNameENUS; postCreateRenewal.Entity.AssetRepNameZHCN = postCreateRenewal.Team.AssetRep.UserNameZHCN; postCreateRenewal.Entity.AssetActorAccount = postCreateRenewal.Team.AssetActor.UserAccount; postCreateRenewal.Entity.AssetActorNameENUS = postCreateRenewal.Team.AssetActor.UserNameENUS; postCreateRenewal.Entity.AssetActorNameZHCN = postCreateRenewal.Team.AssetActor.UserNameZHCN; postCreateRenewal.Entity.FinanceAccount = postCreateRenewal.Team.Finance.UserAccount; postCreateRenewal.Entity.FinanceNameENUS = postCreateRenewal.Team.Finance.UserNameENUS; postCreateRenewal.Entity.FinanceNameZHCN = postCreateRenewal.Team.Finance.UserNameZHCN; postCreateRenewal.Entity.PMAccount = postCreateRenewal.Team.PM.UserAccount; postCreateRenewal.Entity.PMNameENUS = postCreateRenewal.Team.PM.UserNameENUS; postCreateRenewal.Entity.PMNameZHCN = postCreateRenewal.Team.PM.UserNameZHCN; postCreateRenewal.Entity.LegalAccount = postCreateRenewal.Team.Legal.UserAccount; postCreateRenewal.Entity.LegalNameENUS = postCreateRenewal.Team.Legal.UserNameENUS; postCreateRenewal.Entity.LegalNameZHCN = postCreateRenewal.Team.Legal.UserNameZHCN; postCreateRenewal.Entity.AssetManagerAccount = postCreateRenewal.Team.AssetMgr.UserAccount; postCreateRenewal.Entity.AssetManagerNameENUS = postCreateRenewal.Team.AssetMgr.UserNameENUS; postCreateRenewal.Entity.AssetManagerNameZHCN = postCreateRenewal.Team.AssetMgr.UserNameZHCN; postCreateRenewal.Entity.CMAccount = postCreateRenewal.Team.CM.UserAccount; postCreateRenewal.Entity.CMNameENUS = postCreateRenewal.Team.CM.UserNameENUS; postCreateRenewal.Entity.CMNameZHCN = postCreateRenewal.Team.CM.UserNameZHCN; postCreateRenewal.Entity.ProjectId = projectId; postCreateRenewal.Entity.Add(); ProjectInfo.CreateSubProject(FlowCode.Renewal_Letter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_LLNegotiation, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLLNegotiation.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ConsInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); RenewalConsInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount, postCreateRenewal.Entity.NeedProjectCostEst); ProjectInfo.CreateSubProject(FlowCode.Renewal_Tool, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.Finance.UserAccount); var tool = RenewalTool.Create(projectId, postCreateRenewal.Team.Finance.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ClearanceReport, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalClearanceReport.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ConfirmLetter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalConfirmLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_Analysis, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); var analysis = RenewalAnalysis.Create(postCreateRenewal.Entity); ProjectInfo.CreateSubProject(FlowCode.Renewal_LegalApproval, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLegalApproval.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_Package, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalPackage.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount, analysis.Id, tool.Id); ProjectInfo.CreateSubProject(FlowCode.Renewal_ContractInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalContractInfo.Create(projectId); ProjectInfo.CreateSubProject(FlowCode.Renewal_SiteInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); RenewalSiteInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_GBMemo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); List <ProjectUsers> projectUsers = new List <ProjectUsers>(); postCreateRenewal.Team.AssetRep.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetRep.ProjectId = projectId; postCreateRenewal.Team.AssetRep.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetRep.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetRep.RoleCode = ProjectUserRoleCode.AssetRep; postCreateRenewal.Team.AssetRep.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ENUS); postCreateRenewal.Team.AssetRep.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetRep); postCreateRenewal.Team.AssetActor.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetActor.ProjectId = projectId; postCreateRenewal.Team.AssetActor.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetActor.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetActor.RoleCode = ProjectUserRoleCode.AssetActor; postCreateRenewal.Team.AssetActor.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ENUS); postCreateRenewal.Team.AssetActor.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetActor); postCreateRenewal.Team.Finance.Id = Guid.NewGuid(); postCreateRenewal.Team.Finance.ProjectId = projectId; postCreateRenewal.Team.Finance.CreateDate = DateTime.Now; postCreateRenewal.Team.Finance.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.Finance.RoleCode = ProjectUserRoleCode.Finance; postCreateRenewal.Team.Finance.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ENUS); postCreateRenewal.Team.Finance.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.Finance); postCreateRenewal.Team.PM.Id = Guid.NewGuid(); postCreateRenewal.Team.PM.ProjectId = projectId; postCreateRenewal.Team.PM.CreateDate = DateTime.Now; postCreateRenewal.Team.PM.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.PM.RoleCode = ProjectUserRoleCode.PM; postCreateRenewal.Team.PM.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ENUS); postCreateRenewal.Team.PM.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.PM); postCreateRenewal.Team.Legal.Id = Guid.NewGuid(); postCreateRenewal.Team.Legal.ProjectId = projectId; postCreateRenewal.Team.Legal.CreateDate = DateTime.Now; postCreateRenewal.Team.Legal.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.Legal.RoleCode = ProjectUserRoleCode.Legal; postCreateRenewal.Team.Legal.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ENUS); postCreateRenewal.Team.Legal.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.Legal); postCreateRenewal.Team.AssetMgr.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetMgr.ProjectId = projectId; postCreateRenewal.Team.AssetMgr.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetMgr.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetMgr.RoleCode = ProjectUserRoleCode.AssetManager; postCreateRenewal.Team.AssetMgr.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ENUS); postCreateRenewal.Team.AssetMgr.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetMgr); postCreateRenewal.Team.CM.Id = Guid.NewGuid(); postCreateRenewal.Team.CM.ProjectId = projectId; postCreateRenewal.Team.CM.CreateDate = DateTime.Now; postCreateRenewal.Team.CM.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.CM.RoleCode = ProjectUserRoleCode.CM; postCreateRenewal.Team.CM.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ENUS); postCreateRenewal.Team.CM.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.CM); ProjectUsers.Add(projectUsers.ToArray()); postCreateRenewal.Viewers.ForEach(v => { v.Id = Guid.NewGuid(); v.ProjectId = projectId; v.CreateDate = DateTime.Now; v.CreateUserAccount = ClientCookie.UserCode; v.RoleCode = ProjectUserRoleCode.View; }); ProjectUsers.Add(postCreateRenewal.Viewers.ToArray()); //postCreateRenewal.NecessaryViewers.ForEach(v => //{ // v.Id = Guid.NewGuid(); // v.ProjectId = projectId; // v.CreateDate = DateTime.Now; // v.CreateUserAccount = ClientCookie.UserCode; // v.RoleCode = ProjectUserRoleCode.View; //}); //ProjectUsers.Add(postCreateRenewal.NecessaryViewers.ToArray()); Remind.SendRemind(projectId, FlowCode.Renewal, projectUsers); Remind.SendRemind(projectId, FlowCode.Renewal, postCreateRenewal.Viewers); postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_Letter); postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_LLNegotiation); postCreateRenewal.Entity.CreateAttachmentsMemo(); ProjectNode.GenerateOnCreate(FlowCode.Renewal, projectId); ProjectProgress.SetProgress(projectId, "10%"); tranScope.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(); } }