阅读:3416
回复:5
|
[已解决]表单下多个流程如何手工选择
老师好,我想实现的功能是一个表单下有多个流程,默认情况下写表单时不带流程直接保存,需要提交审批时则选择相应的流程进入审批。不知道能不能实现。
|
1楼#
发布于:2017-04-10 08:48
帖内置顶 – H3BPM – 2017-04-10 13:46
如果表单相同,字段和数据什么的也相似,应该在流程里面多做几个条件,多拉几条线就能实现了。
|
|
2楼#
发布于:2017-04-10 08:45
帖内置顶 – H3BPM – 2017-04-10 13:46
建一个流程,填写完表单就完成,在提交的时候根据表单的数据,后台发起对应的流程实例。
如有不明白可跟帖询问。 后台发起流程的大致代码如下: string workflowCode = "ExtraWork"; bool finishStart = true; // 获取模板 OThinker.H3.WorkflowTemplate.PublishedWorkflowTemplateHeader workflowTemplate = GetWorkflowTemplate(workflowCode); string orguser = this.ActionContext.User.UserName; // 查找流程发起人 OThinker.Organization.User user = this.ActionContext.User.User as Organization.User; OThinker.Organization.User userZB = OThinker.H3.WorkSheet.AppUtility.Engine.Organization.GetUnit(userCode) as OThinker.Organization.User; OThinker.H3.DataModel.BizObjectSchema schema = this.Engine.BizObjectManager.GetPublishedSchema(workflowTemplate.BizObjectSchemaCode); OThinker.H3.DataModel.BizObject bo = new DataModel.BizObject( this.Engine.Organization, this.Engine.MetadataRepository, this.Engine.BizObjectManager, schema, user.UnitID, user.CompanyID); bo["Applicant"] = userCode; bo["Contents"] = "由" + orguser + "发起申请; "; bo.Create(); // 创建流程实例 string InstanceId = this.Engine.InstanceManager.CreateInstance( bo.ObjectID, workflowTemplate.WorkflowCode, workflowTemplate.WorkflowVersion, null, null, userZB.UnitID, null, null, false, Instance.InstanceContext.UnspecifiedID, null, Instance.Token.UnspecifiedID); // 设置紧急程度为普通 OThinker.H3.Messages.MessageEmergencyType emergency = Messages.MessageEmergencyType.Normal; // 这里也可以在启动流程的时候赋值 Dictionary<string, object> paramTables = new Dictionary<string, object>(); // 启动流程的消息 OThinker.H3.Messages.StartInstanceMessage startInstanceMessage = new OThinker.H3.Messages.StartInstanceMessage( emergency, InstanceId, paramTables, Instance.PriorityType.Normal, finishStart, null, false, OThinker.H3.Instance.Token.UnspecifiedID, null); Engine.InstanceManager.SendMessage(startInstanceMessage); } catch (Exception ex) { this.ActionContext.Engine.LogWriter.Write("流程发起失败:" + ex.Messages); } |
|
3楼#
发布于:2017-04-09 21:32
不行,一个流程可以对应多个表单,但是一个表单不能对应多个流程
|
|
4楼#
发布于:2017-04-10 08:45
建一个流程,填写完表单就完成,在提交的时候根据表单的数据,后台发起对应的流程实例。
如有不明白可跟帖询问。 后台发起流程的大致代码如下: string workflowCode = "ExtraWork"; bool finishStart = true; // 获取模板 OThinker.H3.WorkflowTemplate.PublishedWorkflowTemplateHeader workflowTemplate = GetWorkflowTemplate(workflowCode); string orguser = this.ActionContext.User.UserName; // 查找流程发起人 OThinker.Organization.User user = this.ActionContext.User.User as Organization.User; OThinker.Organization.User userZB = OThinker.H3.WorkSheet.AppUtility.Engine.Organization.GetUnit(userCode) as OThinker.Organization.User; OThinker.H3.DataModel.BizObjectSchema schema = this.Engine.BizObjectManager.GetPublishedSchema(workflowTemplate.BizObjectSchemaCode); OThinker.H3.DataModel.BizObject bo = new DataModel.BizObject( this.Engine.Organization, this.Engine.MetadataRepository, this.Engine.BizObjectManager, schema, user.UnitID, user.CompanyID); bo["Applicant"] = userCode; bo["Contents"] = "由" + orguser + "发起申请; "; bo.Create(); // 创建流程实例 string InstanceId = this.Engine.InstanceManager.CreateInstance( bo.ObjectID, workflowTemplate.WorkflowCode, workflowTemplate.WorkflowVersion, null, null, userZB.UnitID, null, null, false, Instance.InstanceContext.UnspecifiedID, null, Instance.Token.UnspecifiedID); // 设置紧急程度为普通 OThinker.H3.Messages.MessageEmergencyType emergency = Messages.MessageEmergencyType.Normal; // 这里也可以在启动流程的时候赋值 Dictionary<string, object> paramTables = new Dictionary<string, object>(); // 启动流程的消息 OThinker.H3.Messages.StartInstanceMessage startInstanceMessage = new OThinker.H3.Messages.StartInstanceMessage( emergency, InstanceId, paramTables, Instance.PriorityType.Normal, finishStart, null, false, OThinker.H3.Instance.Token.UnspecifiedID, null); Engine.InstanceManager.SendMessage(startInstanceMessage); } catch (Exception ex) { this.ActionContext.Engine.LogWriter.Write("流程发起失败:" + ex.Messages); } |
|
5楼#
发布于:2017-04-10 08:48
如果表单相同,字段和数据什么的也相似,应该在流程里面多做几个条件,多拉几条线就能实现了。
|
|
6楼#
发布于:2017-04-10 09:27
t156965365:如果表单相同,字段和数据什么的也相似,应该在流程里面多做几个条件,多拉几条线就能实现了。回到原帖我明白了,想实现理论上的多个流程,其实还是只做一个流程,然后在表单做选项,根据选项走相应的流程分支。没有流程也是做选项,可以直接结束。 |
|
7楼#
发布于:2017-04-10 13:48
|
|
|