Exemplo n.º 1
0
        /// <summary>DBデータをセット</summary>
        /// <param name="flowType">フロータイプ</param>
        private void SetDbData(FlowType flowType)
        {
            DataRow row = _container.FlowControlTable.Select("start_job_id='" +
                                                             this.BeginItem.JobId + "' and end_job_id='" + this.EndItem.JobId + "'")[0];

            row["flow_type"] = flowType;
        }
Exemplo n.º 2
0
        public void Set(ScrapParameter param)
        {
            if (!FlowMap.ContainsKey(param.Code))
            {
                throw new ScraperException("Code is not defined. Please check code of parameter. Code : " + param.Code);
            }
            FlowType type = FlowMap[param.Code];

            this.flow      = Activator.CreateInstance(type.Flow, this, param, type.LoginMode) as IScrapFlow;
            this.parameter = param;
            Gecko.LauncherDialog.Download += (sender, e) =>
            {
                String       tempPath  = ConfigSystem.ReadConfig("Config", "Temp", "Path");
                String       file      = Path.Combine(tempPath, DateTime.Now.ToString("yyyyMMddHHmmss") + e.Filename);
                nsILocalFile objTarget = (nsILocalFile)Xpcom.NewNativeLocalFile(file);
                e.HelperAppLauncher.SaveToDisk(objTarget, false);
                Action <String, String> action = flow.DownloadProcedure(e.Url);
                action(e.Url, file);
            };
            timer.Interval = 10 * 1000;
            timer.Tick    += (s, e) =>
            {
                Ping(parameter.Keycode);
            };
            timer.Start();
            this.Navigate(flow.StartPage());
        }
Exemplo n.º 3
0
        FlowKey(FlowType type, Id id)
        {
            type.ExpectIdMatchesCardinality(id);

            Type = type;
            Id   = id;
        }
Exemplo n.º 4
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="flowtype"></param>
 /// <returns></returns>
 public String Add(FlowType flowtype)
 {
     try
     {
         flowtype.Id = Guid.NewGuid().ToString();
         int result = new BLFlowType().Add(flowtype);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "新增成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "新增失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "新增失败,失败原因:" + ex.Message
         }));
     }
 }
Exemplo n.º 5
0
        internal FlowDefinition(FlowServiceInfo serviceInfo, FlowType flowType)
        {
            Type        = flowType;
            ServiceInfo = serviceInfo;

            Entrypoints = new List <FlowProducerDefinitionBase>();
        }
Exemplo n.º 6
0
        private void RegisterFlow(FlowType flow)
        {
            _package.Durable.Register(flow);
            _package.Flows.Register(flow);

            new RuntimeReaderFlow(_map, flow).Register();
        }
Exemplo n.º 7
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="flowtype"></param>
 /// <returns></returns>
 public String Update(FlowType flowtype)
 {
     try
     {
         int result = new BLFlowType().Update(flowtype);
         if (result > 0)
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = true, msg = "修改成功"
             }));
         }
         else
         {
             return(JsonConvert.JavaScriptSerializer(new ExtResult()
             {
                 success = false, msg = "修改失败"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.JavaScriptSerializer(new ExtResult()
         {
             success = false, msg = "修改失败,失败原因:" + ex.Message
         }));
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="type"></param>
 /// <param name="flow"></param>
 public static void Update(FlowType type, IFlow flow)
 {
     if (_flows.ContainsKey(type))
     {
         _flows[type] = flow;
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 流程日志
 /// </summary>
 /// <param name="folowType"></param>
 /// <param name="msg"></param>
 /// <param name="sn"></param>
 private static void FlowLog(FlowType folowType, string msg, string sn = "")
 {
     System.IO.StreamWriter sw = null;
     try
     {
         var currentPath = LogPath;
         if (string.IsNullOrEmpty(sn) == false)
         {
             currentPath = Path.Combine(currentPath, sn);
         }
         if (System.IO.Directory.Exists(currentPath) == false)
         {
             System.IO.Directory.CreateDirectory(currentPath);
         }
         string content;
         if (folowType == FlowType.Send)
         {
             content = "Send:>>>>>>>>>>>>>>>>>>> \r\n" + DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss:]") + msg;
         }
         else
         {
             content = "Recv:<<<<<<<<<<<<<<<<<<< \r\n" + DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss:]:") + msg;
         }
         sw = new System.IO.StreamWriter(currentPath + "/Flow_" + DateTime.Now.ToString("yyyyMMdd") + ".Log", true);
         sw.WriteLine(content);
     }
     catch
     { }
     finally
     {
         // sw.Close();
     }
 }
Exemplo n.º 10
0
 public Connector(Node _node, FlowType _flowType)
 {
     OnDrag   = DraftArea.OnDragConnector;
     EndDrag  = DraftArea.OnStopDragConnector;
     node     = _node;
     flowType = _flowType;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Отказывает в подписании документа, отправленного ранее (для пересланных и документов без подписи)
 /// </summary>
 /// <param name="flowType">Тип документооборота</param>
 /// <param name="rejectSign">Отказ от подписания</param>
 public void RejectSign(FlowType flowType, RejectSign rejectSign)
 {
     CheckAutorizedInvoke(() =>
     {
         client.RejectSign(Token, flowType, rejectSign);
         return(true);
     });
 }
Exemplo n.º 12
0
 /// <summary>
 /// Подписывает документ, отправленный ранее (для пересланных и документов без подписи)
 /// </summary>
 /// <param name="flowType">Тип документооборота</param>
 /// <param name="sign">Подпись документа</param>
 public void SignDocument(FlowType flowType, Sign sign)
 {
     CheckAutorizedInvoke(() =>
     {
         client.SignDocument(Token, flowType, sign);
         return(true);
     });
 }
Exemplo n.º 13
0
        public bool TryOpenFlowScope(FlowType type, TimelineRoute route, out IFlowScope scope)
        {
            var unroutedScope = new FlowScope(_lifetime, _flowDb, type, route);

            scope = unroutedScope.TryRoute() ? unroutedScope : null;

            return(scope != null);
        }
Exemplo n.º 14
0
 public Flow(string budget, DateTime date, decimal amount, FlowType type, string description = null)
 {
     Budget = budget;
     Date = date;
     Type = type;
     Description = description;
     Amount = amount;
 }
Exemplo n.º 15
0
 public FlowScope(ILifetimeScope lifetime, IFlowDb db, FlowType type, TimelineRoute route)
 {
     _lifetime = lifetime;
     _db       = db;
     _type     = type;
     _route    = route;
     Key       = type.CreateKey(route.Id);
 }
Exemplo n.º 16
0
        void ExpectObserves(FlowType queryType, Event e)
        {
            var eventType = _area.Events[e.GetType()];

            if (!queryType.Observations.Contains(eventType))
            {
                throw new ExpectException($"Query {queryType} does not observe event {eventType}");
            }
        }
Exemplo n.º 17
0
 /* This function is called by loop statements to execute embedded statements. You can catch
  * program flow statements, to keep them from falling through, like this:
  * switch (Exec(s, FlowType.Break|FlowType.Continue))
  * {
  * case FlowType.Break:
  *     goto End;
  * case FlowType.Continue:
  *     goto Test;
  * default:
  *     return;
  * }
  */
 internal static FlowType Exec(Statement inner, FlowType Catch)
 {
     using (new SyntaxTreeScope(inner))
     {
         FlowType t = inner.Execute();
         Interpreter.ProgramFlow |= t & ~Catch;
         return(t);
     }
 }
Exemplo n.º 18
0
        /// <summary>
        /// 刪除
        /// </summary>
        /// <param name="type"></param>
        public static void Remove(FlowType type)
        {
            if (!_flows.ContainsKey(type))
            {
                throw new IndexOutOfRangeException($"not exist type:{type}");
            }

            _flows.Remove(type);
        }
Exemplo n.º 19
0
 public FlowItemInfo(string id, string parentId, FlowType flowType, string fullName, ITestReporter reporter, DateTime startTime)
 {
     Id           = id;
     ParentId     = parentId;
     FlowItemType = flowType;
     FullName     = fullName;
     TestReporter = reporter;
     StartTime    = startTime;
 }
Exemplo n.º 20
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="type"></param>
        /// <param name="flow"></param>
        public static void Add(FlowType type, IFlow flow)
        {
            if (_flows.ContainsKey(type))
            {
                throw new IndexOutOfRangeException($"already added this type:{type}");
            }

            _flows.Add(type, flow);
        }
Exemplo n.º 21
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Code?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Description?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FlowType?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 下一步
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        public static Boolean Next(this ILog log)
        {
            //找到log的 nextSts
            int nextSts = log.NextSts;

            //找到log的 flowType
            FlowType type = log.FlowType;

            return(_flows[type]._steps[nextSts]
                   .Excute(log));
        }
Exemplo n.º 23
0
 protected BasePartialFlow(IServiceProvider serviceProvider, FlowType flowType,
                           IOwnIdCoreConfiguration coreConfiguration) : base(serviceProvider, flowType)
 {
     CoreConfiguration = coreConfiguration;
     AddHandler <StopFlowTransitionHandler, TransitionInput>((_, item) => new FrontendBehavior
     {
         Type          = StepType.Stopped,
         ChallengeType = item.ChallengeType,
         ActionType    = ActionType.Finish
     });
 }
 public void ApplyFlow(FlowType flowType, Vector2 impactVector)
 {
     if (flowType == FlowType.Wind)
     {
         _windSpeed += impactVector;
     }
     else
     {
         _flowSpeed += impactVector;
     }
 }
Exemplo n.º 25
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="flowtype"></param>
 /// <returns></returns>
 public String Save(FlowType flowtype)
 {
     if (string.IsNullOrEmpty(flowtype.Id))
     {
         return(Add(flowtype));
     }
     else
     {
         return(Update(flowtype));
     }
 }
Exemplo n.º 26
0
        public FlowPlanInternal(IBlockActionFactory actionFactory, FlowDefinition definition) : base(definition)
        {
            if (actionFactory == null)
            {
                throw new ArgumentNullException(nameof(actionFactory));
            }

            _actionFactory  = actionFactory;
            _blockContainer = new FlowBlockContainer();

            _flowType   = definition.Type;
            _iterations = definition.Iterations;
        }
Exemplo n.º 27
0
        public void SetFields()
        {
            // Arrange
            FlowType       expectedType = FlowType.BoundedAlternative;
            int            expectedId   = 3;
            FlowIdentifier fi           = new FlowIdentifier(expectedType, expectedId);

            // Act

            // Assert
            Assert.AreEqual(expectedType, fi.Type);
            Assert.AreEqual(expectedId, fi.Id);
        }
        public TransactViewDesfire(FlowType flowType, ICardInterfaceManger cardInterfaceManger)
        {
            InitializeComponent();
            totalAmount            = new TotalAmountViewModel();
            gridProgress.IsVisible = false;

            this.cardInterfaceManger = cardInterfaceManger;
            this.flowType            = flowType;

            lblTotal.BindingContext  = totalAmount;
            txtAmount.BindingContext = totalAmount;

            UpdateView(ViewState.Step1TransactDetails);
        }
        public async Task ReadyData(IDialogContext context, LuisResult result)
        {
            DiagnosticsUtil.TraceInformation($"MainLUISDialog- ReadyData");

            _context.Refresh(IntentType.Ready, result);

            //var response = GetNextResponse();
            var surveyDialogInfo = new SurveyLUISDialog.Models.SurveyLUISDialogInfo(_info);

            _flowType = FlowType.Survey;
            context.Call(new SurveyLUISDialog.SurveyLUISDialog(surveyDialogInfo), SurveyLUISDialogDone);

            await Task.FromResult(0);
        }
Exemplo n.º 30
0
 /// <summary>
 /// 刷新警告线上限的数据
 /// </summary>
 /// <param name="i">提醒的次数</param>
 /// <param name="dt">流量类型</param>
 private void RefreshWarningData(int i, FlowType dt)
 {
     if (dt == FlowType.ALL)
     {
         warningALL = Properties.Settings.Default.WarningALL + Convert.ToUInt32(450 * Math.Log(i + 1));
         //warningALL *= 1048576;
         warningALL *= 1000000;
     }
     if (dt == FlowType.UP)
     {
         warningUP  = Properties.Settings.Default.WarningUP + Convert.ToUInt32(450 * Math.Log(i + 1));
         warningUP *= 1000000;
     }
 }
Exemplo n.º 31
0
        private void ImportObservedDataForWell(Borehole bh, List <WellAllocation> wellAllocations, ObservedDataSet observedDataSet)
        {
            ObservedDataSetForWell odsFw = ObservedDataSetForWell.NullObject;

            DeleteExistentDataSetForWell(bh, observedDataSet);

            string   opIdName = "Oil production rate";
            string   gpIdName = "Gas production rate";
            string   wpIdName = "Water production rate";
            string   wiIdName = "Water injection rate";
            string   ufIdName = "Uptime fraction";
            FlowType flow     = FlowType.Default;

            var timeSteps = new List <DateTime>();

            using (ITransaction tr = DataManager.NewTransaction())
            {
                Template opt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateOil;
                Template gpt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateGas;
                Template wpt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateWater;
                Template wit = PetrelProject.WellKnownTemplates.ProductionGroup.InjectionRateWater;
                Template utf = PetrelProject.WellKnownTemplates.ProductionGroup.UptimeFraction;
                tr.Lock(observedDataSet);
                odsFw = observedDataSet.CreateObservedDataSetForWell(bh, flow, timeSteps);

                // Create each data version (columns)
                CreateEmptyObservedData(odsFw, opt, opIdName);
                CreateEmptyObservedData(odsFw, gpt, gpIdName);
                CreateEmptyObservedData(odsFw, wpt, wpIdName);
                CreateEmptyObservedData(odsFw, wit, wiIdName);
                CreateEmptyObservedData(odsFw, utf, ufIdName);

                // Append data
                foreach (WellAllocation allocation in wellAllocations)
                {
                    odsFw.Append(
                        allocation.OperativeDate,
                        odsFw.ObservedDatas,
                        new List <double> {
                        ProductionRate(allocation.Oil, allocation.EffectiveTime),
                        ProductionRate(allocation.Gas, allocation.EffectiveTime),
                        ProductionRate(allocation.Water, allocation.EffectiveTime),
                        ProductionRate(allocation.WaterInjection, allocation.EffectiveTime),
                        allocation.EffectiveTime
                    });
                }
                tr.Commit();
            }
        }
 /* This function is called by loop statements to execute embedded statements. You can catch
  * program flow statements, to keep them from falling through, like this:
  * switch (Exec(s, FlowType.Break|FlowType.Continue))
  * {
  * case FlowType.Break:
  *     goto End;
  * case FlowType.Continue:
  *     goto Test;
  * default:
  *     return;
  * }
  */
 internal static FlowType Exec(Statement inner, FlowType Catch)
 {
     using (new SyntaxTreeScope(inner))
     {
         FlowType t = inner.Execute();
         Interpreter.ProgramFlow |= t & ~Catch;
         return t;
     }
 }
Exemplo n.º 33
0
        /// <summary>
        /// 通过持久化服务查询下一处理人(对应SubmitFlow)
        /// </summary>
        /// <param name="WfRuntimeClone">持久化运行时</param>
        /// <param name="instanceClone">持久化实例</param>
        /// <param name="xml">条件XML</param>
        /// <param name="CurrentStateName">当前状态代码</param>
        /// <param name="DataResult">操作结果</param>
        public void GetUserByInstance(string companyID, WorkflowRuntime WfRuntimeClone, WorkflowInstance instanceClone, string Layout, string xml, string CurrentStateName, List<string> UserID, List<string> PostID, FlowType FlowType, ref DataResult DataResult)
        {
            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            List<UserInfo> AppUserInfo = null;
            string strNextState = CurrentStateName;
            Role_UserType RuleName;
            try
            {
                if (!WfRuntimeClone.IsStarted)
                {
                    WfRuntimeClone.StartRuntime();
                }
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CloneWorkflowInstance(WfRuntimeClone, instanceClone, WfRuntime);
                bool iscurruser = true;

                while (iscurruser)
                {
                    //   CurrentStateName = strNextState;
                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);
                    //if (FlowType == FlowType.Task && strNextState != "EndFlow")
                    //{
                    //    XmlReader XmlReader;

                    //    StringReader tmpLayout = new StringReader(Layout);
                    //    XmlReader = XmlReader.Create(tmpLayout);
                    //    XElement XElementS = XElement.Load(XmlReader);
                    //    var a = from c in XElementS.Descendants("Activity")
                    //            where c.Attribute("Name").Value == strNextState
                    //            select c.Attribute("RoleName").Value;
                    //    if (a.Count() > 0)
                    //    {
                    //        strNextState = a.First().ToString();
                    //    }
                    //    else
                    //    {
                    //        DataResult.Err = "没有找到对应角色";
                    //        DataResult.FlowResult = FlowResult.FAIL;
                    //        return;
                    //    }

                    //    tmpLayout = null;
                    //    XmlReader = null;
                    //    XElementS = null;
                    //    a = null;
                    //}


                    RuleName = Utility.GetRlueName(Layout, strNextState);



                    if (RuleName == null)
                    {
                        DataResult.Err = "没有找到对应角色";
                        DataResult.FlowResult = FlowResult.FAIL;
                        return;
                    }

                    string tmpPostID = RuleName.UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                    bool isHigher = false;
                    AppUserInfo = GetUserByStateCode(RuleName.RoleName, null, tmpPostID, ref isHigher);
                    #region 打印审核人
                    string names = "=======打印审核人E(RuleName.RoleName=" + RuleName.RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                    foreach (var user in AppUserInfo)
                    {
                        names += "CompanyID:" + user.CompanyID + "\r\n";
                        names += "DepartmentID:" + user.DepartmentID + "\r\n";
                        names += "PostID:" + user.PostID + "\r\n";
                        names += "UserID:" + user.UserID + "\r\n";
                        names += "UserName:"******"\r\n";
                    }
                    if (!isHigher && RuleName.IsOtherCompany != null)
                    {
                        if (RuleName.IsOtherCompany.Value == true)
                        {
                            names += "是否指定公司:" + RuleName.IsOtherCompany.Value.ToString() + "\r\n";
                            names += "公司的ID:" + RuleName.OtherCompanyID + "\r\n";
                        }
                        else if (RuleName.IsOtherCompany.Value == false)
                        {
                            names += "实际要查找公司的ID:" + companyID + "\r\n";
                        }
                    }
                    LogHelper.WriteLog(names);
                    #endregion
                    #region beyond
                    if (!isHigher && RuleName.IsOtherCompany != null)
                    {
                        if (RuleName.IsOtherCompany.Value == true)
                        {
                            AppUserInfo = AppUserInfo.Where(user => user.CompanyID == RuleName.OtherCompanyID).ToList();
                        }
                        else if (RuleName.IsOtherCompany.Value == false)
                        {
                            AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                        }
                    }

                    #endregion
                    if (AppUserInfo == null || AppUserInfo.Count == 0)
                    {
                        DataResult.Err = "没有找到审核人";
                        DataResult.FlowResult = FlowResult.FAIL;
                        return;
                    }
                    if (AppUserInfo.Where(c => c.UserID == UserID[1]).Count() == 0)
                        iscurruser = false;
                }

                if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                {
                    DataResult.FlowResult = FlowResult.MULTIUSER;
                }

                DataResult.AppState = strNextState;
                DataResult.UserInfo = AppUserInfo;


            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetUserByInstance异常信息 :" + ex.ToString());
                throw new Exception("GetUserByInstance:" + ex.Message);
            }
            finally
            {
                strNextState = null;
                AppUserInfo = null;
                RuleName = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }


        }
    void Awake()
    {
        if (!Application.isPlaying) return;

        if (isDebug)
        {
            return;
        }
        //level type to flow type
        flowType = (FlowType)LevelData.levelType;

        CreateRes();

    }
Exemplo n.º 35
0
 /// <summary>
 /// 刷新警告线上限的数据
 /// </summary>
 /// <param name="i">提醒的次数</param>
 /// <param name="dt">流量类型</param>
 private void RefreshWarningData(int i, FlowType dt)
 {
     if (dt == FlowType.ALL)
     {
         warningALL = Properties.Settings.Default.WarningALL + Convert.ToUInt32(450 * Math.Log(i + 1));
         //warningALL *= 1048576;
         warningALL *= 1000000;
     }
     if (dt == FlowType.UP)
     {
         warningUP = Properties.Settings.Default.WarningUP + Convert.ToUInt32(450 * Math.Log(i + 1));
         warningUP *= 1000000;
     }
 }
        /// <summary>
        /// 获取下一状态数据
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="FlowDefineXML"></param>
        /// <param name="Rules"></param>
        /// <param name="FlowLayoutXML"></param>
        /// <param name="BusinessXml"></param>
        /// <param name="UserID"></param>
        /// <param name="PostID"></param>
        /// <param name="FlowType"></param>
        /// <param name="DataResult"></param>
        /// <param name="user"></param>
        public void TmFlowToNextStep(string companyID, string FlowDefineXML, string Rules, string FlowLayoutXML, string BusinessXml, string UserID, string PostID, FlowType FlowType, ref DataResult DataResult, ref FlowUser user)
        {
            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            string strCurrActivitID = "StartFlow";
            string strNextActivitID = "StartFlow";
            bool IsCountersign = false;
            string CountersignType = "0";
            //Role_UserType RuleName;
            List<UserInfo> AppUserInfo = null;
            Dictionary<FlowRole, List<UserInfo>> DictCounterUser = null;
            try
            {
                user.TrackingMessage += "创建工作流运行时 SMTWorkFlowManage.CreateWorkFlowRuntime(false)开始\r\n";
                //创建工作流
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);

                user.TrackingMessage += "创建工作流运行时SMTWorkFlowManage.CreateWorkFlowRuntime(false)完成\r\n";
                Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, FlowDefineXML, Rules);

                #region 激发事件到一下状态
                strCurrActivitID = strNextActivitID;
                //user.TrackingMessage += "激发事件到一下状态,并获取状态代码 SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml)开始" + Instance.InstanceId.ToString() + "\r\n";

                strNextActivitID = SMTWorkFlowManage.GetFlowNextStepRoles(WfRuntime, Instance, strNextActivitID, BusinessXml);

                //user.TrackingMessage += "激发事件到一下状态,并获取状态代码 SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml)完成" + Instance.InstanceId.ToString() + "\r\n";

                if (strNextActivitID == "EndFlow")
                {
                    strNextActivitID = strCurrActivitID;

                }
                else
                {
                    //获取节点对应的角色id
                    List<FlowRole> listRoleID = FlowUtility.GetRlueIdFromActivitID(FlowLayoutXML, strNextActivitID, ref IsCountersign, ref CountersignType);

                    if (listRoleID.Count == 0)
                    {
                        DataResult.Err = "流程:" + user.FlowName + " 没有找到对应角色";
                        DataResult.FlowResult = FlowResult.FAIL;
                        Tracer.Debug("Formid=" + user.FormID + ";活动属性 Name=" + strNextActivitID + ";没有在流程:" + user.FlowName + " Layout中找到对应角色,Layout如下:\r\r" + FlowLayoutXML);
                        return;
                    }
                    if (!IsCountersign)
                    {
                        Tracer.Debug("Formid=" + user.FormID + ";(非会签) 根活动的字符串查找角色状态码(即活动Name属性)StateCode=" + strNextActivitID + " Layout=" + FlowLayoutXML + "");
                        #region 非会签
                        bool isHigher = false;
                        //根据角色找人,如果角色有多个人,只找其中一个
                        AppUserInfo = TmGetUserByRoleId(listRoleID[0].RoleName, UserID, PostID, ref isHigher);

                        #region 打印审核人
                        string names = "\r\n=======FormID=" + user.FormID + " 非会签 根据角色找人,如果角色有多个人,只找其中一个 打印审核人B(listRole[0].RoleName=" + listRoleID[0].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                        foreach (var us in AppUserInfo)
                        {
                            names += "CompanyID:" + us.CompanyID + "\r\n";
                            names += "DepartmentID:" + us.DepartmentID + "\r\n";
                            names += "PostID:" + us.PostID + "\r\n";
                            names += "UserID:" + us.UserID + "\r\n";

                            names += "CompanyName:" + us.CompanyName + "\r\n";
                            names += "DepartmentName:" + us.DepartmentName + "\r\n";
                            names += "PostName:" + us.PostName + "\r\n";
                            names += "UserName:"******"\r\n";
                            names += "----------------------------------------------------\r\n";
                        }
                        if (!isHigher && listRoleID[0].IsOtherCompany != null)
                        {
                            if (listRoleID[0].IsOtherCompany.Value == true)
                            {
                                names += "是否指定公司:" + listRoleID[0].IsOtherCompany.Value.ToString() + "\r\n";
                                names += "公司的ID:" + listRoleID[0].OtherCompanyID + "\r\n";
                                if (string.IsNullOrEmpty(listRoleID[0].OtherCompanyID))
                                {
                                    names += "Layout=" + FlowLayoutXML + "\r\n";
                                }
                            }
                            else if (listRoleID[0].IsOtherCompany.Value == false)
                            {
                                names += "实际要查找公司的ID:" + companyID + " " + user.GetCompanyName(companyID) + "\r\n";
                            }
                        }
                        user.ErrorMsg += names;
                        Tracer.Debug(names);
                        #endregion

                        #region beyond

                        if (!isHigher)
                        {
                            if (listRoleID[0].IsOtherCompany != null && listRoleID[0].IsOtherCompany.Value == true)
                            {//指定公司
                                //过滤人
                                AppUserInfo = AppUserInfo.Where(u => u.CompanyID == listRoleID[0].OtherCompanyID).ToList();
                            }
                            else
                            {
                                AppUserInfo = AppUserInfo.Where(u => u.CompanyID == companyID).ToList();
                            }
                        }
                        #endregion

                        if (AppUserInfo == null || AppUserInfo.Count == 0)
                        {
                            DataResult.Err = user.GetCompanyName(companyID) + " " + listRoleID[0].Remark + " 没有找到审核人";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }

                        if (AppUserInfo.Where(c => c.UserID == UserID).Count() == 0)
                        {

                        }

                        #endregion
                    }
                    else
                    {
                        Tracer.Debug("Formid=" + user.FormID + ";(会签) 根活动的字符串查找角色状态码(即活动Name属性)StateCode=" + strNextActivitID + " Layout=" + FlowLayoutXML + "");
                        #region 会签
                        DictCounterUser = new Dictionary<FlowRole, List<UserInfo>>();
                        if (CountersignType == "0")
                        {
                            #region 全部审核通过才算通过
                            for (int i = 0; i < listRoleID.Count; i++)
                            {
                                bool isHigher = false;

                                var listuserinfo = TmGetUserByRoleId(listRoleID[i].RoleName, UserID, PostID, ref isHigher);
                                #region 打印审核人
                                string names = "\r\n=======FormID=" + user.FormID + "会签 全部审核通过才算通过  打印审核人C(listRole[0].RoleName=" + listRoleID[i].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                if (listuserinfo != null)
                                {
                                    foreach (var u in listuserinfo)
                                    {
                                        names += "CompanyID:" + u.CompanyID + "\r\n";
                                        names += "DepartmentID:" + u.DepartmentID + "\r\n";
                                        names += "PostID:" + u.PostID + "\r\n";
                                        names += "UserID:" + u.UserID + "\r\n";

                                        names += "CompanyName:" + u.CompanyName + "\r\n";
                                        names += "DepartmentName:" + u.DepartmentName + "\r\n";
                                        names += "PostName:" + u.PostName + "\r\n";
                                        names += "UserName:"******"\r\n";
                                        names += "----------------------------------------------------\r\n";
                                    }
                                }
                                if (!isHigher && listRoleID[i].IsOtherCompany != null)
                                {
                                    if (listRoleID[i].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRoleID[i].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRoleID[i].OtherCompanyID + "\r\n";
                                        if (string.IsNullOrEmpty(listRoleID[i].OtherCompanyID))
                                        {
                                            names += "Layout=" + FlowLayoutXML + "\r\n";
                                        }
                                    }
                                    else if (listRoleID[i].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                user.ErrorMsg += names;
                                Tracer.Debug(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRoleID[i].IsOtherCompany != null && listRoleID[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(u => u.CompanyID == listRoleID[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(u => u.CompanyID == companyID).ToList();
                                    }
                                }

                                if (listuserinfo == null || listuserinfo.Count == 0)
                                {
                                    DataResult.Err = user.GetCompanyName(companyID) + " " + listRoleID[i].Remark + " 没有找到审核人";
                                    DataResult.FlowResult = FlowResult.FAIL;
                                    return;
                                }
                                DictCounterUser.Add(listRoleID[i], listuserinfo);
                            }
                            #endregion
                        }
                        else
                        {
                            #region 只有一个审核通过了就算审核通过了
                            bool bFlag = false;//判断是否找到审核人
                            string roles = "";//得到所有的角色
                            user.TrackingMessage += "GetUserByStateCode\r\n";
                            for (int i = 0; i < listRoleID.Count; i++)
                            {
                                roles += listRoleID[i].Remark + "、";
                                #region
                                bool isHigher = false;

                                var listuserinfo = TmGetUserByRoleId(listRoleID[i].RoleName, UserID, PostID, ref isHigher);
                                #region 打印审核人
                                string names = "\r\n=======FormID=" + user.FormID + " 会签 只有一个审核通过了就算审核通过了  打印审核人C(listRole[0].RoleName=" + listRoleID[i].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                foreach (var u in listuserinfo)
                                {
                                    names += "CompanyID:" + u.CompanyID + "\r\n";
                                    names += "DepartmentID:" + u.DepartmentID + "\r\n";
                                    names += "PostID:" + u.PostID + "\r\n";
                                    names += "UserID:" + u.UserID + "\r\n";

                                    names += "CompanyName:" + u.CompanyName + "\r\n";
                                    names += "DepartmentName:" + u.DepartmentName + "\r\n";
                                    names += "PostName:" + u.PostName + "\r\n";
                                    names += "UserName:"******"\r\n";
                                    names += "----------------------------------------------------\r\n";
                                }
                                if (!isHigher && listRoleID[i].IsOtherCompany != null)
                                {
                                    if (listRoleID[i].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRoleID[i].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRoleID[i].OtherCompanyID + "\r\n";
                                        if (string.IsNullOrEmpty(listRoleID[i].OtherCompanyID))
                                        {
                                            names += "Layout=" + FlowLayoutXML + "\r\n";
                                        }
                                    }
                                    else if (listRoleID[i].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                user.ErrorMsg += names;
                                Tracer.Debug(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRoleID[i].IsOtherCompany != null && listRoleID[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(u => u.CompanyID == listRoleID[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(u => u.CompanyID == companyID).ToList();
                                    }
                                }

                                if (listuserinfo != null && listuserinfo.Count > 0)
                                {
                                    bFlag = true;
                                    if (listuserinfo.FirstOrDefault(u => u.UserID == UserID) != null)
                                    {
                                        break;
                                    }
                                }
                                DictCounterUser.Add(listRoleID[i], listuserinfo);
                                #endregion
                            }
                            if (!bFlag)
                            {
                                DataResult.Err = user.GetCompanyName(companyID) + " " + roles + " 没有找到审核人";
                                DataResult.FlowResult = FlowResult.FAIL;
                                return;
                            }
                            user.TrackingMessage += " GetUserByStateCode完成\r\n";
                            //iscurruser = false;
                            #endregion
                        }
                        #endregion
                    }
                }
                #endregion

                DataResult.IsCountersign = IsCountersign;
                DataResult.AppState = strNextActivitID;
                DataResult.CountersignType = CountersignType;
                if (!IsCountersign)
                {
                    #region 检查非会签角色是否有多个审核人
                    Tracer.Debug("FormID=" + user.FormID + " 检查非会签角色的审核人数=" + AppUserInfo.Count.ToString());
                    if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                    {
                        DataResult.FlowResult = FlowResult.MULTIUSER;
                    }

                    DataResult.UserInfo = AppUserInfo;
                    #endregion
                }
                else
                {
                    Tracer.Debug("FormID=" + user.FormID + " 检查会签角色的审核人数=" + DictCounterUser.Count.ToString());
                    #region 检查会签角色是否有多个审核人,如果有多个审核人,则返回
                    DataResult.DictCounterUser = DictCounterUser;
                    List<FlowRole> listkeys = DictCounterUser.Keys.ToList();
                    for (int i = 0; i < listkeys.Count; i++)
                    {
                        FlowRole key = listkeys[i];
                        if (DictCounterUser[key].Count > 1)
                        {
                            DataResult.FlowResult = FlowResult.Countersign;
                            break;
                        }
                    }
                    #endregion

                }
                user.TrackingMessage += " iscurruser完成\r\n";

            }
            catch (Exception ex)
            {
                Tracer.Debug("Formid=" + user.FormID + ";GetUserByFlow2异常信息 :" + ex.ToString());
                throw new Exception("获取下一状态数据出错,请联系管理员! \r\n FormID=" + user.FormID + "");
            }
            finally
            {
                strCurrActivitID = null;
                strNextActivitID = null;
                //RuleName = null;
                AppUserInfo = null;
                Instance = null;
                user.TrackingMessage += "  SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime)\r\n";
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);
                user.TrackingMessage += "  SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime)完成\r\n";

            }
        }
    public IEnumerator Init()
    {
        #region debug
        if (isDebug)
        {
            // record params of camera
            camParam = new CamParam(new Vector3(50, 0, 0), heroCamera.fieldOfView);
            curConfig = GameObject.FindObjectOfType(typeof(LevelConfig)) as LevelConfig;
            curLevelCamera = GameObject.FindObjectOfType(typeof(LevelCamera)) as LevelCamera;

            InitRes();

            if (isDebugPvp)
            {
                flowType = FlowType.PVP;
                LevelData.levelType = 8;
            }
        }
        #endregion

        curConfig.Init();

        while (!isInit) yield return null;

        //my heros init :
        myPlayer.ExternalInit();

        switch (flowType)
        {
            case FlowType.PVP:
                InitPVP();
                break;
            default:
                InitPVE();
                break;
        }

        //顺计时开始
        StartCoroutine(BeginTimer());
        //默认计时显示
        UIBattleManager.instance.LoginCountUpTimer();
        InvokeRepeating("CountUpTimer", 0f, 1f);

        ExecuteAction();

        //Debug.Log(" wait time----------------------" + curLevelCamera.waitTimeToPlay);
        if (curLevelCamera)
        {
            if (curLevelCamera.waitTimeToPlay > 0)
                yield return new WaitForSeconds(curLevelCamera.waitTimeToPlay);

            if (curLevelCamera.open.Count > 0)
            {
                int endIndex = curLevelCamera.open.Count - 1;
                foreach (CameraPathBezierAnimator cpa in curLevelCamera.open)
                {
                    cpa.animationTarget = heroCamera.transform;
                }

                curLevelCamera.open[endIndex].AnimationFinished += CameraFinish;
                curLevelCamera.open[0].Play();
                Debug.Log("Camera Play --------------");
            }
            else CameraFinish();
        }
        else
        {
            Debug.Log("LevelCamera is Null --------------");
            CameraFinish();
        }
    }
Exemplo n.º 38
0
        private void CreateNewFlow(Activity source, Activity target, string outcome, string storyLine, string visioId, FlowType type)
        {
            //if (source is Rule)
            //{
            //    new Flow(source, target)
            //    {
            //        Outcome = outcome,
            //        Storyline = storyLine,
            //        VisioId = visioId,
            //        Type = type

            //    };
            //}
            //else
            //{
            //    new FlowMinimal(source, target)
            //    {
            //        Storyline = storyLine,
            //        VisioId = visioId,
            //        Type = type
            //    };
            //}
        }
Exemplo n.º 39
0
Arquivo: FlowBLL.cs Projeto: JuRogn/OA
        public void GetUserByFlow2(string companyID,string Xoml, string Rules, string Layout, string xml, string UserID, string PostID, FlowType FlowType, ref DataResult DataResult) 
        {
           
            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            string strCurrState = "StartFlow";
            string strNextState = "StartFlow";
            bool IsCountersign = false;
            string CountersignType = "0";
            //Role_UserType RuleName;
            List<UserInfo> AppUserInfo = null;
            Dictionary<Role_UserType, List<UserInfo>> DictCounterUser = null;
            try
            {
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);

                bool iscurruser = true;
                int testflag = 0;
                while (iscurruser)
                {
                    testflag++;
                    if (testflag > 10)
                    {
                        throw new Exception("循环超过10次");
                    }
                    #region
                    strCurrState = strNextState;

                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);

                    if (strNextState == "EndFlow")
                    {
                        strNextState = strCurrState;
                        iscurruser = false;
                    }
                    else
                    {
                        List<Role_UserType> listRole = Utility.GetRlueName2(Layout, strNextState, ref IsCountersign, ref CountersignType);
                        if (listRole.Count == 0)
                        {
                            DataResult.Err = "没有找到对应角色";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }
                        if (!IsCountersign)
                        {
                            #region
                            bool isHigher = false;
                            //根据角色找人
                            AppUserInfo = GetUserByStateCode(listRole[0].RoleName, UserID, PostID,ref isHigher);
                            #region beyond

                            if (!isHigher)
                            {
                                if (listRole[0].IsOtherCompany != null&&listRole[0].IsOtherCompany.Value == true)
                                {
                                    //过滤人
                                    AppUserInfo = AppUserInfo.Where(user => user.CompanyID == listRole[0].OtherCompanyID).ToList();
                                }
                                else 
                                {
                                    AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                                }
                            }

                           
                            
                           
                            #endregion 
                            if (AppUserInfo == null || AppUserInfo.Count == 0)
                            {
                                DataResult.Err = "没有找到审核人";
                                DataResult.FlowResult = FlowResult.FAIL;
                                return;
                            }


                            if (AppUserInfo.Where(c => c.UserID == UserID).Count() == 0)
                                iscurruser = false;
                            #endregion
                        }
                        else
                        {
                            #region
                            DictCounterUser = new Dictionary<Role_UserType, List<UserInfo>>();
                            if (CountersignType == "0")
                            {
                                #region
                                for (int i = 0; i < listRole.Count; i++)
                                {
                                    bool isHigher = false;
                                    

                                    var listuserinfo = GetUserByStateCode(listRole[i].RoleName, UserID, PostID,ref isHigher);
                                    if (!isHigher)
                                    {
                                        if (listRole[i].IsOtherCompany != null&&listRole[i].IsOtherCompany.Value == true)
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                        }
                                        else 
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                        }
                                    }

                                    if (listuserinfo == null || listuserinfo.Count == 0)
                                    {
                                        DataResult.Err = "没有找到审核人";
                                        DataResult.FlowResult = FlowResult.FAIL;
                                        return;
                                    }
                                    DictCounterUser.Add(listRole[i], listuserinfo);
                                }
                                iscurruser = false;
                                #endregion
                            }
                            else
                            {
                                #region
                                iscurruser = false;
                                bool bFlag = false;
                                for (int i = 0; i < listRole.Count; i++)
                                {
                                    bool isHigher = false;
                                    var listuserinfo = GetUserByStateCode(listRole[i].RoleName, UserID, PostID,ref isHigher);
                                    if (!isHigher)
                                    {
                                        if (listRole[i].IsOtherCompany != null&&listRole[i].IsOtherCompany.Value == true)
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                        }
                                        else 
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                        }
                                    }

                                    if (listuserinfo != null && listuserinfo.Count > 0)
                                    {
                                        bFlag = true;
                                        if (listuserinfo.FirstOrDefault(u => u.UserID == UserID) != null)
                                        {
                                            iscurruser = true;
                                            break;
                                        }
                                        //DataResult.Err = "没有找到审核人";
                                        //DataResult.FlowResult = FlowResult.FAIL;
                                        //return;
                                    }
                                   
                                    DictCounterUser.Add(listRole[i], listuserinfo);
                                }
                                if (!bFlag)
                                {
                                    DataResult.Err = "没有找到审核人";
                                    DataResult.FlowResult = FlowResult.FAIL;
                                    return;
                                }
                                //iscurruser = false;
                                #endregion
                            }
                            #endregion
                        }
                    }
                    #endregion
                }
                DataResult.IsCountersign = IsCountersign;
                DataResult.AppState = strNextState;
                DataResult.CountersignType = CountersignType;
                if (!IsCountersign)
                {
                    #region
                    if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                    {
                        DataResult.FlowResult = FlowResult.MULTIUSER;
                    }

                    DataResult.UserInfo = AppUserInfo;
                    #endregion
                }
                else
                {
                    #region
                    DataResult.DictCounterUser = DictCounterUser;
                    List<Role_UserType> listkeys = DictCounterUser.Keys.ToList();
                    for (int i = 0; i < listkeys.Count; i++)
                    {
                        Role_UserType key = listkeys[i];
                        if (DictCounterUser[key].Count > 1)
                        {
                            DataResult.FlowResult = FlowResult.Countersign;
                            break;
                        }
                    }
                    #endregion

                }


            }
            catch (Exception ex)
            {
                throw new Exception("GetUserByFlow2:" + ex.Message);
            }
            finally
            {
                strCurrState = null;
                strNextState = null;
                //RuleName = null;
                AppUserInfo = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }


        }
Exemplo n.º 40
0
        /// <summary>
        /// 非会签是使用
        /// </summary>
        /// <param name="con"></param>
        /// <param name="workflowRuntime"></param>
        /// <param name="instance"></param>
        /// <param name="entity"></param>
        /// <param name="NextStateCode"></param>
        /// <param name="AppUser"></param>
        /// <param name="AgentUser"></param>
        /// <param name="SubmitFlag"></param>
        /// <param name="FlowType"></param>
        /// <returns></returns>
        public DataResult AddOrUpdateFlowRecord( WorkflowRuntime workflowRuntime, WorkflowInstance instance, FLOW_FLOWRECORDDETAIL_T entity, string NextStateCode, UserInfo AppUser, UserInfo AgentUser, SubmitFlag SubmitFlag, FlowType FlowType,ref FlowUser fUser)
        {
            DataResult tmpDataResult = new DataResult();
            UserInfo tmpUserInfo = AppUser;
            tmpDataResult.UserInfo.Add(tmpUserInfo);
            try
            {

                if (SubmitFlag == SubmitFlag.New)
                {
                    #region 新增流程
                    //添加启动状态
                    if (SubmitFlag == FlowWFService.SubmitFlag.New)
                    {
                        entity.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID = Guid.NewGuid().ToString();
                    }
                    entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "1";
                    entity.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID = entity.CREATEPOSTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDATE = DateTime.Now;
                    entity.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    // entity.FLOW_FLOWRECORDMASTER_T .INSTANCEID  = instance.InstanceId.ToString();
                    entity.FLAG = "1";
                    entity.CHECKSTATE = "1";

                    //entity.FlowCode = "TestFlow";  //正式使用时关屏蔽

                    entity.STATECODE = "StartFlow";
                    entity.PARENTSTATEID = entity.FLOWRECORDDETAILID;

                    entity.CREATEDATE = DateTime.Now;
                    entity.EDITDATE = DateTime.Now;
                    entity.EDITUSERID = entity.CREATEUSERID;
                    entity.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.EDITCOMPANYID = entity.CREATECOMPANYID;
                    entity.EDITDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.EDITPOSTID = entity.CREATEPOSTID;

                    #region 引擎自动提交时停留在提交人处

                    if (FlowType == FlowType.Pending)
                    {
                        entity.FLAG = "0";
                        entity.EDITUSERID = AppUser.UserID;
                        entity.EDITUSERNAME = AppUser.UserName;
                        entity.EDITCOMPANYID = AppUser.CompanyID;
                        entity.EDITDEPARTMENTID = AppUser.DepartmentID;
                        entity.EDITPOSTID = AppUser.PostID;
                        fUser.NextEditUserID = entity.EDITUSERID;
                        fUser.NextEditUserName = entity.EDITUSERNAME;
                        FLOW_FLOWRECORDMASTER_TDAL.Add( entity.FLOW_FLOWRECORDMASTER_T);
                        AddFlowDetailRecord( entity, NextStateCode, AppUser.UserID);
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";
                        return tmpDataResult;
                    }

                    #endregion

                    FLOW_FLOWRECORDMASTER_TDAL.Add( entity.FLOW_FLOWRECORDMASTER_T);
                    fUser.NextEditUserID = entity.EDITUSERID;
                    fUser.NextEditUserName = entity.EDITUSERNAME;
                    AddFlowDetailRecord( entity, NextStateCode, AppUser.UserID);

                    FLOW_FLOWRECORDDETAIL_T entDetail = new FLOW_FLOWRECORDDETAIL_T();

                    //添加下一状态
                    entDetail.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    entDetail.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                    entDetail.STATECODE = NextStateCode == "" ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                    entDetail.PARENTSTATEID = entity.FLOWRECORDDETAILID;//entity.StateCode;
                    //entity2.Content = ".";
                    entDetail.FLAG = "0";
                    entDetail.CHECKSTATE = "2";
                    entDetail.CREATEPOSTID = entity.CREATEPOSTID;
                    entDetail.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entDetail.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entDetail.CREATEUSERID = entity.EDITUSERID;
                    entDetail.CREATEUSERNAME = entity.EDITUSERNAME;
                    entDetail.CREATEDATE = DateTime.Now;
                    entDetail.EDITUSERID = AppUser.UserID;
                    entDetail.EDITUSERNAME = AppUser.UserName;
                    entDetail.EDITCOMPANYID = AppUser.CompanyID;
                    entDetail.EDITDEPARTMENTID = AppUser.DepartmentID;
                    entDetail.EDITPOSTID = AppUser.PostID;
                    entDetail.EDITDATE = DateTime.Now;

                    if (AgentUser != null)  //如果启用了代理,把代理人信息写入
                    {
                        entDetail.AGENTUSERID = AgentUser.UserID;
                        entDetail.AGENTERNAME = AgentUser.UserName;
                        entDetail.AGENTEDITDATE = DateTime.Now;
                    }

                    tmpDataResult.AppState = entDetail.STATECODE;

                    if (entDetail.STATECODE != "EndFlow")
                    {
                        fUser.NextEditUserID = entDetail.EDITUSERID;
                        fUser.NextEditUserName = entDetail.EDITUSERNAME;
                        AddFlowDetailRecord( entDetail, NextStateCode, AppUser.UserID);
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";
                    }
                    else
                    {
                        tmpDataResult.CheckState = "2";
                        tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                    }
                    tmpDataResult.IsCountersignComplete = true;
                    return tmpDataResult;

                    #endregion
                }

                else
                {
                    #region 更新流程
                    //如果NextStateCode为空则自动获取模型中的下一状态,如果不为空则使用传入状态代码,并使用传入下一任务人ID
                    //更新本流程
                    entity = UpdateFlowDetailRecord( entity, NextStateCode, AppUser.UserID);
                    string stateCode = "";
                    if (NextStateCode.ToUpper() == "ENDFLOW")
                    {
                        stateCode = NextStateCode;
                    }
                    else
                    {
                        stateCode = string.IsNullOrEmpty(NextStateCode) ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                    }
                    if (stateCode == "EndFlow")
                    {
                        #region
                        entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "2"; //设为终审通过
                        if (entity.EDITDATE == entity.AGENTEDITDATE)  //代理审核时
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.AGENTUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.AGENTERNAME;

                        }
                        else   //正常审核时
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.EDITUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.EDITUSERNAME;

                        }

                        entity.FLOW_FLOWRECORDMASTER_T.EDITDATE = DateTime.Now;

                        UpdateFlowDetailRecord( entity, NextStateCode, AppUser.UserID);

                        FLOW_FLOWRECORDMASTER_TDAL.Update(entity.FLOW_FLOWRECORDMASTER_T);
                        tmpDataResult.AppState = stateCode;
                        tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                        tmpDataResult.CheckState = "2";
                        #endregion
                    }
                    else
                    {
                        #region
                        //添加下一状态
                        FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();
                        //添加下一状态
                        entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                        if (NextStateCode != "")
                        {
                            entity2.STATECODE = NextStateCode;
                        }
                        else
                        {
                            entity2.STATECODE = stateCode;
                        }
                        entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                        entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;// entity.StateCode;
                        entity2.FLAG = "0";
                        entity2.CHECKSTATE = "2";
                        entity2.CREATEPOSTID = entity.CREATEPOSTID;
                        entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                        entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                        entity2.CREATEUSERID = entity.EDITUSERID;
                        entity2.CREATEUSERNAME = entity.EDITUSERNAME;

                        entity2.EDITUSERID = AppUser.UserID;
                        entity2.EDITUSERNAME = AppUser.UserName;
                        entity2.EDITCOMPANYID = AppUser.CompanyID;
                        entity2.EDITDEPARTMENTID = AppUser.DepartmentID;
                        entity2.EDITPOSTID = AppUser.PostID;

                        entity2.CREATEDATE = DateTime.Now;

                        entity2.EDITDATE = DateTime.Now;
                        if (AgentUser != null)  //如果启用了代理,把代理人信息写入
                        {
                            entity2.AGENTUSERID = AgentUser.UserID;
                            entity2.AGENTERNAME = AgentUser.UserName;
                            entity2.AGENTEDITDATE = DateTime.Now;
                        }

                        tmpDataResult.AppState = entity2.STATECODE;
                        fUser.NextEditUserID = entity2.EDITUSERID;
                        fUser.NextEditUserName = entity2.EDITUSERNAME;
                        AddFlowDetailRecord( entity2, NextStateCode, AppUser.UserID);
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";
                        #endregion
                        #region 更新审核主表的审核人(提莫科技新增)
                        entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "1";
                        if (entity.EDITDATE == entity.AGENTEDITDATE)
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.AGENTUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.AGENTERNAME;
                        }
                        else   //正常审核时
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.EDITUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.EDITUSERNAME;
                        }
                        entity.FLOW_FLOWRECORDMASTER_T.EDITDATE = DateTime.Now;
                        FLOW_FLOWRECORDMASTER_TDAL.Update(entity.FLOW_FLOWRECORDMASTER_T);

                        #endregion
                    }

                    tmpDataResult.IsCountersignComplete = true;
                    return tmpDataResult;   //如有下一节点,返回SUCCESS

                    #endregion

                }
            }
            catch (Exception ex)
            {
                Tracer.Debug("DoFlowRecord2异常信息 :" + ex.ToString());
                throw new Exception("DoFlowRecord2:" + ex.InnerException + ex.Message);
            }
        }
Exemplo n.º 41
0
Arquivo: FlowBLL.cs Projeto: JuRogn/OA
        /// <summary>
        /// 通过流程查找审核人
        /// </summary>
        /// <param name="Xoml"></param>
        /// <param name="Rules"></param>
        /// <param name="xml"></param>
        /// <param name="UserID"></param>
        /// <param name="DataResult"></param>
        //public void GetUserByFlow(string Xoml, string Rules, string xml, string UserID, ref DataResult DataResult)
        //{
        //    WorkflowRuntime WfRuntime = null;
        //    WorkflowInstance Instance = null;
        //    try
        //    {
        //        WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
        //        Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);

        //        string strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, "StartFlow", xml);



        //        List<UserInfo> AppUserInfo = GetUserByStateCode(strNextState, UserID);
        //        if (AppUserInfo == null || AppUserInfo.Count == 0)
        //        {
        //            DataResult.Err = "没有找到审核人";
        //            DataResult.FlowResult = FlowResult.FAIL;
        //        }
        //        else if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
        //        {
        //            DataResult.FlowResult = FlowResult.MULTIUSER;
        //        }
        //        DataResult.UserInfo = AppUserInfo;


        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);
        //    }
        //    finally
        //    {
        //        Instance = null;
        //        SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

        //    }


        //}

        #endregion

        #region 通过流程查找审核人(对应SubmitFlow)

        /// <summary>
        /// 通过流程查找审核人(对应SubmitFlow)
        /// </summary>
        /// <param name="Xoml"></param>
        /// <param name="Rules"></param>
        /// <param name="Layout"></param>
        /// <param name="xml"></param>
        /// <param name="UserID"></param>
        /// <param name="FlowType"></param>
        /// <param name="DataResult"></param>
        public void GetUserByFlow(string companyID,string Xoml, string Rules, string Layout, string xml, string UserID, string PostID, FlowType FlowType, ref DataResult DataResult)        
        {
           

            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            string strCurrState = "StartFlow";
            string strNextState = "StartFlow";

            Role_UserType RuleName;
            List<UserInfo> AppUserInfo = null;
            try
            {
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);

                bool iscurruser = true;

                while (iscurruser)
                {
                    strCurrState = strNextState;

                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);

                    if (strNextState == "EndFlow")
                    {
                        strNextState = strCurrState;
                        iscurruser = false;
                    }
                    else
                    {

                        RuleName = Utility.GetRlueName(Layout, strNextState);
                        if (RuleName == null)
                        {
                            DataResult.Err = "没有找到对应角色";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }
                        bool isHigher = false;
                        AppUserInfo = GetUserByStateCode(RuleName.RoleName, UserID, PostID,ref isHigher);

                        #region beyond
                        if (!isHigher&& RuleName.IsOtherCompany != null)
                        {
                            if (RuleName.IsOtherCompany.Value==true)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == RuleName.OtherCompanyID).ToList();
                            }
                            else if(RuleName.IsOtherCompany.Value==false)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                            }
                        }
                        #endregion 

                        if (AppUserInfo == null || AppUserInfo.Count == 0)
                        {
                            DataResult.Err = "没有找到审核人";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }

                        if (AppUserInfo.Where(c => c.UserID == UserID).Count() == 0)
                            iscurruser = false;
                    }
                }


                //if (AppUserInfo == null || AppUserInfo.Count == 0)
                //{
                //    DataResult.Err = "没有找到审核人";
                //    DataResult.FlowResult = FlowResult.FAIL;
                //}
                // else if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                {
                    DataResult.FlowResult = FlowResult.MULTIUSER;
                }
                DataResult.AppState = strNextState;
                DataResult.UserInfo = AppUserInfo;


            }
            catch (Exception ex)
            {
                throw new Exception("GetUserByFlow:" + ex.Message);
            }
            finally
            {
                strCurrState = null;
                strNextState = null;
                RuleName = null;
                AppUserInfo = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }


        }
Exemplo n.º 42
0
        /// <summary>
        /// 流程数据处理(对应SubmitFlow)对数据库操作
        /// </summary>
        /// <param name="workflowRuntime"></param>
        /// <param name="instance"></param>
        /// <param name="entity"></param>
        /// <param name="NextStateCode"></param>
        /// <param name="EditUserId"></param>
        /// <param name="EditUserName"></param>
        /// <param name="SubmitFlag"></param>
        /// <param name="FlowType"></param>
        /// <returns></returns>
        public DataResult DoFlowRecord(OracleConnection con, WorkflowRuntime workflowRuntime, WorkflowInstance instance, FLOW_FLOWRECORDDETAIL_T entity, string NextStateCode, UserInfo AppUser, UserInfo AgentUser, SubmitFlag SubmitFlag, FlowType FlowType)
        {
            DataResult tmpDataResult = new DataResult();
            UserInfo tmpUserInfo = AppUser;

            //tmpUserInfo.UserID = EditUserId;
            //tmpUserInfo.UserName = EditUserName;

            tmpDataResult.UserInfo.Add(tmpUserInfo);
            try
            {

                if (SubmitFlag == SubmitFlag.New)
                {
                    #region 新增流程
                    //添加启动状态

                    entity.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID = Guid.NewGuid().ToString();

                    entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "1";

                    entity.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID = entity.CREATEPOSTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDATE = DateTime.Now;

                    entity.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    // entity.FLOW_FLOWRECORDMASTER_T .INSTANCEID  = instance.InstanceId.ToString();
                    entity.FLAG = "1";
                    entity.CHECKSTATE = "1";

                    //entity.FlowCode = "TestFlow";  //正式使用时关屏蔽

                    entity.STATECODE = "StartFlow";
                    entity.PARENTSTATEID = entity.FLOWRECORDDETAILID;

                    entity.CREATEDATE = DateTime.Now;
                    entity.EDITDATE = DateTime.Now;
                    entity.EDITUSERID = entity.CREATEUSERID;
                    entity.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.EDITCOMPANYID = entity.CREATECOMPANYID;
                    entity.EDITDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.EDITPOSTID = entity.CREATEPOSTID;

                    #region 引擎自动提交时停留在提交人处

                    if (FlowType == FlowType.Pending)
                    {
                        entity.FLAG = "0";
                        entity.EDITUSERID = AppUser.UserID;
                        entity.EDITUSERNAME = AppUser.UserName;
                        entity.EDITCOMPANYID = AppUser.CompanyID;
                        entity.EDITDEPARTMENTID = AppUser.DepartmentID;
                        entity.EDITPOSTID = AppUser.PostID;
                        FLOW_FLOWRECORDMASTER_TDAL.Add(con, entity.FLOW_FLOWRECORDMASTER_T);//对数据库操作
                        AddFlowRecord(con, entity, NextStateCode, AppUser.UserID);
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";
                        return tmpDataResult;
                    }

                    #endregion

                    FLOW_FLOWRECORDMASTER_TDAL.Add(con, entity.FLOW_FLOWRECORDMASTER_T);//对数据库操作
                    AddFlowRecord(con, entity, NextStateCode, AppUser.UserID);



                    FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();

                    //添加下一状态
                    entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                    entity2.STATECODE = NextStateCode == "" ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                    entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;//entity.StateCode;

                    //entity2.Content = ".";
                    entity2.FLAG = "0";
                    entity2.CHECKSTATE = "2";
                    entity2.CREATEPOSTID = entity.CREATEPOSTID;
                    entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity2.CREATEUSERID = entity.EDITUSERID;
                    entity2.CREATEUSERNAME = entity.EDITUSERNAME;
                    entity2.CREATEDATE = DateTime.Now;
                    entity2.EDITUSERID = AppUser.UserID;
                    entity2.EDITUSERNAME = AppUser.UserName;
                    entity2.EDITCOMPANYID = AppUser.CompanyID;
                    entity2.EDITDEPARTMENTID = AppUser.DepartmentID;
                    entity2.EDITPOSTID = AppUser.PostID;
                    entity2.EDITDATE = DateTime.Now;

                    if (AgentUser != null)  //如果启用了代理,把代理人信息写入
                    {
                        entity2.AGENTUSERID = AgentUser.UserID;
                        entity2.AGENTERNAME = AgentUser.UserName;
                        entity2.AGENTEDITDATE = DateTime.Now;
                    }

                    tmpDataResult.AppState = entity2.STATECODE;

                    if (entity2.STATECODE != "EndFlow")
                    {
                        AddFlowRecord(con, entity2, NextStateCode, AppUser.UserID);//对数据库操作
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";
                    }
                    else
                    {
                        tmpDataResult.CheckState = "2";
                        tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                    }

                    return tmpDataResult;

                    #endregion
                }
                else
                {
                    #region 更新流程
                    //如果NextStateCode为空则自动获取模型中的下一状态,如果不为空则使用传入状态代码,并使用传入下一任务人ID

                    //更新本流程



                    entity = UpdateFlowRecord(con, entity, NextStateCode, AppUser.UserID);//对数据库操作

                    //添加下一状态
                    FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();

                    //添加下一状态
                    entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();


                    if (NextStateCode != "")
                    {
                        entity2.STATECODE = NextStateCode;
                        //entity2.EditUserID = EditUserId;
                        //entity2.EditUserName = EditUserName;
                    }
                    else
                    {
                        entity2.STATECODE = SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE);
                        // entity2.EditUserID = entity2.StateCode=="EndFlow" ? "" : "EditUserId"; //根据状态查询权限表中用户ID
                    }

                    if (entity2.STATECODE == "EndFlow")
                    {

                        entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "2"; //设为终审通过
                        if (entity.EDITDATE == entity.AGENTEDITDATE)  //代理审核时
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.AGENTUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.AGENTERNAME;
                        }
                        else   //正常审核时
                        {
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.EDITUSERID;
                            entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.EDITUSERNAME;
                        }

                        entity.FLOW_FLOWRECORDMASTER_T.EDITDATE = DateTime.Now;

                        UpdateFlowRecord(con, entity, NextStateCode, AppUser.UserID);//对数据库操作
                        FLOW_FLOWRECORDMASTER_TDAL.Update(entity.FLOW_FLOWRECORDMASTER_T);//对数据库操作
                    }




                    entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;// entity.StateCode;

                    //entity2.Content = "";
                    entity2.FLAG = "0";
                    entity2.CHECKSTATE = "2";
                    entity2.CREATEPOSTID = entity.CREATEPOSTID;
                    entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;

                    //if (entity.EDITDATE == entity.AGENTEDITDATE) //代理审核时
                    //{
                    //    entity2.CREATEUSERID = entity.AGENTUSERID;
                    //    entity2.CREATEUSERNAME = entity.AGENTERNAME;
                    //}
                    //else   //正常审核时
                    //{
                    entity2.CREATEUSERID = entity.EDITUSERID;
                    entity2.CREATEUSERNAME = entity.EDITUSERNAME;
                    //}

                    entity2.EDITUSERID = AppUser.UserID;
                    entity2.EDITUSERNAME = AppUser.UserName;
                    entity2.EDITCOMPANYID = AppUser.CompanyID;
                    entity2.EDITDEPARTMENTID = AppUser.DepartmentID;
                    entity2.EDITPOSTID = AppUser.PostID;

                    entity2.CREATEDATE = DateTime.Now;

                    entity2.EDITDATE = DateTime.Now;
                    if (AgentUser != null)  //如果启用了代理,把代理人信息写入
                    {
                        entity2.AGENTUSERID = AgentUser.UserID;
                        entity2.AGENTERNAME = AgentUser.UserName;
                        entity2.AGENTEDITDATE = DateTime.Now;
                    }

                    tmpDataResult.AppState = entity2.STATECODE;

                    if (entity2.STATECODE != "EndFlow")
                    {
                        entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                        AddFlowRecord(con, entity2, NextStateCode, AppUser.UserID);//对数据库操作
                        tmpDataResult.FlowResult = FlowResult.SUCCESS;
                        tmpDataResult.CheckState = "1";

                    }
                    else
                    {
                        tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                        tmpDataResult.CheckState = "2";
                    }

                    return tmpDataResult;   //如有下一节点,返回SUCCESS

                    #endregion

                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("DoFlowRecord异常信息 :" + ex.ToString());
                throw new Exception("DoFlowRecord:" + ex.InnerException + ex.Message);
                //tmpDataResult.FlowResult = FlowResult.FAIL;
                //tmpDataResult.Err = ex.Message;
                //return tmpDataResult;
            }
        }
Exemplo n.º 43
0
 /// <summary>
 /// Подписывает документ, отправленный ранее (для пересланных и документов без подписи)
 /// </summary>
 /// <param name="flowType">Тип документооборота</param>
 /// <param name="sign">Подпись документа</param>
 public void SignDocument(FlowType flowType, Sign sign)
 {
     CheckAutorizedInvoke(() =>
     {
         client.SignDocument(Token, flowType, sign);
         return true;
     });
 }
Exemplo n.º 44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="WfRuntimeClone"></param>
        /// <param name="instanceClone"></param>
        /// <param name="Layout">从审核主表记录ACTIVEROLE字段获取</param>
        /// <param name="xml"></param>
        /// <param name="CurrentStateName">当前状态</param>
        /// <param name="UserID"></param>
        /// <param name="PostID"></param>
        /// <param name="FlowType"></param>
        /// <param name="DataResult"></param>
        public void GetUserByInstance2(string companyID, WorkflowRuntime WfRuntimeClone, WorkflowInstance instanceClone, string Layout, string xml, string CurrentStateName, List<string> UserID, List<string> PostID, FlowType FlowType, ref DataResult DataResult,ref FlowUser fUser)
        {
            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            List<UserInfo> AppUserInfo = null;
            string strNextState = CurrentStateName;
            bool IsCountersign = false;
            string CountersignType = "0";
            //Role_UserType RuleName;
            //List<UserInfo> AppUserInfo = null;
            Dictionary<FlowRole, List<UserInfo>> DictCounterUser = null;
            try
            {
                if (!WfRuntimeClone.IsStarted)
                {
                    WfRuntimeClone.StartRuntime();
                }
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CloneWorkflowInstance(WfRuntimeClone, instanceClone, WfRuntime);
                bool iscurruser = true;
                int testflag = 0;
                while (iscurruser)
                {
                    testflag++;
                    if (testflag > 10)
                    {
                        throw new Exception("循环处理流程超过10次,请联系系统管理员");
                    }
                    #region

                    strNextState = SMTWorkFlowManage.GetFlowNextStepRoles(WfRuntime, Instance, strNextState, xml);
                    List<FlowRole> listRole = FlowUtility.GetRlueIdFromActivitID(Layout, strNextState, ref IsCountersign, ref CountersignType);
                    if (listRole.Count == 0)
                    {
                        DataResult.Err = "没有找到对应角色";
                        DataResult.FlowResult = FlowResult.FAIL;
                        return;
                    }

                    if (!IsCountersign)
                    {
                        #region
                        string tmpPostID = listRole[0].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                        bool isHigher = false;
                        AppUserInfo = TmGetUserByRoleId(listRole[0].RoleName, null, tmpPostID, ref isHigher);
                        #region 打印审核人
                        string names = "\r\nFormID=" + fUser.FormID + ";=======打印审核人F(listRole[0].RoleName=" + listRole[0].RoleName + ";审核人数量=" + AppUserInfo.Count + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                        foreach (var user in AppUserInfo)
                        {
                            names += "CompanyID:" + user.CompanyID + "\r\n";
                            names += "DepartmentID:" + user.DepartmentID + "\r\n";
                            names += "PostID:" + user.PostID + "\r\n";
                            names += "UserID:" + user.UserID + "\r\n";

                            names += "CompanyName:" + user.CompanyName + "\r\n";
                            names += "DepartmentName:" + user.DepartmentName + "\r\n";
                            names += "PostName:" + user.PostName + "\r\n";
                            names += "UserName:"******"\r\n";
                            names += "----------------------------------------------------\r\n";
                        }
                        if (!isHigher && listRole[0].IsOtherCompany != null)
                        {
                            if (listRole[0].IsOtherCompany.Value == true)
                            {
                                names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                if (string.IsNullOrEmpty(listRole[0].OtherCompanyID))
                                {
                                    names += "Layout=" + Layout + "\r\n";
                                }
                            }
                            else if (listRole[0].IsOtherCompany.Value == false)
                            {
                                names += "实际要查找公司的ID:" + companyID + "\r\n";
                            }
                        }
                        fUser.ErrorMsg += names;
                        Tracer.Debug(names);
                        #endregion
                        #region beyond

                        if (!isHigher && strNextState.ToUpper() != "ENDFLOW")
                        {
                            if (listRole[0].IsOtherCompany != null && listRole[0].IsOtherCompany.Value == true)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == listRole[0].OtherCompanyID).ToList();
                            }
                            else
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                            }

                        }

                        #endregion
                        if (AppUserInfo == null || AppUserInfo.Count == 0)
                        {
                            DataResult.Err = "当前角色 " + listRole[0].Remark + " 没有找到审核人" ;
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }

                        if (AppUserInfo.Where(c => c.UserID == UserID[1]).Count() == 0)
                            iscurruser = false;
                        #endregion
                    }
                    else
                    {
                        #region
                        DictCounterUser = new Dictionary<FlowRole, List<UserInfo>>();
                        if (CountersignType == "0")
                        {
                            #region
                            for (int i = 0; i < listRole.Count; i++)
                            {
                                string tmpPostID = listRole[i].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                                bool isHigher = false;
                                var listuserinfo = TmGetUserByRoleId(listRole[i].RoleName, null, tmpPostID, ref isHigher);
                                #region 打印审核人
                                string names = "\r\n=======打印审核人G(listRole[i].RoleName=" + listRole[0].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                foreach (var user in listuserinfo)
                                {
                                    names += "CompanyID:" + user.CompanyID + "\r\n";
                                    names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                    names += "PostID:" + user.PostID + "\r\n";
                                    names += "UserID:" + user.UserID + "\r\n";

                                    names += "CompanyName:" + user.CompanyName + "\r\n";
                                    names += "DepartmentName:" + user.DepartmentName + "\r\n";
                                    names += "PostName:" + user.PostName + "\r\n";
                                    names += "UserName:"******"\r\n";
                                    names += "----------------------------------------------------\r\n";
                                }
                                if (!isHigher && listRole[0].IsOtherCompany != null)
                                {
                                    if (listRole[0].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                        if (string.IsNullOrEmpty(listRole[0].OtherCompanyID))
                                        {
                                            names += "Layout=" + Layout + "\r\n";
                                        }
                                    }
                                    else if (listRole[0].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                fUser.ErrorMsg += names;
                                Tracer.Debug(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                    }
                                }

                                if (listuserinfo == null || listuserinfo.Count == 0)
                                {
                                    DataResult.Err = "角色 " + listRole[i].Remark + "没有找到审核人";
                                    DataResult.FlowResult = FlowResult.FAIL;
                                    return;
                                }
                                DictCounterUser.Add(listRole[i], listuserinfo);
                            }
                            iscurruser = false;
                            #endregion
                        }
                        else
                        {
                            #region
                            string roleNames = "";//所有角色名称
                            iscurruser = false;
                            bool bFlag = false;
                            for (int i = 0; i < listRole.Count; i++)
                            {
                                roleNames += listRole[i].Remark + "、";
                                string tmpPostID = listRole[i].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                                bool isHigher = false;
                                var listuserinfo = TmGetUserByRoleId(listRole[i].RoleName, null, tmpPostID, ref isHigher);
                                #region 打印审核人
                                string names = "\r\n=======打印审核人H(listRole[0].RoleName=" + listRole[i].RoleName + ";UserID=" + UserID + ";PostID=" + tmpPostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                foreach (var user in listuserinfo)
                                {
                                    names += "CompanyID:" + user.CompanyID + "\r\n";
                                    names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                    names += "PostID:" + user.PostID + "\r\n";
                                    names += "UserID:" + user.UserID + "\r\n";

                                    names += "CompanyName:" + user.CompanyName + "\r\n";
                                    names += "DepartmentName:" + user.DepartmentName + "\r\n";
                                    names += "PostName:" + user.PostName + "\r\n";
                                    names += "UserName:"******"\r\n";
                                    names += "----------------------------------------------------\r\n";
                                }
                                if (!isHigher && listRole[0].IsOtherCompany != null)
                                {
                                    if (listRole[0].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                        if (string.IsNullOrEmpty(listRole[0].OtherCompanyID))
                                        {
                                            names += "Layout=" + Layout + "\r\n";
                                        }
                                    }
                                    else if (listRole[0].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                fUser.ErrorMsg += names;
                                Tracer.Debug(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                    }
                                }
                                if (listuserinfo != null && listuserinfo.Count > 0)
                                {
                                    bFlag = true;
                                    if (listuserinfo.FirstOrDefault(u => u.UserID == UserID[1]) != null)
                                    {
                                        iscurruser = true;
                                        break;
                                    }
                                    //DataResult.Err = "没有找到审核人";
                                    //DataResult.FlowResult = FlowResult.FAIL;
                                    //return;
                                }
                                DictCounterUser.Add(listRole[i], listuserinfo);
                            }
                            if (!bFlag)
                            {
                                DataResult.Err = "当前的角色 " + roleNames + " 没有找到审核人";
                                DataResult.FlowResult = FlowResult.FAIL;
                                return;
                            }
                            #endregion
                        }
                        #endregion
                    }

                    #endregion
                }
                DataResult.IsCountersign = IsCountersign;
                DataResult.AppState = strNextState;
                DataResult.CountersignType = CountersignType;
                if (!IsCountersign)
                {
                    #region
                    if (AppUserInfo != null && AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                    {
                        DataResult.FlowResult = FlowResult.MULTIUSER;
                    }
                    DataResult.UserInfo = AppUserInfo;
                    #endregion
                }
                else
                {
                    #region
                    if (DataResult.DictCounterUser == null)
                    {
                        DataResult.DictCounterUser = new Dictionary<FlowRole, List<UserInfo>>();
                    }
                    DataResult.DictCounterUser = DictCounterUser;

                    List<FlowRole> listkeys = DictCounterUser.Keys.ToList();
                    for (int i = 0; i < listkeys.Count; i++)
                    {
                        FlowRole key = listkeys[i];
                        if (DictCounterUser[key].Count > 1)
                        {
                            DataResult.FlowResult = FlowResult.Countersign;
                            break;
                        }
                    }
                    #endregion

                }

            }
            catch (Exception ex)
            {
                //throw new Exception("GetUserByInstance2:" + ex.Message);//旧的
                Tracer.Debug("FORMID="+fUser.FormID+";通过实体例查找用户Instance=" + Instance.InstanceId.ToString()+" 异常信息:\r\n" + ex.ToString());
                throw new Exception(ex.Message);
            }
            finally
            {
                strNextState = null;
                AppUserInfo = null;
                //RuleName = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }
        }
Exemplo n.º 45
0
        /// <summary>
        /// 通过流程查找审核人
        /// </summary>
        /// <param name="Xoml"></param>
        /// <param name="Rules"></param>
        /// <param name="xml"></param>
        /// <param name="UserID"></param>
        /// <param name="DataResult"></param>
        //public void GetUserByFlow(string Xoml, string Rules, string xml, string UserID, ref DataResult DataResult)
        //{
        //    WorkflowRuntime WfRuntime = null;
        //    WorkflowInstance Instance = null;
        //    try
        //    {
        //        WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
        //        Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);

        //        string strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, "StartFlow", xml);



        //        List<UserInfo> AppUserInfo = GetUserByStateCode(strNextState, UserID);
        //        if (AppUserInfo == null || AppUserInfo.Count == 0)
        //        {
        //            DataResult.Err = "没有找到审核人";
        //            DataResult.FlowResult = FlowResult.FAIL;
        //        }
        //        else if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
        //        {
        //            DataResult.FlowResult = FlowResult.MULTIUSER;
        //        }
        //        DataResult.UserInfo = AppUserInfo;


        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);
        //    }
        //    finally
        //    {
        //        Instance = null;
        //        SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

        //    }


        //}

        #endregion

        #region 通过流程查找审核人(对应SubmitFlow)

        /// <summary>
        /// 通过流程查找审核人(对应SubmitFlow)
        /// </summary>
        /// <param name="Xoml"></param>
        /// <param name="Rules"></param>
        /// <param name="Layout"></param>
        /// <param name="xml"></param>
        /// <param name="UserID"></param>
        /// <param name="FlowType"></param>
        /// <param name="DataResult"></param>
        public void GetUserByFlow(string companyID, string Xoml, string Rules, string Layout, string xml, string UserID, string PostID, FlowType FlowType, ref DataResult DataResult)
        {
            string Msg = "companyID=" + companyID + "\r\n";
            Msg += "Xoml=" + Xoml + "\r\n";
            Msg += "Rules=" + Rules + "\r\n";
            Msg += "Layout=" + Layout + "\r\n";
            Msg += "xml=" + xml + "\r\n";
            Msg += "UserID=" + UserID + "\r\n";
            Msg += "PostID=" + PostID + "\r\n";
            Msg += "FlowType=" + FlowType + "\r\n";

            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            string strCurrState = "StartFlow";
            string strNextState = "StartFlow";

            Role_UserType RuleName;
            List<UserInfo> AppUserInfo = null;
            try
            {
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);
                LogHelper.WriteLog("GetUserByFlow创建工作流实例ID=" + Instance.InstanceId);
                bool iscurruser = true;

                while (iscurruser)
                {
                    strCurrState = strNextState;

                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);

                    if (strNextState == "EndFlow")
                    {
                        strNextState = strCurrState;
                        iscurruser = false;
                    }
                    else
                    {

                        RuleName = Utility.GetRlueName(Layout, strNextState);
                        if (RuleName == null)
                        {
                            DataResult.Err = "没有找到对应角色";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }
                        bool isHigher = false;
                        AppUserInfo = GetUserByStateCode(RuleName.RoleName, UserID, PostID, ref isHigher);
                        #region 打印审核人
                        string names = "=======打印审核人A(listRole[0].RoleName=" + RuleName.RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                        foreach (var user in AppUserInfo)
                        {
                            names += "CompanyID:" + user.CompanyID + "\r\n";
                            names += "DepartmentID:" + user.DepartmentID + "\r\n";
                            names += "PostID:" + user.PostID + "\r\n";
                            names += "UserID:" + user.UserID + "\r\n";
                            names += "UserName:"******"\r\n";
                        }
                        if (!isHigher && RuleName.IsOtherCompany != null)
                        {
                            if (RuleName.IsOtherCompany.Value == true)
                            {
                                names += "是否指定公司:" + RuleName.IsOtherCompany.Value.ToString() + "\r\n";
                                names += "公司的ID:" + RuleName.OtherCompanyID + "\r\n";
                            }
                            else if (RuleName.IsOtherCompany.Value == false)
                            {
                                names += "实际要查找公司的ID:" + companyID + "\r\n";
                            }
                        }

                        LogHelper.WriteLog(names);
                        #endregion
                        #region beyond
                        if (!isHigher && RuleName.IsOtherCompany != null)
                        {
                            if (RuleName.IsOtherCompany.Value == true)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == RuleName.OtherCompanyID).ToList();
                            }
                            else if (RuleName.IsOtherCompany.Value == false)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                            }
                        }
                        #endregion

                        if (AppUserInfo == null || AppUserInfo.Count == 0)
                        {
                            DataResult.Err = "没有找到审核人";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }

                        if (AppUserInfo.Where(c => c.UserID == UserID).Count() == 0)
                            iscurruser = false;
                    }
                }


                //if (AppUserInfo == null || AppUserInfo.Count == 0)
                //{
                //    DataResult.Err = "没有找到审核人";
                //    DataResult.FlowResult = FlowResult.FAIL;
                //}
                // else if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                {
                    DataResult.FlowResult = FlowResult.MULTIUSER;
                }
                DataResult.AppState = strNextState;
                DataResult.UserInfo = AppUserInfo;


            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetUserByFlow发生异常:" + Msg);
                throw new Exception("GetUserByFlow:" + ex.ToString());
            }
            finally
            {
                strCurrState = null;
                strNextState = null;
                RuleName = null;
                AppUserInfo = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }


        }
Exemplo n.º 46
0
        public void GetUserByFlow2(string companyID, string Xoml, string Rules, string Layout, string xml, string UserID, string PostID, FlowType FlowType, ref DataResult DataResult, ref string msg)
        {

            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            string strCurrState = "StartFlow";
            string strNextState = "StartFlow";
            bool IsCountersign = false;
            string CountersignType = "0";
            //Role_UserType RuleName;
            List<UserInfo> AppUserInfo = null;
            Dictionary<Role_UserType, List<UserInfo>> DictCounterUser = null;
            try
            {
                msg += " SMTWorkFlowManage.CreateWorkFlowRuntime(false)" + DateTime.Now.ToString() + "\r\n";
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                msg += " SMTWorkFlowManage.CreateWorkFlowRuntime(false)完成" + DateTime.Now.ToString() + "\r\n";
                msg += " SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules)" + DateTime.Now.ToString() + "\r\n";
                Instance = SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules);
                LogHelper.WriteLog("GetUserByFlow2创建工作流实例ID=" + Instance.InstanceId);
                msg += " SMTWorkFlowManage.CreateWorkflowInstance(WfRuntime, Xoml, Rules)完成" + DateTime.Now.ToString() + "\r\n";
                bool iscurruser = true;
                int testflag = 0;
                msg += " iscurruser" + DateTime.Now.ToString() + "\r\n";
                while (iscurruser)
                {
                    testflag++;
                    if (testflag > 10)
                    {
                        throw new Exception("循环超过10次");
                    }
                    #region
                    strCurrState = strNextState;
                    msg += " SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml)" + DateTime.Now.ToString() + "\r\n";
                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);
                    msg += " SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml)完成" + DateTime.Now.ToString() + "\r\n";
                    if (strNextState == "EndFlow")
                    {
                        strNextState = strCurrState;
                        iscurruser = false;
                    }
                    else
                    {
                        List<Role_UserType> listRole = Utility.GetRlueName2(Layout, strNextState, ref IsCountersign, ref CountersignType);
                        if (listRole.Count == 0)
                        {
                            DataResult.Err = "没有找到对应角色";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }
                        if (!IsCountersign)
                        {
                            #region
                            bool isHigher = false;
                            //根据角色找人
                            AppUserInfo = GetUserByStateCode(listRole[0].RoleName, UserID, PostID, ref isHigher);
                            #region 打印审核人
                            string names = "=======打印审核人B(listRole[0].RoleName=" + listRole[0].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                            foreach (var user in AppUserInfo)
                            {
                                names += "CompanyID:" + user.CompanyID + "\r\n";
                                names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                names += "PostID:" + user.PostID + "\r\n";
                                names += "UserID:" + user.UserID + "\r\n";
                                names += "UserName:"******"\r\n";
                            }
                            if (!isHigher && listRole[0].IsOtherCompany != null)
                            {
                                if (listRole[0].IsOtherCompany.Value == true)
                                {
                                    names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                    names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                }
                                else if (listRole[0].IsOtherCompany.Value == false)
                                {
                                    names += "实际要查找公司的ID:" + companyID + "\r\n";
                                }
                            }
                            LogHelper.WriteLog(names);
                            #endregion
                            #region beyond

                            if (!isHigher)
                            {
                                if (listRole[0].IsOtherCompany != null && listRole[0].IsOtherCompany.Value == true)
                                {
                                    //过滤人
                                    AppUserInfo = AppUserInfo.Where(user => user.CompanyID == listRole[0].OtherCompanyID).ToList();
                                }
                                else
                                {
                                    AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                                }
                            }




                            #endregion
                            if (AppUserInfo == null || AppUserInfo.Count == 0)
                            {
                                DataResult.Err = "没有找到审核人";
                                DataResult.FlowResult = FlowResult.FAIL;
                                return;
                            }


                            if (AppUserInfo.Where(c => c.UserID == UserID).Count() == 0)
                                iscurruser = false;
                            #endregion
                        }
                        else
                        {
                            #region
                            DictCounterUser = new Dictionary<Role_UserType, List<UserInfo>>();
                            if (CountersignType == "0")
                            {
                                #region
                                for (int i = 0; i < listRole.Count; i++)
                                {
                                    bool isHigher = false;


                                    var listuserinfo = GetUserByStateCode(listRole[i].RoleName, UserID, PostID, ref isHigher);
                                    #region 打印审核人
                                    string names = "=======打印审核人C(listRole[0].RoleName=" + listRole[i].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                    foreach (var user in AppUserInfo)
                                    {
                                        names += "CompanyID:" + user.CompanyID + "\r\n";
                                        names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                        names += "PostID:" + user.PostID + "\r\n";
                                        names += "UserID:" + user.UserID + "\r\n";
                                        names += "UserName:"******"\r\n";
                                    }
                                    if (!isHigher && listRole[i].IsOtherCompany != null)
                                    {
                                        if (listRole[i].IsOtherCompany.Value == true)
                                        {
                                            names += "是否指定公司:" + listRole[i].IsOtherCompany.Value.ToString() + "\r\n";
                                            names += "公司的ID:" + listRole[i].OtherCompanyID + "\r\n";
                                        }
                                        else if (listRole[i].IsOtherCompany.Value == false)
                                        {
                                            names += "实际要查找公司的ID:" + companyID + "\r\n";
                                        }
                                    }
                                    LogHelper.WriteLog(names);
                                    #endregion
                                    if (!isHigher)
                                    {
                                        if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                        }
                                        else
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                        }
                                    }

                                    if (listuserinfo == null || listuserinfo.Count == 0)
                                    {
                                        DataResult.Err = "没有找到审核人";
                                        DataResult.FlowResult = FlowResult.FAIL;
                                        return;
                                    }
                                    DictCounterUser.Add(listRole[i], listuserinfo);
                                }
                                iscurruser = false;
                                #endregion
                            }
                            else
                            {
                                #region
                                iscurruser = false;
                                bool bFlag = false;
                                msg += "GetUserByStateCode" + DateTime.Now.ToString() + "\r\n";
                                for (int i = 0; i < listRole.Count; i++)
                                {
                                    #region
                                    bool isHigher = false;

                                    var listuserinfo = GetUserByStateCode(listRole[i].RoleName, UserID, PostID, ref isHigher);
                                    if (!isHigher)
                                    {
                                        if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                        }
                                        else
                                        {
                                            listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                        }
                                    }

                                    if (listuserinfo != null && listuserinfo.Count > 0)
                                    {
                                        bFlag = true;
                                        if (listuserinfo.FirstOrDefault(u => u.UserID == UserID) != null)
                                        {
                                            iscurruser = true;
                                            break;
                                        }
                                        //DataResult.Err = "没有找到审核人";
                                        //DataResult.FlowResult = FlowResult.FAIL;
                                        //return;
                                    }
                                    DictCounterUser.Add(listRole[i], listuserinfo);
                                    #endregion
                                }
                                if (!bFlag)
                                {
                                    DataResult.Err = "没有找到审核人";
                                    DataResult.FlowResult = FlowResult.FAIL;
                                    return;
                                }
                                msg += " GetUserByStateCode完成" + DateTime.Now.ToString() + "\r\n";
                                //iscurruser = false;
                                #endregion
                            }
                            #endregion
                        }
                    }
                    #endregion
                }
                DataResult.IsCountersign = IsCountersign;
                DataResult.AppState = strNextState;
                DataResult.CountersignType = CountersignType;
                if (!IsCountersign)
                {
                    #region
                    if (AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                    {
                        DataResult.FlowResult = FlowResult.MULTIUSER;
                    }

                    DataResult.UserInfo = AppUserInfo;
                    #endregion
                }
                else
                {
                    #region
                    DataResult.DictCounterUser = DictCounterUser;
                    List<Role_UserType> listkeys = DictCounterUser.Keys.ToList();
                    for (int i = 0; i < listkeys.Count; i++)
                    {
                        Role_UserType key = listkeys[i];
                        if (DictCounterUser[key].Count > 1)
                        {
                            DataResult.FlowResult = FlowResult.Countersign;
                            break;
                        }
                    }
                    #endregion

                }
                msg += " iscurruser完成" + DateTime.Now.ToString() + "\r\n";

            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetUserByFlow2异常信息 :" + ex.ToString());
                throw new Exception("GetUserByFlow2:" + ex.Message);
            }
            finally
            {
                strCurrState = null;
                strNextState = null;
                //RuleName = null;
                AppUserInfo = null;
                Instance = null;
                msg += "  SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime)" + DateTime.Now.ToString() + "\r\n";
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);
                msg += "  SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime)完成" + DateTime.Now.ToString() + "\r\n";

            }


        }
Exemplo n.º 47
0
        /// <summary>
        /// Отправить документы
        /// </summary>
        private void SendDocuments(FlowType flowType)
        {
            // нужен сертификат
            if (flowType != FlowType.SentUnsigned && _context.Certificate == null)
                ChooseCertificate();

            var externalRecipients = new List<MessageRecipient>();
            var internalRecipients = new List<InternalMessageRecipient>();
            do
            {
                if (flowType != FlowType.SentInternal)
                {
                    var recipient = ChooseExternalRecipient(externalRecipients.Select(r => r.OrganizationBoxId).ToList());
                    if (recipient != null)
                    {
                        externalRecipients.Add(recipient);
                        if (flowType == FlowType.SentUnsigned)
                            break;
                        if (!UserInput.ChooseYesNo("Добавить еще одного получателя?"))
                            break;
                    }
                }
                else
                {
                    var recipient = ChooseInternalRecipient();
                    if (recipient != null)
                    {
                        internalRecipients.Add(recipient);
                        break;
                    }
                }
            }
            while (true);

            Message message = null;
            UnsignedMessage unsignedMessage = null;
            ForwardMessage forwardMessage = null;
            InternalMessage internalMessage = null;
            switch (flowType)
            {
                case FlowType.SentSigned:
                    message = CreateMessage(externalRecipients);
                    break;
                case FlowType.SentUnsigned:
                    unsignedMessage = CreateUnsignedMessage(externalRecipients);
                    break;
                case FlowType.SentForward:
                    forwardMessage = CreateForwardMessage(externalRecipients);
                    break;
                case FlowType.SentInternal:
                    internalMessage = CreateInternalMessage(internalRecipients);
                    break;
            }

            if ((message != null && message.Documents.Length == 0)
                || (unsignedMessage != null && unsignedMessage.Documents.Length == 0)
                || (forwardMessage != null && forwardMessage.ForwardDocuments.Length == 0)
                || (internalMessage != null && internalMessage.Documents.Length == 0))
            {
                UserInput.Error("Документы для отправки не выбраны");
                return;
            }

            var sendMessageOption = new UserInput.Option("1", "Отправить сообщение", true);
            var saveToDraftOption = new UserInput.Option("2", "Сохранить как черновик", false);

            while (true)
            {
                var chosenOption = UserInput.ChooseOption("Выберите действие", new[]
                {
                    sendMessageOption,
                    saveToDraftOption
                });

                if (chosenOption == sendMessageOption)
                    break;

                if (chosenOption != saveToDraftOption)
                    continue;

                DraftMessage draftMessage = null;
                if (message != null)
                    draftMessage = ConvertToDraftMessage(message);
                else if (unsignedMessage != null)
                    draftMessage = ConvertToDraftMessage(unsignedMessage);
                else if (forwardMessage != null)
                    draftMessage = ConvertToDraftMessage(forwardMessage);
                else if (internalMessage != null)
                    draftMessage = ConvertToDraftMessage(internalMessage);

                try
                {
                    var draftMessageId = _context.ServiceClient.CreateDraftMessage(draftMessage);
                    UserInput.Success("Черновик сообщения сохранен, Id:{0}", draftMessageId);
                }
                catch (ServerException ex)
                {
                    if (ex.Code == ServiceErrorCode.InvalidFormatField)
                    {
                        UserInput.Error(ex.Message);
                    }
                    else
                    {
                        throw;
                    }
                }
                return;
            }

            try
            {
                SentMessage sentMessage = null;
                if (message != null)
                    sentMessage = _context.ServiceClient.SendMessage(message);
                else if (unsignedMessage != null)
                    sentMessage = _context.ServiceClient.SendUnsignedMessage(unsignedMessage);
                else if (forwardMessage != null)
                    sentMessage = _context.ServiceClient.SendForwardMessage(forwardMessage);
                else if (internalMessage != null)
                    sentMessage = _context.ServiceClient.SendInternalMessage(internalMessage);
                UserInput.Success("Сообщение отправлено Id:{0}", sentMessage.MessageId);
            }
            catch (ServerException ex)
            {
                if (ex.Code == ServiceErrorCode.ContragentIsNotAuthorized)
                {
                    UserInput.Error("Контрагент не авторизован");
                }
                else if (ex.Code == ServiceErrorCode.InvalidDestinationAddress)
                {
                    UserInput.Error("Неправильно указан адресат");
                }
                else if (ex.Code == ServiceErrorCode.NotFilledRequiredField)
                {
                    UserInput.Error("Не заполнено обязательно поле \"{0}\"", ex.Field);
                }
                else
                {
                    UserInput.Error("Ошибка отправки Code:{0} Field:{1} Message:{2}", ex.Code, ex.Field, ex.Message);
                    // TODO обработка других ошибок, отображение текста!
                }
            }
            // перехват ошибки уровня транспорта
            catch (Exception ex)
            {
                // TODO здесь надо сделать правильную обработку ошибки
                UserInput.Error(ex.ToString());
            }
        }
Exemplo n.º 48
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="WfRuntimeClone"></param>
        /// <param name="instanceClone"></param>
        /// <param name="Layout"></param>
        /// <param name="xml"></param>
        /// <param name="CurrentStateName"></param>
        /// <param name="UserID"></param>
        /// <param name="PostID"></param>
        /// <param name="FlowType"></param>
        /// <param name="DataResult"></param>
        public void GetUserByInstance2(string companyID, WorkflowRuntime WfRuntimeClone, WorkflowInstance instanceClone, string Layout, string xml, string CurrentStateName, List<string> UserID, List<string> PostID, FlowType FlowType, ref DataResult DataResult)
        {
            WorkflowRuntime WfRuntime = null;
            WorkflowInstance Instance = null;
            List<UserInfo> AppUserInfo = null;
            string strNextState = CurrentStateName;
            bool IsCountersign = false;
            string CountersignType = "0";
            //Role_UserType RuleName;
            //List<UserInfo> AppUserInfo = null;
            Dictionary<Role_UserType, List<UserInfo>> DictCounterUser = null;
            try
            {
                if (!WfRuntimeClone.IsStarted)
                {
                    WfRuntimeClone.StartRuntime();
                }
                WfRuntime = SMTWorkFlowManage.CreateWorkFlowRuntime(false);
                Instance = SMTWorkFlowManage.CloneWorkflowInstance(WfRuntimeClone, instanceClone, WfRuntime);
                bool iscurruser = true;
                int testflag = 0;
                while (iscurruser)
                {
                    testflag++;
                    if (testflag > 10)
                    {
                        throw new Exception("循环处理流程超过10次,请联系系统管理员");
                    }
                    #region


                    strNextState = SMTWorkFlowManage.GetNextStateByEvent(WfRuntime, Instance, strNextState, xml);
                    List<Role_UserType> listRole = Utility.GetRlueName2(Layout, strNextState, ref IsCountersign, ref CountersignType);
                    if (listRole.Count == 0)
                    {
                        DataResult.Err = "没有找到对应角色";
                        DataResult.FlowResult = FlowResult.FAIL;
                        return;
                    }

                    if (!IsCountersign)
                    {
                        #region
                        string tmpPostID = listRole[0].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                        bool isHigher = false;
                        AppUserInfo = GetUserByStateCode(listRole[0].RoleName, null, tmpPostID, ref isHigher);
                        #region 打印审核人
                        string names = "=======打印审核人F(listRole[0].RoleName=" + listRole[0].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                        foreach (var user in AppUserInfo)
                        {
                            names += "CompanyID:" + user.CompanyID + "\r\n";
                            names += "DepartmentID:" + user.DepartmentID + "\r\n";
                            names += "PostID:" + user.PostID + "\r\n";
                            names += "UserID:" + user.UserID + "\r\n";
                            names += "UserName:"******"\r\n";
                        }
                        if (!isHigher && listRole[0].IsOtherCompany != null)
                        {
                            if (listRole[0].IsOtherCompany.Value == true)
                            {
                                names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                            }
                            else if (listRole[0].IsOtherCompany.Value == false)
                            {
                                names += "实际要查找公司的ID:" + companyID + "\r\n";
                            }
                        }
                        LogHelper.WriteLog(names);
                        #endregion
                        #region beyond

                        if (!isHigher && strNextState.ToUpper() != "ENDFLOW")
                        {
                            if (listRole[0].IsOtherCompany != null && listRole[0].IsOtherCompany.Value == true)
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == listRole[0].OtherCompanyID).ToList();
                            }
                            else
                            {
                                AppUserInfo = AppUserInfo.Where(user => user.CompanyID == companyID).ToList();
                            }


                        }


                        #endregion
                        if (AppUserInfo == null || AppUserInfo.Count == 0)
                        {
                            DataResult.Err = "没有找到审核人";
                            DataResult.FlowResult = FlowResult.FAIL;
                            return;
                        }


                        if (AppUserInfo.Where(c => c.UserID == UserID[1]).Count() == 0)
                            iscurruser = false;
                        #endregion
                    }
                    else
                    {
                        #region
                        DictCounterUser = new Dictionary<Role_UserType, List<UserInfo>>();
                        if (CountersignType == "0")
                        {
                            #region
                            for (int i = 0; i < listRole.Count; i++)
                            {
                                string tmpPostID = listRole[i].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                                bool isHigher = false;
                                var listuserinfo = GetUserByStateCode(listRole[i].RoleName, null, tmpPostID, ref isHigher);
                                #region 打印审核人
                                string names = "=======打印审核人G(listRole[i].RoleName=" + listRole[0].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                foreach (var user in AppUserInfo)
                                {
                                    names += "CompanyID:" + user.CompanyID + "\r\n";
                                    names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                    names += "PostID:" + user.PostID + "\r\n";
                                    names += "UserID:" + user.UserID + "\r\n";
                                    names += "UserName:"******"\r\n";
                                }
                                if (!isHigher && listRole[0].IsOtherCompany != null)
                                {
                                    if (listRole[0].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                    }
                                    else if (listRole[0].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                LogHelper.WriteLog(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                    }
                                }

                                if (listuserinfo == null || listuserinfo.Count == 0)
                                {
                                    DataResult.Err = "没有找到审核人";
                                    DataResult.FlowResult = FlowResult.FAIL;
                                    return;
                                }
                                DictCounterUser.Add(listRole[i], listuserinfo);
                            }
                            iscurruser = false;
                            #endregion
                        }
                        else
                        {
                            #region
                            iscurruser = false;
                            bool bFlag = false;
                            for (int i = 0; i < listRole.Count; i++)
                            {
                                string tmpPostID = listRole[i].UserType == "CREATEUSER" ? PostID[0] : PostID[1];
                                bool isHigher = false;
                                var listuserinfo = GetUserByStateCode(listRole[i].RoleName, null, tmpPostID, ref isHigher);
                                #region 打印审核人
                                string names = "=======打印审核人H(listRole[0].RoleName=" + listRole[i].RoleName + ";UserID=" + UserID + ";PostID=" + PostID + ";isHigher=" + isHigher.ToString() + ")=======\r\n";
                                foreach (var user in AppUserInfo)
                                {
                                    names += "CompanyID:" + user.CompanyID + "\r\n";
                                    names += "DepartmentID:" + user.DepartmentID + "\r\n";
                                    names += "PostID:" + user.PostID + "\r\n";
                                    names += "UserID:" + user.UserID + "\r\n";
                                    names += "UserName:"******"\r\n";
                                }
                                if (!isHigher && listRole[0].IsOtherCompany != null)
                                {
                                    if (listRole[0].IsOtherCompany.Value == true)
                                    {
                                        names += "是否指定公司:" + listRole[0].IsOtherCompany.Value.ToString() + "\r\n";
                                        names += "公司的ID:" + listRole[0].OtherCompanyID + "\r\n";
                                    }
                                    else if (listRole[0].IsOtherCompany.Value == false)
                                    {
                                        names += "实际要查找公司的ID:" + companyID + "\r\n";
                                    }
                                }
                                LogHelper.WriteLog(names);
                                #endregion
                                if (!isHigher)
                                {
                                    if (listRole[i].IsOtherCompany != null && listRole[i].IsOtherCompany.Value == true)
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == listRole[i].OtherCompanyID).ToList();
                                    }
                                    else
                                    {
                                        listuserinfo = listuserinfo.Where(user => user.CompanyID == companyID).ToList();
                                    }
                                }
                                if (listuserinfo != null && listuserinfo.Count > 0)
                                {
                                    bFlag = true;
                                    if (listuserinfo.FirstOrDefault(u => u.UserID == UserID[1]) != null)
                                    {
                                        iscurruser = true;
                                        break;
                                    }
                                    //DataResult.Err = "没有找到审核人";
                                    //DataResult.FlowResult = FlowResult.FAIL;
                                    //return;
                                }
                                DictCounterUser.Add(listRole[i], listuserinfo);
                            }
                            if (!bFlag)
                            {
                                DataResult.Err = "没有找到审核人";
                                DataResult.FlowResult = FlowResult.FAIL;
                                return;
                            }
                            #endregion
                        }
                        #endregion
                    }


                    #endregion
                }
                DataResult.IsCountersign = IsCountersign;
                DataResult.AppState = strNextState;
                DataResult.CountersignType = CountersignType;
                if (!IsCountersign)
                {
                    #region
                    if (AppUserInfo != null && AppUserInfo.Count > 1) //处理角色对应多个用户,返回用户集给提交人,选择一个处理人
                    {
                        DataResult.FlowResult = FlowResult.MULTIUSER;
                    }
                    DataResult.UserInfo = AppUserInfo;
                    #endregion
                }
                else
                {
                    #region
                    DataResult.DictCounterUser = DictCounterUser;


                    List<Role_UserType> listkeys = DictCounterUser.Keys.ToList();
                    for (int i = 0; i < listkeys.Count; i++)
                    {
                        Role_UserType key = listkeys[i];
                        if (DictCounterUser[key].Count > 1)
                        {
                            DataResult.FlowResult = FlowResult.Countersign;
                            break;
                        }
                    }
                    #endregion

                }

            }
            catch (Exception ex)
            {
                //throw new Exception("GetUserByInstance2:" + ex.Message);//旧的
                LogHelper.WriteLog(this, "GetUserByInstance2(string companyID,WorkflowRuntime WfRuntimeClone, WorkflowInstance instanceClone, string Layout, string xml, string CurrentStateName, List<string> UserID, List<string> PostID, FlowType FlowType, ref DataResult DataResult):", "", ex);
                throw new Exception(ex.Message);
            }
            finally
            {
                strNextState = null;
                AppUserInfo = null;
                //RuleName = null;
                Instance = null;
                SMTWorkFlowManage.ColseWorkFlowRuntime(WfRuntime);

            }


        }
Exemplo n.º 49
0
        /// <summary>
        /// 会签
        /// </summary>
        /// <param name="workflowRuntime"></param>
        /// <param name="instance"></param>
        /// <param name="entity"></param>
        /// <param name="NextStateCode"></param>
        /// <param name="dictUserInfo"></param>
        /// <param name="dictAgentUserInfo"></param>
        /// <param name="SubmitFlag"></param>
        /// <param name="FlowType"></param>
        /// <returns></returns>

        public DataResult DoFlowRecord_Add(OracleConnection con, WorkflowRuntime workflowRuntime, WorkflowInstance instance, FLOW_FLOWRECORDDETAIL_T entity, string NextStateCode, Dictionary<Role_UserType, List<UserInfo>> dictUserInfo, Dictionary<UserInfo, UserInfo> dictAgentUserInfo, SubmitFlag SubmitFlag, FlowType FlowType)
        {
            DataResult tmpDataResult = new DataResult();
            tmpDataResult.DictCounterUser = dictUserInfo;

            try
            {
                if (SubmitFlag == SubmitFlag.New)
                {

                    #region 添加启动状态

                    entity.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID = Guid.NewGuid().ToString();
                    entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "1";
                    entity.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID = entity.CREATEPOSTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDATE = DateTime.Now;

                    entity.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    // entity.FLOW_FLOWRECORDMASTER_T .INSTANCEID  = instance.InstanceId.ToString();
                    entity.FLAG = "1";
                    entity.CHECKSTATE = "1";
                    //entity.FlowCode = "TestFlow";  //正式使用时关屏蔽

                    entity.STATECODE = "StartFlow";
                    entity.PARENTSTATEID = entity.FLOWRECORDDETAILID;
                    entity.CREATEDATE = DateTime.Now;
                    entity.EDITDATE = DateTime.Now;
                    entity.EDITUSERID = entity.CREATEUSERID;
                    entity.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.EDITCOMPANYID = entity.CREATECOMPANYID;
                    entity.EDITDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.EDITPOSTID = entity.CREATEPOSTID;
                    FLOW_FLOWRECORDMASTER_TDAL.Add(con, entity.FLOW_FLOWRECORDMASTER_T);
                    AddFlowRecord2(con, entity);

                    #endregion
                }
                else
                {
                    #region

                    //entity.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID = Guid.NewGuid().ToString();
                    entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "1";
                    entity.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID = entity.CREATECOMPANYID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID = entity.CREATEPOSTID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.CREATEUSERID;
                    entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.FLOW_FLOWRECORDMASTER_T.CREATEDATE = DateTime.Now;

                    entity.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                    // entity.FLOW_FLOWRECORDMASTER_T .INSTANCEID  = instance.InstanceId.ToString();
                    entity.FLAG = "1";
                    entity.CHECKSTATE = "1";
                    //entity.FlowCode = "TestFlow";  //正式使用时关屏蔽

                    entity.STATECODE = "StartFlow";
                    entity.PARENTSTATEID = entity.FLOWRECORDDETAILID;
                    entity.CREATEDATE = DateTime.Now;
                    entity.EDITDATE = DateTime.Now;
                    entity.EDITUSERID = entity.CREATEUSERID;
                    entity.EDITUSERNAME = entity.CREATEUSERNAME;
                    entity.EDITCOMPANYID = entity.CREATECOMPANYID;
                    entity.EDITDEPARTMENTID = entity.CREATEDEPARTMENTID;
                    entity.EDITPOSTID = entity.CREATEPOSTID;
                    entity.CHECKSTATE = "6";
                    entity.STATECODE = "ReSubmit";
                    entity.FLAG = "1";
                    AddFlowRecord2(con, entity);
                    FLOW_FLOWRECORDMASTER_TDAL.Update(entity.FLOW_FLOWRECORDMASTER_T);
                    #endregion
                }
                //System.Threading.Thread.Sleep(1000);
                string stateCode = NextStateCode == "" ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                tmpDataResult.AppState = stateCode;
                if (stateCode != "EndFlow")
                {
                    #region
                    dictUserInfo.Values.ToList().ForEach(users =>
                    {
                        users.ForEach(user =>
                        {
                            #region
                            FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();
                            entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                            entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                            entity2.STATECODE = stateCode;
                            entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;//entity.StateCode;                            
                            entity2.FLAG = "0";
                            entity2.CHECKSTATE = "2";
                            entity2.CREATEPOSTID = entity.CREATEPOSTID;
                            entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                            entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                            entity2.CREATEUSERID = entity.EDITUSERID;
                            entity2.CREATEUSERNAME = entity.EDITUSERNAME;
                            entity2.CREATEDATE = DateTime.Now;
                            entity2.EDITUSERID = user.UserID;
                            entity2.EDITUSERNAME = user.UserName;
                            entity2.EDITCOMPANYID = user.CompanyID;
                            entity2.EDITDEPARTMENTID = user.DepartmentID;
                            entity2.EDITPOSTID = user.PostID;
                            entity2.EDITDATE = DateTime.Now;
                            if (dictAgentUserInfo.ContainsKey(user))
                            {
                                entity2.AGENTUSERID = dictAgentUserInfo[user].UserID;
                                entity2.AGENTERNAME = dictAgentUserInfo[user].UserName;
                                entity2.AGENTEDITDATE = DateTime.Now;
                            }
                            AddFlowRecord2(con, entity2);

                            #endregion
                        });
                    });
                    #endregion
                    tmpDataResult.AppState = stateCode;
                    tmpDataResult.FlowResult = FlowResult.SUCCESS;
                    tmpDataResult.CheckState = "1";
                }
                else
                {
                    tmpDataResult.CheckState = "2";
                    tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                }
                tmpDataResult.IsCountersignComplete = true;
                return tmpDataResult;


            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("DoFlowRecord_Add异常信息 :" + ex.ToString());
                throw new Exception("DoFlowRecord_Add:" + ex.InnerException + ex.Message);
                //tmpDataResult.FlowResult = FlowResult.FAIL;
                //tmpDataResult.Err = ex.Message;
                //return tmpDataResult;
            }
        }
Exemplo n.º 50
0
        public DataResult DoFlowRecord_Approval(OracleConnection con, WorkflowRuntime workflowRuntime, WorkflowInstance instance, FLOW_FLOWRECORDDETAIL_T entity, string NextStateCode, Dictionary<Role_UserType, List<UserInfo>> dictUserInfo, Dictionary<UserInfo, UserInfo> dictAgentUserInfo, SubmitFlag SubmitFlag, FlowType FlowType)
        {
            DataResult tmpDataResult = new DataResult();
            tmpDataResult.DictCounterUser = dictUserInfo;

            try
            {


                #region 更新流程
                //如果NextStateCode为空则自动获取模型中的下一状态,如果不为空则使用传入状态代码,并使用传入下一任务人ID

                //更新本流程



                entity = UpdateFlowRecord2(con, entity);
                string stateCode = "";
                if (NextStateCode.ToUpper() == "ENDFLOW")
                {
                    stateCode = NextStateCode;
                }
                else
                {
                    stateCode = string.IsNullOrEmpty(NextStateCode) ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                }
                //string stateCode = NextStateCode == "" ? SMTWorkFlowManage.GetNextState(workflowRuntime, instance, entity.STATECODE) : NextStateCode;
                tmpDataResult.AppState = stateCode;



                if (stateCode == "EndFlow")
                {
                    entity.FLOW_FLOWRECORDMASTER_T.CHECKSTATE = "2"; //设为终审通过
                    if (entity.EDITDATE == entity.AGENTEDITDATE)  //代理审核时
                    {
                        entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.AGENTUSERID;
                        entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.AGENTERNAME;
                    }
                    else   //正常审核时
                    {
                        entity.FLOW_FLOWRECORDMASTER_T.EDITUSERID = entity.EDITUSERID;
                        entity.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME = entity.EDITUSERNAME;
                    }

                    entity.FLOW_FLOWRECORDMASTER_T.EDITDATE = DateTime.Now;

                    UpdateFlowRecord2(con, entity);
                    FLOW_FLOWRECORDMASTER_TDAL.Update(entity.FLOW_FLOWRECORDMASTER_T);
                    tmpDataResult.FlowResult = FlowResult.END;   //如果没有下一处理节点,则返回END
                    tmpDataResult.CheckState = "2";
                }
                else
                {
                    dictUserInfo.Values.ToList().ForEach(users =>
                    {
                        users.ForEach(user =>
                        {
                            #region
                            //添加下一状态
                            //FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();

                            ////添加下一状态
                            //entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                            //entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                            //entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;// entity.StateCode;

                            ////entity2.Content = "";
                            //entity2.STATECODE = stateCode;
                            //entity2.FLAG = "0";
                            //entity2.CHECKSTATE = "2";
                            //entity2.CREATEPOSTID = entity.CREATEPOSTID;
                            //entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                            //entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;

                            ////if (entity.EDITDATE == entity.AGENTEDITDATE) //代理审核时
                            ////{
                            ////    entity2.CREATEUSERID = entity.AGENTUSERID;
                            ////    entity2.CREATEUSERNAME = entity.AGENTERNAME;
                            ////}
                            ////else   //正常审核时
                            ////{
                            //entity2.CREATEUSERID = entity.EDITUSERID;
                            //entity2.CREATEUSERNAME = entity.EDITUSERNAME;
                            ////}

                            //entity2.EDITUSERID = user.UserID;
                            //entity2.EDITUSERNAME = user.UserName;
                            //entity2.EDITCOMPANYID = user.CompanyID;
                            //entity2.EDITDEPARTMENTID = user.DepartmentID;
                            //entity2.EDITPOSTID = user.PostID;

                            //entity2.CREATEDATE = DateTime.Now;

                            //entity2.EDITDATE = DateTime.Now;
                            //if (dictAgentUserInfo.ContainsKey(user))
                            //{
                            //    entity2.AGENTUSERID = dictAgentUserInfo[user].UserID;
                            //    entity2.AGENTERNAME = dictAgentUserInfo[user].UserName;
                            //    entity2.AGENTEDITDATE = DateTime.Now;
                            //}
                            //AddFlowRecord2(entity2);

                            #endregion

                            #region
                            FLOW_FLOWRECORDDETAIL_T entity2 = new FLOW_FLOWRECORDDETAIL_T();
                            entity2.FLOWRECORDDETAILID = Guid.NewGuid().ToString();
                            entity2.FLOW_FLOWRECORDMASTER_T = entity.FLOW_FLOWRECORDMASTER_T;
                            entity2.STATECODE = stateCode;
                            entity2.PARENTSTATEID = entity.FLOWRECORDDETAILID;//entity.StateCode;                            
                            entity2.FLAG = "0";
                            entity2.CHECKSTATE = "2";
                            entity2.CREATEPOSTID = entity.CREATEPOSTID;
                            entity2.CREATECOMPANYID = entity.CREATECOMPANYID;
                            entity2.CREATEDEPARTMENTID = entity.CREATEDEPARTMENTID;
                            entity2.CREATEUSERID = entity.EDITUSERID;
                            entity2.CREATEUSERNAME = entity.EDITUSERNAME;
                            entity2.CREATEDATE = DateTime.Now;
                            entity2.EDITUSERID = user.UserID;
                            entity2.EDITUSERNAME = user.UserName;
                            entity2.EDITCOMPANYID = user.CompanyID;
                            entity2.EDITDEPARTMENTID = user.DepartmentID;
                            entity2.EDITPOSTID = user.PostID;
                            entity2.EDITDATE = DateTime.Now;
                            if (dictAgentUserInfo.ContainsKey(user))
                            {
                                entity2.AGENTUSERID = dictAgentUserInfo[user].UserID;
                                entity2.AGENTERNAME = dictAgentUserInfo[user].UserName;
                                entity2.AGENTEDITDATE = DateTime.Now;
                            }
                            AddFlowRecord2(con, entity2);

                            #endregion
                        });
                    });

                    tmpDataResult.AppState = stateCode;
                    tmpDataResult.FlowResult = FlowResult.SUCCESS;
                    tmpDataResult.CheckState = "1";

                }

                tmpDataResult.IsCountersignComplete = true;
                return tmpDataResult;

                #endregion


            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("DoFlowRecord_Approval异常信息 :" + ex.ToString());
                throw new Exception("DoFlowRecord_Approval:" + ex.InnerException + ex.Message);
                //tmpDataResult.FlowResult = FlowResult.FAIL;
                //tmpDataResult.Err = ex.Message;
                //return tmpDataResult;
            }
        }
Exemplo n.º 51
0
        //結構物設置
        //public bool tBarCheck = false;
        //public bool bridgePierCheck = false;
        //public bool groundsillWorkCheck = false;
        //public bool sedimentationWeirCheck = false;
        //public int tBarNum = 0;
        //public int bridgePierNum = 0;
        //public int groundsillWorkNum = 0;
        //public int sedimentationWeirNum = 0;
        // private int _dryBedNum = 0;
        //private List<Point>[] _tBarPts = null;
        //private List<Point>[] _bridgePierPts = null;
        //private List<Point>[] _groundsillWorkPts = null;
        //private List<Point>[] _sedimentationWeirPts = null;
        //public List<Point>[] TBarSets
        //{
        //    get { return _tBarSets; }
        //    set { _tBarSets = (List<Point>[])value.Clone(); }
        //}
        //浸沒邊界資訊
        //private int _immersedBoundaryNum = 0;
        //private List<Point>[] _immersedBoundaryPts = null;
        //public bool sidewallBoundarySlip = false;      //4.1.3.1
        private void Initialization()
        {
            //模組特殊功能高程
            dimensionType = DimensionType.None;   //維度選擇
            modelingType = ModelingType.None;      //模組選擇

            //Special Functions
            //水理
            closeDiffusionEffectFunction = false;              //關閉移流擴散效應
            secondFlowEffectFunction = false;                  //二次流效應
            structureSetFunction = false;                      //結構物設置
            sideInOutFlowFunction = false;                     //側出入流
            waterHighSandContentEffectFunction = false;        //水理高含砂效應

            //動床
            bedrockFunction = false;                           //岩床
            quayStableAnalysisFunction = false;                //岩壁穩定分析
            movableBedHighSandContentEffectFunction = false;   //動床高含砂效應

            //全域參數
            inputGrid = null;
            importSource = ImportSource.None;
            coorType = TWD97;
            verticalLevelNumber = 19;      //0.1.1 垂向格網分層數目
            levelProportion = null;       //0.1.1.1 分層比例 陣列大小_verticalLevelNumber

            //水理參數
            flowType = FlowType.None;               //1.0 定/變量流
            //1.1 數值參數 =========================================
            //1.1.1 時間
            totalSimulationTime = 0;         //1.1.1.1 總模擬時間
            timeSpan2d = 0;                  //1.1.1.2 二維時間間距
            outputFrequency = 0;              //1.1.1.3 輸出頻率
            steppingTimesInVertVslcTime = 10;  //1.1.1.4 垂直方向計算時間步進次數
            //1.1.2 收斂條件
            waterModelingConvergenceCriteria2d = 0.0001;          //1.1.2.1 二維水理收斂標準
            waterModelingConvergenceCriteria3d = 0.0001;          //1.1.2.2 三維水理收斂標準
            waterModelingMaxIterationTimes = 10000;               //1.1.2.3 水理最大疊代次數

            //1.1.3 輸出控制
            //2D
            outputControlInitialBottomElevation = false;   //1.1.3 輸出控制 初始底床高程
            outputControlLevel = false;                    //1.1.3 輸出控制 水位
            outputControlDepth = false;                    //1.1.3 輸出控制 水深
            outputControlAverageDepthFlowRate = false;     //1.1.3 輸出控制 水深平均流速
            outputControlFlow = false;                     //1.1.3 輸出控制 流量
            outputControlBottomShearingStress = false;     //1.1.3 輸出控制 底床剪應力
            //3D
            outputControlVelocityInformation3D = false;    //1.1.3 輸出控制 三維流速資訊

            minWaterDeoth = 0.0001;                               //1.1.4 最小水深 單一數值 m 0.0001 實數(>0) 實數 8 格 (隱藏版功能)
            viscosityFactorAdditionInMainstream = 1;         //1.1.5 主流方向黏滯係數加成比例 單一數值 1 實數(>=0) 實數 8 格 (隱藏版功能)
            viscosityFactorAdditionInSideDirection = 1;      //1.1.6 側方向黏滯係數加成比例 單一數值 1 實數(>=0) 實數 8 格 (隱藏版功能)
            //1.2 物理參數 =========================================
            roughnessType = RoughnessType.None;        //1.2.1 糙度係數 二選一 整數 8 格
            manningN = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);                    //1.2.1.1 Manning n 二選一 -- 均一值
            chezy = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);                       //1.2.1.2 Chezy 二選一 -- 均一值
            roughnessHeightKs = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);           //1.2.1.3 粗糙高度 ks mm -- 均一值

            turbulenceViscosityType = TurbulenceViscosityType.None;    //1.2.2 紊流黏滯係數 四選一 整數 8 格
            //1.2.2.1 使用者輸入 模擬功能為二維或三維都可選擇此項輸入
            //1.2.2.1.1 紊流黏滯係數 Ns/m2 實數(>0) 實數 8 格
            tvInMainstreamDirection = 0;     //需確認
            tvInSideDirection = 0;           //需確認
            zeroEquationType = ZeroEquationType.Constant;  //1.2.2.2 零方程 五選一 總共 5 種選項
            //1.2.2.3 單方程 --
            //1.2.2.4 雙方程(k-ε) 三維 only,僅一項,不用下拉選單。

            //1.2.3 其他
            gravityConstant = 9.81;             //1.2.3.1 重力常數 單一數值 m/s2 9.81 實數 Free
            waterDensity = 1000;                //1.2.3.2 水密度 單一數值 kg/m3 1000 實數(>0) Free

            //1.3 二次流效應 二維 only
            curvatureRadiusType = 0;      //1.3.1 曲率半徑 是否自動計算
            curvatureRadius = null;      //1.3.1 曲率半徑 矩陣(I,J) m 0 實數 Free

            //1.4 結構物設置 四種結構物:丁壩、橋墩、固床工、攔河堰。
            tBarSet = false;                   //丁壩設置
            bridgePierSet = false;             //橋墩設置
            groundsillWorkSet = false;         //固床工設置
            sedimentationWeirSet = false;      //攔河堰設置
            //1.4.1 結構物數量
            tBarNumber = 0;               //丁壩數量
            bridgePierNumber = 0;         //橋墩數量
            groundsillWorkNumber = 0;     //固床工數量
            sedimentationWeirNumber = 0;  //攔河堰數量
            //1.4.1.1 格網位置
            tBarSets = null;                 //丁壩位置集合
            bridgePierSets = null;           //橋墩位置集合
            groundsillWorkSets = null;       //固床工位置集合
            sedimentationWeirSets = null;    //攔河堰位置集合

            //1.6 高含砂效應 供使用者輸入 6 個常數:α1、β1、c 1、α2、β2、c 2
            highSandEffectAlpha1 = 0;
            highSandEffectBeta1 = 0;
            highSandEffectC1 = 0;
            highSandEffectAlpha2 = 0;
            highSandEffectBeta2 = 0;
            highSandEffectC2 = 0;

            //動床參數
            //2.1 數值參數 =========================================
            waterTimeSpan = 0;                //2.1.1 時間間距
            waterOutputFrequency = 0;          //2.1.2 輸出頻率

            //2.1.3 輸出控制
            //2D
            outputControlBottomElevation = false;       //2.1.3 輸出控制 初始底床高程
            outputControlAverageDepthDensity = false;   //2.1.3 輸出控制 水深平均流速
            outputControlErosionDepth = false;          //2.1.3 沖淤深度

            //3D
            outputControlDensityInformation3D = false;   //2.1.3 輸出控制 三維流速資訊

            //2.1.4 選擇擴散公式
            diffusionFormulaUse = false;;                //2.1.4 擴散公式
            diffusionFormula = DiffusionFormulaType.None;   //2.1.4 擴散公式

            diffusionBonusProportionalInMainstream = 1.0;   //2.1.5 主流方向擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInSideflow = 1.0;     //2.1.6 側方向擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInSurface = 1.0;      //2.1.7 水面擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInBottom = 1.0;       //2.1.8 底床擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)

            //2.2 物理參數
            kinematicViscosityCoefficient = 1.12e-6;    //2.2.1 動力黏滯係數單一數值 秒 1.12e-6 實數(>=0) 實數16 格
            sedimentPoreRatio = 0.4;                //2.2.2 泥砂孔隙比單一數值 -- 0.4 實數(>=0) 實數8 格
            sedimentDensity = 2700;                  //2.2.3 泥砂密度單一數值 Kg/m3 2700 實數(>=0) 實數8 格
            sedimentParticlesNumber = 3;           //2.2.4 泥砂顆粒數目單一數值K 3 整數(>2) 最優先設定
            sedimentParticleSize = null;          //2.2.4.1 泥砂粒徑矩陣(K) m 實數(>0) 實數16 格矩陣(K)為泥砂顆粒數目
            //2.3 底床組成
            bottomLevelNumber = 6;                 //2.3.1 底床分層數目單一數值 整數(>0) a. 使用者輸入底床分層數目後
            bottomLevelArray = null;               //2.3.1.1 底床分層厚度矩陣(L) m 實數(>0) 矩陣(L)為底床分層數目
            sedimentCompositionArray = null;      //2.3.1.2 泥砂組成比例矩陣(K,L) 實數(>0) 矩陣(K,L)為(泥砂顆粒數目, 底床分層數目)

            shenCohesiveSediment = false;  //2.3.2 凝聚性沉滓option

            surfaceErosion = false;                 //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值
            surfaceErosionCoefficient = 0;          //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值
            surfaceErosionCriticalShearStress = 0;  //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值

            massiveErosion = false;                 //2.3.2.2 塊狀沖蝕 單一數值 N/m2。 -- 實數(>0) 供者用者輸入臨界剪應力(N/m2)
            massiveErosionCriticalShearStress = 0;  //2.3.2.2 塊狀沖蝕 單一數值 N/m2。 -- 實數(>0) 供者用者輸入臨界剪應力(N/m2)
            noErosionElevationUse = false;             //2.3.3 不可沖刷高程 二選一 m 實數 a. option 用 check box
            noErosionElevation = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);            //b. 0:均一值,逐點給:-1

            //2.4.2 高含砂輸砂公式 多選一 -- -- 整數 8 格 共 3 種選項
            sandTransportEquation = SandTransportEquationType.None;
            waterJettingAlpha = 0;    //2.5.1 水力沖刷 實數 供使用者輸入α及β兩個常數。
            waterJettingBeta = 0;     //2.5.1 水力沖刷 實數 供使用者輸入α及β兩個常數。

            sedimentErosion = false;                            //2.5.2 泥砂磨蝕
            sedimentErosionElasticModulusValue = 0;       //2.5.2.1 彈性模數 二選一 pa 實數(>=0) a. 0:均一值,逐點給:-1
            sedimentErosionElasticModulusArray = null;    //2.5.2.1 彈性模數 二選一 pa 實數(>=0) a. 若為逐點給,則參數形式為矩陣(I,J)
            sedimentErosionTensileStrengthValue = 0;      //2.5.2.2 張力強度 二選一 pa 實數(>=0) a. 0:均一值,逐點給:-1
            sedimentErosionTensileStrengthArray = null;   //2.5.2.2 張力強度 二選一 pa 實數(>=0) a. 若為逐點給,則參數形式為矩陣(I,J)

            bedrockElevation = false;           //2.5.3 岩床高程
            bedrockElevationValue = 0;;    //2.5.3 岩床高程 二選一 m 實數 a. 0:均一值,逐點給:-1。
            bedrockElevationArray = null; //2.5.3 岩床高程 二選一 m 實數 a. 為逐點給,則參數形式為矩陣(I,J)

            //2.6 岸壁穩定分析 option
            //2.6.1 分析位置
            positionAnalysis = false;   //2.6.1 分析位置
            positionAnalysisType = PositionAnalysisType.None;   //2.6.1 分析位置二選一 -- a. 僅供介面用,不用輸入到input 檔。此選項為提供全部模擬與局部模擬兩個選項
            localBlockNumber = 0;                        //2.6.1.1 數值格網數目的表格供使用者填入欲分析位置數目IB,其中IB 的數目不可超過格網數目I。
            localBlockArray = null;                         //2.6.1.1 局部區塊數目矩陣(2, IB) -- a. 矩陣(2, IB),1 代表左岸,2 代表右岸。僅為0、1 兩個數目字可供選擇,若1 為計算,若0 為不計算。

            //2.6.2 入滲效應
            infiltrationEffect = false;        //2.6.2 入滲效應 option
            infiltrationEffectTimeFormat = InfiltrationEffectTimeFormat.Minute;   //2.6.2.1 時間格式二選一 小時/分鐘,二選一。
            infiltrationEffectTimeSpacing = 0;                        //2.6.2.2 間距單一數值 實數(>0) 使用者自行輸入數值ex:1.5 小時or 90 分鐘
            rainfall = null;                                           //2.6.2.2.1 降雨量矩陣 mm 實數(>0) Free a. 矩陣大小需計算:首先將間距換為秒,然後“總模擬時間” (秒)除於間距(秒),即為矩陣大小

            //2.6.3 岸壁幾何條件
            quayGeometry = false;      //2.6.3 岸壁幾何條件
            soilStratificationNumber = 0;        //2.6.3.1 岸壁土壤分層數目單一數值 整數(>0) option
            layerThicknessArray = null;       //2.6.3.1.1 分層厚度矩陣(LBK)m 實數(>0) 矩陣(LBK)為岸壁土壤分層數目
            quayHeightArray = null;           //2.6.3.2 岸壁高度矩陣(2, IB) m 實數
            dikeToWharfLengthArray = null;    //2.6.3.3 堤防到岸壁的長度矩陣(2, IB)m 實數(>0)

            //2.6.4 岸壁土壤性質
            quaySoilProperties = false;   //2.6.4 岸壁土壤性質
            cohesion = 0;                         //2.6.4.1 凝聚力 二選一 pa 實數(>0) a. 0:均一值,逐點給:-1
            cohesionArray = null;                //2.6.4.1 凝聚力 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            reposeAngle = 0;                      //2.6.4.2 安息角 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            reposeAngleArray = null;             //2.6.4.2 安息角 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            frictionAngle = 0;                    //2.6.4.3 內摩擦角 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            frictionAngleArray = null;           //2.6.4.3 內摩擦角 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            flowRateRatio = 0;                    //2.6.4.3 比流率 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            flowRateRatioArray = null;          //2.6.4.3 比流率 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            porosityRatio = 0;                    //2.6.4.5 孔隙率二選一 -- 實數(>0) a. 0:均一值,逐點給:-1
            porosityRatioArray = null;           //若為逐點給,則參數形式為矩陣(2,IB,LBK)

            soilProportion = 0;                  //2.6.4.6 土壤比重二選一 -- 實數(>0) a. 0:均一值,逐點給:-1
            soilProportionArray = null;         //若為逐點給,則參數形式為矩陣(2,IB,LBK)

            ShearStrengthAngle = 0;              //2.6.4.7 岸壁未飽和基值吸力造成剪力強度增加所對應角度 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            ShearStrengthAngleArray = null;      //2.6.4.7 岸壁未飽和基值吸力造成剪力強度增加所對應角度 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            //3. 初始條件
            //3.1 水理模組 =========================================
            depthAverageFlowSpeedU = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);
            depthAverageFlowSpeedV = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);
            waterLevel = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim); ;      //3.1.4 水位 二選一 m 實數 實數 8 格a. 若為逐 點給,則參數形式為矩陣(I,J)
            verticalVelocitySlice = VerticalVelocitySliceType.None;         //3.1.4 垂向流速剖面二選一 -- -- 整數8 格a. 三維only b. 0:關;1:開

            //3.2 動床模組
            depthAverageConcentration = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim);      //3.2.1 水深平均濃度二選一 ppm -- 實數(>=0) 實數8 格a. 總共有K 個粒徑種類,每種粒徑都要輸入。
            verticalConcentrationSlice = VerticalConcentrationSliceType.None;         //3.2.2 垂向濃度剖面二選一 -- -- 整數8 格a. 三維only b. 0:關;1:開

            //4. 邊界條件
            //4.1 水理模組
            boundaryTimeNumber = 0;         //4.1.0 邊界時間數目
            boundaryTime = null;            //4.1.0 邊界時間

            //4.1.1 上游
            upFlowCondition = FlowConditionType.None;         //4.1.1.1 流況設定 二選一

            //4.1.1.1.1 超臨界流
            //boundaryConditionNumber = 0;                   //4.1.1.1.2.0 邊界條件數目 T 整數(>1) 定量流不輸入
            superMainFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                 //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            superSideFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                 //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            superWaterLevel = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                   //4.1.1.1.1.2 水位 m 實數

            //4.1.1.1.2 亞臨界流
            //subBoundaryConditionNumber = 0;                 //4.1.1.1.2.0 邊界條件數目 T 整數(>1) 定量流不輸入
            subMainFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);               //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            subSideFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);               //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1

            verticalVelocityType = VerticalVelocityType.Auto;       //4.1.1.2 垂向流速分布(3D) 矩陣(2,P) 實數(>=0)
            verticalVelocityDistributionArray = null;     //4.1.1.2 垂向流速分布(3D) 矩陣(2,P) 實數(>=0)

            //4.1.2 下游 二選一
            downFlowCondition = FlowConditionType.None;         //4.1.2 下游 二選一
            downSubWaterLevel = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                   //4.1.2.2.1 水位 實數 同 4.1.1.1.1.2,T 與前同(4.1.1.1.1.0 或4.1.1.1.2.0)

            //4.1.3 側壁
            sidewallBoundarySlip = false;               //4.1.3.1 側壁邊界滑移 -- 0 整數(>0) 整數 8 格 0:非滑移、1:滑移,check box

            //4.1.4 水面 三維 only。(”即時互動處”不放圖示)
            mainstreamWindShear = 0;              //4.1.4.1 主流方向風剪 單一數值 N/m2 0 實數 實數 8 格
            sideWindShear = 0;                    //4.1.4.2 側方向風剪 單一數值 N/m2 0 實數 實數 8 格
            coriolisForce = 0;                    //4.1.4.3 科氏力 單一數值 N/m2 0 實數 實數 8 格

            //4.1.5 底床 實數 三維 only。(”即時互動處”不放圖示)
            boundaryLayerThickness = 3;              //4.1.5.1 邊界層厚度 三選一 3 整數(>0) 整數 8 格 1、2、3,三維 only,下拉選單。
            seabedBoundarySlip = SeabedBoundarySlipType.NonSlip;   //4.1.5.2 底床邊界滑移 三選一 -- 0 整數(>0) 整數 8 格 a. 三維 only,下拉選單 b. 0:非滑移、1:滑移、2:壁函數

            //4.2 動床模組
            //4.2.1 上游
            //4.2.1.1 入流泥砂設定
            bottomBedLoadFluxType = BottomBedLoadFluxType.Auto; //4.2.1.1.1 底床載通量 實數(>=0)“模式自動計算”
            bottomBedLoadFluxArray = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim); ;            //4.2.1.1.1 底床載通量 實數(>=0)“自行輸入”,如果為“自行輸入”,則如圖4.2.1.1.1 所示
            suspendedLoadDepthAvgConcentration = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim);  //4.2.1.1.2 懸浮載水深平均濃度實數(>=0) 如圖 4.2.1.1.1 所示
            boundaryUpVerticalDistributionNum = 0;
            boundaryUpVerticalDistribution = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.1.1.3 垂向濃度分布(3D) 矩陣(2,PP) 均一值 實數(>=0) a. 可為均一值或自行輸入。

            //4.2.1.2 上游邊界底床
            upBoundaryElevationType = BottomBedLoadFluxType.Auto;   //4.2.1.2.1 可採用初始上游邊界底床高程或自行輸入
            upBoundaryElevationArray = null;              //4.2.1.2.1 高程矩陣(T,J) m 初始實數 可採用初始上游邊界底床高程或自行輸入,
            bottomBedParticleSizeRatio = null;            //4.2.1.2.2 底床粒徑比例實數(>=0) 如圖 4.2.1.1.3 所示

            //4.2.2 下游 圖5,“即時互動處”不放圖示
            movableBedDownType = BottomBedLoadFluxType.Auto;        //4.2.2.1 通量實數(>=0) 如圖 2.2.2.1 所示
            movableBedDownConcentration = null;           //4.2.2.2 濃度 實數(>=0) 如圖 2.2.2.1 所示

            boundaryDownVerticalDistributionNum = 0;
            boundaryDownVerticalDistribution = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.1.1.3 垂向濃度分布(3D) 矩陣(2,PP) 均一值 實數(>=0) a. 可為均一值或自行輸入。
            nearBedBoundaryType = NearBedBoundaryType.None;         //4.2.3 近底床濃度邊界二選一 實數 a. 三維only
            concentrationCalculation = ConcentrationCalculationType.None;   //4.2.3.1 濃度計算公式多選一 整數 8 格下拉式選單(總共2~3 種選項)
            inputConcentration = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.3.2 通量/給定濃度二選一 a. 先令使用者選擇是通量或者是給定濃
            stopFlah = false;
        }
Exemplo n.º 52
0
 /// <summary>
 /// Отказывает в подписании документа, отправленного ранее (для пересланных и документов без подписи)
 /// </summary>
 /// <param name="flowType">Тип документооборота</param>
 /// <param name="rejectSign">Отказ от подписания</param>
 public void RejectSign(FlowType flowType, RejectSign rejectSign)
 {
     CheckAutorizedInvoke(() =>
     {
         client.RejectSign(Token, flowType, rejectSign);
         return true;
     });
 }