氚云代码-流程
1.两表,一个表拥有流程,在流程审核节点进行判断,判断后对另一个表进行新增
2.在审核节点进行判断,如果判断不通过,对其数据进行删除
3.节点上的审核判断:
Rejecte不同意,Submit同意(节点上的同意与不同意)
public class D00172893e6b1bd96954e4c9a373aeb07357941: H3.SmartForm.SmartFormController { public D00172893e6b1bd96954e4c9a373aeb07357941(H3.SmartForm.SmartFormRequest request): base(request) { } protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { //Rejecte不同意,Submit同意(节点上的同意与不同意) // if(actionName == "Reject" && this.Request.ActivityCode == "Activity2") // { // //不同意 // } if(actionName=="Submit"&&this.Request.ActivityCode=="Activity2") { // //同意 // } 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) { //先激活流程 //再把流程弄到某个节点上 H3.Workflow.Messages.ActivateInstanceMessage activiteinstanceMessage = new H3.Workflow.Messages.ActivateInstanceMessage(this.Request.InstanceId); //传递参数为流程实例ID this.Request.Engine.WorkflowInstanceManager.SendMessage(activiteinstanceMessage);//只会激活流程,并不会触发运行的节点 //激活某个节点 H3.Workflow.Messages.ActivateActivityMessage activiteMessage = new H3.Workflow.Messages.ActivateActivityMessage(this.Request.InstanceId, "Activity2", H3.Workflow.Instance.Token.UnspecifiedId, new string[] {}, null, false, H3.Workflow.WorkItem.ActionEventType.Adjust);//参数对应描述:流程实例ID,活动节点编码,令牌ID,参与者,前驱令牌,是否检测入口条件,激活类型 this.Request.Engine.WorkflowInstanceManager.SendMessage(activiteMessage);//1.不会取消正在运行的节点。2.进行中的流程才能激活调整。 } base.OnSubmit(actionName, postValue, response); } protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.WorkflowInstanceState newState) { //流程审批结束事件(先执行业务规则,在执行该方法)。 if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished) { H3.DataModel.BizObject biz = new H3.DataModel.BizObject(this.Engine, this.Engine.BizObjectManager.GetPublishedSchema("D001728cabfdaed1101436cbdd4f0861d5639c4"), this.Request.UserContext.UserId); biz["F0000001"] = this.Request.BizObject["F0000001"]; biz["F0000011"] = this.Request.BizObject["F0000004"]; biz.Status = H3.DataModel.BizObjectStatus.Effective; biz.Create(); if(double.Parse("0" + this.Request.BizObject["F0000004"]) < 100) { this.Request.BizObject.Remove(); } } //流程审批结束后,重新激活事件(先执行业务规则,在执行该方法)。 if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Finished && newState == H3.Workflow.Instance.WorkflowInstanceState.Running) { //执行业务代码逻辑 } base.OnWorkflowInstanceStateChanged(oldState, newState); } }