// public const string

        public static string GetWorkflowUrl(this Workflow.Core.Workflow workflow)
        {
            string     stepName;
            ManualStep currManualStep = workflow.CurrentStep as ManualStep;

            if (currManualStep != null)
            {
                stepName = currManualStep.Config.Name;
            }
            else
            {
                stepName = string.Empty;
            }
            string wdName = workflow.WorkflowRow.WI_WD_NAME;

            // WorkflowContent context = new WorkflowContent();
            if (workflow.IsUserStep(GlobalVariable.UserId.ToString()))
            {
                ManualStep step = workflow.CurrentStep as ManualStep;
                return(string.Format(ObjectUtil.SysCulture,
                                     "/workflow/MyWork/ProcessDetail?id={0}",
                                     workflow.WorkflowId));
            }
            else
            {
                return(MYWORK_PAGE);
            }
        }
Exemple #2
0
        public string WorkflowProcess(string wid, DataSet PostDataSet)
        {
            Workflow.Core.Workflow wf = Workflow.Core.Workflow.CreateWorkflow(context, wid);
            WorkflowConfig.ConnString = PlugAreaRegistration.CONN;
            ManualStepConfig config = wf.CurrentStep.Config as ManualStepConfig;

            AtawDebug.AssertNotNull(config, "调用时机有误,当前的步骤必须是人工步骤,现在不是", this);

            WorkflowContent content = WorkflowInstUtil.CreateContent(wf.WorkflowRow);

            if (!string.IsNullOrEmpty(config.Process.UIOperation.RegName))
            {
                UIProcessor processor = AtawIocContext.Current.FetchInstance <UIProcessor>(
                    config.Process.UIOperation.PlugIn);
                processor.Config  = config;
                processor.Source  = context;
                processor.Content = content;

                processor.UIData = PostDataSet;
                processor.Execute(wf.WorkflowRow);
                WorkflowInstUtil.ManualSendWorkflow(wf.WorkflowRow, GlobalVariable.UserId, processor);
            }
            else
            {
                wf.WorkflowRow.WI_PROCESS_ID   = GlobalVariable.UserId.ToString();
                wf.WorkflowRow.WI_PROCESS_DATE = context.Now;
                wf.WorkflowRow.WI_STATUS       = (int)StepState.ProcessNotSend;
            }
            //context.Submit();
            wf.UpdateState(ManualPNSState.Instance);
            string url = wf.GetWorkflowUrl();
            JsResponseResult <string> res = new JsResponseResult <string>()
            {
                ActionType = JsActionType.Url,
                Content    = url
            };

            return(res.ToJSON());
        }
        private MapModel GetMapModel(Workflow.Core.Workflow workflow)
        {
            List <StepView> otherSteps = new List <StepView>();
            var             lastStep   = workflow.Config.Steps[workflow.CurrentStep.WorkflowRow.WI_LAST_STEP];

            if (lastStep.StepType == StepType.Route)
            {
                var steps = lastStep.NextSteps.ToList();
                steps.ForEach(
                    a =>
                {
                    if (a.Name != workflow.CurrentStep.Config.Name)
                    {
                        otherSteps.Add(new StepView()
                        {
                            Name        = a.Name,
                            DisplayName = a.DisplayName
                        });
                    }
                }
                    );
            }
            var nextStep = workflow.CurrentStep.Config.NextSteps.FirstOrDefault();

            return(new MapModel
            {
                CurrentStep = new StepView {
                    Name = workflow.CurrentStep.Config.Name, DisplayName = workflow.CurrentStep.Config.DisplayName
                },
                LastStep = new StepView {
                    Name = workflow.CurrentStep.WorkflowRow.WI_LAST_STEP, DisplayName = workflow.CurrentStep.WorkflowRow.WI_LAST_STEP_NAME
                },
                OtherSteps = otherSteps,
                NextStep = nextStep == null ? null : new StepView {
                    Name = nextStep.Name, DisplayName = nextStep.DisplayName
                },
            });
        }