GroupStepForDelegation.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using OASystem.API.OAMethodLib;
  2. using OASystem.Domain.Dtos.Groups;
  3. using OASystem.Domain.Entities.Groups;
  4. using OASystem.Infrastructure.Repositories.Groups;
  5. using System.Configuration;
  6. namespace OASystem.API.OAMethodLibs
  7. {
  8. /// <summary>
  9. /// 团组流程管控
  10. /// </summary>
  11. public static class GroupStepForDelegation
  12. {
  13. /// <summary>
  14. /// 创建流程管控
  15. /// </summary>
  16. /// <param name="Diid">团组Id</param>
  17. public static async void CreateWorkStep(int DiId)
  18. {
  19. var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
  20. //判断是否已存在团组的流程管控
  21. Grp_ScheduleInfo check = _grpScheduleRep.Query(s => s.DiId == DiId).First();
  22. if (check == null)
  23. {
  24. _grpScheduleRep.BeginTran();
  25. GroupsConfig _groupConfig = AutofacIocManager.Instance.GetService<GroupsConfig>();
  26. #region 主流程
  27. Grp_ScheduleInfo _primary = new Grp_ScheduleInfo();
  28. _primary.CreateUserId = _groupConfig.AutoCreate;
  29. _primary.DiId = DiId;
  30. _primary.Exception = 0;
  31. _primary.ExpectBeginDt = DateTime.Now.AddDays(_groupConfig.ExBeginDays);
  32. _primary.ExpectEndDt = DateTime.Now.AddDays(_groupConfig.ExEndDays);
  33. _primary.Leader = _groupConfig.Leader;
  34. _primary.PrimaryStep = GrpSchedulePrimaryStepEnum.Wait;
  35. _primary.Remark = "请设置各流程预计开始/结束时间";
  36. int _primaryId = await _grpScheduleRep.AddAsync(_primary);
  37. if (_primaryId > 0)
  38. {
  39. #region 子流程
  40. #region 经费预算
  41. Grp_ScheduleDetailInfo grp_budget = new Grp_ScheduleDetailInfo();
  42. grp_budget.CreateTime = DateTime.Now;
  43. grp_budget.CreateUserId = _groupConfig.AutoCreate;
  44. //grp_budget.Duty=
  45. #endregion
  46. #endregion
  47. }
  48. else
  49. {
  50. _grpScheduleRep.RollbackTran();
  51. }
  52. #endregion
  53. _grpScheduleRep.CommitTran();
  54. }
  55. }
  56. }
  57. }