/// <summary> /// 执行流程方法 /// </summary> /// <param name="methodName">方法名称</param> /// <param name="methodMode">方法类型(0:直接提交,1:第一步提交,2:第二步提交)</param> /// <param name="methodVersion">方法版本</param> /// <param name="bizContext">流程上下文参数</param> /// <returns></returns> internal static string ExecuteMethod(string methodName, int methodMode, string methodVersion, BizContext bizContext, string bizWFServiceURL = "") { //补充BizContext的信息(CurrentUser,AppCode) WFClientProcess.RepaireBizContext(bizContext); //将appCode,action,method,param(序列化后的dicParam)添加到dicParamWebService中调用WebService var dicParamWebService = new Dictionary <string, object>(); dicParamWebService.Add("appCode", bizContext.AppCode); dicParamWebService.Add("action", "Process"); dicParamWebService.Add("method", methodName); dicParamWebService.Add("token", bizContext.WFToken); dicParamWebService.Add("param", Newtonsoft.Json.JsonConvert.SerializeObject(new { BizContext = JsonConvert.SerializeObject(bizContext), Mode = methodMode, Version = methodVersion })); dicParamWebService.Add("callBackUrl", ""); string url = AppSettingInfo.WorkflowServerUrl; if (!string.IsNullOrEmpty(bizWFServiceURL)) { url = bizWFServiceURL; } string workFlowServerFullURL = SDKHelper.GetWorkflowServerUrlFullPath(url); string result = SDKHelper.QueryPostWebService(workFlowServerFullURL, AppSettingInfo.CONST_WorkflowServiceMethodName, dicParamWebService); return(result); }
/// <summary> /// 执行流程动作(分步执行) /// </summary> /// <param name="methodName">操作命令</param> /// <param name="methodMode">方法类型(1:第一步提交,2:第二步提交)</param> /// <param name="bizContext">业务系统上下文</param> /// <returns></returns> public static WorkflowContext ExecuteMethod(string methodName, int methodMode, BizContext bizContext) { if (string.IsNullOrEmpty(methodName)) { throw new Exception("操作命令不能为空"); } string result = WFClientProcess.ExecuteMethod(methodName, methodMode, AppSettingInfo.CONST_WorkflowMethodVersion, bizContext); 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); }
/// <summary> /// 获取流程WorkflowContext对象(加载已有流程信息) /// </summary> /// <param name="page">页面对象</param> /// <param name="businessID">业务ID</param> /// <param name="userLoginID">用户CTX账号</param> /// <returns>流程信息</returns> public static WorkflowContext GetProcess(Page page, string businessID, string userLoginID = null) { BizContext bizContext = new BizContext(); bizContext.BusinessID = businessID; if (!string.IsNullOrEmpty(userLoginID)) { bizContext.CurrentUser = new UserInfo() { UserLoginID = userLoginID }; } return(WFClientProcess.GetProcess(page, bizContext)); }
/// <summary> /// 获取流程WorkflowContext对象(根据参数刷新流程信息) /// </summary> /// <param name="page">页面对象</param> /// <param name="businessID">业务ID</param> /// <param name="formParam">流程参数</param> /// <param name="DynamicRoleUserList">动态角色</param> /// <param name="userLoginID">用户UserLoginID(为空或null则从SSO获取)</param> /// <returns>刷新后的流程信息</returns> public static WorkflowContext GetProcessForceRefresh(Page page, string businessID, Dictionary <string, object> formParam, Dictionary <string, List <UserInfo> > DynamicRoleUserList, string userLoginID = null) { BizContext bizContext = new BizContext(); bizContext.BusinessID = businessID; bizContext.FormParams = formParam; bizContext.DynamicRoleUserList = DynamicRoleUserList; if (!string.IsNullOrEmpty(userLoginID)) { bizContext.CurrentUser = new UserInfo() { UserLoginID = userLoginID }; } bizContext.ExtensionCommond = new Dictionary <string, string>(); bizContext.ExtensionCommond.Add(AppSettingInfo.CONST_ExtensionCommond_GetProcessForceRefresh, bool.TrueString); return(WFClientProcess.GetProcess(page, bizContext)); }
/// <summary> /// 获取流程WorkflowContext对象(加载已有流程信息) /// </summary> /// <param name="page">页面对象</param> /// <param name="businessID">业务ID</param> /// <param name="userInfo">用户信息</param> /// <returns>流程信息</returns> public static WorkflowContext GetProcess(Page page, string businessID, UserInfo userInfo) { BizContext bizContext = new BizContext(); bizContext.BusinessID = businessID; if (userInfo == null) { bizContext.CurrentUser = new UserInfo() { UserLoginID = SDKHelper.GetUserName(HttpContext.Current) }; } else { bizContext.CurrentUser = userInfo; } return(WFClientProcess.GetProcess(page, bizContext)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text"; string bizContext = context.Request.Form["BizContext"]; string methodName = context.Request.Form["MethodName"]; string methodMode = context.Request.Form["MethodMode"]; string methodVersion = context.Request.Form["Version"]; string bizWFURL = context.Request.Form["BizWFURL"]; if (string.IsNullOrEmpty(bizContext)) { bizContext = context.Request.QueryString["BizContext"]; } if (string.IsNullOrEmpty(methodName)) { methodName = context.Request.QueryString["MethodName"]; } if (string.IsNullOrEmpty(methodMode)) { methodMode = context.Request.QueryString["MethodMode"]; } if (string.IsNullOrEmpty(methodVersion)) { methodVersion = context.Request.QueryString["Version"]; } if (string.IsNullOrEmpty(methodName)) { throw new Exception("参数MethodName为空"); } if (string.IsNullOrEmpty(bizContext)) { throw new Exception("参数BizContext为空"); } //反序列化得到BizContext BizContext bizContextObj = JsonConvert.DeserializeObject <BizContext>(bizContext); string result = WFClientProcess.ExecuteMethod(methodName, SDKHelper.ToInt(methodMode), methodVersion, bizContextObj, bizWFURL); context.Response.Write(result); }
/// <summary> /// 根据业务ID查询已办数据(同一流程同一个人只会查询到一条最新的已办信息) /// </summary> /// <param name="businessID">业务ID</param> /// <returns>已办查询结果(同一流程同一个人只会查询到一条最新的已办信息)</returns> public static WFTaskQueryResult QueryDoneDistinctByBusinessID(string businessID) { return(WFClientProcess.QueryDoneDistinctByBusinessID(businessID)); }
/// <summary> /// 查询已办(同一流程同一个人只会查询到一条最新的已办信息) /// </summary> /// <param name="condition">查询条件(PageSize和PageIndex同时为0表示查询所有)</param> /// <returns>已办查询结果(同一流程同一个人只会查询到一条最新的已办信息)</returns> public static WFTaskQueryResult QueryDoneDistinct(WFTaskQueryFilter condition) { return(WFClientProcess.QueryDoneDistinct(condition)); }
/// <summary> /// 查询已办 /// </summary> /// <param name="condition">查询条件(PageSize和PageIndex同时为0表示查询所有)</param> /// <returns>已办查询结果</returns> public static WFTaskQueryResult QueryDone(WFTaskQueryFilter condition) { return(WFClientProcess.QureyTask(condition, AppSettingInfo.CONST_OtherMethod_QueryDone)); }
/// <summary> /// 检查是否发起过流程 /// </summary> /// <param name="businessID">业务ID</param> /// <returns>true,表示已发起过流程。false表示未发起过流程</returns> public static bool Exist(string businessID) { return(WFClientProcess.Exist(businessID)); }
/// <summary> /// 获取审批记录 /// </summary> /// <param name="businessID">业务ID</param> /// <returns>按照倒序排列的审批记录</returns> public static List <ProcessLog> GetProcessLogList(string businessID) { return(WFClientProcess.GetProcessLogList(businessID)); }
/// <summary> /// 获取流程信息 /// </summary> /// <param name="page">页面对象</param> /// <param name="bizContext">业务系统BizContext</param> /// <returns></returns> public static WorkflowContext GetProcess(Page page, BizContext bizContext) { return(WFClientProcess.GetProcess(page, bizContext)); }
/// <summary> /// 创建流程返回WorkflowContext对象 /// </summary> /// <param name="page">页面</param> /// <param name="startup">发起流程的参数</param> /// <returns>流程信息</returns> public static WorkflowContext CreateProcess(Page page, WFStartupParameter startup) { return(WFClientProcess.CreateProcess(page, startup)); }