/// <summary> /// 获取流程信息 /// </summary> /// <param name="page">页面对象</param> /// <param name="bizContext">业务系统BizContext</param> /// <returns></returns> internal static WorkflowContext GetProcess(Page page, BizContext bizContext) { string result = ExecuteMethod(AppSettingInfo.CONST_ExecuteMethod_GetProcess, AppSettingInfo.CONST_ExecuteMode_Zero, AppSettingInfo.CONST_WorkflowMethodVersion, bizContext); SDKHelper.ShowProcess(page, result); return(JsonConvert.DeserializeObject <WorkflowContext>(result)); }
/// <summary> /// 创建流程返回WorkflowContext对象 /// </summary> /// <param name="page">页面对象</param> /// <param name="startup">流程发起参数</param> /// <returns></returns> internal static WorkflowContext CreateProcess(Page page, WFStartupParameter startup) { var bizContext = ConvertToBizContext(startup); string result = ExecuteMethod(AppSettingInfo.CONST_ExecuteMethod_CreateProcess, AppSettingInfo.CONST_ExecuteMode_Zero, AppSettingInfo.CONST_WorkflowMethodVersion, bizContext); SDKHelper.ShowProcess(page, result); return(JsonConvert.DeserializeObject <WorkflowContext>(result)); }
/// <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); }