/*
--- Batch Process of game tag processing ---------
--- Step 1, create a table, and check whether project code contains special characters.
--- Step 2 --- check the existence of zookeeper ---
-- Check whether the checking reviewer is correct (mainly determines whether the checking data is NULL)
Select distinct [distinct data] from dbo. [zlq_PCO1107]
Select * from dbo. [zlq_PCO1107] where [sequence number] = 1 and ([one sequence core] is NULL)
Select * from dbo. [zlq_PCO1107] where [sequence number] = 2 and ([two sequence kernel] is NULL or [one sequence kernel] is NULL)
Select * from dbo. [zlq_PCO1107] where [sequence number] = 3 and ([three sequence kernel] is NULL or [two sequence kernel] is NULL or [one sequence kernel] is NULL)
Select * from dbo. [zlq_PCO1107] where [numbers] = 4 and ([four cores] is NULL or [three cores] is NULL or [two cores] is NULL or [two cores] is NULL or [one worker core] is NULL)
Select * from dbo. [zlq_PCO1107] where [numbers] = 5 and ([five cores] is NULL or [four cores] is NULL or [three cores] is NULL or [two worker cores] is NULL or [one worker cores] is NULL)
Select * from dbo. [zlq_PCO1107] where [numbers] = 6 and ([six cores] is NULL or [five cores] is NULL or [four cores] is NULL or [three cores] is NULL or [two cores] is NULL or [one core] is NULL)
Select * from dbo. [zlq_PCO1107] where [numbers] = 7 and ([Seven cores] is NULL or [six cores] is NULL or [five cores] is NULL or [four cores] is NULL or [three cores] is NULL or [two cores] is NULL or [one core] is NULL)
Select * from dbo. [zlq_PCO1107] where [Partition Number] = 8 and ([octal primary cores] is NULL or [seven primary cores] is NULL or [six primary cores] is NULL or [five cores] is NULL or [four cores] is NULL or [three cores] is NULL or [two cores] is NULL or [one core]] is NULL)
--- Locate to check whether it exists in the dbo. PCO_CheckMan table -----
---- First, check whether the sequence exists in the dbo. PCO_CheckMan table ---
---- Secondly, whether the actual sequence exists in the dbo. Ac_BRM_User table ---
Select. [One worker core], B. username, c. checkManID from (select distinct [one distinct kernel] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [One worker cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [Two worker cores], B. username, c. checkManID from (select distinct [two distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [two distinct cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [three cores], B. username, c. checkManID from (select distinct [three distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [three cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [four cores], B. username, c. checkManID from (select distinct [four distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [four cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [five cores], B. username, c. checkManID from (select distinct [five distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [five cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [Six cores], B. username, c. checkManID from (select distinct [six distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [Six cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [Seven cores], B. username, c. checkManID from (select distinct [seven distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [Seven cores] left join dbo. PCO_CheckMan c on c. userName = B. username
Select. [Eight cores], B. username, c. checkManID from (select distinct [eight distinct cores] from dbo. [zlq_PCO1107]) a left join dbo. ac_BRM_User B on B. realname =. [Eight cores] left join dbo. PCO_CheckMan c on c. userName = B. username
In the response results of the preceding sentence, the following two types of conditions exist in the condition that the reviewer, UserName, and CheckManID are empty:
If the UserName receiver is empty, it indicates that the corresponding receiver does not have a receiver in the system. In this case, the configuration process is stopped, ask the related reviewer to submit a ticket and handle it again.
If the UserName is not empty and the CheckManID detection bit is empty, it indicates that the corresponding sequence operator exists in the system, but the sequence operator does not exist in the PCO_CheckMan table, you need to put the cursor in PCO_CheckMan.
-- Step 3 --- establish the game standard ----------
Declare Step_cur scroll cursor
Select [process sequence], [sequence number] from [zlq_PCO1107]
Open Step_cur
Declare @ StartID int, @ Step int
Fetch first from Step_cur into @ StartID, @ Step
While @ fetch_status = 0
Begin
Print convert (varchar (30), @ StartID) + ',' + convert (varchar (30), @ Step)
Exec dbo. ljj_SetWorkFlow @ StartID, @ Step
Fetch next from Step_cur into @ StartID, @ Step
End
Close Step_cur
Deallocate Step_cur
------------------------------------------
-- Delete dbo. PCO_WorkFlowStep where stepid in (select distinct StepID from dbo. PCO_WorkFlowStep where StepID> = 219320 and StepID <= 229543)
Select a. StepID, B. [workflow]
From dbo. PCO_WorkFlowStep
Left join dbo. [zlq_PCO1107] B on a. StepID = B. [workflow]
Where StepID> = 229540 and StepID <= 229549
Exec dbo. ljj_SetWorkFlow 229540,4
The preceding sentence shows a rescue method when the mobile phone number is set up and the mobile phone number is set up.
-- Step 4 --- set the kernel condition ----------
Select * from dbo. zlq_PCO1107 where uprange = '+ ∞'
Update [zlq_PCO1107]
Set [UpRange] = 8888 where uprange = '+ ∞'
Select * from dbo. zlq_PCO1107 where downrange = '-∞'
Update [zlq_PCO1107]
Set [DownRange] =-8888 where downrange = '-∞'
Insert into [QBRClient]. [dbo]. [PCO_CheckCondition]
([ProjectCode], [CommodityCode], [UpRange], [DownRange], [SupplierFlag], [StepID], [Remark])
SELECT [ProjectCode], [Commoditycode], convert (decimal (38,6), [UpRange]), convert (decimal (38,6), [DownRange]), [internal diplomacy or other], [process details], [metric Data]
FROM [QBRClient]. [dbo]. [zlq_PCO1107]
Select * from dbo. PCO_Checkcondition where UpRange = 8888
Update dbo. PCO_Checkcondition
Set UpRange = 99999999999999999999999999999999
Where UpRange = 8888
Select * from dbo. PCO_Checkcondition where DownRange =-8888
Update dbo. PCO_Checkcondition
Set DownRange =-99999999999999999999999999999999
Where DownRange =-8888
-- Step 5 --- set kernel cores ----------
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [process sequence], (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [1)
From dbo. [zlq_PCO1107] where [one writable kernel] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [workflow] + 1, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [two cores])
From dbo. [zlq_PCO1107] where [two worker cores] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [workflow] + 2, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [three cores])
From dbo. [zlq_PCO1107] where [three cores] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [process sequence] + 3, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [four cores])
From dbo. [zlq_PCO1107] where [four cores] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [process sequence] + 4, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [five cores])
From dbo. [zlq_PCO1107] where [five cores] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [workflow] + 5, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [six cores])
From dbo. [zlq_PCO1107] where [six cores] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [process sequence] + 6, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [Seven cores])
From dbo. [zlq_PCO1107] where [] is not null
Insert into [QBRClient]. [dbo]. [PCO_WorkFlowChecker] ([StepID], [CheckManID])
Select [process sequence] + 7, (select CheckmanID from dbo. PCO_CheckMan
Where UserName = (select UserName from dbo. member where Isvalid = 1 and Realname = [Eight cores])
From dbo. [zlq_PCO1107] where [Eight cores] is not null
-- Step 6 ---- check whether there is a one-person renewal process under the same condition multiple times -------------
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
)
--- Step 7 -------------- check whether the PCO process settings are optimized -----------------------
The stepid of the root worker PCO kernel table is not 0, and the process table (PCO_WorkFlowStep)
Compare the number of the last vertex in the kernel step (the value of nextID is 0). If the number is the same, it means there is no limit.
The checking process can be passed.
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
--------- Step 8 ------- whether the supervisor is correct in the checking process ---------
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 = 'your set process SetpID = '+ convert (varchar (30), @ SetpID) + ', kernel kernel = '+ convert (varchar (30), @ Level) +' already exists in the system. You cannot configure the kernel process! '
---- Print @ err
Raiserror (@ err, 16,1)
Return 111
End
-- 1st certificate ---------------------------
-- Print '-- First Certificate ---------------------------'
-- 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
-- Second digit to second digit ---------------
-- Print '-- second digit to second digit ----------------------'
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
-- Last certificate -------------------------
-- Print '-- the last response ---------------------------'
-- Print @ SetpID + @ Level-1
If @ Level> 1
Begin
Insert into dbo. PCO_WorkFlowStep
(StepID, PreID, NextID)
Values (@ SetpID + @ Level-1, @ SetpID + @ Level-2, 0)
End
From tearsmo's column