|  | @@ -0,0 +1,434 @@
 | 
												
													
														
															|  | 
 |  | +using Google.Protobuf.WellKnownTypes;
 | 
												
													
														
															|  | 
 |  | +using Microsoft.AspNetCore.DataProtection.KeyManagement;
 | 
												
													
														
															|  | 
 |  | +using OASystem.API.OAMethodLib;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Domain.Common;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Domain.Dtos.Groups;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Domain.Entities.Groups;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Domain.Enums;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Infrastructure.Repositories.Groups;
 | 
												
													
														
															|  | 
 |  | +using System.Configuration;
 | 
												
													
														
															|  | 
 |  | +using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +namespace OASystem.API.OAMethodLibs
 | 
												
													
														
															|  | 
 |  | +{
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    /// <summary>
 | 
												
													
														
															|  | 
 |  | +    /// 团组流程管控
 | 
												
													
														
															|  | 
 |  | +    /// </summary>
 | 
												
													
														
															|  | 
 |  | +    public static class GroupStepForDelegation
 | 
												
													
														
															|  | 
 |  | +    {
 | 
												
													
														
															|  | 
 |  | +        private readonly static GrpScheduleRepository _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        /// <summary>
 | 
												
													
														
															|  | 
 |  | +        /// 创建流程管控
 | 
												
													
														
															|  | 
 |  | +        /// </summary>
 | 
												
													
														
															|  | 
 |  | +        /// <param name="DiId">团组Id</param>
 | 
												
													
														
															|  | 
 |  | +        public static async void CreateWorkStep(int DiId)
 | 
												
													
														
															|  | 
 |  | +        {
 | 
												
													
														
															|  | 
 |  | +            //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            //判断是否已存在团组的流程管控
 | 
												
													
														
															|  | 
 |  | +            Grp_ScheduleInfo check = _grpScheduleRep.Query(s => s.DiId == DiId).First();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            if (check == null)
 | 
												
													
														
															|  | 
 |  | +            {
 | 
												
													
														
															|  | 
 |  | +                _grpScheduleRep.BeginTran();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                GroupsConfig _groupConfig = AutofacIocManager.Instance.GetService<GroupsConfig>();
 | 
												
													
														
															|  | 
 |  | +                DateTime dftBeginDt = DateTime.Now.AddDays(_groupConfig.ExBeginDays);//默认预计开始时间
 | 
												
													
														
															|  | 
 |  | +                DateTime dftEndDt = DateTime.Now.AddDays(_groupConfig.ExEndDays);//默认预计结束时间
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                #region 主流程
 | 
												
													
														
															|  | 
 |  | +                Grp_ScheduleInfo _primary = new Grp_ScheduleInfo();
 | 
												
													
														
															|  | 
 |  | +                _primary.CreateUserId = _groupConfig.AutoCreate;
 | 
												
													
														
															|  | 
 |  | +                _primary.DiId = DiId;
 | 
												
													
														
															|  | 
 |  | +                _primary.Exception = 0;
 | 
												
													
														
															|  | 
 |  | +                _primary.ExpectBeginDt = dftBeginDt;
 | 
												
													
														
															|  | 
 |  | +                _primary.ExpectEndDt = dftEndDt;
 | 
												
													
														
															|  | 
 |  | +                _primary.Leader = _groupConfig.Leader;
 | 
												
													
														
															|  | 
 |  | +                _primary.PrimaryStep = GrpSchedulePrimaryStepEnum.Wait;
 | 
												
													
														
															|  | 
 |  | +                _primary.Remark = "请设置各流程负责人、预计开始/结束时间";
 | 
												
													
														
															|  | 
 |  | +                int _primaryId = await _grpScheduleRep.AddAsync(_primary);
 | 
												
													
														
															|  | 
 |  | +                if (_primaryId > 0)
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    #region 子流程
 | 
												
													
														
															|  | 
 |  | +                    List<Grp_ScheduleDetailInfo> entityList = new List<Grp_ScheduleDetailInfo>();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #region 模板
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo _model = new Grp_ScheduleDetailInfo();
 | 
												
													
														
															|  | 
 |  | +                    _model.CreateUserId = _groupConfig.AutoCreate;
 | 
												
													
														
															|  | 
 |  | +                    _model.Duty = _groupConfig.DefaultUser;
 | 
												
													
														
															|  | 
 |  | +                    _model.Exception = 0;
 | 
												
													
														
															|  | 
 |  | +                    _model.ExpectBeginDt = dftBeginDt;
 | 
												
													
														
															|  | 
 |  | +                    _model.ExpectEndDt = dftEndDt;
 | 
												
													
														
															|  | 
 |  | +                    _model.Remark = "未设置负责人";
 | 
												
													
														
															|  | 
 |  | +                    _model.ScheduleId = DiId;
 | 
												
													
														
															|  | 
 |  | +                    _model.StepStatus = 0;
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 经费预算
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_budget202 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_budget202.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BudgetChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_budget202.ParentStep = (int)GrpSchedulePrimaryStepEnum.Budget;
 | 
												
													
														
															|  | 
 |  | +                    grp_budget202.Step = (int)GrpSchedulePrimaryStepEnum.BudgetChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_budget202);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 市场部人员报价对接/反馈
 | 
												
													
														
															|  | 
 |  | +                    //上传明细单
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_feedback302 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback302.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback302.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback302.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_feedback302);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //录入最终总经费预算
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_feedback303 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback303.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild03);
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback303.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback303.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild03;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_feedback303);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //完成报价对接/反馈
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_feedback304 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback304.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.FeedbackChild04);
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback304.ParentStep = (int)GrpSchedulePrimaryStepEnum.Feedback;
 | 
												
													
														
															|  | 
 |  | +                    grp_feedback304.Step = (int)GrpSchedulePrimaryStepEnum.FeedbackChild04;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_feedback304);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)报批流程
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 护照/签证
 | 
												
													
														
															|  | 
 |  | +                    //收集资料
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa502 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa502.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa502.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa502.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa502);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //取护照资料
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa503 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa503.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild03);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa503.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa503.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild03;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa503);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //填资料
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa504 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa504.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild04);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa504.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa504.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild04;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa504);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //送签
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa505 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa505.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild05);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa505.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa505.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild05;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa505);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //出签+取护照
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa506 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa506.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild06);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa506.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa506.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild06;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa506);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //归还护照
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa507 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa507.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild07);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa507.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa507.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild07;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa507);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //签证费用录入 
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_visa508 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_visa508.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.VisaChild08);
 | 
												
													
														
															|  | 
 |  | +                    grp_visa508.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_visa508.Step = (int)GrpSchedulePrimaryStepEnum.VisaChild08;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_visa508);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 业务操作
 | 
												
													
														
															|  | 
 |  | +                    //机票
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJP601 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP601.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJP);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP601.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP601.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJP601);
 | 
												
													
														
															|  | 
 |  | +                    //机票-询价并导入黑屏代码
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJP6012 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6012.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6012.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6012.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJP6012);
 | 
												
													
														
															|  | 
 |  | +                    //机票-机票已占位
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJP6013 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6013.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild03);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6013.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6013.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild03;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJP6013);
 | 
												
													
														
															|  | 
 |  | +                    //机票-已出票
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJP6014 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6014.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild04);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6014.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6014.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild04;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJP6014);
 | 
												
													
														
															|  | 
 |  | +                    //机票-机票费用录入
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJP6015 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6015.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJPChild05);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6015.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJP;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJP6015.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJPChild05;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJP6015);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //酒店
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJD602 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD602.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJD);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD602.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD602.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJD;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJD602);
 | 
												
													
														
															|  | 
 |  | +                    //酒店-酒店费用录入
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busJD6022 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD6022.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessJDChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD6022.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessJD;
 | 
												
													
														
															|  | 
 |  | +                    grp_busJD6022.Step = (int)GrpSchedulePrimaryStepEnum.BusinessJDChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busJD6022);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //OP
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busOP603 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP603.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessOP);
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP603.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP603.Step = (int)GrpSchedulePrimaryStepEnum.BusinessOP;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busOP603);
 | 
												
													
														
															|  | 
 |  | +                    //OP-OP费用录入
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busOP6032 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP6032.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessOPChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP6032.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessOP;
 | 
												
													
														
															|  | 
 |  | +                    grp_busOP6032.Step = (int)GrpSchedulePrimaryStepEnum.BusinessOPChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busOP6032);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //商邀
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busSY604 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY604.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessSY);
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY604.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY604.Step = (int)GrpSchedulePrimaryStepEnum.BusinessSY;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busSY604);
 | 
												
													
														
															|  | 
 |  | +                    //商邀-商邀费用录入
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busSY6042 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY6042.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessSYChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY6042.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessSY;
 | 
												
													
														
															|  | 
 |  | +                    grp_busSY6042.Step = (int)GrpSchedulePrimaryStepEnum.BusinessSYChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busSY6042);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //其他
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busQT605 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT605.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessQT);
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT605.ParentStep = (int)GrpSchedulePrimaryStepEnum.Visa;
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT605.Step = (int)GrpSchedulePrimaryStepEnum.BusinessQT;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busQT605);
 | 
												
													
														
															|  | 
 |  | +                    //商邀-商邀费用录入
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_busQT6052 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT6052.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.BusinessQTChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT6052.ParentStep = (int)GrpSchedulePrimaryStepEnum.BusinessQT;
 | 
												
													
														
															|  | 
 |  | +                    grp_busQT6052.Step = (int)GrpSchedulePrimaryStepEnum.BusinessQTChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_busQT6052);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 费用审批
 | 
												
													
														
															|  | 
 |  | +                    //机票费用审批
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_cost702 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_cost702.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_cost702.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost702.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild02;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost702.Duty = _groupConfig.Boss;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_cost702);
 | 
												
													
														
															|  | 
 |  | +                    //酒店费用审批
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_cost703 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_cost703.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild03);
 | 
												
													
														
															|  | 
 |  | +                    grp_cost703.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost703.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild03;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost703.Duty = _groupConfig.Boss;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_cost703);
 | 
												
													
														
															|  | 
 |  | +                    //OP费用审批
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_cost704 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_cost704.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild04);
 | 
												
													
														
															|  | 
 |  | +                    grp_cost704.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost704.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild04;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost704.Duty = _groupConfig.Boss;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_cost704);
 | 
												
													
														
															|  | 
 |  | +                    //OP费用审批
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_cost705 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_cost705.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild05);
 | 
												
													
														
															|  | 
 |  | +                    grp_cost705.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost705.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild05;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost705.Duty = _groupConfig.Boss;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_cost705);
 | 
												
													
														
															|  | 
 |  | +                    //增减款项审批
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_cost706 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_cost706.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.CostAuditChild06);
 | 
												
													
														
															|  | 
 |  | +                    grp_cost706.ParentStep = (int)GrpSchedulePrimaryStepEnum.CostAudit;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost706.Step = (int)GrpSchedulePrimaryStepEnum.CostAuditChild06;
 | 
												
													
														
															|  | 
 |  | +                    grp_cost706.Duty = _groupConfig.Boss;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_cost706);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 付款给供应商
 | 
												
													
														
															|  | 
 |  | +                    //OP费用付款
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_pay802 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_pay802.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild02);
 | 
												
													
														
															|  | 
 |  | +                    grp_pay802.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
 | 
												
													
														
															|  | 
 |  | +                    grp_pay802.Step = (int)GrpSchedulePrimaryStepEnum.PayChild02;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_pay802);
 | 
												
													
														
															|  | 
 |  | +                    //商邀费用付款
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_pay803 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_pay803.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild03);
 | 
												
													
														
															|  | 
 |  | +                    grp_pay803.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
 | 
												
													
														
															|  | 
 |  | +                    grp_pay803.Step = (int)GrpSchedulePrimaryStepEnum.PayChild03;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_pay803);
 | 
												
													
														
															|  | 
 |  | +                    //增减款项付款
 | 
												
													
														
															|  | 
 |  | +                    Grp_ScheduleDetailInfo grp_pay804 = _model.DeepClone();
 | 
												
													
														
															|  | 
 |  | +                    grp_pay804.JobContent = EnumHelper.GetEnumDescription(GrpSchedulePrimaryStepEnum.PayChild04);
 | 
												
													
														
															|  | 
 |  | +                    grp_pay804.ParentStep = (int)GrpSchedulePrimaryStepEnum.Pay;
 | 
												
													
														
															|  | 
 |  | +                    grp_pay804.Step = (int)GrpSchedulePrimaryStepEnum.PayChild04;
 | 
												
													
														
															|  | 
 |  | +                    entityList.Add(grp_pay804);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)出行事项会议
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)送机
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)接机
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)收款
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region (目前为空)团组完成
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    //SqlSugar批量添加
 | 
												
													
														
															|  | 
 |  | +                    _grpScheduleRep.bulkInsert(entityList);
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                    #region 流程管控成员
 | 
												
													
														
															|  | 
 |  | +                    string sqlPerson = string.Format(@"Select u.Id As SysUserId,u.CnName As SysUserName,JobName as JobStr 
 | 
												
													
														
															|  | 
 |  | +From Sys_Users As u With(Nolock) 
 | 
												
													
														
															|  | 
 |  | +Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id
 | 
												
													
														
															|  | 
 |  | +Inner Join Sys_JobPost as j With(Nolock) On u.JobPostId=j.Id
 | 
												
													
														
															|  | 
 |  | +Where d.Id={0} And u.Id not in({1})", DepartmentCode.IC, _groupConfig.FilterUser);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    List<Grp_SchedulePersonInfo> personList = await _grpScheduleRep.GetEntityList_SchedulePersonBySql(sqlPerson);
 | 
												
													
														
															|  | 
 |  | +                    if (personList.Count > 0)
 | 
												
													
														
															|  | 
 |  | +                    {
 | 
												
													
														
															|  | 
 |  | +                        foreach (var item in personList)
 | 
												
													
														
															|  | 
 |  | +                        {
 | 
												
													
														
															|  | 
 |  | +                            item.CreateUserId = _groupConfig.DefaultUser;
 | 
												
													
														
															|  | 
 |  | +                            item.ScheduleId = DiId;
 | 
												
													
														
															|  | 
 |  | +                        }
 | 
												
													
														
															|  | 
 |  | +                        _grpScheduleRep.bulkInsert(personList);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                    #endregion
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                else
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    _grpScheduleRep.RollbackTran();
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                #endregion
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                _grpScheduleRep.CommitTran();
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        public static async void ChangeStepForPrimary(int DiId, GrpSchedulePrimaryStepEnum primary, int isDel, int exception, string remark)
 | 
												
													
														
															|  | 
 |  | +        {
 | 
												
													
														
															|  | 
 |  | +            //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
 | 
												
													
														
															|  | 
 |  | +            string sqlPrimary = string.Format(@" Select * From Grp_Schedule With(Nolock) Where IsDel=0 And DiId={0} ", DiId);
 | 
												
													
														
															|  | 
 |  | +            Grp_ScheduleInfo _grpPrimaryInfo = _grpScheduleRep.GetSingleInfoBySqlWithNolock(sqlPrimary);
 | 
												
													
														
															|  | 
 |  | +            if (_grpPrimaryInfo != null)
 | 
												
													
														
															|  | 
 |  | +            {
 | 
												
													
														
															|  | 
 |  | +                _grpPrimaryInfo.PrimaryStep = primary;
 | 
												
													
														
															|  | 
 |  | +                _grpPrimaryInfo.IsDel = isDel;
 | 
												
													
														
															|  | 
 |  | +                _grpPrimaryInfo.Exception = exception;
 | 
												
													
														
															|  | 
 |  | +                _grpPrimaryInfo.Remark += ";" + remark;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleInfo>()
 | 
												
													
														
															|  | 
 |  | +                .Where(s => s.Id == _grpPrimaryInfo.Id)
 | 
												
													
														
															|  | 
 |  | +                .UpdateColumns(s => new { s.PrimaryStep, s.IsDel, s.Exception, s.Remark })
 | 
												
													
														
															|  | 
 |  | +                .ExecuteCommandAsync();
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        #region 流程管控步骤推进
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        /// <summary>
 | 
												
													
														
															|  | 
 |  | +        /// 刷新团组管控最新状态,或推进流程到下一节点
 | 
												
													
														
															|  | 
 |  | +        /// </summary>
 | 
												
													
														
															|  | 
 |  | +        /// <param name="scheduleId">团组流程Id</param>
 | 
												
													
														
															|  | 
 |  | +        public static async void RefreshWorkStep(int scheduleId, bool auto = false)
 | 
												
													
														
															|  | 
 |  | +        {
 | 
												
													
														
															|  | 
 |  | +            //var _grpScheduleRep = AutofacIocManager.Instance.GetService<GrpScheduleRepository>();
 | 
												
													
														
															|  | 
 |  | +            string sqlPrimary = string.Format(@" Select * From Grp_Schedule With(Nolock) Where IsDel=0 And Id={0} ", scheduleId);
 | 
												
													
														
															|  | 
 |  | +            Grp_ScheduleInfo _grpPrimaryInfo = _grpScheduleRep.GetSingleInfoBySqlWithNolock(sqlPrimary);
 | 
												
													
														
															|  | 
 |  | +            if (_grpPrimaryInfo != null)
 | 
												
													
														
															|  | 
 |  | +            {
 | 
												
													
														
															|  | 
 |  | +                List<Grp_ScheduleDetailInfo> _list = _grpScheduleRep._sqlSugar.Queryable<Grp_ScheduleDetailInfo>()
 | 
												
													
														
															|  | 
 |  | +                 .Where(s => s.ScheduleId == scheduleId && s.IsDel != 1 && s.ParentStep == (int)_grpPrimaryInfo.PrimaryStep && s.StepStatus != 2)
 | 
												
													
														
															|  | 
 |  | +                 .ToList();
 | 
												
													
														
															|  | 
 |  | +                if (_list.Count > 0)
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    //未完成主流程节点下所有步骤任务
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                else
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    //可推进节点
 | 
												
													
														
															|  | 
 |  | +                    if (auto)
 | 
												
													
														
															|  | 
 |  | +                    {
 | 
												
													
														
															|  | 
 |  | +                        int nextPrimaryStep = (int)_grpPrimaryInfo.PrimaryStep + 1;
 | 
												
													
														
															|  | 
 |  | +                        var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleInfo>()
 | 
												
													
														
															|  | 
 |  | +                            .Where(s => s.Id == _grpPrimaryInfo.Id)
 | 
												
													
														
															|  | 
 |  | +                            .UpdateColumns(s => new { nextPrimaryStep })
 | 
												
													
														
															|  | 
 |  | +                            .ExecuteCommandAsync();
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                //eg:CheckStep_Budget
 | 
												
													
														
															|  | 
 |  | +                //switch (_grpPrimaryInfo.PrimaryStep)
 | 
												
													
														
															|  | 
 |  | +                //{
 | 
												
													
														
															|  | 
 |  | +                //    case GrpSchedulePrimaryStepEnum.Budget: CheckStep_Budget(scheduleId); break;
 | 
												
													
														
															|  | 
 |  | +                //}
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        /// <summary>
 | 
												
													
														
															|  | 
 |  | +        /// 暂无需求,先保存,可扩展至查询验证主流程下每一个详细流程步骤对应的业务操作是否完成,需要其他业务提供验证方法
 | 
												
													
														
															|  | 
 |  | +        /// 查看流程-经费预算
 | 
												
													
														
															|  | 
 |  | +        /// </summary>
 | 
												
													
														
															|  | 
 |  | +        /// <param name="scheduleId"></param>
 | 
												
													
														
															|  | 
 |  | +        /// <returns>true:已完成所有步骤,false:存在未完成的步骤(Grp_ScheduleDetail.StepStatus:0/1/2)</returns>
 | 
												
													
														
															|  | 
 |  | +        private static bool CheckStep_Budget(int scheduleId)
 | 
												
													
														
															|  | 
 |  | +        {
 | 
												
													
														
															|  | 
 |  | +            List<Grp_ScheduleDetailInfo> _list = _grpScheduleRep._sqlSugar.Queryable<Grp_ScheduleDetailInfo>()
 | 
												
													
														
															|  | 
 |  | +                 .Where(s => s.ScheduleId == scheduleId && s.IsDel != 1 && s.ParentStep == (int)GrpSchedulePrimaryStepEnum.Budget)
 | 
												
													
														
															|  | 
 |  | +                 .ToList();
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            foreach (var item in _list)
 | 
												
													
														
															|  | 
 |  | +            {
 | 
												
													
														
															|  | 
 |  | +                switch (item.Step)
 | 
												
													
														
															|  | 
 |  | +                {
 | 
												
													
														
															|  | 
 |  | +                    case (int)GrpSchedulePrimaryStepEnum.BudgetChild01:
 | 
												
													
														
															|  | 
 |  | +                        //验证方法
 | 
												
													
														
															|  | 
 |  | +                        break;
 | 
												
													
														
															|  | 
 |  | +                    case (int)GrpSchedulePrimaryStepEnum.BudgetChild02: break;
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +            return false;
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +        #endregion
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +}
 |