氚云丨开发课— 08 流程操作及组织机构管理| 学习笔记

简介: 快速学习氚云丨开发课— 08 流程操作及组织机构管理。

开发者学堂课程【低代码氚云应用开发课程氚云丨开发课— 08 流程操作及组织机构管理】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/894/detail/14285


氚云丨开发课— 08 流程操作及组织机构管理

 

流程操作及组织机构管理

结束流程时执行特定的业务逻辑
示例:
protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.WorkflowInstanceState newState)
//流程审批结束事件(先执行业务规则,在执行该方法)。
if(oldState == H3.Workilow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)

//执行业务代码逻辑
//流程审批结束后,重新激活事件(先执行业务规则,在执行该方
法)。
if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Finished && newState == H3.Workflow.Instance.WorkflowInstanceState.Running)
//执行业务代码逻辑
base.OnWorkflowInstanceStateChanged(oldState, newState); 

ected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)base.OnLoad(response);
ected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)base.OnSubmit(actionName, postvalue, response);
ected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceStatee oldstate, H3.Workflow.Instance.WorkflowInstanceState newState)
//流程审批结束事件(先执行业务规则,在执行该方法)。
if(oldstate == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)
//H3.DataModel.BizObject targetBiz=new H3.DataModel.BizObject(this.Engine,this.Engine.BizObjectManager.GetPublishedSchema("D60159908452
//targetBiz["userName"]-this.Request.BizObject["userName"];
//targetBiz["money"]-this.Request.BizObject["money"];
// targetBiz.Status=H3.DataModel.BizObjectStatus.Effective;
1/ targetBiz.Create();
if(double.Parse("0"* this.Request,Biz0bject["moner"1)f 100)
this.Request.BizObject.Remove();
//流程审批结束后,重新激活事件(先执行业务规则,在执行该方法)。if(oldstate =- H3.Workflow.Instance.WorkflowInstanceState.Finished && newState == H3.Workflow.Instance.WorkflowInstanceState.Running)
//执行业务代码逻辑
base.OnWorkflowInstanceStatechanged(oldstate, newState);

流程操作
重新激活流程
示例:
H3.Workflow.Messages.ActivatelnstanceMessage activiteinstanceMessage = newH3.Workflow.Messages,ActivatelnstanceMessage(this.Request.Instanceld);//传递参数为流
程实例 ID
[this.Request.Engine.WorkflowInstanceManager.SendMessage(activiteinstanceMessage);//
只会激活流程,并不会触发运行的节点

激活某个活动节点
示例:
[H3.Workflow.Messages.ActivateActivityMessage activiteMessage = new H3.Workflow.Messages.ActivateActivityMessage(this.Request.Instanceld,"Activity3", H3.Workflow.Instance.Token.Unspecifiedld, new string0 0,hull, false, H3.Workflow.Workltem.ActionEventType.Adjust);//参数对应描述:流程实
例 ID,活动节点编码,令牌 ID,参与者,前驱令牌,是否检测入口条件,激活类型
[this.Request.Engine.WorkflowlnstanceManager.SendMessage(activiteMessage);//1.
不会取消正在运行的节点。2.进行中的流程才能激活调整。

取消某个活动节点
示例:
H3.Workflow.Messages.CancelActivityMessage cancelMessage = new3.Workflow.Messages.CancelActivityMessage(this.Request.Instanceld,"Activity3", false);this.Request.Engine.WorkilowInstanceManager.SendMessage(cancelMessage);

取消流程
示例:
H3.Workflow.Messages.CancellnstanceMessage cancelMessage = newH3.Workflow.Messages.CancellnstanceMessage(this.Request.Instanceld,false);this.Request.Engine.WorkflowInstanceManager.SendMessage(cancelMessage)
结束流程
示例:
H3.Workflow.Instance.WorkflowInstance instance = this.Request.Engine.WorkflowInstanceManager.GetWorkflowInstance(this.Request.Instanceld);//获取当前流程实例对象
H3.Workflow.Messages.FinishInstanceMessage cancelMessage = new
H3.Workflow.Messages.FinishInstanceMessage(this.Request.Instancel
a,(inyinstance.rinaiokenia);this,Beauest.Enaine.WorkflowInstanceManaaer,SendMessaae(cancelprotected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response)
base.OnLoad(response);protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response)if(actionName =="Submit"&& this.Request.Bizobject.Status =H3.DataModel.Bizobjectstatus.Effective)base.Onsubmit(actionName, postValue, response);protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.Workf1owInstanceStateoldState, H3.Workflow.Instance.WorkflowInstanceState newState)
//流程审批结束事件(先执行业务规则,在执行该方法)。
if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)
// H3.DataModel.BizObject targetBiz=new H3.DataModel.Biz0bject(this.Engine,this.Engine,BizObjectManager.GetpublishedSchema("D0015990845285c574547399f4b42e95d272;// targetBiz["userName"]-this.Request.BizObject["userName"];// targetBiz["money"]-this,Request.BizObject["money"];// targetBiz.Status=H3.DataModel.BizObjectStatus.Effective;// targetBiz.Create();/1if(double.Parse("6"+ this.Request.BizObject["money"])< 100)

组织单元
查找组织单元
获取组织机构中角色清单及员工所在部门、员工拥有哪些角色等。如:选择员工后,自动查询员工所在部门并赋值给其他字段。
示例:
//获取所有角色分组
H3.Organization.OrgRoleGroup[ groups = this.Request.Engine.Organization.GetAllRoleGroups0;
//获取公司所有角色
H3.Organization.OrgRolell allRoles = this.Request.Engine.Organization.GetAlIRoles0;
//获取用户所在部门
H3.Organization.Unit unit = this Request.Engine.Organization.GetParentUnit(this.Request.UserContext.Userld);

//获取用户所有角色
H3.Organization.OrgRolell roles = this.Request.Engine.Organization.GetUserRoles(this.Request.UserContext.Userld,true);
// 获取公司所有有效用户
string[ userlds = this.Request.Engine.Organization.GetChildren(this.Request.Engine.Organization.Company.Companyld, H3.Organization.UnitType.User, true, H3.Organization.State.Active);

//根据用户 ID 获取用户对象
H3.Organization.User user = Engine.Organization.GetUnit(this.Request.UserContext.Userld) as H3.Organization.User;
//根据人员ld查询其所有的部门 ld
H3.Organization.User user =(H3.Organization.User) this.Engine.Organization.GetUnit("用户Id");
string0 plds = user.Parentlds;
//根据人员 id 第 N 级父部门,0是第一级,1是第二级,以此类推
H3.Organization.Unit unit = this.Engine.Trganization.GetParentUnitByLevel("用户Id", 1);
//根据部门 Id 获取其第 N 级父部门,0是第一级,1是第二级,以此类推
H3.Organization.Unit unit = this.Engine.Organization.GetParentUnitByLevel("部门ld", 1);

//判断一个部门是否是另一个部门的祖先部门,返回 true 表示是祖先部门
bool isAncestor = this.Engine.Organization.IsAncestor("子孙部门ld",“祖先部门ld");

//根据人员/部门 ID 获取人员/部门名称
string.name=this,Engine.Organization.GetName(string id, H3.Organization,NameType type);
id:人员/部门的 ID
type:名称的类型
H3.Organization.NameType.Name
名称
H3.Organization.NameType.Path
组织路径,/Company/0U1/0U2
这种格式
H3.Organizatign.NameType.FullName 全名称,如果是用户则是:用户
名[用户编码];如果是 OU,则是:/Company/OU1/OU2 这种格式!protected override void Onsubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.Submit5martFormResponse response)
iflactionName =.IBedestT.
//不同意
if(actionName.=="Submit"&&this.Reques!Actitvity2"
//同意
base.OnSubmit(actionName, postValue,_response);oldState, H3.Workflow.Instance.WorkflowInstanceState newState)
//流程审批结束患件(先执行业务规则,在执行该方法2;
if(oldstate == H3.Workflow.Instance.Workflowingtancestate.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished)
// H3.DataModel.Biz0bject targetBiz-new H3.DataModel.Biz0bject(this.Engine,this.Engine.Biz0bjectManager.GetPublishedSchema("D8015990845285c574547399f4b42e95d
// targetBiz["userName"]-this.Request.BizObject["userName"];
// targetBiz["money"]-this.Request.BizObject["money"];
ected sympol
"n class, struct, or interface member declarationlgofected symbol if in class, struct, or_interface member declaration[24]
ected symbol
{' in class, struct, or interface member declaration[29]unexpected symbol,
[==' in class, struct, or interface member declaratign'Unexpected symbol,'==',in class, struct, or interface member declaration
Unexpected symbol'' in class, struct, or interface member declaration

结束流程
示例:
H3.Workflow.Instance.Workflowlnstance instance = this.Request.Engine.WorkflowInstanceManager.GetWorkflowInstance(this.Request.Instanceld);//获取当前流程实例对象
H3.Workflow.Messages.FinishInstanceMessage cancelMessage = new
H3.Workflow.Messages.FinishInstanceMessage(this.Request.Instancel
d(int)instance.FinalTokenld);
this. Request.Engine.WorkflowInstanceManager.SendMessage(cancelM
essage);
结束流程时执行特定的业务逻辑
示例:
protected override void OnWorkflowInstanceStateChanged(H3.Workf
low.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.

相关文章
|
3月前
|
安全 测试技术 物联网
系统集成项目经理中级第三章 信息系统集成专业技术知识(选择10分)
系统集成项目经理中级第三章 信息系统集成专业技术知识(选择10分)
系统集成项目经理中级第三章 信息系统集成专业技术知识(选择10分)
|
4月前
|
项目管理
系统集成项目管理中级第二章信息系统集成及服务(选择4分)
系统集成项目管理中级第二章信息系统集成及服务(选择4分)
|
5月前
|
存储 安全 搜索推荐
100 云笔记案例(需求分析)
100 云笔记案例(需求分析)
32 0
|
9月前
信息系统开发与管理思维导图
信息系统开发与管理思维导图
73 0
|
9月前
|
存储 前端开发 JavaScript
构建高效学生志愿者活动管理系统:基于前后端分离的设计与实现
构建高效学生志愿者活动管理系统:基于前后端分离的设计与实现
构建高效学生志愿者活动管理系统:基于前后端分离的设计与实现
|
搜索推荐 数据管理 开发者
合同管理的高级流程设计|学习笔记
快速学习合同管理的高级流程设计
243 0
合同管理的高级流程设计|学习笔记
|
测试技术 开发者
软件工程高效学 | 实战案例:在线选修课程管理系统设计
软件工程是计算机领域的一门专业基础课,它对于培养开发者的软件素质、提高开发者的软件开发能力与软件项目管理能力具有重要意义。本篇介绍了利用Rational Rose进行“在线选修课程管理系统”面向对象的设计案例。
143 0
软件工程高效学 | 实战案例:在线选修课程管理系统设计
|
开发者 容器
招聘管理综合实践——审批结果更新|学习笔记
快速学习招聘管理综合实践——审批结果更新
100 0
招聘管理综合实践——审批结果更新|学习笔记
|
开发者 容器
招聘管理综合实践——面试流程搭建|学习笔记
快速学习招聘管理综合实践——面试流程搭建
138 0
招聘管理综合实践——面试流程搭建|学习笔记
|
负载均衡 算法 Java
SptingCloud版协作流程 | 学习笔记
快速学习SptingCloud版协作流程。
83 0
SptingCloud版协作流程 | 学习笔记