簽核流程設置(4)
select [流程號]+7,(select CheckmanID from dbo.PCO_CheckMan
where UserName=(select UserName from dbo.member where Isvalid=1 and Realname=[八級簽核]))
from dbo.[zlq_PCO1107] where [八級簽核] is not null
--步驟6----檢查同一種條件下是否存在一人簽多次的流程-------------
select * from dbo.PCO_WorkFlowChecker
where id in(
select a.id from dbo.PCO_WorkFlowChecker a (nolock)
inner join dbo.PCO_WorkFlowChecker b (nolock) on a.checkmanid=b.checkmanid
and a.stepid+1=b.stepid
)
---步驟7--------------檢查PCO流程設置是否斷點-----------------------
根據PCO簽核條件表中STEPID不為0的記錄數﹐去跟簽核流程表(PCO_WorkFlowStep)
中的最后一級簽核步驟數(nextID為0的步驟)比較﹐如果相同﹐則說明無斷點﹐可
簽核流程可走通。
select count(*) from dbo.PCO_WorkFlowStep
where stepid in
(
select a.stepid+c.Remark-1 from dbo.PCO_WorkFlowChecker a (nolock)
--inner join dbo.PCO_WorkFlowStep b (nolock) on a.stepid=b.stepid
inner join dbo.PCO_CheckCondition c (nolock) on a.stepid=c.stepid
)
and nextid=0
---------步驟8-------簽核人在簽核流程里是否正確---------
select * from dbo.PCO_WorkFlowStep (nolock)
where StepID>=229550 and StepID<=229550
*/
CREATE proc dbo.ljj_SetWorkFlow
@SetpID int,
@Level int
as
declare @err varchar(200)
declare @i int
if exists(select * from dbo.PCO_WorkFlowStep where StepID>=@SetpID and StepID<=(@SetpID+@Level))
begin
select @err='您設置的流程SetpID='+convert(varchar(30),@SetpID)+',簽核層級='+convert(varchar(30),@Level)+' 在系統中已經存在,無法繼續設置簽核流程!'
----print @err
raiserror(@err,16,1)
return 111
end
--第一級---------------------------
--print '--第一級---------------------------'
--print @SetpID
if @Level=1
begin
insert into dbo.PCO_WorkFlowStep
( StepID,PreID,NextID )
values(@SetpID, 0 ,0 )
end
if @Level>1
begin
insert into dbo.PCO_WorkFlowStep
( StepID,PreID,NextID )
values(@SetpID, 0 ,@SetpID+1)
end
--第二級到倒數第二級---------------
--print '--第二級到倒數第二級----------------------'
select @i=(@SetpID+1)
while @i<(@SetpID+@Level-1)
begin
--print @i
insert into dbo.PCO_WorkFlowStep
(StepID,PreID,NextID)
values( @i ,@i-1 ,@i+1 )
select @i=@i+1
end
相关新闻>>
- 发表评论
-
- 最新评论 更多>>