using OASystem.API.OAMethodLib; using OASystem.Domain.Dtos.Groups; using OASystem.Domain.Entities.Groups; using OASystem.Infrastructure.Repositories.Groups; using System.Configuration; namespace OASystem.API.OAMethodLibs { /// /// 团组流程管控 /// public static class GroupStepForDelegation { /// /// 创建流程管控 /// /// 团组Id public static async void CreateWorkStep(int DiId) { var _grpScheduleRep = AutofacIocManager.Instance.GetService(); //判断是否已存在团组的流程管控 Grp_ScheduleInfo check = _grpScheduleRep.Query(s => s.DiId == DiId).First(); if (check == null) { _grpScheduleRep.BeginTran(); GroupsConfig _groupConfig = AutofacIocManager.Instance.GetService(); #region 主流程 Grp_ScheduleInfo _primary = new Grp_ScheduleInfo(); _primary.CreateUserId = _groupConfig.AutoCreate; _primary.DiId = DiId; _primary.Exception = 0; _primary.ExpectBeginDt = DateTime.Now.AddDays(_groupConfig.ExBeginDays); _primary.ExpectEndDt = DateTime.Now.AddDays(_groupConfig.ExEndDays); _primary.Leader = _groupConfig.Leader; _primary.PrimaryStep = GrpSchedulePrimaryStepEnum.Wait; _primary.Remark = "请设置各流程预计开始/结束时间"; int _primaryId = await _grpScheduleRep.AddAsync(_primary); if (_primaryId > 0) { #region 子流程 #region 经费预算 Grp_ScheduleDetailInfo grp_budget = new Grp_ScheduleDetailInfo(); grp_budget.CreateTime = DateTime.Now; grp_budget.CreateUserId = _groupConfig.AutoCreate; //grp_budget.Duty= #endregion #endregion } else { _grpScheduleRep.RollbackTran(); } #endregion _grpScheduleRep.CommitTran(); } } } }