/// <summary> /// 执行 /// </summary> /// <param name="host"></param> /// <param name="param"></param> internal void Execute(WFClientSDK host, WFExecuteParameter param) { string workflowContextPost = JsonConvert.SerializeObject(param.WorkflowContext); //TODO 执行流程操作 WFExecuteArgs args = new WFExecuteArgs(param); if (args.ExecuteParameter.OperatorType == 7) { //如果执行的是撤回操作,则直接执行工作流方法,然后调用After。 ExecuteMethodOnlyCallAfter(host, param); return; } bool result = true; if (BeforeExecute != null) { result = BeforeExecute(this, args); } if (result == false) { //如果Before出错则把POST回来的WorkflowContext再返回回去 SDKHelper.ShowProcess(host.PageInstance, workflowContextPost); return; } string workflowContext = WFClientProcess.ExecuteMethod(args.ExecuteParameter, 1); WorkflowContext workflowContextOne = JsonConvert.DeserializeObject <WorkflowContext>(workflowContext); ProcessReturn(args, workflowContextOne); if (args.ExecuteParameter.WorkflowContext.StatusCode != 0) { SDKHelper.ShowProcess(host.PageInstance, JsonConvert.SerializeObject(args.ExecuteParameter.WorkflowContext)); return; } if (SaveApplicationData != null) { result = SaveApplicationData(this, args); } if (result) { workflowContext = WFClientProcess.ExecuteMethod(args.ExecuteParameter, 2); args.ExecuteParameter.WorkflowContext = JsonConvert.DeserializeObject <WorkflowContext>(workflowContext); if (AfterExecute != null) { AfterExecute(this, args); } SDKHelper.ShowProcess(host.PageInstance, workflowContext); } else { SDKHelper.ShowProcess(host.PageInstance, workflowContextPost); } }
/// <summary> /// 执行工作流的方法(只调用After) /// </summary> /// <param name="host"></param> /// <param name="param"></param> private void ExecuteMethodOnlyCallAfter(WFClientSDK host, WFExecuteParameter param) { string workflowContextPost = JsonConvert.SerializeObject(param.WorkflowContext); //TODO 执行流程操作 WFExecuteArgs args = new WFExecuteArgs(param); string workflowContext = WFClientProcess.ExecuteMethod(args.ExecuteParameter, 0); args.ExecuteParameter.WorkflowContext = JsonConvert.DeserializeObject <WorkflowContext>(workflowContext); if (AfterExecute != null) { AfterExecute(this, args); } SDKHelper.ShowProcess(host.PageInstance, workflowContext); }
/// <summary> /// 构造函数 /// </summary> /// <param name="param">流程执行的参数</param> public WFExecuteArgs(WFExecuteParameter param) { this.ExecuteParameter = param; }
/// <summary> /// 执行流程方法 /// </summary> /// <param name="param"></param> /// <param name="methodMode"></param> /// <returns></returns> internal static string ExecuteMethod(WFExecuteParameter param, int methodMode) { return(ExecuteMethod(param.MethodName, methodMode, param.Version, param.BizContext)); }