public override bool ExecTaskExec(Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing, string nextExecUserIDs, string nextExecUserNames, string nextExecUserIDsGroup, string nextExecRoleIDs, string nextExecOrgIDs, string execComment) { var result = base.ExecTaskExec(taskExec, routing, nextExecUserIDs, nextExecUserNames, nextExecUserIDsGroup, nextExecRoleIDs, nextExecOrgIDs, execComment); var entity = this.GetEntityByID(taskExec.S_WF_InsFlow.FormInstanceID); if (entity == null) { throw new Formula.Exceptions.BusinessValidationException("未能找到指定的表单数据,无法执行任务"); } var supplier = this.GetEntityByID <S_I_SupplierInfo>(entity.SupplierInfo); if (supplier != null) { supplier.FlowPhase = entity.FlowPhase; } return(result); }
protected override void OnFlowEnd(T_Trainmanagement_Companytrainresults entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity == null) { return; } var compPlan = BusinessEntities.Set <S_Train_CompPlan>().Find(entity.Trainproject); if (compPlan == null) { //生成计划外培训数据 compPlan = new S_Train_CompPlan(); compPlan.ID = Formula.FormulaHelper.CreateGuid(); compPlan.Trainyear = entity.Trainyears; compPlan.Fillname = entity.Fillname; compPlan.FillnameName = entity.FillnameName; compPlan.Trainproject = entity.TrainprojectName; compPlan.InOrOut = "Out";//计划外 compPlan.Undertakedept = entity.Udertakedept; compPlan.UndertakedeptName = entity.UdertakedeptName; BusinessEntities.Set <S_Train_CompPlan>().Add(compPlan); entity.Trainproject = compPlan.ID; } //累计学时 if (compPlan.Accumulathours == null) { compPlan.Accumulathours = 0; } compPlan.Accumulathours += entity.Trainhours; //进度=100 标记为完成 if (entity.Progress == 100) { compPlan.IsComplete = "True"; } BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_B_BidApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { base.OnFlowEnd(entity, taskExec, routing); if (entity.Agree == "True") { entity.Submit(); } }
protected override void OnFlowEnd(S_EP_CBSInfoCancel data, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (data != null) { data.Push(); } }
protected override void OnFlowEnd(T_Foreign_Goabroadapplybusiness entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var list = entity.T_Foreign_Goabroadapplybusiness_Peerlist.ToList(); var mod = new S_E_Peerlist(); mod.ID = FormulaHelper.CreateGuid(); mod.ApplyDate = entity.Applytime; mod.ApplyType = "因公出国"; mod.T_Foreign_GoabroadapplybusinessID = entity.ID; mod.TaskName = entity.Taskname; mod.UserID = entity.ApplyUser; mod.UserName = entity.ApplyUserName; mod.DeptID = entity.Applydept; mod.DeptName = entity.ApplydeptName; mod.Code = FormulaHelper.GetUserInfoByID(entity.ApplyUser).Code; mod.Gocountry = entity.Gocountry; BusinessEntities.Set <S_E_Peerlist>().Add(mod); foreach (var item in list) { mod = new S_E_Peerlist(); mod.ID = FormulaHelper.CreateGuid(); mod.ApplyDate = entity.Applytime; mod.ApplyType = "因公出国"; mod.T_Foreign_GoabroadapplybusinessID = entity.ID; mod.TaskName = entity.Taskname; mod.UserID = item.UserID; mod.UserName = item.Name; mod.DeptID = item.Dept; mod.DeptName = item.DeptName; mod.Code = item.Workid; mod.Gocountry = entity.Gocountry; BusinessEntities.Set <S_E_Peerlist>().Add(mod); } BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_EXE_TaskWorkSettlement entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var enumService = FormulaHelper.GetService <IEnumService>(); //base.OnFlowEnd(entity, taskExec, routing); var detaillist = entity.T_EXE_TaskWorkSettlement_TaskWorkList.ToList(); var budgetids = detaillist.Select(a => a.BudgetID).ToList(); var budgetList = this.BusinessEntities.Set <S_C_CBS_Budget>().Where(a => budgetids.Contains(a.ID)).ToList(); var taskList = this.BusinessEntities.Set <S_W_TaskWork>().Where(a => budgetids.Contains(a.ID)).ToList(); var nodeType = CBSNodeType.Root.ToString(); var rootCBS = this.BusinessEntities.Set <S_C_CBS>().FirstOrDefault(a => a.ProjectInfoID == entity.ProjectInfo && a.NodeType == nodeType); foreach (var detail in detaillist) { var budget = budgetList.FirstOrDefault(a => a.ID == detail.BudgetID); var task = taskList.FirstOrDefault(a => a.ID == budget.ID); var taskRoleRateList = task.S_W_TaskWork_RoleRate.ToList(); //校验预算不能超过 var settlement = Convert.ToDecimal(detail.Settlement); decimal remain = Convert.ToDecimal(budget.Quantity) - Convert.ToDecimal(budget.SummaryCostQuantity); if (settlement > remain) { throw new Formula.Exceptions.BusinessException("卷册【" + budget.Name + "】的本次结算工时不能大于可结算工时"); } //分配人员工时 var n = 0; var sumQuantity = 0m; var roleBudgets = budget.Children.Where(a => a.Quantity.HasValue && a.Quantity.Value != 0).ToList(); foreach (var roleBudget in roleBudgets) { n++; var cost = new S_C_CBS_Cost(); cost.Code = roleBudget.Code; cost.Name = roleBudget.Name; //获取角色人员 var rbs = task.S_W_WBS.GetUser(roleBudget.Code); if (rbs != null) { cost.CostUser = rbs.UserID; cost.CostUserName = rbs.UserName; var userinfo = FormulaHelper.GetUserInfoByID(cost.CostUser); if (userinfo != null) { cost.UserDept = userinfo.UserOrgID; cost.UserDeptName = userinfo.UserOrgName; } } //获取角色比例,计算人员结算工时 if (n == roleBudgets.Count) { cost.Quantity = Convert.ToDecimal(detail.Settlement) - sumQuantity; } else { var rate = 0m; var roleRate = taskRoleRateList.FirstOrDefault(a => a.Role == roleBudget.Code); if (roleRate != null && roleRate.Rate.HasValue) { rate = roleRate.Rate.Value; } cost.Quantity = Math.Round(Convert.ToDecimal(detail.Settlement) * rate / 100, 2); sumQuantity += cost.Quantity.Value; } cost.BelongDept = entity.BelongDept; cost.BelongDeptName = entity.BelongDeptName; var costDate = DateTime.Now; if (entity.BelongDate.HasValue) { costDate = entity.BelongDate.Value; } cost.BelongYear = costDate.Year; cost.BelongQuarter = (costDate.Month - 1) / 3 + 1; cost.BelongMonth = costDate.Month; cost.CostDate = costDate; cost.MajorCode = detail.Major; cost.MajorName = enumService.GetEnumText("Project.Major", detail.Major); cost.TaskWorkCode = budget.Code; cost.TaskWorkName = budget.Name; cost.RoleCode = roleBudget.Code; cost.RoleName = roleBudget.Name; cost.FormID = entity.ID; if (cost.Quantity.HasValue && cost.UnitPrice.HasValue) { cost.TotalValue = cost.Quantity.Value * cost.UnitPrice.Value; } roleBudget.AddCost(cost); } //同步卷册分配数据 budget.SummaryCost(); task.WorkloadFinish = budget.SummaryCostQuantity; //卷册完成 if (task.WorkloadFinish >= task.Workload) { task.Finish(); } } this.BusinessEntities.SaveChanges(); rootCBS.Ansestors.FirstOrDefault(a => a.NodeType == CBSNodeType.Root.ToString()).SummaryCost(); this.BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(S_EP_ProgressConfirm data, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (data != null) { data.Push(); } }
protected override void OnFlowEnd(S_P_ProcurementSmartApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { entity.Push(); this.EPCEntites.SaveChanges(); } }
protected override void OnFlowEnd(T_EXE_PublishApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var publishInfo = this.GetEntityByID <S_EP_PublishInfo>(entity.ID); var majors = EnumBaseHelper.GetEnumDef("Project.Major").EnumItem.ToList(); if (publishInfo == null) { publishInfo = new S_EP_PublishInfo(); this.BusinessEntities.Set <S_EP_PublishInfo>().Add(publishInfo); } this.UpdateEntity <S_EP_PublishInfo>(publishInfo, entity.ToDic()); publishInfo.ID = entity.ID; publishInfo.SubmitTime = DateTime.Now; publishInfo.BelongYear = ((DateTime)publishInfo.SubmitTime).Year; publishInfo.BelongMonth = ((DateTime)publishInfo.SubmitTime).Month; publishInfo.BelongQuarter = ((publishInfo.BelongMonth - 1) / 3) + 1; var major = majors.FirstOrDefault(a => a.Code == publishInfo.MajorCode); if (major != null) { publishInfo.MajorName = major.Name; } foreach (var item in entity.T_EXE_PublishApply_PriceDetail) { var price = this.GetEntityByID <S_EP_PublishInfo_PriceDetail>(item.ID); if (price == null) { price = new S_EP_PublishInfo_PriceDetail(); this.BusinessEntities.Set <S_EP_PublishInfo_PriceDetail>().Add(price); } this.UpdateEntity <S_EP_PublishInfo_PriceDetail>(price, item.ToDic()); price.ID = item.ID; price.S_EP_PublishInfoID = publishInfo.ID; } foreach (var item in entity.T_EXE_PublishApply_Products) { var product = this.GetEntityByID <S_EP_PublishInfo_Products>(item.ID); if (product == null) { product = new S_EP_PublishInfo_Products(); this.BusinessEntities.Set <S_EP_PublishInfo_Products>().Add(product); } this.UpdateEntity <S_EP_PublishInfo_Products>(product, item.ToDic()); product.ID = item.ID; product.S_EP_PublishInfoID = publishInfo.ID; } entity.SetProductPrintState(PrintState.Printed.ToString()); this.BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_Recruitment_Socialrecruitmentemployment entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var currentUser = FormulaHelper.GetUserInfo(); var sentity = new S_E_Recruitment_Socialrecruitmentemployment() { ID = FormulaHelper.CreateGuid(), CreateUserID = currentUser.UserID, CreateUser = currentUser.UserName, CreateDate = DateTime.Now, T_Recruitment_SocialrecruitmentemploymentID = entity.ID, Major = entity.Professional, Year = DateTime.Now.Year, Dept = entity.Employmentdept, DeptName = entity.EmploymentdeptName, IsPass = entity.IsPass, Fillperson = entity.Fillperson, Filldate = entity.Filldate, Candidatename = entity.Candidatename, Position = entity.Position, FillpersonName = entity.FillpersonName, Monthlysalary = entity.Monthlysalary, Annualsalary = entity.Annualsalary, Pretest = entity.Pretest, }; BusinessEntities.Set <S_E_Recruitment_Socialrecruitmentemployment>().Add(sentity); BusinessEntities.SaveChanges(); }
// // GET: /AutoForm/Recruitment_Socialrecruitmentemployment/ public override bool ExecTaskExec(Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing, string nextExecUserIDs, string nextExecUserNames, string nextExecUserIDsGroup, string nextExecRoleIDs, string nextExecOrgIDs, string execComment) { string ID = taskExec.S_WF_InsTask.S_WF_InsFlow.FormInstanceID; var entity = BusinessEntities.Set <T_Recruitment_Socialrecruitmentemployment>().Find(ID); if (routing.Code == "Pass") { entity.IsPass = "******"; BusinessEntities.SaveChanges(); } if (routing.Code == "NoPass") { entity.IsPass = "******"; BusinessEntities.SaveChanges(); } var isFlowComplete = base.ExecTaskExec(taskExec, routing, nextExecUserIDs, nextExecUserNames, nextExecUserIDsGroup, nextExecRoleIDs, nextExecOrgIDs, execComment); return(isFlowComplete); }
protected override void OnFlowEnd(T_P_ReturnDatFile entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { var bomDetails = entity.T_P_ReturnDatFile_BomDetail.ToList(); foreach (var item in bomDetails) { var pBom = this.GetEntityByID <S_P_Bom>(item.BomID); if (pBom != null) { if (!String.IsNullOrEmpty(item.ReturnDatFile)) { pBom.ReturnDatFile = item.ReturnDatFile; pBom.ReturnDatFileName = item.ReturnDatFileName; } pBom.ReturnDatState = ProjectState.Finish.ToString(); if (!pBom.FactReturnDate.HasValue) { pBom.FactReturnDate = entity.ReturnDatDate; } } } this.EPCEntites.SaveChanges(); } }
protected override void OnFlowEnd(T_Trainmanagement_Departmenttrainplan entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { if (string.IsNullOrEmpty(entity.RelateID)) { entity.RelateID = entity.ID; } var list = entity.T_Trainmanagement_Departmenttrainplan_Trainplan.ToList(); HRSQLDB.ExecuteNonQuery("delete from S_Train_DeptPlan where FormID ='" + entity.RelateID + "'"); foreach (var item in list) { S_Train_DeptPlan plan = new S_Train_DeptPlan(); plan.ID = Formula.FormulaHelper.CreateGuid(); //更新主表对应的数据 UpdateEntity <S_Train_DeptPlan>(plan, entity.ToDic()); //更新子表对应的数据 UpdateEntity <S_Train_DeptPlan>(plan, item.ToDic()); plan.FormID = entity.RelateID; plan.InOrOut = "In"; BusinessEntities.Set <S_Train_DeptPlan>().Add(plan); } //更新本年的部门培训通知状态 var sql = string.Format("update S_Train_DeptTask set IsSubmit = 'True' where Dept = '{0}' and Trainyears ='{1}'", entity.Putdept, entity.Trainyears); HRSQLDB.ExecuteNonQuery(sql); entity.IsNewVersion = "True"; sql = string.Format("update T_Trainmanagement_Departmenttrainplan set IsNewVersion = 'False' where RelateID='{0}' and ID <>'{1}'", entity.RelateID, entity.ID); HRSQLDB.ExecuteNonQuery(sql); BusinessEntities.SaveChanges(); } base.OnFlowEnd(entity, taskExec, routing); }
protected override void OnFlowEnd(T_Trainmanagement_TrainplanApproval entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity == null) { return; } if (string.IsNullOrEmpty(entity.RelateID)) { entity.RelateID = entity.ID; } var detailList = entity.T_Trainmanagement_TrainplanApproval_Trainplan.ToList(); if (detailList.Count == 0) { return; } HRSQLDB.ExecuteNonQuery("delete from S_Train_CompPlan where FormID ='" + entity.RelateID + "'"); foreach (var item in detailList) { S_Train_CompPlan plan = new S_Train_CompPlan(); plan.ID = Formula.FormulaHelper.CreateGuid(); plan.FormID = entity.RelateID; BusinessEntities.Set <S_Train_CompPlan>().Add(plan); plan.InOrOut = "In"; //将表单主表数据更新至结果表 UpdateEntity <S_Train_CompPlan>(plan, entity.ToDic()); //将表单子表数据更新至结果表 UpdateEntity <S_Train_CompPlan>(plan, item.ToDic()); } entity.IsNewVersion = "True"; string sql = string.Format("update T_Trainmanagement_TrainplanApproval set IsNewVersion = 'False' where RelateID='{0}' and ID <>'{1}'", entity.RelateID, entity.ID); HRSQLDB.ExecuteNonQuery(sql); BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_EXE_DesignChangeApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (!string.IsNullOrEmpty(entity.TaskWorkID)) { //专业工作区内发起设计变更申请(单卷册) var task = this.GetEntityByID <S_W_TaskWork>(entity.TaskWorkID); if (task == null) { throw new Formula.Exceptions.BusinessException("卷册【" + task.Name + "】不存在!"); } if (task.Version == null) { task.Version = 1; } else { task.Version++; } task.ChangeState = TaskWorkChangeState.ApplyFinish.ToString(); task.State = TaskWorkState.Plan.ToString(); task.FactEndDate = null; task.FactYear = null; task.FactSeason = null; task.FactMonth = null; } else { //专业工作区外发起设计变更申请(多卷册) var majorWbs = this.BusinessEntities.Set <S_W_WBS>().FirstOrDefault( a => a.ProjectInfoID == entity.ProjectInfoID && a.WBSValue == entity.MajorValue); var taskWorkList = this.BusinessEntities.Set <S_W_TaskWork>().Where(a => a.MajorValue == entity.MajorValue && a.ProjectInfoID == entity.ProjectInfoID).ToList(); foreach (var detail in entity.T_EXE_DesignChangeApply_TaskWork.ToList()) { var task = taskWorkList.FirstOrDefault(a => a.ID == detail.TaskWorkID); if (task == null) { task = new S_W_TaskWork(); } task.Name = detail.Name; task.Code = detail.Code; task.MajorValue = detail.Major; task.PhaseValue = detail.Phase; task.DossierCode = detail.DossierCode; task.DossierName = detail.DossierName; task.PlanEndDate = detail.PlanEndDate; task.Workload = detail.Workload; if (string.IsNullOrEmpty(task.ID)) { task.ID = detail.TaskWorkID; //根据专业同步人员 task.FillWBSUser(majorWbs); majorWbs.AddTaskWork(task); task.InitRoleRate(); } else { task.Save(); } task.ChangeState = TaskWorkChangeState.ApplyFinish.ToString(); task.S_W_WBS.PhaseCode = task.PhaseValue; //修改成果的阶段、专业、卷号 foreach (var product in task.S_W_WBS.S_E_Product.ToList()) { product.PhaseValue = task.PhaseValue; product.MajorValue = task.MajorValue; product.MonomerCode = task.DossierCode; product.MonomerInfo = task.DossierName; product.PackageCode = task.Code; product.PackageName = task.Name; } if (task.Version == null) { task.Version = 1; } else { task.Version++; } task.State = TaskWorkState.Plan.ToString(); task.FactEndDate = null; task.FactYear = null; task.FactSeason = null; task.FactMonth = null; } } this.BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_P_FbContractReview entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { base.OnFlowEnd(entity, taskExec, routing); var contract = EPCEntites.Set <S_P_ContractInfo>().Find(entity.ContractID); if (contract == null) { throw new Formula.Exceptions.BusinessValidationException("找不到id为【" + entity.ContractID + "】的分包合同"); } contract.ContractState = "Review"; EPCEntites.SaveChanges(); }
protected override void OnFlowEnd(T_Foreign_Goabroadpersonal entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var mod = new S_E_Peerlist(); mod.ID = FormulaHelper.CreateGuid(); mod.ApplyDate = entity.Applytime; mod.ApplyType = "因私出国"; mod.T_Foreign_GoabroadapplybusinessID = entity.ID; mod.TaskName = entity.Position; mod.UserID = entity.ApplyUser; mod.UserName = entity.ApplyUserName; mod.DeptID = entity.Appledept; mod.DeptName = entity.AppledeptName; mod.Code = entity.ApplyCode; mod.Gocountry = entity.Country; BusinessEntities.Set <S_E_Peerlist>().Add(mod); BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_P_ContractReview entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { base.OnFlowEnd(entity, taskExec, routing); S_P_ContractInfo contract = EPCEntites.Set <S_P_ContractInfo>().Find(entity.ContractInfo); if (contract == null) { throw new BusinessException("已无法找到id为【" + entity.ContractInfo + "】的采购合同信息"); } contract.ContractState = "Review"; //foreach (var content in contract.S_P_ContractInfo_Content) //{ // var tContent = entity.T_P_ContractReview_Content.FirstOrDefault(a => a.PBomID == content.PBomID); // if(tContent != null) // { // content.SFZJ = tContent.SFZJ; // } //} EPCEntites.SaveChanges(); }
protected override void OnFlowEnd(S_Q_QBS_Version entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { entity.Push(); this.EPCEntites.SaveChanges(); } }
protected override void OnFlowEnd(T_I_ManagerNominate entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { entity.Push(); #region 生成项目仓库 var engineeringInfo = EPCEntites.Set <S_I_Engineering>().Find(entity.EngineeringInfoID); if (engineeringInfo == null) { throw new Formula.Exceptions.BusinessValidationException("未能找到指定的工程信息"); } var storage = EPCEntites.Set <S_W_StorageInfo>().FirstOrDefault(a => a.Engineering == engineeringInfo.ID); if (storage == null) { storage = new S_W_StorageInfo { ID = FormulaHelper.CreateGuid(), Name = engineeringInfo.Name, Type = StorageType.Project.ToString(), Engineering = engineeringInfo.ID, EngineeringName = engineeringInfo.Name }; EntityCreateLogic <S_W_StorageInfo>(storage); EPCEntites.Set <S_W_StorageInfo>().Add(storage); } #endregion this.EPCEntites.SaveChanges(); } }
protected override void OnFlowEnd(T_SC_SingleProjectScheme entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { string formData = Request["FormData"]; Dictionary <string, string> dic = JsonHelper.ToObject <Dictionary <string, string> >(formData); var projectInfo = this.GetEntityByID <S_I_ProjectInfo>(entity.ProjectInfoID); var marketEntities = Formula.FormulaHelper.GetEntities <Market.Logic.Domain.MarketEntities>(); var marketProject = marketEntities.Set <Market.Logic.Domain.S_I_Project>().FirstOrDefault(d => d.ID == projectInfo.MarketProjectInfoID); if (projectInfo.ProjectMode.ExtentionObject.GetValue("Ext_TemporaryMode") == TrueOrFalse.True.ToString()) { var schemeDic = JsonHelper.ToObject <Dictionary <string, object> >(formData); var ignorKeys = new string[] { "CreateUserID", "CreateUser", "CreateDate", "State", "Major" }; schemeDic.RemoveWhere(a => ignorKeys.Contains(a.Key)); FormulaHelper.UpdateEntity(projectInfo, schemeDic); projectInfo.ReBuild(); marketProject.Phase = projectInfo.PhaseValue; marketProject.Name = projectInfo.Name; marketProject.Code = projectInfo.Code; marketProject.Phase = projectInfo.PhaseValue; marketProject.ProjectClass = projectInfo.ProjectClass; marketProject.Customer = projectInfo.CustomerID; marketProject.CustomerName = projectInfo.CustomerName; marketProject.CreateDate = DateTime.Now; marketProject.EngineeringInfo = projectInfo.EngineeringInfoID; marketProject.ChargerDept = projectInfo.ChargeDeptID; marketProject.ChargerDeptName = projectInfo.ChargeDeptName; marketProject.ChargerUser = projectInfo.ChargeUserID; marketProject.ChargerUserName = projectInfo.ChargeUserName; marketProject.Country = projectInfo.Country; marketProject.Province = projectInfo.Province; marketProject.City = projectInfo.City; marketProject.ProjectScale = projectInfo.ProjectLevel.HasValue ? projectInfo.ProjectLevel.Value.ToString() : ""; } List <S_P_MileStone> deleteMileStoneList = new List <S_P_MileStone>(); if (entity != null) { var selectCodes = entity.T_SC_SingleProjectScheme_MileStoneList.Select(a => a.Code).ToList(); deleteMileStoneList = projectInfo.S_P_MileStone.Where(a => !selectCodes.Contains(a.Code)).ToList(); entity.Push(dic); } if (marketProject != null) { marketProject.State = ProjectCommoneState.Execute.ToString(); } marketEntities.SaveChanges(); this.BusinessEntities.SaveChanges(); //同步关联的收款项的里程碑信息:时间、状态 var fo = new Basic.Controllers.MileStoneExecuteController(); //找到删除的里程碑的所有收款项,在这些收款项中去除当前里程碑,在同步这些收款项的里程碑信息 foreach (var item in deleteMileStoneList) { fo.UpdateReceiptObjByDelMeliStoneID(item.ID); } foreach (var item in projectInfo.S_P_MileStone.ToList()) { fo.SyncReceiptObj(item); } marketEntities.SaveChanges(); }
protected override void OnFlowEnd(T_SceneMark_Entry entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { //流程结束之后更新库存数量 var lstDetail = BusinessEntities.Set <T_SceneMark_Entry_EntryDetail>().Where(x => x.T_SceneMark_EntryID == entity.ID); lstDetail.ToList().ForEach(x => { var dicModel = BusinessEntities.Set <T_SceneMark_Dictionaries>().FirstOrDefault(d => d.ID == x.DictID); if (dicModel != null) { dicModel.StockQuantity = (Convert.ToInt32(dicModel.StockQuantity) + Convert.ToInt32(x.EntryQuantity)).ToString(); } }); BusinessEntities.SaveChanges(); } base.OnFlowEnd(entity, taskExec, routing); }
protected override void OnFlowEnd(T_C_CreditNoteApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { entity.State = InvoiceApplyState.Wait.ToString(); var contract = this.BusinessEntities.Set <S_C_ManageContract>().Find(entity.Contract); if (contract == null) { throw new Formula.Exceptions.BusinessException("没有找到对应的合同信息,开票操作失败"); } entity.Submit(); this.BusinessEntities.SaveChanges(); contract.SummaryInvoiceData(); this.BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_F_LoanApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { entity.Push(); } this.BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(T_SC_MajorDesignInput entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { entity.Publish(); } this.BusinessEntities.SaveChanges(); }
// // GET: /OfficeAuto/AutoForm/LogisticsOfficeApply/ protected override void OnFlowEnd(T_Logistics_OfficeApply entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var dept = entity.ApplyDept; var deptName = entity.ApplyDeptName; var type = entity.ApplyType; if (type == "Add") { var office = entity.NewOfficeName; var officeEntity = BusinessEntities.Set <T_Logistics_Office>().Find(office); if (officeEntity != null) { officeEntity.CurrentUseDept = dept; officeEntity.CurrentUseDeptName = deptName; officeEntity.UseStatus = "Use"; //新增记录 var record = new S_E_Logistics_OfficeRecord() { ID = FormulaHelper.CreateGuid(), CreateDate = DateTime.Now, CreateUser = CurrentUserInfo.UserName, CreateUserID = CurrentUserInfo.UserID, CompanyID = CurrentUserInfo.UserCompanyID, OrgID = CurrentUserInfo.UserOrgID, Dept = dept, DeptName = deptName, Office = officeEntity.ID, OfficeName = officeEntity.Name, Pos = officeEntity.Pos, PosName = officeEntity.PosName, Area = officeEntity.Area, Number = officeEntity.Number, StartDate = entity.StartDate }; BusinessEntities.Set <S_E_Logistics_OfficeRecord>().Add(record); BusinessEntities.SaveChanges(); } } if (type == "Back") { var office = entity.BackOfficeName; var officeEntity = BusinessEntities.Set <T_Logistics_Office>().Find(office); if (officeEntity != null) { officeEntity.CurrentUseDept = string.Empty; officeEntity.CurrentUseDeptName = string.Empty; officeEntity.UseStatus = "NoUse"; var record = BusinessEntities.Set <S_E_Logistics_OfficeRecord>().Where(p => p.Dept == dept && p.EndDate == null && p.Office == officeEntity.ID).FirstOrDefault(); record.EndDate = entity.BackDate; BusinessEntities.SaveChanges(); } } if (type == "Change") { var oldOffice = entity.Change_OldOfficeName; var newOffice = entity.Change_NewOfficeName; //退 var oldEntity = BusinessEntities.Set <T_Logistics_Office>().Find(oldOffice); if (oldEntity != null) { oldEntity.CurrentUseDept = string.Empty; oldEntity.CurrentUseDeptName = string.Empty; oldEntity.UseStatus = "NoUse"; var record = BusinessEntities.Set <S_E_Logistics_OfficeRecord>().Where(p => p.Dept == dept && p.EndDate == null && p.Office == oldEntity.ID).FirstOrDefault(); record.EndDate = entity.BackDate; } //增 var newEntity = BusinessEntities.Set <T_Logistics_Office>().Find(newOffice); if (newEntity != null) { newEntity.CurrentUseDept = dept; newEntity.CurrentUseDeptName = deptName; newEntity.UseStatus = "Use"; //新增记录 var record = new S_E_Logistics_OfficeRecord() { ID = FormulaHelper.CreateGuid(), CreateDate = DateTime.Now, CreateUser = CurrentUserInfo.UserName, CreateUserID = CurrentUserInfo.UserID, OrgID = CurrentUserInfo.UserOrgID, Dept = dept, DeptName = deptName, Office = newEntity.ID, OfficeName = newEntity.Name, Pos = newEntity.Pos, PosName = newEntity.PosName, Area = newEntity.Area, Number = newEntity.Number, StartDate = entity.StartDate }; BusinessEntities.Set <S_E_Logistics_OfficeRecord>().Add(record); } BusinessEntities.SaveChanges(); } }
protected override void OnFlowEnd(T_CP_TaskNotice entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity == null) { throw new Formula.Exceptions.BusinessException("没有找到指定的任务单,立项失败"); } var marketEntities = FormulaHelper.GetEntities <Market.Logic.Domain.MarketEntities>(); var projectList = new List <S_I_ProjectInfo>(); if (!String.IsNullOrEmpty(entity.ProjectInfoID) && this.BusinessEntities.Set <S_I_ProjectInfo>().Any(a => a.ID == entity.ProjectInfoID)) { #region 任务单升版 S_I_ProjectInfo projectInfo = null; S_I_Project project = null; projectInfo = entity.UpGrade(); project = marketEntities.S_I_Project.FirstOrDefault(d => d.ID == projectInfo.MarketProjectInfoID); project.Name = entity.ProjectInfo; project.Code = entity.SerialNumber; project.Phase = entity.Phase; project.ProjectClass = entity.ProjectClass; project.Customer = entity.Customer; project.CustomerName = entity.CustomerName; project.CreateDate = DateTime.Now; project.EngineeringInfo = entity.EngineeringID; project.ChargerDept = string.IsNullOrEmpty(entity.ChargeDept) ? entity.DesignDept : entity.ChargeDept; project.ChargerDeptName = string.IsNullOrEmpty(entity.ChargeDeptName) ? entity.DesignDeptName : entity.ChargeDeptName; project.ChargerUser = entity.ChargeUser; project.ChargerUserName = entity.ChargeUserName; project.Country = entity.Country; project.Province = entity.Province; project.Area = entity.Area; if (string.IsNullOrEmpty(project.Area)) { //获取省份对应的地区(SubCategory) var enumItem = EnumBaseHelper.GetEnumDef("System.Province").EnumItem.FirstOrDefault(a => a.Code == entity.Province); if (enumItem != null) { project.Area = enumItem.SubCategory; } } project.City = entity.City; project.ProjectScale = entity.ProjectLevel; projectInfo.ModifyDate = DateTime.Now; projectInfo.ModifyUser = entity.CreateUser; projectInfo.ModifyUserID = entity.CreateUserID; //修改经营库项目名称冗余字段 if (!string.IsNullOrEmpty(projectInfo.MarketProjectInfoID)) { if (entity.ContractValue.HasValue && String.IsNullOrEmpty(entity.ContractInfo)) { marketEntities.S_C_ManageContract_ProjectRelation.Where(a => a.ProjectID == projectInfo.MarketProjectInfoID && a.S_C_ManageContractID == entity.ContractInfo).Update(a => a.ProjectValue = entity.ContractValue); } marketEntities.S_C_ManageContract_ProjectRelation.Where(a => a.ProjectID == projectInfo.MarketProjectInfoID).Update(a => a.ProjectName = entity.ProjectInfo); marketEntities.S_C_ManageContract_ReceiptObj.Where(a => a.ProjectInfo == projectInfo.MarketProjectInfoID).Update(a => a.ProjectInfoName = entity.ProjectInfo); marketEntities.S_C_PlanReceipt.Where(a => a.ProjectID == projectInfo.MarketProjectInfoID).Update(a => a.ProjectName = entity.ProjectInfo); marketEntities.S_FC_CostInfo.Where(a => a.ProjectID == projectInfo.MarketProjectInfoID).Update(a => a.ProjectName = entity.ProjectInfo); marketEntities.S_SP_SupplierContract.Where(a => a.ProjectInfo == projectInfo.MarketProjectInfoID).Update(a => a.ProjectInfoName = entity.ProjectInfo); } projectList.Add(projectInfo); #endregion } else { #region 新建任务单立项 #region 如果工程信息为空,则默认创建工程 var engineering = marketEntities.S_I_Engineering.Find(entity.EngineeringID); bool newEngineer = false; if (engineering == null) { engineering = new S_I_Engineering(); engineering.ID = FormulaHelper.CreateGuid(); marketEntities.S_I_Engineering.Add(engineering); newEngineer = true; } engineering.Name = String.IsNullOrEmpty(entity.EngineeringName) ? entity.ProjectInfo : entity.EngineeringName; if (!String.IsNullOrEmpty(entity.Customer)) { engineering.CustomerInfo = entity.Customer; engineering.CustomerInfoName = entity.CustomerName; } engineering.Code = String.IsNullOrEmpty(entity.EngineeringCode) ? entity.SerialNumber : entity.EngineeringCode; if (!string.IsNullOrEmpty(entity.MainDeptInfo)) { engineering.MainDept = entity.MainDeptInfo; engineering.MainDeptName = entity.MainDeptInfoName; } else if (string.IsNullOrEmpty(engineering.MainDept)) { engineering.MainDept = entity.ChargeDept; engineering.MainDeptName = entity.ChargeDeptName; } engineering.OtherDept = String.IsNullOrEmpty(entity.EngineeringOtherDept) ? entity.OtherDept : entity.EngineeringOtherDept; engineering.OtherDeptName = String.IsNullOrEmpty(entity.EngineeringOtherDeptName) ? entity.OtherDeptName : entity.EngineeringOtherDeptName; engineering.ChargerUser = String.IsNullOrEmpty(entity.EngineeringChargeUser) ? entity.ChargeUser : entity.EngineeringChargeUser; engineering.ChargerUserName = String.IsNullOrEmpty(entity.EngineeringChargeUserName) ? entity.ChargeUserName : entity.EngineeringChargeUserName; engineering.Country = entity.Country; engineering.Province = entity.Province; engineering.City = entity.City; engineering.Area = entity.Area; engineering.Proportion = entity.BuildArea; engineering.Address = entity.BuildAddress; engineering.LandingArea = entity.LandArea; engineering.CreateDate = DateTime.Now; if (!String.IsNullOrEmpty(entity.Investment)) { engineering.Investment = Convert.ToDecimal(entity.Investment); } if (newEngineer) { entity.EngineeringID = engineering.ID; entity.EngineeringName = engineering.Name; entity.EngineeringCode = engineering.Code; entity.EngineeringChargeUser = engineering.ChargerUser; entity.EngineeringChargeUserName = engineering.ChargerUserName; entity.MainDeptInfo = engineering.MainDept; entity.MainDeptInfoName = engineering.MainDeptName; entity.EngineeringOtherDept = engineering.OtherDept; entity.EngineeringOtherDeptName = engineering.OtherDeptName; } var phaseName = ""; var phaseList = BaseConfigFO.GetWBSAttrList(WBSNodeType.Phase); var entityPhaseList = phaseList.Where(d => entity.Phase.Contains(d.Code)).ToList(); foreach (var item in entityPhaseList) { phaseName += item.Name + ","; } engineering.PhaseContent = phaseName.TrimEnd(','); engineering.PhaseValue = entity.Phase; #endregion if (!string.IsNullOrEmpty(entity.MultiProjMode) && entity.MultiProjMode.ToLower() == "1") { var list = entity.Phase.Split(','); if (list.Length == 0) { throw new Formula.Exceptions.BusinessException("没有指定阶段"); } string projIds = ""; foreach (var item in entity.T_CP_TaskNotice_PhaseDetail) { var prj = AddProject(entity, engineering, item); projIds += prj.ID + ","; item.ProjectInfoID = prj.ID; projectList.Add(prj); } entity.ProjectInfoID = projIds.TrimEnd(','); } else { var prj = AddProject(entity, engineering); projectList.Add(prj); } #endregion } this.BusinessEntities.SaveChanges(); marketEntities.SaveChanges(); #region 自动同步核算项目 Expenses.Logic.CBSInfoFO.SynCBSInfo(FormulaHelper.ModelToDic <T_CP_TaskNotice>(entity), Expenses.Logic.SetCBSOpportunity.TaskNoticeComplete); #endregion }
protected override void OnFlowEnd(T_SC_DesignPlanPetrifaction entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { if (entity != null) { List <S_P_MileStone> deleteMileStoneList = new List <S_P_MileStone>(); var projectEntities = FormulaHelper.GetEntities <ProjectEntities>(); var projectInfo = projectEntities.Set <S_I_ProjectInfo>().Find(entity.ProjectInfoID); var detailMileStoneList = entity.T_SC_DesignPlanPetrifaction_MilestoneList.ToList(); var selectCodes = detailMileStoneList.Select(a => a.Code).ToList(); deleteMileStoneList = projectInfo.S_P_MileStone.Where(a => !selectCodes.Contains(a.Code)).ToList(); entity.Push(); this.BusinessEntities.SaveChanges(); //同步关联的收款项的里程碑信息:时间、状态 var fo = new Basic.Controllers.MileStoneExecuteController(); //找到删除的里程碑的所有收款项,在这些收款项中去除当前里程碑,在同步这些收款项的里程碑信息 //foreach (var item in deleteMileStoneList) //{ // fo.UpdateReceiptObjByDelMeliStoneID(item.ID); //} //foreach (var item in projectInfo.S_P_MileStone.ToList()) //{ // fo.SyncReceiptObj(item); //} //FormulaHelper.GetEntities<Market.Logic.Domain.MarketEntities>().SaveChanges(); } }
protected override void OnFlowEnd(T_Monthlyreport_Monthlyreportfill entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { var list = entity.T_Monthlyreport_Monthlyreportfill_Advice.ToList(); foreach (var item in list) { var S_E_MonthAdvice = new S_E_MonthAdvice(); S_E_MonthAdvice.ID = FormulaHelper.CreateGuid(); S_E_MonthAdvice.Advice = item.Advice; S_E_MonthAdvice.BelongMonth = Convert.ToDateTime(entity.Filldate).Month; S_E_MonthAdvice.BelongYear = Convert.ToDateTime(entity.Filldate).Year; S_E_MonthAdvice.ContentOutline = item.Content; S_E_MonthAdvice.Dept = item.Dept; S_E_MonthAdvice.DeptName = item.DeptName; S_E_MonthAdvice.Filldate = entity.Filldate; S_E_MonthAdvice.T_Monthlyreport_MonthlyreportfillID = item.T_Monthlyreport_MonthlyreportfillID; S_E_MonthAdvice.FillUserID = entity.Fillname; S_E_MonthAdvice.FillUserName = entity.FillnameName; BusinessEntities.Set <S_E_MonthAdvice>().Add(S_E_MonthAdvice); } BusinessEntities.SaveChanges(); }
protected override void OnFlowEnd(S_C_BOQ_Version entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing) { base.OnFlowEnd(entity, taskExec, routing); //获取detail }