GroupStepForDelegation.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. using Google.Protobuf.WellKnownTypes;
  2. using Microsoft.AspNetCore.DataProtection.KeyManagement;
  3. using OASystem.API.OAMethodLib;
  4. using OASystem.Domain.Common;
  5. using OASystem.Domain.Dtos.Groups;
  6. using OASystem.Domain.Entities.Groups;
  7. using OASystem.Domain.Enums;
  8. using OASystem.Infrastructure.Repositories.Groups;
  9. using System.Configuration;
  10. using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
  11. namespace OASystem.API.OAMethodLibs
  12. {
  13. /// <summary>
  14. /// 团组流程管控
  15. /// </summary>
  16. public static class GroupStepForDelegation
  17. {
  18. private readonly static GrpScheduleRepository _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
  19. /// <summary>
  20. /// 创建流程管控
  21. /// </summary>
  22. /// <param name="DiId">团组Id</param>
  23. public static async void CreateWorkStep(int DiId)
  24. {
  25. //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
  26. //判断是否已存在团组的流程管控
  27. Grp_ScheduleInfo check = _grpScheduleRep.Query(s => s.DiId == DiId).First();
  28. if (check == null)
  29. {
  30. _grpScheduleRep.BeginTran();
  31. GroupsConfig _groupConfig = AutofacIocManager.Instance.GetService<GroupsConfig>();
  32. DateTime dftBeginDt = DateTime.Now.AddDays(_groupConfig.ExBeginDays);//默认预计开始时间
  33. DateTime dftEndDt = DateTime.Now.AddDays(_groupConfig.ExEndDays);//默认预计结束时间
  34. #region 主流程
  35. Grp_ScheduleInfo _primary = new Grp_ScheduleInfo();
  36. _primary.CreateUserId = _groupConfig.AutoCreate;
  37. _primary.DiId = DiId;
  38. _primary.Exception = 0;
  39. _primary.ExpectBeginDt = dftBeginDt;
  40. _primary.ExpectEndDt = dftEndDt;
  41. _primary.Leader = _groupConfig.Leader;
  42. _primary.PrimaryStep = GrpSchedulePrimaryStepEnum.Wait;
  43. _primary.Remark = "请设置各流程负责人、预计开始/结束时间";
  44. int _primaryId = await _grpScheduleRep.AddAsync(_primary);
  45. if (_primaryId > 0)
  46. {
  47. #region 子流程
  48. List<Grp_ScheduleDetailInfo> entityList = new List<Grp_ScheduleDetailInfo>();
  49. #region 模板
  50. Grp_ScheduleDetailInfo _model = new Grp_ScheduleDetailInfo();
  51. _model.CreateUserId = _groupConfig.AutoCreate;
  52. _model.Duty = _groupConfig.DefaultUser;
  53. _model.Exception = 0;
  54. _model.ExpectBeginDt = dftBeginDt;
  55. _model.ExpectEndDt = dftEndDt;
  56. _model.Remark = "未设置负责人";
  57. _model.ScheduleId = DiId;
  58. _model.StepStatus = 0;
  59. #endregion
  60. #region 经费预算
  61. Grp_ScheduleDetailInfo grp_budget202 = _model.DeepClone();
  62. grp_budget202.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BudgetChild02);
  63. grp_budget202.ParentStep = (int)GrpSchedulePrimaryStepEnum.Budget;
  64. grp_budget202.Step = (int)GrpSchedulePrimaryStepEnum.BudgetChild02;
  65. entityList.Add(grp_budget202);
  66. #endregion
  67. #region 市场部人员报价对接/反馈
  68. //上传明细单
  69. Grp_ScheduleDetailInfo grp_feedback302 = _model.DeepClone();
  70. grp_feedback302.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild02);
  71. grp_feedback302.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
  72. grp_feedback302.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild02;
  73. entityList.Add(grp_feedback302);
  74. //录入最终总经费预算
  75. Grp_ScheduleDetailInfo grp_feedback303 = _model.DeepClone();
  76. grp_feedback303.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild03);
  77. grp_feedback303.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
  78. grp_feedback303.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild03;
  79. entityList.Add(grp_feedback303);
  80. //完成报价对接/反馈
  81. Grp_ScheduleDetailInfo grp_feedback304 = _model.DeepClone();
  82. grp_feedback304.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild04);
  83. grp_feedback304.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
  84. grp_feedback304.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild04;
  85. entityList.Add(grp_feedback304);
  86. #endregion
  87. #region (目前为空)报批流程
  88. #endregion
  89. #region 护照/签证
  90. //收集资料
  91. Grp_ScheduleDetailInfo grp_visa502 = _model.DeepClone();
  92. grp_visa502.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild02);
  93. grp_visa502.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  94. grp_visa502.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild02;
  95. entityList.Add(grp_visa502);
  96. //取护照资料
  97. Grp_ScheduleDetailInfo grp_visa503 = _model.DeepClone();
  98. grp_visa503.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild03);
  99. grp_visa503.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  100. grp_visa503.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild03;
  101. entityList.Add(grp_visa503);
  102. //填资料
  103. Grp_ScheduleDetailInfo grp_visa504 = _model.DeepClone();
  104. grp_visa504.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild04);
  105. grp_visa504.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  106. grp_visa504.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild04;
  107. entityList.Add(grp_visa504);
  108. //送签
  109. Grp_ScheduleDetailInfo grp_visa505 = _model.DeepClone();
  110. grp_visa505.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild05);
  111. grp_visa505.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  112. grp_visa505.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild05;
  113. entityList.Add(grp_visa505);
  114. //出签+取护照
  115. Grp_ScheduleDetailInfo grp_visa506 = _model.DeepClone();
  116. grp_visa506.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild06);
  117. grp_visa506.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  118. grp_visa506.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild06;
  119. entityList.Add(grp_visa506);
  120. //归还护照
  121. Grp_ScheduleDetailInfo grp_visa507 = _model.DeepClone();
  122. grp_visa507.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild07);
  123. grp_visa507.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  124. grp_visa507.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild07;
  125. entityList.Add(grp_visa507);
  126. //签证费用录入
  127. Grp_ScheduleDetailInfo grp_visa508 = _model.DeepClone();
  128. grp_visa508.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild08);
  129. grp_visa508.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  130. grp_visa508.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild08;
  131. entityList.Add(grp_visa508);
  132. #endregion
  133. #region 业务操作
  134. //机票
  135. Grp_ScheduleDetailInfo grp_busJP601 = _model.DeepClone();
  136. grp_busJP601.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJP);
  137. grp_busJP601.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  138. grp_busJP601.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
  139. entityList.Add(grp_busJP601);
  140. //机票-询价并导入黑屏代码
  141. Grp_ScheduleDetailInfo grp_busJP6012 = _model.DeepClone();
  142. grp_busJP6012.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild02);
  143. grp_busJP6012.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
  144. grp_busJP6012.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild02;
  145. entityList.Add(grp_busJP6012);
  146. //机票-机票已占位
  147. Grp_ScheduleDetailInfo grp_busJP6013 = _model.DeepClone();
  148. grp_busJP6013.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild03);
  149. grp_busJP6013.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
  150. grp_busJP6013.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild03;
  151. entityList.Add(grp_busJP6013);
  152. //机票-已出票
  153. Grp_ScheduleDetailInfo grp_busJP6014 = _model.DeepClone();
  154. grp_busJP6014.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild04);
  155. grp_busJP6014.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
  156. grp_busJP6014.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild04;
  157. entityList.Add(grp_busJP6014);
  158. //机票-机票费用录入
  159. Grp_ScheduleDetailInfo grp_busJP6015 = _model.DeepClone();
  160. grp_busJP6015.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild05);
  161. grp_busJP6015.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
  162. grp_busJP6015.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild05;
  163. entityList.Add(grp_busJP6015);
  164. //酒店
  165. Grp_ScheduleDetailInfo grp_busJD602 = _model.DeepClone();
  166. grp_busJD602.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJD);
  167. grp_busJD602.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  168. grp_busJD602.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJD;
  169. entityList.Add(grp_busJD602);
  170. //酒店-酒店费用录入
  171. Grp_ScheduleDetailInfo grp_busJD6022 = _model.DeepClone();
  172. grp_busJD6022.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJDChild02);
  173. grp_busJD6022.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJD;
  174. grp_busJD6022.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJDChild02;
  175. entityList.Add(grp_busJD6022);
  176. //OP
  177. Grp_ScheduleDetailInfo grp_busOP603 = _model.DeepClone();
  178. grp_busOP603.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessOP);
  179. grp_busOP603.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  180. grp_busOP603.Step = (int)GrpSchedulePrimaryStepEnum.BusinessOP;
  181. entityList.Add(grp_busOP603);
  182. //OP-OP费用录入
  183. Grp_ScheduleDetailInfo grp_busOP6032 = _model.DeepClone();
  184. grp_busOP6032.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessOPChild02);
  185. grp_busOP6032.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessOP;
  186. grp_busOP6032.Step = (int)GrpSchedulePrimaryStepEnum.BusinessOPChild02;
  187. entityList.Add(grp_busOP6032);
  188. //商邀
  189. Grp_ScheduleDetailInfo grp_busSY604 = _model.DeepClone();
  190. grp_busSY604.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessSY);
  191. grp_busSY604.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  192. grp_busSY604.Step = (int)GrpSchedulePrimaryStepEnum.BusinessSY;
  193. entityList.Add(grp_busSY604);
  194. //商邀-商邀费用录入
  195. Grp_ScheduleDetailInfo grp_busSY6042 = _model.DeepClone();
  196. grp_busSY6042.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessSYChild02);
  197. grp_busSY6042.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessSY;
  198. grp_busSY6042.Step = (int)GrpSchedulePrimaryStepEnum.BusinessSYChild02;
  199. entityList.Add(grp_busSY6042);
  200. //其他
  201. Grp_ScheduleDetailInfo grp_busQT605 = _model.DeepClone();
  202. grp_busQT605.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessQT);
  203. grp_busQT605.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
  204. grp_busQT605.Step = (int)GrpSchedulePrimaryStepEnum.BusinessQT;
  205. entityList.Add(grp_busQT605);
  206. //商邀-商邀费用录入
  207. Grp_ScheduleDetailInfo grp_busQT6052 = _model.DeepClone();
  208. grp_busQT6052.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessQTChild02);
  209. grp_busQT6052.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessQT;
  210. grp_busQT6052.Step = (int)GrpSchedulePrimaryStepEnum.BusinessQTChild02;
  211. entityList.Add(grp_busQT6052);
  212. #endregion
  213. #region 费用审批
  214. //机票费用审批
  215. Grp_ScheduleDetailInfo grp_cost702 = _model.DeepClone();
  216. grp_cost702.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild02);
  217. grp_cost702.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
  218. grp_cost702.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild02;
  219. grp_cost702.Duty = _groupConfig.Boss;
  220. entityList.Add(grp_cost702);
  221. //酒店费用审批
  222. Grp_ScheduleDetailInfo grp_cost703 = _model.DeepClone();
  223. grp_cost703.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild03);
  224. grp_cost703.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
  225. grp_cost703.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild03;
  226. grp_cost703.Duty = _groupConfig.Boss;
  227. entityList.Add(grp_cost703);
  228. //OP费用审批
  229. Grp_ScheduleDetailInfo grp_cost704 = _model.DeepClone();
  230. grp_cost704.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild04);
  231. grp_cost704.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
  232. grp_cost704.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild04;
  233. grp_cost704.Duty = _groupConfig.Boss;
  234. entityList.Add(grp_cost704);
  235. //OP费用审批
  236. Grp_ScheduleDetailInfo grp_cost705 = _model.DeepClone();
  237. grp_cost705.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild05);
  238. grp_cost705.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
  239. grp_cost705.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild05;
  240. grp_cost705.Duty = _groupConfig.Boss;
  241. entityList.Add(grp_cost705);
  242. //增减款项审批
  243. Grp_ScheduleDetailInfo grp_cost706 = _model.DeepClone();
  244. grp_cost706.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild06);
  245. grp_cost706.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
  246. grp_cost706.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild06;
  247. grp_cost706.Duty = _groupConfig.Boss;
  248. entityList.Add(grp_cost706);
  249. #endregion
  250. #region 付款给供应商
  251. //OP费用付款
  252. Grp_ScheduleDetailInfo grp_pay802 = _model.DeepClone();
  253. grp_pay802.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild02);
  254. grp_pay802.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
  255. grp_pay802.Step = (int)GrpSchedulePrimaryStepEnum.PayChild02;
  256. entityList.Add(grp_pay802);
  257. //商邀费用付款
  258. Grp_ScheduleDetailInfo grp_pay803 = _model.DeepClone();
  259. grp_pay803.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild03);
  260. grp_pay803.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
  261. grp_pay803.Step = (int)GrpSchedulePrimaryStepEnum.PayChild03;
  262. entityList.Add(grp_pay803);
  263. //增减款项付款
  264. Grp_ScheduleDetailInfo grp_pay804 = _model.DeepClone();
  265. grp_pay804.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild04);
  266. grp_pay804.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
  267. grp_pay804.Step = (int)GrpSchedulePrimaryStepEnum.PayChild04;
  268. entityList.Add(grp_pay804);
  269. #endregion
  270. #region (目前为空)出行事项会议
  271. #endregion
  272. #region (目前为空)送机
  273. #endregion
  274. #region (目前为空)接机
  275. #endregion
  276. #region (目前为空)收款
  277. #endregion
  278. #region (目前为空)团组完成
  279. #endregion
  280. //SqlSugar批量添加
  281. _grpScheduleRep.bulkInsert(entityList);
  282. #endregion
  283. #region 流程管控成员
  284. string sqlPerson = string.Format(@"Select u.Id As SysUserId,u.CnName As SysUserName,JobName as JobStr
  285. From Sys_Users As u With(Nolock)
  286. Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id
  287. Inner Join Sys_JobPost as j With(Nolock) On u.JobPostId=j.Id
  288. Where d.Id={0} And u.Id not in({1})", DepartmentCode.IC, _groupConfig.FilterUser);
  289. List<Grp_SchedulePersonInfo> personList = await _grpScheduleRep.GetEntityList_SchedulePersonBySql(sqlPerson);
  290. if (personList.Count > 0)
  291. {
  292. foreach (var item in personList)
  293. {
  294. item.CreateUserId = _groupConfig.DefaultUser;
  295. item.ScheduleId = DiId;
  296. }
  297. _grpScheduleRep.bulkInsert(personList);
  298. }
  299. #endregion
  300. }
  301. else
  302. {
  303. _grpScheduleRep.RollbackTran();
  304. }
  305. #endregion
  306. _grpScheduleRep.CommitTran();
  307. }
  308. }
  309. public static async void ChangeStepForPrimary(int DiId, GrpSchedulePrimaryStepEnum primary, int isDel, int exception, string remark)
  310. {
  311. //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
  312. string sqlPrimary = string.Format(@" Select * From Grp_Schedule With(Nolock) Where IsDel=0 And DiId={0} ", DiId);
  313. Grp_ScheduleInfo _grpPrimaryInfo = _grpScheduleRep.GetSingleInfoBySqlWithNolock(sqlPrimary);
  314. if (_grpPrimaryInfo != null)
  315. {
  316. _grpPrimaryInfo.PrimaryStep = primary;
  317. _grpPrimaryInfo.IsDel = isDel;
  318. _grpPrimaryInfo.Exception = exception;
  319. _grpPrimaryInfo.Remark += ";" + remark;
  320. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleInfo>()
  321. .Where(s => s.Id == _grpPrimaryInfo.Id)
  322. .UpdateColumns(s => new { s.PrimaryStep, s.IsDel, s.Exception, s.Remark })
  323. .ExecuteCommandAsync();
  324. }
  325. }
  326. #region 流程管控步骤推进
  327. /// <summary>
  328. /// 刷新团组管控最新状态,或推进流程到下一节点
  329. /// </summary>
  330. /// <param name="scheduleId">团组流程Id</param>
  331. public static async void RefreshWorkStep(int scheduleId, bool auto = false)
  332. {
  333. //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
  334. string sqlPrimary = string.Format(@" Select * From Grp_Schedule With(Nolock) Where IsDel=0 And Id={0} ", scheduleId);
  335. Grp_ScheduleInfo _grpPrimaryInfo = _grpScheduleRep.GetSingleInfoBySqlWithNolock(sqlPrimary);
  336. if (_grpPrimaryInfo != null)
  337. {
  338. List<Grp_ScheduleDetailInfo> _list = _grpScheduleRep._sqlSugar.Queryable<Grp_ScheduleDetailInfo>()
  339. .Where(s => s.ScheduleId == scheduleId && s.IsDel != 1 && s.ParentStep == (int)_grpPrimaryInfo.PrimaryStep && s.StepStatus != 2)
  340. .ToList();
  341. if (_list.Count > 0)
  342. {
  343. //未完成主流程节点下所有步骤任务
  344. }
  345. else
  346. {
  347. //可推进节点
  348. if (auto)
  349. {
  350. int nextPrimaryStep = (int)_grpPrimaryInfo.PrimaryStep + 1;
  351. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleInfo>()
  352. .Where(s => s.Id == _grpPrimaryInfo.Id)
  353. .UpdateColumns(s => new { nextPrimaryStep })
  354. .ExecuteCommandAsync();
  355. }
  356. }
  357. //eg:CheckStep_Budget
  358. //switch (_grpPrimaryInfo.PrimaryStep)
  359. //{
  360. // case GrpSchedulePrimaryStepEnum.Budget: CheckStep_Budget(scheduleId); break;
  361. //}
  362. }
  363. }
  364. /// <summary>
  365. /// 暂无需求,先保存,可扩展至查询验证主流程下每一个详细流程步骤对应的业务操作是否完成,需要其他业务提供验证方法
  366. /// 查看流程-经费预算
  367. /// </summary>
  368. /// <param name="scheduleId"></param>
  369. /// <returns>true:已完成所有步骤,false:存在未完成的步骤(Grp_ScheduleDetail.StepStatus:0/1/2)</returns>
  370. private static bool CheckStep_Budget(int scheduleId)
  371. {
  372. List<Grp_ScheduleDetailInfo> _list = _grpScheduleRep._sqlSugar.Queryable<Grp_ScheduleDetailInfo>()
  373. .Where(s => s.ScheduleId == scheduleId && s.IsDel != 1 && s.ParentStep == (int)GrpSchedulePrimaryStepEnum.Budget)
  374. .ToList();
  375. foreach (var item in _list)
  376. {
  377. switch (item.Step)
  378. {
  379. case (int)GrpSchedulePrimaryStepEnum.BudgetChild01:
  380. //验证方法
  381. break;
  382. case (int)GrpSchedulePrimaryStepEnum.BudgetChild02: break;
  383. }
  384. }
  385. return false;
  386. }
  387. #endregion
  388. }
  389. }