1
|
/****** Object: StoredProcedure [dbo].[WFMoveRunToHisRegID] Script Date: 8/29/2022 4:22:32 PM ******/
|
2
|
SET ANSI_NULLS ON
|
3
|
GO
|
4
|
SET QUOTED_IDENTIFIER ON
|
5
|
GO
|
6
|
CREATE PROCEDURE [dbo].[WFMoveRunToHisRegID]
|
7
|
(
|
8
|
@RegID BIGINT
|
9
|
)
|
10
|
AS
|
11
|
/*Move WF To His By RegID
|
12
|
EXEC [WFMoveRunToHisRegID] @RegID = XXX */
|
13
|
/*DECLARE @RegID AS INT = 986 */
|
14
|
INSERT INTO dbo.PCMWFHISBIZDATA SELECT * FROM dbo.PCMWFRUNBIZDATA WHERE RegID = @RegID
|
15
|
INSERT INTO dbo.PCMWFHISTASK SELECT * FROM dbo.PCMWFRUNTASK WHERE RegID = @RegID
|
16
|
INSERT INTO dbo.PCMWFHISMAIN SELECT * FROM dbo.PCMWFRUNMAIN WHERE RegID = @RegID
|
17
|
INSERT INTO dbo.PCMWFHISAPPR SELECT * FROM dbo.PCMWFRUNAPPR WHERE RegID = @RegID
|
18
|
INSERT INTO dbo.PCMWFHISATTACHMENT SELECT * FROM dbo.PCMWFRUNATTACHMENT WHERE RegID = @RegID
|
19
|
INSERT INTO dbo.PCMWFHISCOMMENT SELECT * FROM dbo.PCMWFRUNCOMMENT WHERE RegID = @RegID
|
20
|
INSERT INTO dbo.PCMWFHISMAIL SELECT * FROM dbo.PCMWFRUNMAIL WHERE RegID = @RegID
|
21
|
INSERT INTO dbo.PCMWFHISPIC SELECT * FROM dbo.PCMWFRUNPIC WHERE RegID = @RegID
|
22
|
SET IDENTITY_INSERT dbo.PCMWFHISINBOXLOCK ON;
|
23
|
INSERT INTO dbo.PCMWFHISINBOXLOCK (ID, RegID, [Sequence], LockStatus, EmployeeLock, LockAt, LockRelease)
|
24
|
SELECT ID, RegID, [Sequence], LockStatus, EmployeeLock, LockAt, LockRelease
|
25
|
FROM dbo.PCMWFRUNINBOXLOCK WHERE RegID = @RegID
|
26
|
SET IDENTITY_INSERT dbo.PCMWFHISINBOXLOCK OFF;
|
27
|
|
28
|
DELETE FROM dbo.PCMWFRUNBIZDATA WHERE RegID = @RegID
|
29
|
DELETE FROM dbo.PCMWFRUNTASK WHERE RegID = @RegID
|
30
|
DELETE FROM dbo.PCMWFRUNMAIN WHERE RegID = @RegID
|
31
|
DELETE FROM dbo.PCMWFRUNAPPR WHERE RegID = @RegID
|
32
|
|
33
|
DELETE FROM dbo.PCMWFRUNATTACHMENT WHERE RegID = @RegID
|
34
|
DELETE FROM dbo.PCMWFRUNCOMMENT WHERE RegID = @RegID
|
35
|
DELETE FROM dbo.PCMWFRUNMAIL WHERE RegID = @RegID
|
36
|
DELETE FROM dbo.PCMWFRUNPIC WHERE RegID = @RegID
|
37
|
DELETE FROM dbo.PCMWFRUNINBOXLOCK WHERE RegID = @RegID
|
38
|
|
39
|
GO
|
40
|
CREATE PROCEDURE [dbo].[WFMoveHisToRunRegID]
|
41
|
(
|
42
|
@RegID BIGINT
|
43
|
)
|
44
|
AS
|
45
|
/*Move WF To His By RegID
|
46
|
EXEC [WFMoveRunToHisRegID] @RegID = XXX */
|
47
|
/*DECLARE @RegID AS INT = 986 */
|
48
|
INSERT INTO dbo.PCMWFRUNBIZDATA SELECT * FROM dbo.PCMWFHISBIZDATA WHERE RegID = @RegID
|
49
|
INSERT INTO dbo.PCMWFRUNTASK SELECT * FROM dbo.PCMWFHISTASK WHERE RegID = @RegID
|
50
|
INSERT INTO dbo.PCMWFRUNMAIN SELECT * FROM dbo.PCMWFHISMAIN WHERE RegID = @RegID
|
51
|
INSERT INTO dbo.PCMWFRUNAPPR SELECT * FROM dbo.PCMWFHISAPPR WHERE RegID = @RegID
|
52
|
INSERT INTO dbo.PCMWFRUNATTACHMENT SELECT * FROM dbo.PCMWFHISATTACHMENT WHERE RegID = @RegID
|
53
|
INSERT INTO dbo.PCMWFRUNCOMMENT SELECT * FROM dbo.PCMWFHISCOMMENT WHERE RegID = @RegID
|
54
|
INSERT INTO dbo.PCMWFRUNMAIL SELECT * FROM dbo.PCMWFHISMAIL WHERE RegID = @RegID
|
55
|
INSERT INTO dbo.PCMWFRUNPIC SELECT * FROM dbo.PCMWFHISPIC WHERE RegID = @RegID
|
56
|
SET IDENTITY_INSERT dbo.PCMWFRUNINBOXLOCK ON;
|
57
|
INSERT INTO dbo.PCMWFRUNINBOXLOCK (ID, RegID, [Sequence], LockStatus, EmployeeLock, LockAt, LockRelease)
|
58
|
SELECT ID, RegID, [Sequence], LockStatus, EmployeeLock, LockAt, LockRelease
|
59
|
FROM dbo.PCMWFHISINBOXLOCK WHERE RegID = @RegID
|
60
|
SET IDENTITY_INSERT dbo.PCMWFRUNINBOXLOCK OFF;
|
61
|
|
62
|
DELETE FROM dbo.PCMWFHISBIZDATA WHERE RegID = @RegID
|
63
|
DELETE FROM dbo.PCMWFHISTASK WHERE RegID = @RegID
|
64
|
DELETE FROM dbo.PCMWFHISMAIN WHERE RegID = @RegID
|
65
|
DELETE FROM dbo.PCMWFHISAPPR WHERE RegID = @RegID
|
66
|
|
67
|
DELETE FROM dbo.PCMWFHISATTACHMENT WHERE RegID = @RegID
|
68
|
DELETE FROM dbo.PCMWFHISCOMMENT WHERE RegID = @RegID
|
69
|
DELETE FROM dbo.PCMWFHISMAIL WHERE RegID = @RegID
|
70
|
DELETE FROM dbo.PCMWFHISPIC WHERE RegID = @RegID
|
71
|
DELETE FROM dbo.PCMWFHISINBOXLOCK WHERE RegID = @RegID
|
72
|
|