Пример #1
0
        public List <ProcessInstanceInfoModel> GetProcessInstanceInfoModels(string processName)
        {
            try
            {
                var processInstances = ProcessManagement.GetProcessInstances(processName);

                return(processInstances.Select(processInstance =>
                {
                    var currentStepInfo = processInstance.GetCurrentStep();

                    return new ProcessInstanceInfoModel
                    {
                        Index = processInstance.Pid,
                        ProcessName = processInstance.ProcessName,
                        CurrentStep = currentStepInfo.Name,
                        CurrentStepId = currentStepInfo.Id,
                        Container = currentStepInfo.Container,
                        ProcessInstanceParameters = processInstance.GetParametersValue()
                    };
                })
                       .ToList());
            }
            catch (Exception e)
            {
                Log.Error($"获取Process实例观察参数失败,异常为:[{e.Message}]");
                return(null);
            }
        }