处理流程已办完,选择一个节点,添加一条待办

---找到流程实例id---
select * from ACT_HI_PROCINST t where t.proc_inst_id_ in (select distinct t.proc_inst_id_ from ACT_HI_VARINST t where t.text_='402880e8641c8f260164491e12e800f0')


---确认记录-----911477
select t.*, t.rowid from ACT_RU_EXECUTION t where t.proc_inst_id_='911477';

---如果没有,先找最后任务的id----- 如id_为920600
select * from ACT_HI_TASKINST t where t.proc_inst_id_=911477 order by t.start_time_ asc;

----往ACT_RU_EXECUTION插入一条记录,缺少REV_,BUSINESS_KEY_赋值----注意CACHED_ENT_STATE_ 0代表会签加号上的节点,2代表一般,7代表会签的节点
insert into ACT_RU_EXECUTION  (
ID_,PROC_INST_ID_,PROC_DEF_ID_,ACT_ID_,IS_ACTIVE_,IS_CONCURRENT_,IS_SCOPE_,IS_EVENT_SCOPE_,SUSPENSION_STATE_,CACHED_ENT_STATE_
) 
(select 
PROC_INST_ID_,PROC_INST_ID_,PROC_DEF_ID_,TASK_DEF_KEY_,1,0,1,0,1,2 from ACT_HI_TASKINST where ID_=920600);

--BUSINESS_KEY_赋值----
update ACT_RU_EXECUTION set BUSINESS_KEY_=
(
select t0.business_key_ from ACT_HI_PROCINST t0 
where t0.id_=
(
select max(t.id_) from ACT_HI_PROCINST t where t.proc_inst_id_ in (select distinct t.proc_inst_id_ from ACT_HI_VARINST t where t.text_='402880e8641c8f260164491e12e800f0')
)
) where proc_inst_id_='911477' and BUSINESS_KEY_ is null;

----REV_赋值--------
update ACT_RU_EXECUTION set REV_=(
select t.rev_ from ACT_RE_PROCDEF t where t.id_=(select t1.proc_def_id_ from ACT_HI_TASKINST t1 where t1.id_=920600))
where proc_inst_id_='911477' and REV_ is null;

---添加待办-----
insert into ACT_RU_TASK(ID_,EXECUTION_ID_,PROC_INST_ID_,PROC_DEF_ID_,NAME_,PARENT_TASK_ID_,DESCRIPTION_,TASK_DEF_KEY_,OWNER_,ASSIGNEE_,PRIORITY_,CREATE_TIME_,DUE_DATE_,CATEGORY_,TENANT_ID_,FORM_KEY_)  
(select ID_,EXECUTION_ID_,PROC_INST_ID_,PROC_DEF_ID_,NAME_,PARENT_TASK_ID_,DESCRIPTION_,TASK_DEF_KEY_,OWNER_,ASSIGNEE_,PRIORITY_,START_TIME_,DUE_DATE_,CATEGORY_,TENANT_ID_,FORM_KEY_ from ACT_HI_TASKINST where ID_=920600);


--更新ACT_RU_TASK
UPDATE ACT_RU_TASK t0
SET (REV_,SUSPENSION_STATE_) = (
select t.rev_,t.suspension_state_ from ACT_RE_PROCDEF t where t.id_=(select t1.proc_def_id_ from ACT_HI_TASKINST t1 where t1.id_=920600)
) 
where t0.ID_=920600;


--添加待办候选人
insert into ACT_RU_IDENTITYLINK(ID_,GROUP_ID_,TYPE_,USER_ID_,TASK_ID_,PROC_INST_ID_)
(select ID_,GROUP_ID_,TYPE_,USER_ID_,TASK_ID_,PROC_INST_ID_ from ACT_HI_IDENTITYLINK t where t.task_id_=920600);

  

posted @ 2018-12-19 14:23  摩西摩西点点  阅读(577)  评论(1编辑  收藏  举报